예제 #1
0
 public void SetVerbEntry(
     string pastStem,
     string presentStem,
     ENUM_VERB_TRANSITIVITY transitivity)
 {
     this.SetVerbEntry(pastStem, presentStem, transitivity, ENUM_VERB_TYPE.SADE, "", "", "");
 }
예제 #2
0
 public VerbEntry()
 {
     this.pastStem     = "";
     this.presentStem  = "";
     this.transitivity = ENUM_VERB_TRANSITIVITY.INVALID;
     this.verbType     = ENUM_VERB_TYPE.INVALID;
     this.pishvand     = "";
     this.felyar       = "";
     this.harfe_ezafe  = "";
 }
예제 #3
0
 public VerbEntry(
     string past_stem,
     string present_stem,
     ENUM_VERB_TRANSITIVITY transitivity,
     ENUM_VERB_TYPE verb_type,
     string _pishvand,
     string _felyar,
     string h_ezafe)
 {
     this.SetVerbEntry(past_stem, present_stem, transitivity, verb_type, _pishvand, _felyar, h_ezafe);
 }
예제 #4
0
        private void addVerbEntry(
            string mazi,
            string mozare,
            ENUM_VERB_TRANSITIVITY transitivity,
            ENUM_VERB_TYPE verb_type,
            string _pishvand,
            string _felyar,
            string h_ezafe)
        {
            VerbEntry ve = new VerbEntry();

            ve.SetVerbEntry(mazi, mozare, transitivity, verb_type, _pishvand, _felyar, h_ezafe);
            this.entrys.Add(ve);
        }
예제 #5
0
 public void SetVerbEntry(
     string past_stem,
     string present_stem,
     ENUM_VERB_TRANSITIVITY transitivity,
     ENUM_VERB_TYPE verb_type,
     string _pishvand,
     string _felyar,
     string h_ezafe)
 {
     this.pastStem     = past_stem;
     this.presentStem  = present_stem;
     this.transitivity = transitivity;
     this.verbType     = verb_type;
     this.pishvand     = _pishvand;
     this.felyar       = _felyar;
     this.harfe_ezafe  = h_ezafe;
     this.SetStemAlpha();
 }
예제 #6
0
        public bool isValidTense(ENUM_VERB_TRANSITIVITY transitivity)
        {
            if (this.getTenseTime() == ENUM_TENSE_TIME.AMR)
            {
                if (this.getTensePerson() != ENUM_TENSE_PERSON.PLURAL_SECOND &&
                    this.getTensePerson() != ENUM_TENSE_PERSON.SINGULAR_SECOND)
                {
                    return(false);
                }
            }

            if (transitivity == ENUM_VERB_TRANSITIVITY.INTRANSITIVE)
            {
                if (this.getTensePassivity() == ENUM_TENSE_PASSIVITY.PASSIVE)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #7
0
 public VerbWrapper(string bon_mazi, string boe_mozare, string pishvand, string felyar, string hezafe, ENUM_VERB_TRANSITIVITY transitivity)
 {
     this.entry = new VerbEntry(bon_mazi, boe_mozare, transitivity, ENUM_VERB_TYPE.INVALID, pishvand, felyar, hezafe);
 }
예제 #8
0
        public bool LoadStemFile(string fileName)
        {
            this.entrys.Clear();

            // Specify file, instructions, and privelegdes
            FileStream file = new FileStream(fileName, FileMode.Open, FileAccess.Read);

            // Create a new stream to read from a file
            StreamReader sr = new StreamReader(file);
            //int startPos = 0;
            Regex r = new Regex("([\\d])\\s+([\\d])\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)\\s+([^\\s]+)");
            Match m;

            string mazi   = "";
            string mozare = "";
            ENUM_VERB_TRANSITIVITY trans = ENUM_VERB_TRANSITIVITY.INVALID;
            ENUM_VERB_TYPE         vtype = ENUM_VERB_TYPE.INVALID;
            string felyar   = "";
            string pishvand = "";
            string h_ezafe  = "";

            string input = null;

            while ((input = sr.ReadLine()) != null)
            {
                m = r.Match(input);

                if (m.Success)
                {
                    // Verb Type
                    switch (Convert.ToInt32(m.Groups[1].Value))
                    {
                    case 1:
                        vtype = ENUM_VERB_TYPE.SADE;
                        break;

                    case 2:
                        vtype = ENUM_VERB_TYPE.PISHVANDI;
                        break;

                    case 3:
                        vtype = ENUM_VERB_TYPE.MORAKKAB;
                        break;

                    case 4:
                        vtype = ENUM_VERB_TYPE.PISHVANDI_MORAKKAB;
                        break;

                    case 5:
                        vtype = ENUM_VERB_TYPE.EBARATE_FELI;
                        break;

                    case 6:
                        vtype = ENUM_VERB_TYPE.NAGOZAR;
                        break;

                    case 7:
                        break;

                    default:
                        vtype = ENUM_VERB_TYPE.INVALID;
                        break;
                    }

                    // Verb Transitivity
                    if (m.Groups[2].Value == "0")
                    {
                        trans = ENUM_VERB_TRANSITIVITY.INTRANSITIVE;
                    }
                    else if (m.Groups[2].Value == "1")
                    {
                        trans = ENUM_VERB_TRANSITIVITY.TRANSITIVE;
                    }
                    else if (m.Groups[2].Value == "2")
                    {
                        trans = ENUM_VERB_TRANSITIVITY.BILATERAL;
                    }

                    // Verb Stem
                    mazi   = m.Groups[3].Value;
                    mozare = m.Groups[4].Value;

                    // Components
                    felyar = m.Groups[5].Value;
                    if (felyar == "-")
                    {
                        felyar = "";
                    }
                    pishvand = m.Groups[6].Value;
                    if (pishvand == "-")
                    {
                        pishvand = "";
                    }
                    h_ezafe = m.Groups[7].Value;
                    if (h_ezafe == "-")
                    {
                        h_ezafe = "";
                    }

                    this.addVerbEntry(mazi, mozare, trans, vtype, pishvand, felyar, h_ezafe);
                }
            }

            // Close StreamReader
            sr.Close();

            // Close file
            file.Close();

            if (this.entrys.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }