-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a734ce2
Showing
20 changed files
with
1,053 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
src/packages/ | ||
src/Skybrud.TextAnalysis/bin/ | ||
src/Skybrud.TextAnalysis/obj/ | ||
src/.vs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29806.167 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skybrud.TextAnalysis", "Skybrud.TextAnalysis\Skybrud.TextAnalysis.csproj", "{1D28A1E8-826F-4A30-AF13-944A1365A5B1}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{1D28A1E8-826F-4A30-AF13-944A1365A5B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{1D28A1E8-826F-4A30-AF13-944A1365A5B1}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{1D28A1E8-826F-4A30-AF13-944A1365A5B1}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{1D28A1E8-826F-4A30-AF13-944A1365A5B1}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {0A8CE6D2-0910-4D2F-BA5B-09F729847D33} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
namespace Skybrud.TextAnalysis.Hunspell { | ||
|
||
public class Affix { | ||
|
||
public Dictionary<string, SuffixRuleSet> SuffixRuleSets { get; } | ||
|
||
private Affix(string raw) { | ||
|
||
string[] lines = raw.Split('\n'); | ||
|
||
SuffixRuleSets = new Dictionary<string, SuffixRuleSet>(); | ||
|
||
for (int i = 0; i < lines.Length; i++) { | ||
|
||
if (lines[i].Length == 0 || lines[i][0] == '#') continue; | ||
|
||
string last = i == 0 ? null : lines[i - 1]; | ||
|
||
if (lines[i].StartsWith("SFX ")) { | ||
|
||
string[] pieces = lines[i].Split(' ', '\t'); | ||
|
||
string name = pieces[1]; | ||
string comment = last != null && last.StartsWith("#") ? last.Substring(1).Trim() : null; | ||
int count = int.Parse(pieces[3]); | ||
string[] rules = lines.Skip(i + 1).Take(count).ToArray(); | ||
|
||
var set = new SuffixRuleSet(name, comment, rules); | ||
SuffixRuleSets.Add(set.Name, set); | ||
|
||
i += count; | ||
|
||
} | ||
|
||
} | ||
|
||
} | ||
|
||
public static Affix Load(string path) { | ||
return new Affix(File.ReadAllText(path)); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.