コード例 #1
0
 public FrequencyInformation(string word, int index, double frequency, BasePOSType pos = null)
 {
     Word      = word;
     Index     = index;
     Frequency = frequency;
     Pos       = pos;
 }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: Phrase.cs プロジェクト: zzhnobug/Wikiled.Sentiment
        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);
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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);
        }
コード例 #7
0
 public IWordItem CreateWord(string word, BasePOSType wordPosType)
 {
     return(WordOccurrence.Create(wordsHandlers, extractor, inquirerManager, word, null, wordPosType));
 }
コード例 #8
0
ファイル: Phrase.cs プロジェクト: zzhnobug/Wikiled.Sentiment
 private Phrase(BasePOSType pos)
 {
     Text    = string.Empty;
     POS     = pos ?? throw new System.ArgumentNullException(nameof(pos));
     Stemmed = string.Empty;
 }