public ComplexChain RandomEnPiChainOfProperModifers() { Word headWord; int dice = random.Next(0, 100); if (dice < 70) { headWord = Words.jan; } else if (dice < 84) { headWord = Words.meli; } else if (dice < 99) { headWord = Words.mije; } else { headWord = Words.soweli; } WordSet modifiers; if (random.Next(0, 100) < 75) { modifiers = new WordSet { Neologism.MakeProperNeologism() }; } else { modifiers = new WordSet { Neologism.MakeProperNeologism(), Neologism.MakeProperNeologism() }; } List <Chain> agents = new List <Chain>(); agents.Add(new Chain(Particles.pi, new[] { new HeadedPhrase(headWord, modifiers) })); ComplexChain c = new ComplexChain(Particles.en, agents.ToArray()); return(c); }
public void NewThings() { string[] samples = new string[] { CorpusTexts.ProfesorAndMadMan, CorpusTexts.UnpaText, CorpusTexts.Gilgamesh, CorpusTexts.SampleText1, CorpusTexts.SampleText3, CorpusTexts.Lao, CorpusTexts.GeorgeSong, CorpusTexts.CrazyAnimal, CorpusTexts.CrazyAnimal2 //,CorpusTexts.JanSin //Too many neologisms to cope. , CorpusTexts.RuneDanceSong , CorpusTexts.janPusaRice , CorpusTexts.janPend }; foreach (string sample in samples) { //Split, normalize, tokenize, find words. TokenParserUtils tp = new TokenParserUtils(); Dictionary <string, string> stuff = new Dictionary <string, string>(); foreach (Token toke in tp.ValidTokens(sample).Distinct()) { if (toke.CheckIsCompoundWord(toke.Text)) { if (!stuff.ContainsKey(toke.Text)) { stuff.Add(toke.Text, "Compound"); } } if (toke.Text.StartCheck("#") && toke.CheckIsNumber(toke.Text)) { //Should just have to verify we can parse. No need for dictionary. if (!stuff.ContainsKey(toke.Text)) { stuff.Add(toke.Text, "Number"); } } if (toke.CheckIsProperModifier(toke.Text)) { if (!stuff.ContainsKey(toke.Text)) { stuff.Add(toke.Text, "Proper"); } } if (ForeignWord.IsForeign(toke.Text)) { if (!stuff.ContainsKey(toke.Text)) { stuff.Add(toke.Text, "Proper"); } } if (Neologism.IsNeologism(toke.Text)) { if (!stuff.ContainsKey(toke.Text)) { stuff.Add(toke.Text, "Neologism"); } } } foreach (var t in stuff) { Console.WriteLine(t.Value + " " + t.Key); } } }