public FrequencyInformation(string word, int index, double frequency, BasePOSType pos = null) { Word = word; Index = index; Frequency = frequency; Pos = pos; }
public BasePOSType GetTag(string word) { if (string.IsNullOrEmpty(word)) { throw new ArgumentException("Value cannot be null or empty.", nameof(word)); } BasePOSType wordPosType = POSTags.Instance.UnknownWord; if (!word.HasLetters() && POSTags.Instance.Contains(word)) { wordPosType = POSTags.Instance.FindType(word); } else if (wordType.IsArticle(word)) { wordPosType = POSTags.Instance.RP; } else if (wordType.IsCoordinatingConjunctions(word)) { wordPosType = POSTags.Instance.CC; } else if (wordType.IsPronoun(word)) { wordPosType = POSTags.Instance.PRP; } else if (wordType.IsAdverb(word)) { wordPosType = POSTags.Instance.RB; } else if (wordType.IsAdjective(word)) { wordPosType = POSTags.Instance.JJ; } else if (wordType.IsVerb(word)) { wordPosType = POSTags.Instance.VB; } else if (wordType.IsNoun(word)) { wordPosType = POSTags.Instance.NN; } else if (!word.HasLetters()) { wordPosType = POSTags.Instance.SYM; } else if (frequentList != null) { wordPosType = frequentList.GetPOS(word); } return(wordPosType); }
public static Phrase Create(IContextWordsHandler wordsHandlers, BasePOSType pos) { if (wordsHandlers == null) { throw new System.ArgumentNullException(nameof(wordsHandlers)); } var item = new Phrase(pos); item.Relationship = new WordItemRelationships(wordsHandlers, item); return(item); }
public IPhrase CreatePhrase(string posPhrase) { BasePOSType postType = POSTags.Instance.UnknownPhrase; if (!POSTags.Instance.Contains(posPhrase)) { log.LogWarning("POS not found <{0}>", posPhrase); } else { postType = POSTags.Instance.FindType(posPhrase); } return(Phrase.Create(wordsHandlers, postType)); }
private WordOccurrence(string text, string raw, BasePOSType pos) { Text = text; POS = pos ?? throw new ArgumentNullException(nameof(pos)); if (pos.IsGroup) { throw new ArgumentException(nameof(pos)); } if (string.IsNullOrEmpty(text)) { throw new ArgumentException("Value cannot be null or empty.", nameof(text)); } Stemmed = raw; }
public static bool IsWordType(this IPOSTagger tagger, WordEx word, BasePOSType posType) { if (tagger is null) { throw new ArgumentNullException(nameof(tagger)); } if (word is null) { throw new ArgumentNullException(nameof(word)); } if (posType is null) { throw new ArgumentNullException(nameof(posType)); } return(word.Tag == posType || tagger.GetTag(word.Text) == posType); }
public IWordItem CreateWord(string word, BasePOSType wordPosType) { return(WordOccurrence.Create(wordsHandlers, extractor, inquirerManager, word, null, wordPosType)); }
private Phrase(BasePOSType pos) { Text = string.Empty; POS = pos ?? throw new System.ArgumentNullException(nameof(pos)); Stemmed = string.Empty; }