private IList <IWord> CreateAdjective(IWordData wordData) { //There will be non-functional adjectives here List <IWord> alt = new List <IWord> (); string adjective = wordData.Word + "ly"; if (wordData.Word [wordData.Word.Length - 1] == 'y') { adjective = wordData.Word + "ily"; } /* else if (wordData.Word.Substring(wordData.Word.Length -2, 2) == "le") { * * adjective = wordData.Word.Substring(wordData.Word.Length -1) + "ly"; * * }*/ if (ContainsWordDelegate.Contains(adjective)) { return(alt); } DefaultGram gram = m_gram.Children.Where(child => child.Name == "adjective").First(); string typeClass = adjective [0].IsVowel() ? gram.Classes.Where(c => c == "an").First() : gram.Classes.Where(c => c == "a").First(); alt.Add(new DefaultWord(adjective, gram, NextWordId, typeClass)); //alt.AddRange (CreateDeterminedAndUndetermined (adjective, gram)); return(alt); }
public DefaultWord(string value, DefaultGram gram, int id, string classType = null) { m_value = value; m_gram = gram; m_id = id; m_class = classType; }
public DefaultWord (string value, DefaultGram gram, int id, string classType = null ) { m_value = value; m_gram = gram; m_id = id; m_class = classType; }
public English1AdverbIdentifier (DefaultGram adverb, IWordIdCounter counter) : base (counter) { m_gram = adverb; m_adverbs = new List<string> (); }
public English1AdjectiveIdentifier (DefaultGram adjective, IWordIdCounter counter) : base (counter) { m_gram = adjective; m_adjectives = new List<string> (); }
public override IList <IWord> Identify(IWordData wordData) { List <IWord> alt = new List <IWord> (); if (m_pluralCaseIgnore.IsMatch(wordData.RawData)) { //Plural form only (i e wives) and will be included in the base noun (wife); thus, ignore return(alt); } //string article = "the"; DefaultGram pluralGrammar = m_noun.Children.Where(child => child.Name == "plural").First(); if (wordData.Descriptor == "n.pl.") { //Plural only nuon (ie scissors) alt.Add(new DefaultWord(wordData.Word, pluralGrammar, NextWordId)); /*string definedPluralOnly = article + " " + wordData.Word; * * alt.Add (new DefaultWord (definedPluralOnly, pluralGrammar.Children.Where (child => child.Name == "articulated").First (), NextWordId)); */ alt.AddRange(CreateGenitiveList(alt)); return(alt); } string typeClass = wordData.Word [0].IsVowel() ? m_noun.Classes.Where(c => c == "an").First() : m_noun.Classes.Where(c => c == "a").First(); alt.Add(new DefaultWord(wordData.Word, m_noun, NextWordId, typeClass)); // if n.sing., the word is conjugated the same in singular/plural string pluralWord = wordData.Descriptor == "n.sing." ? wordData.Word : getPlural(wordData); alt.Add(new DefaultWord(pluralWord, pluralGrammar, NextWordId)); /* * string undetermined = getUnDermined (wordData.Word); * * alt.Add (new DefaultWord(undetermined, m_noun.Children.Where( child => child.Name == "undetermined").First(), NextWordId)); * * string definedSingular = article + " " + wordData.Word; * * alt.Add (new DefaultWord(definedSingular, m_noun.Children.Where( child => child.Name == "articulated").First(), NextWordId)); * * string definedPlural = article + " " + pluralWord; * * alt.Add (new DefaultWord(definedPlural, pluralGrammar.Children.Where( child => child.Name == "articulated").First(), NextWordId)); */ alt.AddRange(CreateGenitiveList(alt)); return(alt); }
public English1VerbIdentifier(DefaultGram verb, IWordIdCounter counter) : base(counter) { m_verb = verb; m_verbIdentifiers = new string[] { "v.t.", "v.i.", "v." }; m_trackedWords = new List <string> [26]; m_untrackedWords = new List <String> (); for (int i = 0; i < 26; i++) { m_trackedWords [i] = new List <string> (); } }
public English1VerbIdentifier (DefaultGram verb, IWordIdCounter counter) : base(counter) { m_verb = verb; m_verbIdentifiers = new string[] { "v.t.", "v.i.", "v." }; m_trackedWords = new List<string>[26]; m_untrackedWords = new List<String> (); for (int i = 0; i < 26; i++) { m_trackedWords [i] = new List<string> (); } }
private IList <IWord> CreateGenitiveList(IList <IWord> words) { IList <IWord> alt = new List <IWord> (); foreach (IWord word in words) { DefaultGram genetive = ((DefaultGram)word.Gram).Children.Where(child => child.Name == "genetive").FirstOrDefault(); if (genetive != null) { string genetiveWord = getGenetive(word.Value); alt.Add(new DefaultWord(genetiveWord, genetive, NextWordId)); } } return(alt); }
private IList <IWord> GetSuperlative(string bracketsContainer) { List <IWord> alt = new List <IWord> (); if (m_superlative.IsMatch(bracketsContainer)) { string adjContainer = m_superlative.Match(bracketsContainer).Value; string adj = new Regex(@"[A-Za-z]+$").Match(adjContainer).Value.ToLower(); DefaultGram gram = m_gram.Children.Where(child => child.Name == "superlative").First(); string typeClass = adj [0].IsVowel() ? gram.Classes.Where(c => c == "an").First() : gram.Classes.Where(c => c == "a").First(); alt.Add(new DefaultWord(adj, gram, NextWordId, typeClass)); } return(alt); }
public English1AdverbIdentifier(DefaultGram adverb, IWordIdCounter counter) : base(counter) { m_gram = adverb; m_adverbs = new List <string> (); }
public override IList <IWord> Identify(IWordData wordData) { if (ContainsWordDelegate == null) { throw new ApplicationException("English1AdjectiveIdentifier needs a ContainsWordDelegate"); } List <IWord> alt = new List <IWord> (); string typeClass; if (wordData.Descriptor == "a.superl.") { //Supqrlative only adjective (ie aftermost) DefaultGram gram = m_gram.Children.Where(child => child.Name == "superlative").First(); typeClass = wordData.Word [0].IsVowel() ? gram.Classes.Where(c => c == "an").First() : gram.Classes.Where(c => c == "a").First(); alt.Add(new DefaultWord(wordData.Word, gram, NextWordId)); //alt.AddRange(CreateArticulated(wordData.Word,gram)); return(alt); } if (m_brackets.IsMatch(wordData.RawData)) { //Brackets ( [Compa...) found string bracketsContainer = m_brackets.Match(wordData.RawData).Value.Replace('\n', ' '); IList <IWord> comp = GetComparative(bracketsContainer); if (comp.Count > 0) { alt.AddRange(comp); } else { Console.WriteLine("Unable to match Comparative for: " + wordData.Word); } IList <IWord> sup = GetSuperlative(bracketsContainer); if (sup.Count > 0) { alt.AddRange(sup); } else { Console.WriteLine("Unable to match Superlative for: " + wordData.Word); } } else { //Console.WriteLine ("Unable to match brackets for: " + wordData.Word); } typeClass = wordData.Word [0].IsVowel() ? m_gram.Classes.Where(c => c == "an").First() : m_gram.Classes.Where(c => c == "a").First(); alt.Add(new DefaultWord(wordData.Word, m_gram, NextWordId, typeClass)); //alt.AddRange(CreateDeterminedAndUndetermined(wordData.Word, m_gram)); alt.AddRange(CreateAdjective(wordData)); foreach (IWord word in alt) { m_adjectives.Add(word.Value); } return(alt); }
public English1AdjectiveIdentifier(DefaultGram adjective, IWordIdCounter counter) : base(counter) { m_gram = adjective; m_adjectives = new List <string> (); }
public English1NounIdentifier (DefaultGram nuon, IWordIdCounter counter) : base (counter) { m_noun = nuon; m_nuonIdentifiers = new string[] { "n.", "n.pl." , "n.sing."}; }
public English1NounIdentifier(DefaultGram nuon, IWordIdCounter counter) : base(counter) { m_noun = nuon; m_nuonIdentifiers = new string[] { "n.", "n.pl.", "n.sing." }; }