Exemplo n.º 1
0
        private bool LemmatizeWord(string inputWord, bool cap, bool predict, IList <AutomAnnotationInner> result, bool getLemmaInfos)
        {
            int wordOffset = 0;

            FormAutomat.GetInnerMorphInfos(inputWord, 0, result);
            var res = result.Count > 0;

            if (result.Count == 0)
            {
                if (predict)
                {
                    PredictBySuffix(inputWord, out wordOffset, 4, result);
                    if (inputWord[wordOffset - 1] != '-')
                    {
                        var knownPostfixLen  = inputWord.Length - wordOffset;
                        var unknownPrefixLen = wordOffset;
                        if (knownPostfixLen < 6)
                        {
                            if (!IsPrefix(inputWord.Substring(0, unknownPrefixLen)))
                            {
                                result.Clear();
                            }
                        }
                    }
                    for (var i = 0; i < result.Count; i++)
                    {
                        if (NPSs[result[i].ModelNo] == Constants.UnknownPartOfSpeech)
                        {
                            result.Clear();
                            break;
                        }
                    }
                }
            }
            if (result.Count > 0)
            {
                if (getLemmaInfos)
                {
                    GetLemmaInfos(inputWord, wordOffset, result);
                }
            }
            else
            {
                if (predict)
                {
                    PredictByDataBase(inputWord, result, cap);
                    for (var i = result.Count - 1; i >= 0; i--)
                    {
                        var a = result[i];
                        if (FlexiaModels[a.ModelNo][a.ItemNo].FlexiaStr.Length >= inputWord.Length)
                        {
                            result.RemoveAt(i);
                        }
                    }
                }
            }
            return(res);
        }
Exemplo n.º 2
0
 public bool CheckABC(string wordForm)
 {
     return(FormAutomat.CheckABCWithoutAnnotator(wordForm.ToUpper()));
 }