Beispiel #1
0
        public string[] Conjugate(ENUM_VERB_TYPE verbType, ENUM_TENSE_PERSON person)
        {
            VerbEntry ve;

            m_verbWrapper = new VerbWrapper();

            List <string> lst = new List <string>();

            m_verbInfoContainer.ResetIndex();
            while ((ve = m_verbInfoContainer.GetVerbEntry()) != null)
            {
                m_verbWrapper.SetVerbEntry(ve);
                m_verbWrapper.setTensePassivity(ENUM_TENSE_PASSIVITY.ACTIVE);

                if (verbType.Has(ENUM_VERB_TYPE.INFINITIVE))
                {
                    lst.AddRange(m_verbWrapper.PrintInfinitive());
                }

                if (!verbType.Has(ve.verbType))
                {
                    continue;
                }

                #region Conjugate

                foreach (ENUM_TENSE_TIME tm in m_timeList)
                {
                    m_verbWrapper.setTenseTime(tm);
                    //foreach (ENUM_TENSE_OBJECT obj in Enum.GetValues(typeof(ENUM_TENSE_OBJECT)))
                    foreach (ENUM_TENSE_POSITIVITY pos in Enum.GetValues(typeof(ENUM_TENSE_POSITIVITY)))
                    {
                        m_verbWrapper.setTensePositivity(pos);
                        if (!m_verbWrapper.IsValidPositivity())
                        {
                            continue;
                        }


                        if (person == ENUM_TENSE_PERSON.INVALID || person == ENUM_TENSE_PERSON.UNMACHED_SEGMENT)
                        {
                            continue;
                        }

                        m_verbWrapper.setTensePerson(person);

                        if (m_verbWrapper.isValidTense(ENUM_VERB_TRANSITIVITY.INTRANSITIVE))
                        {
                            lst.Add(m_verbWrapper.PrintVerb().Split(' ')[0]);
                        }
                    }
                }

                #endregion
            }

            return(lst.Distinct().ToArray());
        }
Beispiel #2
0
 public void setTense(ENUM_TENSE_TIME time, ENUM_TENSE_PASSIVITY passivity,
                      ENUM_TENSE_POSITIVITY positivity, ENUM_TENSE_PERSON person)
 {
     this.resetVerb();
     this.setTensePerson(person);
     this.setTenseTime(time);
     this.setTensePassivity(passivity);
     this.setTensePositivity(positivity);
     this.setTenseType(ENUM_VERB_TYPE.SADE);
 }
Beispiel #3
0
        public Token(string lexeme, PersianPOSTag persianPOSTag, string lemma, NumberType numberType, int length, int startPos, ENUM_TENSE_PERSON person)
        {
            Lexeme = lexeme;
            POSTag = persianPOSTag;
            Lemma = lemma;

            Number = numberType;
            Length = length;
            Lemma = lemma;
            Lexeme = lexeme;
            Person = person;
            POSTag = persianPOSTag;
            StartPos = startPos;
        }
Beispiel #4
0
        public Token(string lexeme, PersianPOSTag persianPOSTag, string lemma, NumberType numberType, int length, int startPos, ENUM_TENSE_PERSON person)
        {
            Lexeme = lexeme;
            POSTag = persianPOSTag;
            Lemma  = lemma;

            Number   = numberType;
            Length   = length;
            Lemma    = lemma;
            Lexeme   = lexeme;
            Person   = person;
            POSTag   = persianPOSTag;
            StartPos = startPos;
        }
Beispiel #5
0
        public ENUM_TENSE_PERSON getTensePerson()
        {
            Int32 mask = Convert.ToInt32(ENUM_TENSE_PERSON.INVALID);

            ENUM_TENSE_PERSON vtp = (ENUM_TENSE_PERSON)(this.ID & mask);

            switch (vtp)
            {
            case ENUM_TENSE_PERSON.SINGULAR_FIRST:
            case ENUM_TENSE_PERSON.SINGULAR_SECOND:
            case ENUM_TENSE_PERSON.SINGULAR_THIRD:
            case ENUM_TENSE_PERSON.PLURAL_FIRST:
            case ENUM_TENSE_PERSON.PLURAL_SECOND:
            case ENUM_TENSE_PERSON.PLURAL_THIRD:
            case ENUM_TENSE_PERSON.UNMACHED_SEGMENT:
                return(vtp);

            default:
                return(ENUM_TENSE_PERSON.INVALID);
            }
        }
Beispiel #6
0
        private string printPronoun()
        {
            ENUM_TENSE_TIME   time   = this.getTenseTime();
            ENUM_TENSE_PERSON person = this.getTensePerson();

            PRONOUN_TYPE pt      = this.getPronounType();
            string       postfix = "";

            switch (pt)
            {
            case PRONOUN_TYPE.MAZI:
                switch (person)
                {
                case ENUM_TENSE_PERSON.SINGULAR_FIRST:
                    postfix = "م";
                    break;

                case ENUM_TENSE_PERSON.SINGULAR_SECOND:
                    postfix = "ی";
                    break;

                case ENUM_TENSE_PERSON.SINGULAR_THIRD:
                    postfix = "";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_FIRST:
                    postfix = "یم";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_SECOND:
                    postfix = "ید";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_THIRD:
                    postfix = "ند";
                    break;

                default:
                    postfix = "";
                    break;
                }
                break;

            case PRONOUN_TYPE.MOZARE:
                switch (person)
                {
                case ENUM_TENSE_PERSON.SINGULAR_FIRST:
                    postfix = "م";
                    break;

                case ENUM_TENSE_PERSON.SINGULAR_SECOND:
                    postfix = "ی";
                    break;

                case ENUM_TENSE_PERSON.SINGULAR_THIRD:
                    postfix = "د";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_FIRST:
                    postfix = "یم";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_SECOND:
                    postfix = "ید";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_THIRD:
                    postfix = "ند";
                    break;

                default:
                    postfix = "";
                    break;
                }
                break;

            case PRONOUN_TYPE.NAGHLI:
                switch (person)
                {
                case ENUM_TENSE_PERSON.SINGULAR_FIRST:
                    postfix = "‌ام";
                    break;

                case ENUM_TENSE_PERSON.SINGULAR_SECOND:
                    postfix = "‌ای";
                    break;

                case ENUM_TENSE_PERSON.SINGULAR_THIRD:
                    postfix = " است";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_FIRST:
                    postfix = "‌ایم";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_SECOND:
                    postfix = "‌اید";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_THIRD:
                    postfix = "‌اند";
                    break;

                default:
                    postfix = "";
                    break;
                }
                break;

            case PRONOUN_TYPE.AMR:
                switch (person)
                {
                case ENUM_TENSE_PERSON.SINGULAR_SECOND:
                    postfix = "";
                    break;

                case ENUM_TENSE_PERSON.PLURAL_SECOND:
                    postfix = "ید";
                    break;

                default:
                    postfix = "";
                    break;
                }
                break;

            default:
                break;
            }

            return(postfix);
        }
Beispiel #7
0
 public void setTensePerson(ENUM_TENSE_PERSON person)
 {
     this.ID  = this.ID & ~Convert.ToInt32(ENUM_TENSE_PERSON.INVALID);
     this.ID |= Convert.ToInt32(person);
 }
Beispiel #8
0
 public Verb(ENUM_TENSE_TIME time, ENUM_TENSE_PASSIVITY passivity,
             ENUM_TENSE_POSITIVITY positivity, ENUM_TENSE_PERSON person)
 {
     this.setTense(time, passivity, positivity, person);
 }