Skip to content

Commit

Permalink
Updated to v0.9.5 and made some more small changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
zedseven committed Feb 9, 2021
1 parent a97a37c commit b361292
Show file tree
Hide file tree
Showing 18 changed files with 306 additions and 305 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Romanization.NET
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://choosealicense.com/licenses/mit/)
[![Build Status](https://img.shields.io/travis/zedseven/Romanization.net/dev?logo=travis-ci&logoColor=white)](https://travis-ci.org/zedseven/Romanization.NET)
[![Build Status](https://img.shields.io/travis/zedseven/Romanization.NET/dev?logo=travis-ci&logoColor=white)](https://travis-ci.org/zedseven/Romanization.NET)
[![NuGet](https://img.shields.io/nuget/v/Romanization.NET.svg?logo=nuget)](https://www.nuget.org/packages/Romanization.NET/)
[![# Issues](https://img.shields.io/github/issues/zedseven/Romanization.NET?logo=github)](https://github.com/zedseven/Romanization.NET/issues)
[![Maintainability](https://img.shields.io/codeclimate/maintainability/zedseven/Romanization.NET?logo=code-climate)](https://codeclimate.com/github/zedseven/Romanization.NET/maintainability)
Expand Down
4 changes: 2 additions & 2 deletions Romanization/Internal/CaseAwareSub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ internal class CaseAwareSub : ISub

public CaseAwareSub(string pattern, string dynamicReplacement, bool countCapturesInCasing = false)
{
_findRegex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
_findRegex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase);
_dynamicReplacement = new DynamicReplacement(dynamicReplacement);
_countCapturesInCasing = countCapturesInCasing;
}

public CaseAwareSub(string pattern, string dynamicReplacement, RegexOptions options, bool countCapturesInCasing = false)
{
_findRegex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | options);
_findRegex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | options);
_dynamicReplacement = new DynamicReplacement(dynamicReplacement);
_countCapturesInCasing = countCapturesInCasing;
}
Expand Down
4 changes: 2 additions & 2 deletions Romanization/Internal/CharSub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ internal class CharSub : ISub

public CharSub(string pattern, string substitution, bool ignoreCase = true)
{
_findRegex = new Regex(pattern, ignoreCase ? RegexOptions.Compiled | RegexOptions.IgnoreCase : RegexOptions.Compiled);
_findRegex = new Regex(pattern, ignoreCase ? RegexOptions.Compiled | RegexOptions.IgnoreCase : RegexOptions.Compiled);
_substitution = substitution;
}

public CharSub(string pattern, string substitution, RegexOptions options)
{
_findRegex = new Regex(pattern, RegexOptions.Compiled | options);
_findRegex = new Regex(pattern, RegexOptions.Compiled | options);
_substitution = substitution;
}

Expand Down
8 changes: 4 additions & 4 deletions Romanization/Internal/CharSubCased.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ internal class CharSubCased : ISub

public CharSubCased(string patternUpper, string patternLower, string substitutionUpper, string substitutionLower)
{
_findRegexUpper = new Regex(patternUpper, RegexOptions.Compiled);
_findRegexLower = new Regex(patternLower, RegexOptions.Compiled);
_findRegexUpper = new Regex(patternUpper, RegexOptions.Compiled);
_findRegexLower = new Regex(patternLower, RegexOptions.Compiled);
_substitutionUpper = substitutionUpper;
_substitutionLower = substitutionLower;
}

public CharSubCased(string patternUpper, string patternLower, string substitutionUpper, string substitutionLower, RegexOptions options)
{
_findRegexUpper = new Regex(patternUpper, RegexOptions.Compiled | options);
_findRegexLower = new Regex(patternLower, RegexOptions.Compiled | options);
_findRegexUpper = new Regex(patternUpper, RegexOptions.Compiled | options);
_findRegexLower = new Regex(patternLower, RegexOptions.Compiled | options);
_substitutionUpper = substitutionUpper;
_substitutionLower = substitutionLower;
}
Expand Down
8 changes: 4 additions & 4 deletions Romanization/Internal/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ internal static class Constants
public static readonly string AssemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

// General Constants
public const string LatinVowels = "aeiouy";
public const string LatinConsonants = "bcdfghjklmnpqrstvwxz";
public const string Punctuation = @"\.?!";
public const string LatinVowels = "aeiouy";
public const string LatinConsonants = "bcdfghjklmnpqrstvwxz";
public const string Punctuation = @"\.?!";
public const char IdeographicFullStop = '。';
public const char Interpunct = '・';
public const char Interpunct = '・';

// Replacement Characters
public const string MacronA = "ā";
Expand Down
4 changes: 3 additions & 1 deletion Romanization/Internal/CsvLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ public static void LoadCharacterMap<TKey, TVal>(string fileName, IDictionary<TKe
}

/// <summary>
/// Loads a CSV file stream into a dictionary, using the provided mapping functions to map CSV entries to dict keys &amp; values.
/// Loads a CSV file stream into a dictionary, using the provided mapping functions to map CSV entries to dict
/// keys &amp; values.<br />
/// Note that this is a non-standard CSV parsing implementation - it only looks for the first comma.
/// </summary>
/// <typeparam name="TKey">The type of the dictionary keys.</typeparam>
/// <typeparam name="TVal">The type of the dictionary values.</typeparam>
Expand Down
6 changes: 3 additions & 3 deletions Romanization/Internal/NumeralRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public static string ToRomanNumerals(this decimal num)
{ 100, 'C' },
{ 50, 'L' },
{ 10, 'X' },
{ 5, 'V' },
{ 1, 'I' }
{ 5, 'V' },
{ 1, 'I' }
};
Dictionary<int, int> subtractiveSteps = new Dictionary<int, int>
{
Expand All @@ -46,7 +46,7 @@ public static string ToRomanNumerals(this decimal num)
{ 100, 10 },
{ 50, 10 },
{ 10, 1 },
{ 5, 1 }
{ 5, 1 }
};
Dictionary<decimal, char> fractionRepresentations = new Dictionary<decimal, char>
{
Expand Down
76 changes: 38 additions & 38 deletions Romanization/Languages/Greek/Ancient/AlaLc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ public sealed class AlaLc : IMultiInOutCultureSystem
private readonly INumeralParsingSystem NumeralsSystem;

// System-Specific Constants
private readonly Dictionary<string, string> RomanizationTable = new Dictionary<string, string>();
private readonly Dictionary<string, string> DiphthongTable = new Dictionary<string, string>();
private readonly Dictionary<string, string> RomanizationTable = new Dictionary<string, string>();
private readonly Dictionary<string, string> DiphthongTable = new Dictionary<string, string>();
private readonly Dictionary<string, string> SpecificCombinationTable = new Dictionary<string, string>();
private readonly Dictionary<string, string> PunctuationTable = new Dictionary<string, string>();
private readonly Dictionary<string, string> PunctuationTable = new Dictionary<string, string>();

private readonly CaseAwareSub RhoAspiratedSub = new CaseAwareSub("(?:\\bρ|(?<=ρ)ρ(?!\\b|ρ))", "rh");

Expand All @@ -81,32 +81,32 @@ public AlaLc(OutputNumeralType outputNumeralType = OutputNumeralType.Roman, bool
// Sourced from https://en.wikipedia.org/wiki/Romanization_of_Greek

// Main characters (2021)
RomanizationTable["α"] = "a";
RomanizationTable["β"] = "b";
RomanizationTable["γ"] = "g"; // has special provisions
RomanizationTable["δ"] = "d";
RomanizationTable["ε"] = "e";
RomanizationTable["ζ"] = "z";
RomanizationTable["η"] = "ē";
RomanizationTable["θ"] = "th";
RomanizationTable["ι"] = "i";
RomanizationTable["κ"] = "k";
RomanizationTable["λ"] = "l";
RomanizationTable["μ"] = "m";
RomanizationTable["ν"] = "n";
RomanizationTable["ξ"] = "x";
RomanizationTable["ο"] = "o";
RomanizationTable["π"] = "p";
RomanizationTable["α"] = "a";
RomanizationTable["β"] = "b";
RomanizationTable["γ"] = "g"; // has special provisions
RomanizationTable["δ"] = "d";
RomanizationTable["ε"] = "e";
RomanizationTable["ζ"] = "z";
RomanizationTable["η"] = "ē";
RomanizationTable["θ"] = "th";
RomanizationTable["ι"] = "i";
RomanizationTable["κ"] = "k";
RomanizationTable["λ"] = "l";
RomanizationTable["μ"] = "m";
RomanizationTable["ν"] = "n";
RomanizationTable["ξ"] = "x";
RomanizationTable["ο"] = "o";
RomanizationTable["π"] = "p";
RomanizationTable[\u0314"] = "rh";
RomanizationTable["ρ"] = "r"; // has special provisions
RomanizationTable["σ"] = "s";
RomanizationTable["ς"] = "s";
RomanizationTable["τ"] = "t";
RomanizationTable["υ"] = "y"; // has special provisions
RomanizationTable["φ"] = "ph";
RomanizationTable["χ"] = "ch";
RomanizationTable["ψ"] = "ps";
RomanizationTable["ω"] = "ō";
RomanizationTable["ρ"] = "r"; // has special provisions
RomanizationTable["σ"] = "s";
RomanizationTable["ς"] = "s";
RomanizationTable["τ"] = "t";
RomanizationTable["υ"] = "y"; // has special provisions
RomanizationTable["φ"] = "ph";
RomanizationTable["χ"] = "ch";
RomanizationTable["ψ"] = "ps";
RomanizationTable["ω"] = "ō";

DiphthongTable["αι"] = "ae";
DiphthongTable["ει"] = "ei";
Expand All @@ -129,27 +129,27 @@ public AlaLc(OutputNumeralType outputNumeralType = OutputNumeralType.Roman, bool
RomanizationTable["ͷ"] = "w"; // Digamma
RomanizationTable["ϙ"] = "ḳ"; // Koppa
RomanizationTable["ϟ"] = "ḳ"; // Koppa
RomanizationTable["ϡ"] = ""; // Sampi
RomanizationTable["ͳ"] = ""; // Sampi
RomanizationTable["ϻ"] = ""; // San
RomanizationTable["ϡ"] = ""; // Sampi
RomanizationTable["ͳ"] = ""; // Sampi
RomanizationTable["ϻ"] = ""; // San
RomanizationTable["Ϲ"] = "s"; // Lunate sigma
RomanizationTable["ϲ"] = "s"; // Lunate sigma
RomanizationTable["ϳ"] = ""; // Yot
RomanizationTable["ϳ"] = ""; // Yot

// Punctuation
if (VeryOld)
{
PunctuationTable["."] = ","; // Low dot (in ancient Greek this acted as a short breath, or comma)
PunctuationTable["·"] = ";"; // Mid dot (in ancient Greek this acted as a long breath, or semicolon)
PunctuationTable["."] = ","; // Low dot (in ancient Greek this acted as a short breath, or comma)
PunctuationTable["·"] = ";"; // Mid dot (in ancient Greek this acted as a long breath, or semicolon)
PunctuationTable["\u0387"] = ";"; // Distinct from above but visually the same
PunctuationTable["\u02D9"] = "."; // High dot (in ancient Greek this acted as a full stop)
PunctuationTable["\u205A"] = "."; // In ancient texts the Greek two-dot punctuation mark (looks like a colon) served as the full stop
PunctuationTable["\u203F"] = "-"; // Papyrological hyphen
PunctuationTable["\u035C"] = "-"; // Papyrological hyphen
}
PunctuationTable[";"] = "?";
PunctuationTable[";"] = "?";
PunctuationTable["\u037E"] = "?"; // Distinct from above but visually the same
PunctuationTable["’"] = "h"; // Sometimes used as an aspiration mark
PunctuationTable["’"] = "h"; // Sometimes used as an aspiration mark

#endregion
}
Expand Down Expand Up @@ -181,8 +181,8 @@ public string Process(string text, CultureInfo nativeCulture, CultureInfo romani
"\u0301\u0341" + // Acute accent
"\u0313\u0343" + // Smooth breathing/koronis
"\u0303\u0342" + // Tilde
"\u0311" + // Inverted breve
"\u0345") // Iota subscript
"\u0311" + // Inverted breve
"\u0345") // Iota subscript
.ReplaceFromChartWithSameCase(PunctuationTable);

// Convert numerals
Expand Down
Loading

0 comments on commit b361292

Please sign in to comment.