Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 51.29 KB | None | 0 0
  1. using ConsoleLib.Console;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text.RegularExpressions;
  5. using System.Text;
  6. using System;
  7. using XRL.World;
  8. using HistoryKit;
  9.  
  10. namespace XRL.Language
  11. {
  12.     public static class Grammar
  13.     {
  14.  
  15.         public static string Pluralize(string word)
  16.         {
  17.             if (string.IsNullOrEmpty(word)) return word;
  18.             if (word[0] == '=') return "=pluralize=" + word;
  19.  
  20.             string plural = "";
  21.             if (singularToPlural.TryGetValue(word, out plural)) return plural;
  22.  
  23.             if (irregularPluralization.TryGetValue(word, out plural)) return FoundPlural(word, plural);
  24.  
  25.             Match match;
  26.             match = Regex.Match(word, @"(.*?)(&.(?:\^.)?)$");
  27.             if (match.Success) return FoundPlural(word, Pluralize(match.Groups[1].Value) + match.Groups[2].Value);
  28.             match = Regex.Match(word, @"^(&.(?:\^.)?)(.*?)$");
  29.             if (match.Success) return FoundPlural(word, match.Groups[1].Value + Pluralize(match.Groups[2].Value));
  30.             match = Regex.Match(word, "^([*\\-_~'\"/])(.*)(\\1)$");
  31.             if (match.Success) return FoundPlural(word, match.Groups[1].Value + Pluralize(match.Groups[2].Value) + match.Groups[3].Value);
  32.             match = Regex.Match(word, @"(.*?)( +)$");
  33.             if (match.Success) return FoundPlural(word, Pluralize(match.Groups[1].Value) + match.Groups[2].Value);
  34.             match = Regex.Match(word, @"^( +)(.*?)$");
  35.             if (match.Success) return FoundPlural(word, match.Groups[1].Value + Pluralize(match.Groups[2].Value));
  36.             match = Regex.Match(word, @"^(.*)( \(.*\))$");
  37.             if (match.Success) return FoundPlural(word, Pluralize(match.Groups[1].Value) + match.Groups[2].Value);
  38.             match = Regex.Match(word, @"^(.*)( \[.*\])$");
  39.             if (match.Success) return FoundPlural(word, Pluralize(match.Groups[1].Value) + match.Groups[2].Value);
  40.             match = Regex.Match(word, @"^(.*)( (?:of|in a|in an|in the|into|for|from|o'|to|with) .*)$", RegexOptions.IgnoreCase);
  41.             if (match.Success) return FoundPlural(word, Pluralize(match.Groups[1].Value) + match.Groups[2].Value);
  42.             match = Regex.Match(word, @"^(.*)( (?:mk\.?|mark) *(?:[ivx]+))$", RegexOptions.IgnoreCase);
  43.             if (match.Success) return FoundPlural(word, Pluralize(match.Groups[1].Value) + match.Groups[2].Value);
  44.             if (!word.Contains(" "))
  45.             {
  46.                 match = Regex.Match(word, @"^(.*)-(.*)$");
  47.                 if (match.Success) return FoundPlural(word, match.Groups[1].Value + "-" + Pluralize(match.Groups[2].Value));
  48.             }
  49.  
  50.             if (identicalPluralization.Contains(word)) return FoundPlural(word, word);
  51.  
  52.             if (latinPluralization.Contains(word))
  53.             {
  54.                 if (word.EndsWith("us")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "i");
  55.                 if (word.EndsWith("a")) return FoundPlural(word, word + "e");
  56.                 if (word.EndsWith("num")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "i");
  57.                 if (word.EndsWith("um") || word.EndsWith("on")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "a");
  58.                 if (word.EndsWith("en")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "ina");
  59.                 if (word.EndsWith("is")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "es");
  60.                 if (word.EndsWith("es")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "ites");
  61.                 if (word.EndsWith("ex") || word.EndsWith("ix")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "ices");
  62.                 return FoundPlural(word, word);
  63.             }
  64.  
  65.             if (greekPluralization1.Contains(word))
  66.             {
  67.                 if (word.EndsWith("os") || word.EndsWith("on")) return FoundPlural(word, word.Substring(0, word.Length - 1) + "i");
  68.                 if (word.EndsWith("is") || word.EndsWith("ix") || word.EndsWith("as")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "des");
  69.                 if (word.EndsWith("ys")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "daes");
  70.                 if (word.EndsWith("ma")) return FoundPlural(word, word + "ta");
  71.                 if (word.EndsWith("a")) return FoundPlural(word, word + "e");
  72.                 if (word.EndsWith("x")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "ges");
  73.                 if (word.EndsWith("or")) return FoundPlural(word, word + "es");
  74.                 if (word.EndsWith("r")) return FoundPlural(word, word + "oi");
  75.                 return FoundPlural(word, word + "a");
  76.             }
  77.             if (greekPluralization2.Contains(word))
  78.             {
  79.                 if (word.EndsWith("on")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "a");
  80.                 if (word.EndsWith("is")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "es");
  81.                 return FoundPlural(word, word);
  82.             }
  83.  
  84.             if (hebrewPluralization.Contains(word))
  85.             {
  86.                 if (word.EndsWith("ah")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "ot");
  87.                 if (word.EndsWith("da")) return FoundPlural(word, word.Substring(0, word.Length - 1) + "ot");
  88.                 if (word.EndsWith("esh")) return FoundPlural(word, word.Substring(0, word.Length - 3) + "ashot");
  89.                 if (word.EndsWith("ch") || word.EndsWith("kh")) return FoundPlural(word, word + "ot");
  90.                 if (word.EndsWith("a")) return FoundPlural(word, word.Substring(0, word.Length - 1) + "im");
  91.                 return FoundPlural(word, word + "im");
  92.             }
  93.  
  94.             if (word.Contains(" "))
  95.             {
  96.                 string[] words = word.Split(' ');
  97.                 StringBuilder build = Event.NewStringBuilder();
  98.                 if (dualPluralization.Contains(words[words.Length - 1]))
  99.                 {
  100.                     for (int i = 0; i < words.Length - 2; i++)
  101.                     {
  102.                         build.Append(words[i]);
  103.                         build.Append(" ");
  104.                     }
  105.                     build.Append(Pluralize(words[words.Length - 2]));
  106.                     build.Append(" ");
  107.                     build.Append(Pluralize(words[words.Length - 1]));
  108.                 }
  109.                 else
  110.                 {
  111.                     for (int i = 0; i < words.Length - 1; i++)
  112.                     {
  113.                         build.Append(words[i]);
  114.                         build.Append(" ");
  115.                     }
  116.                     build.Append(Pluralize(words[words.Length - 1]));
  117.                 }
  118.                 return FoundPlural(word, build.ToString().Trim());
  119.             }
  120.  
  121.             if (ColorUtility.HasUpperExceptFormatting(word))
  122.             {
  123.                 if (ColorUtility.IsAllUpperExceptFormatting(word)) return FoundPlural(word, ColorUtility.ToUpperExceptFormatting(Pluralize(ColorUtility.ToLowerExceptFormatting(word))));
  124.                 if (ColorUtility.IsFirstUpperExceptFormatting(word)) return FoundPlural(word, ColorUtility.CapitalizeExceptFormatting(Pluralize(ColorUtility.ToLowerExceptFormatting(word))));
  125.                 return FoundPlural(word, Pluralize(ColorUtility.ToLowerExceptFormatting(word)));
  126.             }
  127.  
  128.             if (word.EndsWith("elf") || word.EndsWith("olf") || word.EndsWith("arf") || word.EndsWith("alf")) return FoundPlural(word, word.Substring(0, word.Length - 1) + "ves");
  129.             if (word.EndsWith("man")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "en");
  130.             if (word.EndsWith("ife")) return FoundPlural(word, word.Substring(0, word.Length - 2) + "ves");
  131.             if (word.EndsWith("mensch")) return FoundPlural(word, word + "en");
  132.  
  133.             if (word.Length == 1) return FoundPlural(word, word + "s");
  134.  
  135.             char last = word[word.Length - 1];
  136.             char secLast = word[word.Length - 2];
  137.             string lastTwo = word.Substring(word.Length - 2, 2);
  138.             plural = word;
  139.             if (last == 'z' && (secLast == 'a' || secLast == 'e' || secLast == 'i' || secLast == 'o' || secLast == 'u'))
  140.             {
  141.                 plural += "z";
  142.             }
  143.             if (last == 's' || last == 'x' || last == 'z' || lastTwo == "sh" || lastTwo == "ss" || lastTwo == "ch" || (last == 'o' && secLast != 'o' && secLast != 'b'))
  144.             {
  145.                 plural += "es";
  146.             }
  147.             else if (last == 'y' && secLast != 'a' && secLast != 'e' && secLast != 'i' && secLast != 'o' && secLast != 'u')
  148.             {
  149.                 plural = plural.Substring(0, plural.Length - 1) + "ies";
  150.             }
  151.             else
  152.             {
  153.                 plural += "s";
  154.             }
  155.             return FoundPlural(word, plural);
  156.         }
  157.  
  158.         /**
  159.          * support method for Pluralize()
  160.          */
  161.         private static string FoundPlural(string word, string plural)
  162.         {
  163.             if (!singularToPlural.ContainsKey(word)) singularToPlural.Add(word, plural);
  164.             if (!pluralToSingular.ContainsKey(plural)) pluralToSingular.Add(plural, word);
  165.             return plural;
  166.         }
  167.  
  168.         public static string ThirdPerson(string word, bool PrependSpace = false)
  169.         {
  170.             // not prepending a space even if PrependSpace is true in this case is intentional
  171.             if (string.IsNullOrEmpty(word)) return word;
  172.  
  173.             string thirdPerson = "";
  174.             if (PrependSpace)
  175.             {
  176.                 if (firstPersonToThirdPersonWithSpace.TryGetValue(word, out thirdPerson)) return thirdPerson;
  177.             }
  178.             else
  179.             {
  180.                 if (firstPersonToThirdPerson.TryGetValue(word, out thirdPerson)) return thirdPerson;
  181.             }
  182.  
  183.             if (irregularThirdPerson.TryGetValue(word, out thirdPerson)) return FoundThirdPerson(word, thirdPerson, PrependSpace);
  184.  
  185.             Match match;
  186.             match = Regex.Match(word, @"(.*?)(&.(?:\^.)?)$");
  187.             if (match.Success) return FoundThirdPerson(word, ThirdPerson(match.Groups[1].Value) + match.Groups[2].Value, PrependSpace);
  188.             match = Regex.Match(word, @"^(&.(?:\^.)?)(.*?)$");
  189.             if (match.Success) return FoundThirdPerson(word, match.Groups[1].Value + ThirdPerson(match.Groups[2].Value), PrependSpace);
  190.             match = Regex.Match(word, "^([*\\-_~'\"/])(.*)(\\1)$");
  191.             if (match.Success) return FoundThirdPerson(word, match.Groups[1].Value + ThirdPerson(match.Groups[2].Value) + match.Groups[3].Value, PrependSpace);
  192.             match = Regex.Match(word, @"(.*?)( +)$");
  193.             if (match.Success) return FoundThirdPerson(word, ThirdPerson(match.Groups[1].Value) + match.Groups[2].Value, PrependSpace);
  194.             match = Regex.Match(word, @"^( +)(.*?)$");
  195.             if (match.Success) return FoundThirdPerson(word, match.Groups[1].Value + ThirdPerson(match.Groups[2].Value), PrependSpace);
  196.             match = Regex.Match(word, @"^(.+)( (?:and|or) )(.+)$", RegexOptions.IgnoreCase);
  197.             if (match.Success) return FoundThirdPerson(word, ThirdPerson(match.Groups[1].Value) + match.Groups[2].Value + ThirdPerson(match.Groups[3].Value), PrependSpace);
  198.             if (word.Contains(" "))
  199.             {
  200.                 string[] words = word.Split(' ');
  201.                 StringBuilder build = Event.NewStringBuilder();
  202.                 for (int i = 0; i < words.Length - 1; i++)
  203.                 {
  204.                     build.Append(words[i]);
  205.                     build.Append(" ");
  206.                 }
  207.                 build.Append(ThirdPerson(words[words.Length - 1]));
  208.                 return FoundThirdPerson(word, build.ToString(), PrependSpace);
  209.             }
  210.             else
  211.             {
  212.                 match = Regex.Match(word, @"^(.*)-(.*)$");
  213.                 if (match.Success) return FoundThirdPerson(word, match.Groups[1].Value + "-" + ThirdPerson(match.Groups[2].Value), PrependSpace);
  214.             }
  215.  
  216.             if (ColorUtility.HasUpperExceptFormatting(word))
  217.             {
  218.                 if (ColorUtility.IsAllUpperExceptFormatting(word)) return FoundThirdPerson(word, ColorUtility.ToUpperExceptFormatting(ThirdPerson(ColorUtility.ToLowerExceptFormatting(word))), PrependSpace);
  219.                 if (ColorUtility.IsFirstUpperExceptFormatting(word)) return FoundThirdPerson(word, ColorUtility.CapitalizeExceptFormatting(ThirdPerson(ColorUtility.ToLowerExceptFormatting(word))), PrependSpace);
  220.                 return FoundThirdPerson(word, ThirdPerson(ColorUtility.ToLowerExceptFormatting(word)), PrependSpace);
  221.             }
  222.  
  223.             if (word.Length == 1) return FoundThirdPerson(word, word + "s", PrependSpace);
  224.  
  225.             char last = word[word.Length - 1];
  226.             char secLast = word[word.Length - 2];
  227.             string lastTwo = word.Substring(word.Length - 2, 2);
  228.             thirdPerson = word;
  229.             if (last == 'z' && (secLast == 'a' || secLast == 'e' || secLast == 'i' || secLast == 'o' || secLast == 'u'))
  230.             {
  231.                 thirdPerson += "z";
  232.             }
  233.             if (last == 's' || last == 'x' || last == 'z' || lastTwo == "sh" || lastTwo == "ss" || lastTwo == "ch" || (last == 'o' && secLast != 'o' && secLast != 'b'))
  234.             {
  235.                 thirdPerson += "es";
  236.             }
  237.             else if (last == 'y' && secLast != 'a' && secLast != 'e' && secLast != 'i' && secLast != 'o' && secLast != 'u')
  238.             {
  239.                 thirdPerson = thirdPerson.Substring(0, thirdPerson.Length - 1) + "ies";
  240.             }
  241.             else
  242.             {
  243.                 thirdPerson += "s";
  244.             }
  245.             return FoundThirdPerson(word, thirdPerson, PrependSpace);
  246.         }
  247.  
  248.         /**
  249.          * support method for ThirdPerson()
  250.          */
  251.         private static string FoundThirdPerson(string firstPerson, string thirdPerson, bool PrependSpace)
  252.         {
  253.             if (!firstPersonToThirdPerson.ContainsKey(firstPerson)) firstPersonToThirdPerson.Add(firstPerson, thirdPerson);
  254.             if (!thirdPersonToFirstPerson.ContainsKey(thirdPerson)) thirdPersonToFirstPerson.Add(thirdPerson, firstPerson);
  255.             if (PrependSpace)
  256.             {
  257.                 thirdPerson = " " + thirdPerson;
  258.                 if (!firstPersonToThirdPersonWithSpace.ContainsKey(firstPerson)) firstPersonToThirdPersonWithSpace.Add(firstPerson, thirdPerson);
  259.             }
  260.             return thirdPerson;
  261.         }
  262.  
  263.         public static string PastTenseOf( string verb )
  264.         {                        
  265.             if (verb == "sleep") return "slept";
  266.             if (verb == "sit") return "sat";
  267.             if (verb == "drink") return "drank";
  268.             if (verb == "put") return "put";
  269.             if (verb == "are") return "was";
  270.             if (verb == "have") return "had";
  271.             if (verb == "eat") return "ate";
  272.             if ( verb.EndsWith("e")) return verb + "d";
  273.             return verb+"ed";
  274.         }
  275.  
  276.         public static string CardinalNo( int num )
  277.         {
  278.             return (num == 0 ? "no" : Cardinal(num));
  279.         }
  280.  
  281.         public static string Cardinal(int num)
  282.         {
  283.             if (num == 0) return "zero";
  284.             StringBuilder result = Event.NewStringBuilder();
  285.             if (num < 0)
  286.             {
  287.                 result.Append("negative");
  288.                 num = -num;
  289.             }
  290.             int magnitude = (int) Math.Floor(Math.Log10(num));
  291.             ProcessMagnitudes(ref num, ref magnitude, result);
  292.             if (num >= 20)
  293.             {
  294.                 int ones = num % 10;
  295.                 int tens = (num - ones) / 10;
  296.                 num = ones;
  297.                 switch (tens)
  298.                 {
  299.                 case 2: result.Append("twent"); break;
  300.                 case 3: result.Append("thirt"); break;
  301.                 case 4: result.Append("fort"); break;
  302.                 case 5: result.Append("fift"); break;
  303.                 case 6: result.Append("sixt"); break;
  304.                 case 7: result.Append("sevent"); break;
  305.                 case 8: result.Append("eight"); break;
  306.                 case 9: result.Append("ninet"); break;
  307.                 }
  308.                 if (num == 0)
  309.                 {
  310.                     result.Append("y");
  311.                     return result.ToString();
  312.                 }
  313.                 result.Append("y-");
  314.             }
  315.             switch (num)
  316.             {
  317.             case 1: result.Append("one"); break;
  318.             case 2: result.Append("two"); break;
  319.             case 3: result.Append("three"); break;
  320.             case 4: result.Append("four"); break;
  321.             case 5: result.Append("five"); break;
  322.             case 6: result.Append("six"); break;
  323.             case 7: result.Append("seven"); break;
  324.             case 8: result.Append("eight"); break;
  325.             case 9: result.Append("nine"); break;
  326.             case 10: result.Append("ten"); break;
  327.             case 11: result.Append("eleven"); break;
  328.             case 12: result.Append("twelve"); break;
  329.             case 13: result.Append("thirteen"); break;
  330.             case 14: result.Append("fourteen"); break;
  331.             case 15: result.Append("fifteen"); break;
  332.             case 16: result.Append("sixteen"); break;
  333.             case 17: result.Append("seventeen"); break;
  334.             case 18: result.Append("eighteen"); break;
  335.             case 19: result.Append("nineteen"); break;
  336.             }
  337.             return result.ToString();
  338.         }
  339.  
  340.         public static string Ordinal(int num)
  341.         {
  342.             if (num == 0) return "zeroth";
  343.             sharedStringBuilder.Length = 0;
  344.             if (num < 0)
  345.             {
  346.                 sharedStringBuilder.Append("negative");
  347.                 num = -num;
  348.             }
  349.             int magnitude = (int) Math.Floor(Math.Log10(num));
  350.             ProcessMagnitudes(ref num, ref magnitude, sharedStringBuilder, "th");
  351.             if (num >= 20)
  352.             {
  353.                 int ones = num % 10;
  354.                 int tens = (num - ones) / 10;
  355.                 num = ones;
  356.                 switch (tens)
  357.                 {
  358.                 case 2: sharedStringBuilder.Append("twent"); break;
  359.                 case 3: sharedStringBuilder.Append("thirt"); break;
  360.                 case 4: sharedStringBuilder.Append("fort"); break;
  361.                 case 5: sharedStringBuilder.Append("fift"); break;
  362.                 case 6: sharedStringBuilder.Append("sixt"); break;
  363.                 case 7: sharedStringBuilder.Append("sevent"); break;
  364.                 case 8: sharedStringBuilder.Append("eight"); break;
  365.                 case 9: sharedStringBuilder.Append("ninet"); break;
  366.                 }
  367.                 if (num == 0)
  368.                 {
  369.                     sharedStringBuilder.Append("ieth");
  370.                     return sharedStringBuilder.ToString();
  371.                 }
  372.                 sharedStringBuilder.Append("y-");
  373.             }
  374.             switch (num)
  375.             {
  376.             case 1: sharedStringBuilder.Append("first"); break;
  377.             case 2: sharedStringBuilder.Append("second"); break;
  378.             case 3: sharedStringBuilder.Append("third"); break;
  379.             case 4: sharedStringBuilder.Append("fourth"); break;
  380.             case 5: sharedStringBuilder.Append("fifth"); break;
  381.             case 6: sharedStringBuilder.Append("sixth"); break;
  382.             case 7: sharedStringBuilder.Append("seventh"); break;
  383.             case 8: sharedStringBuilder.Append("eighth"); break;
  384.             case 9: sharedStringBuilder.Append("ninth"); break;
  385.             case 10: sharedStringBuilder.Append("tenth"); break;
  386.             case 11: sharedStringBuilder.Append("eleventh"); break;
  387.             case 12: sharedStringBuilder.Append("twelfth"); break;
  388.             case 13: sharedStringBuilder.Append("thirteenth"); break;
  389.             case 14: sharedStringBuilder.Append("fourteenth"); break;
  390.             case 15: sharedStringBuilder.Append("fifteenth"); break;
  391.             case 16: sharedStringBuilder.Append("sixteenth"); break;
  392.             case 17: sharedStringBuilder.Append("seventeenth"); break;
  393.             case 18: sharedStringBuilder.Append("eighteenth"); break;
  394.             case 19: sharedStringBuilder.Append("nineteenth"); break;
  395.             }
  396.             return sharedStringBuilder.ToString();
  397.         }
  398.  
  399.         /**
  400.          * support method for Cardinal() and Ordinal()
  401.          */
  402.         private static void ProcessMagnitude(ref int num, ref int magnitude, StringBuilder result, string place)
  403.         {
  404.             if (magnitude > 3) magnitude -= magnitude % 3;
  405.             int offset = (int) Math.Floor(Math.Exp(magnitude * Math.Log(10)));
  406.             int remainder = num % offset;
  407.             int val = num - remainder;
  408.             int count = val / offset;
  409.             if (count > 0)
  410.             {
  411.                 result.Append(Cardinal(count));
  412.                 result.Append(" ");
  413.                 result.Append(place);
  414.                 num = remainder;
  415.                 if (num > 0) result.Append(" ");
  416.             }
  417.             magnitude--;
  418.         }
  419.  
  420.         /**
  421.          * support method for Cardinal() and Ordinal()
  422.          */
  423.         private static bool ProcessMagnitudes(ref int num, ref int magnitude, StringBuilder result, string suffix = null)
  424.         {
  425.             switch (magnitude)
  426.             {
  427.             case 20:
  428.             case 19:
  429.             case 18:
  430.                 ProcessMagnitude(ref num, ref magnitude, result, "quintillion");
  431.                 if (num == 0)
  432.                 {
  433.                     if (suffix != null) result.Append(suffix);
  434.                     return true;
  435.                 }
  436.                 goto case 15;
  437.             case 17:
  438.             case 16:
  439.             case 15:
  440.                 ProcessMagnitude(ref num, ref magnitude, result, "quadrillion");
  441.                 if (num == 0)
  442.                 {
  443.                     if (suffix != null) result.Append(suffix);
  444.                     return true;
  445.                 }
  446.                 goto case 12;
  447.             case 14:
  448.             case 13:
  449.             case 12:
  450.                 ProcessMagnitude(ref num, ref magnitude, result, "trillion");
  451.                 if (num == 0)
  452.                 {
  453.                     if (suffix != null) result.Append(suffix);
  454.                     return true;
  455.                 }
  456.                 goto case 9;
  457.             case 11:
  458.             case 10:
  459.             case 9:
  460.                 ProcessMagnitude(ref num, ref magnitude, result, "billion");
  461.                 if (num == 0)
  462.                 {
  463.                     if (suffix != null) result.Append(suffix);
  464.                     return true;
  465.                 }
  466.                 goto case 6;
  467.             case 8:
  468.             case 7:
  469.             case 6:
  470.                 ProcessMagnitude(ref num, ref magnitude, result, "million");
  471.                 if (num == 0)
  472.                 {
  473.                     if (suffix != null) result.Append(suffix);
  474.                     return true;
  475.                 }
  476.                 goto case 3;
  477.             case 5:
  478.             case 4:
  479.             case 3:
  480.                 ProcessMagnitude(ref num, ref magnitude, result, "thousand");
  481.                 if (num == 0)
  482.                 {
  483.                     if (suffix != null) result.Append(suffix);
  484.                     return true;
  485.                 }
  486.                 goto case 2;
  487.             case 2:
  488.                 if (magnitude > 1)
  489.                 {
  490.                     ProcessMagnitude(ref num, ref magnitude, result, "hundred");
  491.                     if (num == 0)
  492.                     {
  493.                         if (suffix != null) result.Append(suffix);
  494.                         return true;
  495.                     }
  496.                 }
  497.                 break;
  498.             }
  499.             return false;
  500.         }
  501.  
  502.         public static string MakeOrList(string[] words)
  503.         {
  504.             if (words.Length == 1) return words[0];
  505.             if (words.Length == 2) return words[0] + " or " + words[1];
  506.  
  507.             sharedStringBuilder.Length = 0;
  508.             for (int i = 0; i < words.Length - 2; i++)
  509.             {
  510.                 sharedStringBuilder.Append(words[i]);
  511.                 sharedStringBuilder.Append(",");
  512.             }
  513.             sharedStringBuilder.Append(words[words.Length - 1]);
  514.             return sharedStringBuilder.ToString();
  515.         }
  516.  
  517.         public static string MakeOrList( List<string> words )
  518.         {
  519.             if( words.Count == 1 ) return words[0];
  520.             if( words.Count == 2 ) return words[0] + " or " + words[1];
  521.  
  522.             sharedStringBuilder.Length = 0;
  523.             for ( int i = 0; i < words.Count-1; i++ )
  524.             {
  525.                 sharedStringBuilder.Append(words[i]);
  526.                 sharedStringBuilder.Append(", ");
  527.             }
  528.             sharedStringBuilder.Append("or ");
  529.             sharedStringBuilder.Append(words[words.Count - 1]);
  530.             return sharedStringBuilder.ToString();
  531.         }
  532.  
  533.         public static string MakeAndList(List<string> words)
  534.         {
  535.             if (words.Count == 1) return words[0];
  536.             if (words.Count == 2) return words[0] + " and " + words[1];
  537.  
  538.             sharedStringBuilder.Length = 0;
  539.             for (int i = 0; i < words.Count - 1; i++)
  540.             {
  541.                 sharedStringBuilder.Append(words[i]);
  542.                 sharedStringBuilder.Append(", ");
  543.             }
  544.             sharedStringBuilder.Append("and ");
  545.             sharedStringBuilder.Append(words[words.Count - 1]);
  546.             return sharedStringBuilder.ToString();
  547.         }
  548.  
  549.         public static string MakePossessive(string word)
  550.         {
  551.             if (word.EndsWith("s")) return word + "'";
  552.             else return word + "'s";
  553.         }
  554.  
  555.         public static string MakeTitleCase(string Phrase)
  556.         {
  557.             string[] words = Phrase.Split(' ');
  558.             bool isFirstWord = true;
  559.             sharedStringBuilder.Length = 0;
  560.  
  561.             foreach (string word in words)
  562.             {
  563.                 if (isFirstWord)
  564.                 {
  565.                     sharedStringBuilder.Append(InitialCap(word));
  566.                     isFirstWord = false;
  567.                 }
  568.  
  569.                 else
  570.                 if (IsLowerCapWord(word)) sharedStringBuilder.Append(word);
  571.                 else sharedStringBuilder.Append(InitialCap(word));
  572.                 sharedStringBuilder.Append(" ");
  573.             }
  574.             return sharedStringBuilder.ToString().TrimEnd(' ');
  575.         }
  576.  
  577.         public static string InitialCap(string Word)
  578.         {
  579.             if (String.IsNullOrEmpty(Word)) return Word;
  580.             if (Word.Contains("-"))
  581.             {
  582.                 string[] pieces = Word.Split('-');
  583.                 for (int i = 0; i < pieces.Length; i++)
  584.                 {
  585.                     if (pieces[i].Length > 1) pieces[i] = char.ToUpper(pieces[i][0]).ToString() + pieces[i].Substring(1);
  586.                 }
  587.                 return String.Join("-", pieces);
  588.             }
  589.             return char.ToUpper(Word[0]).ToString() + Word.Substring(1);
  590.         }
  591.  
  592.         public static bool IsSupportingWord(string Word)
  593.         {
  594.             string LowerWord = Word.Any(char.IsUpper) ? Word.ToLower() : Word;
  595.             return
  596.                 prepositions.Contains(LowerWord)
  597.                 || articles.Contains(LowerWord)
  598.                 || conjunctions.Contains(LowerWord)
  599.                 || badEndingWords.Contains(LowerWord)
  600.                 || badStartingWords.Contains(LowerWord)
  601.             ;
  602.         }
  603.  
  604.         public static bool IsLowerCapWord(string Word)
  605.         {
  606.             string LowerWord = Word.Any(char.IsUpper) ? Word.ToLower() : Word;
  607.             return
  608.                 shortPrepositions.Contains(LowerWord)
  609.                 || articles.Contains(LowerWord)
  610.                 || conjunctions.Contains(LowerWord)
  611.             ;
  612.         }
  613.  
  614.         public static bool IsBadTitleStartingWord(string Word)
  615.         {
  616.             string LowerWord = Word.Any(char.IsUpper) ? Word.ToLower() : Word;
  617.             return badStartingWords.Contains(LowerWord);
  618.         }
  619.  
  620.         private static bool IsArticleException(string Word)
  621.         {
  622.             string LowerWord = Word.Any(char.IsUpper) ? Word.ToLower() : Word;
  623.             return articleExceptions.Contains(LowerWord);
  624.         }
  625.  
  626.         public static string RemoveBadTitleEndingWords(string Phrase)
  627.         {
  628.             string[] words = Phrase.Split(' ');
  629.             if (IsSupportingWord(words[words.Length - 1]))
  630.             {
  631.                 words[words.Length - 1] = "";
  632.                 return RemoveBadTitleEndingWords(String.Join(" ", words).TrimEnd(' '));
  633.             }
  634.             else return Phrase;
  635.         }
  636.  
  637.         public static string RemoveBadTitleStartingWords(string Phrase)
  638.         {
  639.             string[] words = Phrase.Split(' ');
  640.             if (IsBadTitleStartingWord(words[0]))
  641.             {
  642.                 words[0] = "";
  643.                 return RemoveBadTitleStartingWords(String.Join(" ", words).TrimStart(' '));
  644.             }
  645.             else return Phrase;
  646.         }
  647.  
  648.         public static string RandomShePronoun()
  649.         {
  650.             if (Rules.Stat.Random(0, 1) == 1) return "he";
  651.             else return "she";
  652.         }
  653.  
  654.         public static string ObjectPronoun(string subjectPronoun)
  655.         {
  656.             if (subjectPronoun == "he") return "him";
  657.             else return "her";
  658.         }
  659.  
  660.         public static string PossessivePronoun(string subjectPronoun)
  661.         {
  662.             if (subjectPronoun == "he") return "his";
  663.             else return "her";
  664.         }
  665.  
  666.         public static string InitCap(string word)
  667.         {
  668.             if( string.IsNullOrEmpty(word)) return "";
  669.             if (word.Length == 1 ) return Char.ToUpper( word[0] ).ToString();
  670.  
  671.             char[] a = word.ToCharArray();
  672.             a[0] = char.ToUpper( a[0] );
  673.             return new string( a );
  674.         }
  675.  
  676.         public static string InitCapWithFormatting(string word)
  677.         {
  678.             if( string.IsNullOrEmpty(word)) return "";
  679.             if (word.Length == 1 ) return Char.ToUpper( word[0] ).ToString();
  680.  
  681.             char[] a = word.ToCharArray();
  682.  
  683.             for( int x=0;x<word.Length;x++ )
  684.             {
  685.                 if( word[x] == '&' || word[x] == '^')
  686.                 {
  687.                     x++;
  688.                 }
  689.                 else
  690.                 {
  691.                     a[x] = char.ToUpper( a[x] );
  692.                     break;
  693.                 }
  694.             }
  695.             return new string( a );
  696.         }
  697.  
  698.         public static string CapAfterNewlines(string text)
  699.         {
  700.             if (string.IsNullOrEmpty(text)) return "";
  701.             sharedStringBuilder.Length = 0;
  702.             string[] sentences = text.Split('\n');
  703.             for (int i = 0, j = sentences.Length; i < j; i++)
  704.             {
  705.                 sharedStringBuilder.Append(InitCap(sentences[i]));
  706.                 if (i < j - 1) sharedStringBuilder.Append('\n');
  707.             }
  708.             return sharedStringBuilder.ToString();
  709.         }
  710.  
  711.         public static string InitLower(string word)
  712.         {
  713.             if( string.IsNullOrEmpty( word ) ) return "";
  714.  
  715.             if( word.Length == 1 ) return Char.IsUpper(word[0]) ? Char.ToLower( word[0] ).ToString() : word;
  716.  
  717.             if( word[0] == '&' && word.Length >= 3) return word.Substring(0,2) + Char.ToLower(word[2]).ToString() + word.Substring(3);
  718.             else return Char.ToLower(word[0]).ToString() + word.Substring(1);
  719.         }
  720.  
  721.         public static string InitLowerIfArticle(string word)
  722.         {
  723.             if (word.Length < 7) return word;
  724.             if ( word.Substring(0, 5).Contains("A ") || word.Substring(0, 6).Contains("The ") || word.Substring(0, 5).Contains("An ") || word.Substring(0, 7).Contains("Some "))
  725.             {
  726.                 if (word[0] == '&') return word.Substring(0, 2) + Char.ToLower(word[2]).ToString() + word.Substring(3);
  727.                 else return Char.ToLower(word[0]).ToString() + word.Substring(1);
  728.             }
  729.             else return word;
  730.         }
  731.  
  732.         public static string LowerArticles(string phrase)
  733.         {
  734.             return phrase.Replace("A ", "a ").Replace("The ", "the ").Replace("Some ", "some ");
  735.         }
  736.  
  737.         public static string MakeTitleCaseWithArticle(string phrase)
  738.         {
  739.             if (phrase.StartsWith("the ") || phrase.StartsWith("The ") || phrase.StartsWith("some ") || phrase.StartsWith("Some "))
  740.             {
  741.                 string capPhrase = MakeTitleCase(phrase);
  742.                 return Char.ToLower(capPhrase[0]).ToString() + capPhrase.Substring(1);
  743.             }
  744.             else return MakeTitleCase(phrase);
  745.         }
  746.  
  747.         public static bool IndefiniteArticleShouldBeAn(string Word)
  748.         {
  749.             if (String.IsNullOrEmpty(Word))
  750.             {
  751.                 return false;
  752.             }
  753.             string LowerWord = Word.Any(char.IsUpper) ? Word.ToLower() : Word;
  754.             char first = LowerWord[0];
  755.             return ((first == 'a' || first == 'e' || first == 'i' || first == 'o' || first == 'u') ^ IsArticleException(LowerWord)) && !LowerWord.StartsWith("one-");
  756.         }
  757.  
  758.         public static string A(string word, bool capitalize = false)
  759.         {
  760.             if (word[0] == '=') return "=article=" + word;
  761.             return (IndefiniteArticleShouldBeAn(word) ? (capitalize ? "An " : "an ") : (capitalize ? "A " : "a ")) + word;
  762.         }
  763.  
  764.         public static void A(string word, StringBuilder result, bool capitalize = false)
  765.         {
  766.             if (word[0] == '=')
  767.             {
  768.                 result.Append("=article=").Append(word);
  769.             }
  770.             else
  771.             {
  772.                 result.Append(IndefiniteArticleShouldBeAn(word) ? (capitalize ? "An " : "an ") : (capitalize ? "A " : "a "));
  773.                 result.Append(word);
  774.             }
  775.         }
  776.  
  777.         public static string ConvertAtoAn(string sentence)
  778.         {
  779.             string[] words = sentence.Split(' ');
  780.             sharedStringBuilder.Length = 0;
  781.  
  782.             for (int i = 0; i < words.Length; i++)
  783.             {
  784.                 sharedStringBuilder.Append(words[i]);
  785.                 if (i < words.Length - 1)
  786.                 {
  787.                     if ((words[i].Equals("a") || words[i].Equals("A")) && !String.IsNullOrEmpty(words[i + 1]) && IndefiniteArticleShouldBeAn(words[i + 1]))
  788.                     {
  789.                         sharedStringBuilder.Append("n");
  790.                     }
  791.                     sharedStringBuilder.Append(" ");
  792.                 }
  793.             }
  794.  
  795.             return sharedStringBuilder.ToString();
  796.         }
  797.  
  798.         public static string GetWordRoot(string word)
  799.         {
  800.             string objWord = GetRandomMeaningfulWord(word);
  801.  
  802.             string result = "";
  803.             String[] substrings = Regex.Split(objWord, @"(?=[aeiouy])");
  804.  
  805.             for (int i = 0; i <= substrings.Length - 1; i++)
  806.             {
  807.                 if (i == substrings.Length - 1)
  808.                 {
  809.                     result += substrings[i].TrimEnd(new char[] { 'a', 'e', 'i', 'o', 'u', 'y' });
  810.                 }
  811.                 else result += substrings[i];
  812.             }
  813.  
  814.             return result;
  815.         }
  816.  
  817.         public static string Adjectify(string word)
  818.         {
  819.             string suffix = new string[] { "ian", "ic", "-like", "ary", "ique" }.GetRandomElement();
  820.             word = TrimTrailingS(word);
  821.             if (suffix[0] != '-') word = GetWordRoot(word);
  822.             return word + suffix;
  823.         }
  824.  
  825.         public static string TrimLeadingThe( string phrase )
  826.         {
  827.             if (phrase.StartsWith("the ") && phrase.Length >= 5) return phrase.Substring(4);
  828.             else return phrase;
  829.         }
  830.  
  831.         public static string TrimTrailingS( string word )
  832.         {
  833.             if (word[word.Length - 1] == 's') return word.Substring(0, word.Length-1);
  834.             return word;
  835.         }
  836.  
  837.         public static string ShortenName(string name)
  838.         {
  839.             return name.Split(',')[0];
  840.         }
  841.  
  842.         public static string TrimTrailingPunctuation( string phrase )
  843.         {
  844.             if (phrase.Length == 0) return phrase;
  845.             if (punctuation.Contains(phrase[phrase.Length - 1])) return TrimTrailingPunctuation(phrase.Substring(0, phrase.Length - 1));
  846.             else return phrase;
  847.         }
  848.  
  849.         public static string GetRandomMeaningfulWord(string phrase)
  850.         {
  851.             String[] splitWords = phrase.Split(' ');
  852.             string word = splitWords[Rules.Stat.Random(0, splitWords.Length - 1)];
  853.  
  854.             while (prepositions.Contains(word) || articles.Contains(word) || conjunctions.Contains(word) || ordinalsRoman.Contains(word) || demonstrativePronouns.Contains(word))
  855.             {
  856.                 word = splitWords[Rules.Stat.Random(0, splitWords.Length - 1)];
  857.             }
  858.             return word;
  859.         }
  860.  
  861.         public static string Stutterize( string sentence, string word )
  862.         {
  863.             String[] splitSentence = sentence.Split(' ');
  864.  
  865.             if (splitSentence.Length > 3)
  866.             {
  867.                 int index = Rules.Stat.Random(0, splitSentence.Length - 3);
  868.                 int stuttersLeft = 0;
  869.  
  870.                 for (int i = 0; i < splitSentence.Length - 1; i++)
  871.                 {
  872.                     if (i == index) stuttersLeft = 4;
  873.                     if (stuttersLeft == 1)
  874.                     {
  875.                         splitSentence[i] = splitSentence[i] + "... " + word;
  876.                         stuttersLeft--;
  877.                     }
  878.                     else
  879.                     if (stuttersLeft > 0)
  880.                     {
  881.                         splitSentence[i] = splitSentence[i] + "...";
  882.                         stuttersLeft--;
  883.                     }
  884.                 }
  885.  
  886.                 return String.Join(" ", splitSentence);
  887.             }
  888.             return sentence;
  889.         }
  890.  
  891.         public static string GetRomanNumeral( int n )
  892.         {
  893.             if (n == 0) return "";
  894.             if (n == 1) return "I";
  895.             if (n == 2) return "II";
  896.             if (n == 3) return "III";
  897.             if (n == 4) return "IV";
  898.             if (n == 5) return "V";
  899.             if (n == 6) return "VI";
  900.             if (n == 7) return "VII";
  901.             if (n == 8) return "VIII";
  902.             if (n == 9) return "IX";
  903.             if (n == 10) return "X";
  904.             else return "";
  905.         }
  906.  
  907.         public static string GetOrdinalNumber( int n )
  908.         {
  909.             if (n == 0) return "";
  910.             if (n == 1) return "first";
  911.             if (n == 2) return "second";
  912.             if (n == 3) return "third";
  913.             if (n == 4) return "fourth";
  914.             if (n == 5) return "fifth";
  915.             if (n == 6) return "sixth";
  916.             if (n == 7) return "seventh";
  917.             if (n == 8) return "eigth";
  918.             if (n == 9) return "ninth";
  919.             if (n == 10) return "tenth";
  920.             else return "";
  921.         }
  922.  
  923.         public static string Weirdify( string word, int Chance = 100 )
  924.         {
  925.             char a = weirdLowerAs.GetRandomElement();
  926.             char A = weirdUpperAs.GetRandomElement();
  927.             char e = weirdLowerEs.GetRandomElement();
  928.             char E = weirdLowerEs.GetRandomElement();
  929.             char i = weirdLowerIs.GetRandomElement();
  930.             char I = weirdUpperIs.GetRandomElement();
  931.             char o = weirdLowerOs.GetRandomElement();
  932.             char O = weirdUpperOs.GetRandomElement();
  933.             char u = weirdLowerUs.GetRandomElement();
  934.             char U = weirdUpperUs.GetRandomElement();
  935.             char c = weirdLowerCs.GetRandomElement();
  936.             char f = weirdLowerFs.GetRandomElement();
  937.             char n = weirdLowerNs.GetRandomElement();
  938.             char t = weirdLowerTs.GetRandomElement();
  939.             char y = weirdLowerYs.GetRandomElement();
  940.             char B = weirdUpperBs.GetRandomElement();
  941.             char C = weirdUpperCs.GetRandomElement();
  942.             char Y = weirdUpperYs.GetRandomElement();
  943.             char L = weirdUpperLs.GetRandomElement();
  944.             char R = weirdUpperRs.GetRandomElement();
  945.             char N = weirdUpperNs.GetRandomElement();
  946.  
  947.             if (If.Chance(Chance)) word = word.Replace('a', a);
  948.             if (If.Chance(Chance)) word = word.Replace('A', A);
  949.             if (If.Chance(Chance)) word = word.Replace('e', e);
  950.             if (If.Chance(Chance)) word = word.Replace('E', E);
  951.             if (If.Chance(Chance)) word = word.Replace('i', i);
  952.             if (If.Chance(Chance)) word = word.Replace('I', I);
  953.             if (If.Chance(Chance)) word = word.Replace('o', o);
  954.             if (If.Chance(Chance)) word = word.Replace('O', O);
  955.             if (If.Chance(Chance)) word = word.Replace('u', u);
  956.             if (If.Chance(Chance)) word = word.Replace('U', U);
  957.             if (If.Chance(Chance)) word = word.Replace('c', c);
  958.             if (If.Chance(Chance)) word = word.Replace('f', f);
  959.             if (If.Chance(Chance)) word = word.Replace('n', n);
  960.             if (If.Chance(Chance)) word = word.Replace('t', t);
  961.             if (If.Chance(Chance)) word = word.Replace('y', y);
  962.             if (If.Chance(Chance)) word = word.Replace('B', B);
  963.             if (If.Chance(Chance)) word = word.Replace('C', C);
  964.             if (If.Chance(Chance)) word = word.Replace('Y', Y);
  965.             if (If.Chance(Chance)) word = word.Replace('L', L);
  966.             if (If.Chance(Chance)) word = word.Replace('R', R);
  967.             if (If.Chance(Chance)) word = word.Replace('N', N);
  968.  
  969.             return word;
  970.         }
  971.  
  972.         public static bool ContainsBadWords( string phrase )
  973.         {
  974.             phrase = phrase.ToLower();
  975.             foreach ( string s in badWords ) if (phrase.Contains(s)) return true;
  976.             return false;
  977.         }
  978.  
  979.         public static char[] weirdLowerAs = { (char)131, (char)132, (char)133, (char)134, (char)160, (char)166, (char)224, (char)97 };
  980.         public static char[] weirdUpperAs = { (char)65, (char)142, (char)143, (char)146 };
  981.         public static char[] weirdLowerEs = { (char)101, (char)130, (char)136, (char)137, (char)138, (char)238 };
  982.         public static char[] weirdUpperEs = { (char)69, (char)144, (char)288 };
  983.         public static char[] weirdLowerIs = { (char)105, (char)139, (char)140, (char)141, (char)161, (char)173 };
  984.         public static char[] weirdUpperIs = { (char)73, (char)173, (char)179 };
  985.         public static char[] weirdLowerOs = { (char)111, (char)147, (char)148, (char)149, (char)162, (char)229, (char)235, (char)248 };
  986.         public static char[] weirdUpperOs = { (char)79, (char)153, (char)232, (char)233, (char)237 };
  987.         public static char[] weirdLowerUs = { (char)117, (char)150, (char)151, (char)163, (char)230 };
  988.         public static char[] weirdUpperUs = { (char)85, (char)154, (char)230 };
  989.  
  990.         public static char[] weirdLowerCs = { (char)99, (char)135, (char)155 };
  991.         public static char[] weirdLowerFs = { (char)102, (char)159 };
  992.         public static char[] weirdLowerNs = { (char)110, (char)164, (char)227, (char)239 };
  993.         public static char[] weirdLowerTs = { (char)116, (char)231 };
  994.         public static char[] weirdLowerYs = { (char)121, (char)152 };
  995.  
  996.         public static char[] weirdUpperBs = { (char)66, (char)225 };
  997.         public static char[] weirdUpperCs = { (char)67, (char)128 };
  998.         public static char[] weirdUpperYs = { (char)89, (char)157 };
  999.         public static char[] weirdUpperLs = { (char)76, (char)156 };
  1000.         public static char[] weirdUpperRs = { (char)82, (char)158 };
  1001.         public static char[] weirdUpperNs = { (char)78, (char)165, (char)238 };
  1002.  
  1003.         static string[] shortPrepositions = { "at", "by", "in", "of", "on", "to", "up", "from", "with", "into", "over" };
  1004.         static string[] prepositions = { "at", "by", "in", "of", "on", "to", "up", "from", "with", "into" };
  1005.         static string[] articles = { "an", "a", "the" };
  1006.         static string[] demonstrativePronouns = { "this", "that", "those", "these", "such", "none", "neither", "who", "whom", "whose" };
  1007.         static string[] conjunctions = { "and", "but", "or", "nor", "for", "as" };
  1008.         static string[] ordinalsRoman = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X" };
  1009.         static string[] badEndingWords = { "this", "were", "every", "are", "which", "their", "has", "your", "that", "who", "our", "additional", "its", "he", "her", "during", "no", "she's", "he's", "than", "they" };
  1010.         static string[] badStartingWords = { "were", "though", "them", "him,", "her", "is" };
  1011.         static string[] articleExceptions = { "herb", "herbal", "hour", "one", "ubiquitous", "ubiquitously", "ubiquity", "unary", "unicorn", "unicorns", "unicycle", "unidirectional", "unidirectionality", "unidirectionally", "unification", "unifications", "unified", "unifier", "unifies", "uniform", "uniformed", "uniformity", "uniformly", "uniforms", "unify", "unifying", "union", "unionization", "unionize", "unionized", "unionizer", "unionizers", "unionizes", "unionizing", "unions", "uniprocessor", "unique", "uniquely", "uniqueness", "unison", "unit", "unitary", "unities", "uniting", "unity", "univalve", "univalved", "univalves", "universal", "universal", "universality", "universally", "universe", "universes", "universities", "university", "usable", "use", "useless" };
  1012.         static string[] badWords = { "nigg", "fag" };
  1013.  
  1014.         private static char[] punctuation = { '.', '!', ',', ':', ';' };
  1015.  
  1016.         private static Dictionary<string, string> singularToPlural = new Dictionary<string, string>();
  1017.         private static Dictionary<string, string> pluralToSingular = new Dictionary<string, string>();
  1018.         private static Dictionary<string, string> irregularPluralization = new Dictionary<string, string>{
  1019.             {"atterkop", "atterkoppen"},
  1020.             {"attorney general", "attorneys general"},
  1021.             {"bergrisi", "bergrisar"},
  1022.             {"child", "children"},
  1023.             {"childe", "childer"},
  1024.             {"commando", "commandos"},
  1025.             {"court martial", "courts martial"},
  1026.             {"die", "dice"},
  1027.             {"djinn", "djinni"},
  1028.             {"dunadan", "dunadain"},
  1029.             {"eldjotun", "eldjotnar"},
  1030.             {"eldthurs", "eldthursar"},
  1031.             {"felljotun", "felljotnar"},
  1032.             {"fife", "fifes"},
  1033.             {"fomor", "fomori"},
  1034.             {"foot", "feet"},
  1035.             {"forefoot", "forefeet"},
  1036.             {"genus", "genera"},
  1037.             {"goose", "geese"},
  1038.             {"hindfoot", "hindfeet"},
  1039.             {"hrimthurs", "hrimthursar"},
  1040.             {"ifrit", "ifriti"},
  1041.             {"jabberwock", "jabberwocky"},
  1042.             {"jerky", "jerkys"},
  1043.             {"jotun", "jotnar"},
  1044.             {"knight templar", "knights templar"},
  1045.             {"leaf", "leaves"},
  1046.             {"loaf", "loaves"},
  1047.             {"longstaff", "longstaves"},
  1048.             {"mosquito", "mosquitos"},
  1049.             {"mouse", "mice"},
  1050.             {"notary public", "notaries public"},
  1051.             {"octopus", "octopodes"},
  1052.             {"opus", "opera"},
  1053.             {"ordo", "ordines"},
  1054.             {"ox", "oxen"},
  1055.             {"pancreas", "pancreata"},
  1056.             {"person", "people"},
  1057.             {"platypus", "platypoda"},
  1058.             {"plus", "plusses"},
  1059.             {"quarterstaff", "quarterstaves"},
  1060.             {"rhinox", "rhinoxen"},
  1061.             {"risi", "risar"},
  1062.             {"secretary general", "secretaries general"},
  1063.             {"shaman", "shamans"},
  1064.             {"staff", "staves"},
  1065.             {"sturmjotun", "sturmjotnar"},
  1066.             {"surgeon general", "surgeons general"},
  1067.             {"talisman", "talismans"},
  1068.             {"thief", "thieves"},
  1069.             {"tooth", "teeth"},
  1070.             {"topaz", "topazes"},
  1071.             {"townsperson", "townspeople"},
  1072.         };
  1073.         private static string[] identicalPluralization = { "barracks", "bison", "buffalo", "cannon", "caribou", "chosen", "corps", "deer", "einheriar", "fish", "fruit", "geisha", "gi", "hellspawn", "katana", "kraken", "lamia", "kris", "means", "moose", "naga", "ninja", "nunchaku", "oni", "remains", "sai", "scissors", "series", "sheep", "shrimp", "shuriken", "spawn", "species", "sputum", "waterworks", "wakizashi", "yeti", "yoroi", "young" };
  1074.         private static string[] latinPluralization = { "abacus", "adytum", "alkalus", "alumnus", "alumno", "alumna", "anima", "animo", "animus", "antenna", "appendix", "arboretum", "astrum", "automaton", "axis", "bacterium", "ballista", "cacosteum", "cactus", "cestus", "cinctus", "cognomen", "corpus", "datum", "desideratum", "dictum", "dominatrix", "drosophilium", "ellipsis", "emerita", "emerito", "emeritus", "epona", "eques", "equus", "erratum", "esophagus", "exoculus", "exodus", "fascia", "focus", "forum", "fungus", "haruspex", "hippocampus", "hippopotamus", "hypha", "iambus", "illuminata", "illuminato", "illuminatus", "imperator", "imperatrix", "incarnus", "larva", "locus", "lorica", "maga", "mago", "magus", "manica", "matrix", "medium", "melia", "momentum", "neurosis", "nexus", "nomen", "nucleus", "patagium", "pegasus", "penis", "persona", "phenomenon", "phoenix", "pilum", "plexus", "praenomen", "psychosis", "quantum", "radius", "rectum", "sanctum", "scintilla", "scriptorium", "scrotum", "scutum", "septum", "simulacrum", "stratum", "substratum", "testis", "tympani", "ultimatum", "uterus", "vagina", "vertex", "vomitorium", "vortex", "vulva" };
  1075.         private static string[] greekPluralization1 = { "archon", "aristos", "astron", "bebelos", "charisma", "chimera", "daimon", "domos", "echthros", "eidolon", "ephemeris", "epopis", "hegemon", "horos", "hystrix", "kentaur", "kharisma", "kudos", "laryngis", "larynx", "lemma", "logos", "mestor", "minotaur", "mnemon", "mythos", "omphalos", "ouros", "patris", "pharynx", "pragma", "rhetor", "rhinoceros", "schema", "stigma", "telos", "topos" };
  1076.         private static string[] greekPluralization2 = { "diokesis", "ganglion", "noumenon", "numenon", "praxis", "therion" };
  1077.         private static string[] hebrewPluralization = { "aswad", "chaya", "cherub", "golem", "kabbalah", "keruv", "khaya", "nefesh", "nephil", "neshamah", "qabalah", "ruach", "ruakh", "sephirah", "seraph", "yechida", "yekhida" };
  1078.         private static string[] dualPluralization = { "emerita", "emeritus" };
  1079.  
  1080.         private static Dictionary<string, string> firstPersonToThirdPerson = new Dictionary<string, string>();
  1081.         private static Dictionary<string, string> firstPersonToThirdPersonWithSpace = new Dictionary<string, string>();
  1082.         private static Dictionary<string, string> thirdPersonToFirstPerson = new Dictionary<string, string>();
  1083.  
  1084.         private static Dictionary<string, string> irregularThirdPerson = new Dictionary<string, string>{
  1085.             {"'re", "'s"},
  1086.             {"'ve", "'s"},
  1087.             {"are", "is"},
  1088.             {"aren't", "isn't"},
  1089.             {"cannot", "cannot"},
  1090.             {"can't", "can't"},
  1091.             {"could", "could"},
  1092.             {"couldn't", "couldn't"},
  1093.             {"don't", "doesn't"},
  1094.             {"grew", "grew"},
  1095.             {"had", "had"},
  1096.             {"have", "has"},
  1097.             {"may", "may"},
  1098.             {"might", "might"},
  1099.             {"must", "must"},
  1100.             {"shall", "shall"},
  1101.             {"shouldn't", "shouldn't"},
  1102.             {"should", "should"},
  1103.             {"sought", "sought"},
  1104.             {"were", "was"},
  1105.             {"will", "will"},
  1106.             {"won't", "won't"},
  1107.             {"wouldn't", "wouldn't"},
  1108.             {"would", "would"},
  1109.         };
  1110.  
  1111.         private static StringBuilder sharedStringBuilder = new StringBuilder(128);
  1112.  
  1113.     }
  1114. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement