Exemplo n.º 1
0
        public GroupPattern GetFelyarPattern(ENUM_VERB_TYPE vtype)
        {
            GroupPattern  gp      = new GroupPattern();
            List <string> strList = new List <string>();

            this.entrys.ForEach(delegate(VerbEntry ve)
            {
                if ((ve.felyar != "") && (ve.verbType == vtype) && !strList.Contains(ve.felyar))
                {
                    strList.Add(ve.felyar);
                }
            });

            strList.ForEach(delegate(string s)
            {
                gp.addUnit(s);
            });

            return(gp);
        }
Exemplo n.º 2
0
        public GroupPattern GetStemPatten(STEM_TIME st, STEM_ALPHA vs, ENUM_VERB_TYPE verb_type, ENUM_PATTERN_GENERALITY generality)
        {
            GroupPattern dp = new GroupPattern();

            dp.stemAlpha = vs;
            dp.stemTime  = st;
            string generalVerb = ".{2,4}";

            switch (st)
            {
            case STEM_TIME.MAZI:
                switch (vs)
                {
                case STEM_ALPHA.A_X:
                case STEM_ALPHA.A_B:
                case STEM_ALPHA.A_A:
                    if (generality == ENUM_PATTERN_GENERALITY.EXPLICIT)
                    {
                        this.entrys.ForEach(delegate(VerbEntry ve)
                        {
                            if ((ve.StartingAlpha(STEM_TIME.MAZI) == STEM_ALPHA.A_X) && (ve.verbType == verb_type))
                            {
                                dp.addUnit(ve.GetTail(STEM_TIME.MAZI));
                            }
                        });
                        dp.pattern = "[آا](?:" + dp.pattern + ")";
                    }
                    else
                    {
                        dp.pattern = "[آا](?:" + generalVerb + ")";
                    }
                    break;

                case STEM_ALPHA.B_X:
                case STEM_ALPHA.B_B:
                case STEM_ALPHA.B_A:
                    if (generality == ENUM_PATTERN_GENERALITY.EXPLICIT)
                    {
                        this.entrys.ForEach(delegate(VerbEntry ve)
                        {
                            if ((ve.StartingAlpha(STEM_TIME.MAZI) == STEM_ALPHA.B_X) && (ve.verbType == verb_type))
                            {
                                dp.addUnit(ve.pastStem);
                            }
                        });
                    }
                    else
                    {
                        dp.pattern = generalVerb;
                    }
                    break;

                default:
                    break;
                }
                break;

            case STEM_TIME.MOZARE:
                switch (vs)
                {
                case STEM_ALPHA.A_B:
                    if (generality == ENUM_PATTERN_GENERALITY.EXPLICIT)
                    {
                        this.entrys.ForEach(delegate(VerbEntry ve)
                        {
                            if ((ve.BoundingAlpha(STEM_TIME.MOZARE) == STEM_ALPHA.A_B) && (ve.verbType == verb_type))
                            {
                                dp.addUnit(ve.GetTail(STEM_TIME.MOZARE));
                            }
                        });
                        dp.pattern = "[آا](?:" + dp.pattern + ")";
                    }
                    else
                    {
                        dp.pattern = "[آا](?:" + generalVerb + ")";
                    }
                    break;

                case STEM_ALPHA.A_A:
                    if (generality == ENUM_PATTERN_GENERALITY.EXPLICIT)
                    {
                        this.entrys.ForEach(delegate(VerbEntry ve)
                        {
                            if ((ve.BoundingAlpha(STEM_TIME.MOZARE) == STEM_ALPHA.A_A) && (ve.verbType == verb_type))
                            {
                                dp.addUnit(ve.GetTail(STEM_TIME.MOZARE));
                            }
                        });
                        dp.pattern = "[آا](?:" + dp.pattern + ")";
                    }
                    else
                    {
                        dp.pattern = "[آا](?:" + generalVerb + ")";
                    }
                    break;

                case STEM_ALPHA.B_B:
                    if (generality == ENUM_PATTERN_GENERALITY.EXPLICIT)
                    {
                        this.entrys.ForEach(delegate(VerbEntry ve)
                        {
                            if ((ve.BoundingAlpha(STEM_TIME.MOZARE) == STEM_ALPHA.B_B) && (ve.verbType == verb_type))
                            {
                                dp.addUnit(ve.presentStem);
                            }
                        });
                    }
                    else
                    {
                        dp.pattern = generalVerb;
                    }
                    break;

                case STEM_ALPHA.B_A:
                    if (generality == ENUM_PATTERN_GENERALITY.EXPLICIT)
                    {
                        this.entrys.ForEach(delegate(VerbEntry ve)
                        {
                            if ((ve.BoundingAlpha(STEM_TIME.MOZARE) == STEM_ALPHA.B_A) && (ve.verbType == verb_type))
                            {
                                dp.addUnit(ve.presentStem);
                            }
                        });
                    }
                    else
                    {
                        dp.pattern = "[آا](?:" + generalVerb + ")";
                    }
                    break;

                default:
                    break;
                }
                break;
            }

            return(dp);
        }