Esempio n. 1
0
        public WordMorphology GetWordMorphology_NoToUpper(string wordUpper, WordFormMorphologyModeEnum wordFormMorphologyMode)
        {
            var wordMorphology = new WordMorphology();

            if (_morphoModel.GetWordFormMorphologies(wordUpper, _wordFormMorphologies, wordFormMorphologyMode))
            {
                var len = _wordFormMorphologies.Count;
                switch (len)
                {
                case 0: break;

                case 1:
                    wordMorphology.IsSinglePartOfSpeech = true;
                    wordMorphology.PartOfSpeech         = _wordFormMorphologies[0].PartOfSpeech;
                    wordMorphology.WordFormMorphologies = _wordFormMorphologies;
                    break;

                default:
                    for (int i = 0; i < len; i++)
                    {
                        var pos = _wordFormMorphologies[i].PartOfSpeech;
                        if (i == 0)
                        {
                            wordMorphology.IsSinglePartOfSpeech = true;
                        }
                        else
                        {
                            wordMorphology.IsSinglePartOfSpeech &= (wordMorphology.PartOfSpeech == pos);
                        }
                        wordMorphology.PartOfSpeech |= pos;
                    }

                    wordMorphology.WordFormMorphologies = _wordFormMorphologies;
                    break;
                }
            }

            return(wordMorphology);
        }
Esempio n. 2
0
        unsafe private WordMorphology GetWordMorphology_4LastValueUpperInNumeralChain(char *wordUpper, WordFormMorphologyModeEnum wordFormMorphologyMode)
        {
            var wordMorphology = new WordMorphology();

            if (_morphoModel.GetWordFormMorphologies(wordUpper, _wordFormMorphologies, wordFormMorphologyMode))
            {
                var len = _wordFormMorphologies.Count;
                switch (len)
                {
                case 0: break;

                case 1:
                    wordMorphology.IsSinglePartOfSpeech = true;
                    wordMorphology.PartOfSpeech         = _wordFormMorphologies[0].PartOfSpeech;
                    wordMorphology.WordFormMorphologies = _wordFormMorphologies;
                    break;

                default:
                    for (int i = 0; i < len; i++)
                    {
                        var pos = _wordFormMorphologies[i].PartOfSpeech;
                        if (i == 0)
                        {
                            wordMorphology.IsSinglePartOfSpeech = true;
                        }
                        else
                        {
                            wordMorphology.IsSinglePartOfSpeech &= (wordMorphology.PartOfSpeech == pos);
                        }
                        wordMorphology.PartOfSpeech |= pos;
                    }

                    wordMorphology.WordFormMorphologies = _wordFormMorphologies;
                    break;
                }
            }

            return(wordMorphology);
        }