public GroupPattern() { this.pattern = ""; this.stemAlpha = STEM_ALPHA.X_X; this.stemTime = STEM_TIME.UNSET; this.stemCount = 0; }
private void SetStemAlpha() { string alpha = ""; alpha = this.pastStem.Substring(0, 1); alph_start_mazi = (alpha == "آ" || alpha == "ا") ? STEM_ALPHA.A_X : STEM_ALPHA.B_X; if (alpha == "v") { pastStem = pastStem.Substring(1); } alpha = this.presentStem.Substring(0, 1); alph_start_moza = (alpha == "آ" || alpha == "ا") ? STEM_ALPHA.A_X : STEM_ALPHA.B_X; if (alpha == "v") { presentStem = presentStem.Substring(1); } alpha = this.presentStem.Substring(presentStem.Length - 1); alph_end_moza = (alpha == "ا" || alpha == "آ" || alpha == "و") ? STEM_ALPHA.X_A : STEM_ALPHA.X_B; if (alpha == "v") { presentStem = presentStem.Substring(0, presentStem.Length - 1); } alph_end_mazi = STEM_ALPHA.X_X; }
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); }