-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a ton of Russian systems (no single standard :/) and reworked t…
…he way some of the processing is done.
- Loading branch information
Showing
37 changed files
with
2,252 additions
and
303 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
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
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
This file was deleted.
Oops, something went wrong.
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,43 @@ | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Romanization.LanguageAgnostic | ||
{ | ||
internal interface ISub | ||
{ | ||
public string Replace(string text); | ||
} | ||
|
||
internal class CharSub : ISub | ||
{ | ||
private readonly Regex _findRegex; | ||
private readonly string _substitution; | ||
|
||
public CharSub(string pattern, string substitution, bool ignoreCase = true) | ||
{ | ||
_findRegex = new Regex(pattern, ignoreCase ? RegexOptions.Compiled | RegexOptions.IgnoreCase : RegexOptions.Compiled); | ||
_substitution = substitution; | ||
} | ||
|
||
public string Replace(string text) | ||
=> _findRegex.Replace(text, _substitution); | ||
} | ||
|
||
internal class CharSubCased : ISub | ||
{ | ||
private readonly Regex _findRegexUpper; | ||
private readonly Regex _findRegexLower; | ||
private readonly string _substitutionUpper; | ||
private readonly string _substitutionLower; | ||
|
||
public CharSubCased(string patternUpper, string patternLower, string substitutionUpper, string substitutionLower) | ||
{ | ||
_findRegexUpper = new Regex(patternUpper, RegexOptions.Compiled); | ||
_findRegexLower = new Regex(patternLower, RegexOptions.Compiled); | ||
_substitutionUpper = substitutionUpper; | ||
_substitutionLower = substitutionLower; | ||
} | ||
|
||
public string Replace(string text) | ||
=> _findRegexLower.Replace(_findRegexUpper.Replace(text, _substitutionUpper), _substitutionLower); | ||
} | ||
} |
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,26 @@ | ||
using System.Text.RegularExpressions; | ||
|
||
// ReSharper disable CommentTypo | ||
|
||
namespace Romanization.LanguageAgnostic | ||
{ | ||
/// <summary> | ||
/// A global class for language-agnostic functions and constants (things that are independent of specific languages). | ||
/// </summary> | ||
internal static class Constants | ||
{ | ||
// General Constants | ||
public const string Vowels = "aeiouy"; | ||
public const string Consonants = "bcdfghjklmnpqrstvwxz"; | ||
public const string Punctuation = @"\.?!"; | ||
public const char IdeographicFullStop = '。'; | ||
public const char Interpunct = '・'; | ||
|
||
// Replacement Characters | ||
public const string MacronA = "ā"; | ||
public const string MacronE = "ē"; | ||
public const string MacronI = "ī"; | ||
public const string MacronO = "ō"; | ||
public const string MacronU = "ū"; | ||
} | ||
} |
Oops, something went wrong.