예제 #1
0
        unsafe private void FillWordForms_Core(char *wordPart, int wordPartLength, int fullWordLength, List <WordForm> result)
        {
            if (_BaseMorphoForms == null)
            {
                return;
            }

            foreach (var baseMorphoForm in _BaseMorphoForms)
            {
                int baseLength = baseMorphoForm.Base.Length;
                if ((fullWordLength < baseLength) ||
                    (baseLength + baseMorphoForm.MorphoType.MaxEndingLength < fullWordLength)
                    )
                {
                    continue;
                }

                var morphoForms = baseMorphoForm.MorphoType.MorphoForms;
                foreach (var morphoForm in morphoForms)
                {
                    var endingLength = morphoForm.EndingUpper.Length;
                    if (baseLength + endingLength != fullWordLength)
                    {
                        continue;
                    }

                    if (endingLength != wordPartLength)
                    {
                        continue;
                    }
                    if (wordPartLength == 0)
                    {
                        ;
                    }
                    else
                    if (!StringsHelper.IsEqual(morphoForm.EndingUpper, wordPart, wordPartLength))
                    {
                        continue;
                    }

                    var partOfSpeech = baseMorphoForm.MorphoType.PartOfSpeech;
                    foreach (var _morphoForm in morphoForms)
                    {
                        /// получение словоформы
                        var wordForm = baseMorphoForm.Base + _morphoForm.Ending;

                        var wf = new WordForm(wordForm, partOfSpeech);
                        result.Add(wf);
                    }
                    break;
                }
            }
        }
예제 #2
0
        public WordForms GetWordFormsByPartOfSpeech_NoToUpper(string wordUpper, PartOfSpeechEnum partOfSpeechFilter)
        {
            var result = new WordForms(wordUpper);

            if (_morphoModel.GetWordForms(wordUpper, _wordForms))
            {
                FillUniqueWordFormsDictionary(partOfSpeechFilter);

                _wordForms.Clear();
                foreach (var p in _uniqueWordFormsDictionary)
                {
                    var form         = p.Key;
                    var partOfSpeech = p.Value;

                    var wf = new WordForm(form, partOfSpeech);
                    _wordForms.Add(wf);
                }
                result.Forms = _wordForms;
            }

            return(result);
        }