예제 #1
0
        public static bool IsWordType(this IPOSTagger tagger, WordEx word, WordType type)
        {
            if (tagger is null)
            {
                throw new ArgumentNullException(nameof(tagger));
            }

            if (word is null)
            {
                throw new ArgumentNullException(nameof(word));
            }

            return(word.Tag.WordType == type || tagger.GetTag(word.Text).WordType == type);
        }
        public WordEx Construct(string word)
        {
            if (string.IsNullOrEmpty(word))
            {
                throw new ArgumentException("Value cannot be null or empty.", nameof(word));
            }

            var wordEx = new WordEx(word);

            wordEx.Type       = tagger.GetTag(word).Tag;
            wordEx.IsStop     = Words.WordTypeResolver.Instance.IsStop(word);
            wordEx.IsInvertor = Words.WordTypeResolver.Instance.IsInvertor(word);
            wordEx.Raw        = raw.GetWord(word);
            return(wordEx);
        }
예제 #3
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);
        }