示例#1
0
        private Word ConvertToWord(Sentence sentence, Parse parse)
        {
            int    start = parse.Span.Start;
            int    end   = parse.Span.End;
            string text  = GetPartText(parse, start, end);

            string          dirtyType       = parse.Type;
            GrammarWordType grammarWordType = _typeConverter.ConvertToWordType(dirtyType);
            var             result          = new Word(text, grammarWordType);

            string fullText = GetFullWord(text, grammarWordType);

            if (_nativeTextAnalyzer.NeedTryGetBaseForm(dirtyType) &&
                !_specialWords.Contains(fullText.ToLowerInvariant()))
            {
                result.NormalForms = _nativeTextAnalyzer.GetLemmas(fullText, dirtyType.ToLowerInvariant());
            }

            if (!string.Equals(fullText, text, StringComparison.InvariantCultureIgnoreCase))
            {
                result.FullText = fullText;
            }

            sentence.AddWord(result);
            return(result);
        }