/// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        /// <remarks>Need to change returned UnknownEntity's Value.</remarks>
        private IEntity CreateOrdinalEntity(string word, FullLemmaInfo info)
        {
            if (!this.GramTable.ContainsKey(info.CommonMF.Gramcode))
            {
                throw new Exception("Gramcode error");
            }

            if (info == FullLemmaInfo.Unknown)
            {
                return(null);
            }

            IEntity result = null;

            PartOfSpeech pos = this.GramTable[info.CommonMF.Gramcode].PartOfSpeech;

            if (pos == PartOfSpeech.Noun)
            {
                result = new ClassEntity(info.CommonLemma);
            }
            else if (pos == PartOfSpeech.Adjective ||
                     pos == PartOfSpeech.AdjectiveFull ||
                     pos == PartOfSpeech.AdjectiveShort)
            {
                result = new PropertyEntity(info.CommonLemma);
            }
            else
            {
                result = new UnknownEntity(info.CommonLemma);
            }

            result.PartOfSpeech = pos;
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        /// <remarks>Need to change returned UnknownEntity's Value.</remarks>
        private IEntity CreateSimpleEntity(string word, FullLemmaInfo info)
        {
            if (!this.GramTable.ContainsKey(info.CommonMF.Gramcode))
            {
                throw new Exception("Gramcode error");
            }

            if (info == FullLemmaInfo.Unknown)
            {
                return(null);
            }

            IEntity result = null;

            PartOfSpeech pos, currentPos;

            try
            {
                pos        = this.GramTable[info.CommonMF.Gramcode].PartOfSpeech;
                currentPos = this.GramTable[info.CurrentMF.Gramcode].PartOfSpeech;
            }
            catch
            {
                return(CreateUnknownEntity(word));
            }


            if (pos == PartOfSpeech.Noun)
            {
                result = new ClassEntity(info.CommonLemma);
                result.PartOfSpeech = currentPos;
            }
            else if (pos == PartOfSpeech.Adjective ||
                     pos == PartOfSpeech.AdjectiveFull ||
                     pos == PartOfSpeech.AdjectiveShort)
            {
                result = new PropertyEntity(info.CommonLemma);
                result.PartOfSpeech = currentPos;
            }
            else
            {
                result = new UnknownEntity(info.CommonLemma);
                result.PartOfSpeech = currentPos;
            }

            result.MorphologicalInfo = info;
            return(result);
        }