public void InitializePronunciationRules() { string[] noFCons = new string[] { "" }; string[] fCons1 = new string[] { "¹", "Á", "Â", "Ç", "§", "¡", "´", "º" }; string[] fCons2 = new string[] { "¹", "Á", "Â", "Ç", "§", "¡", "´", "º", "Í" }; WordStructureUnionRule allRules = new WordStructureUnionRule ( "¡è͹,k-@@-n^-1", "Íè͹,z-@@-n^-1", "ÍéÍÁ,z-@@-m^-2", "ÍêÍ´,z-@@-t^-3", "à¡éÒ,k-aa-w^-2", "à¨éÒ,c-aa-w^-2", "à¡ÅéÒ,kl-aa-w^-2", "à·éÒ,th-aa-w^-3", new WordStructurePronunciationRule("-Ð", "a", false, noFCons), new WordStructurePronunciationRule("-" + "ÍÑ"[1], "a", false, new string[] { "¹", "Á", "Â", "§", "¡", "´", "º" }), new WordStructurePronunciationRule("-Ò", "aa", true), new WordStructurePronunciationRule("-" + "ÍÔ"[1], "i", false), new WordStructurePronunciationRule("-" + "ÍÕ"[1], "ii", true), new WordStructurePronunciationRule("-" + "ÍÖ"[1], "v", false), new WordStructurePronunciationRule("-" + "Í×"[1], "vv", true, fCons2), new WordStructurePronunciationRule("-" + "ÍØ"[1], "u", false), new WordStructurePronunciationRule("-" + "ÍÙ"[1], "uu", true), new WordStructurePronunciationRule("à-Ð", "e", false, noFCons), new WordStructurePronunciationRule("à-" + "Íç"[1], "e", false, fCons1), new WordStructurePronunciationRule("à-", "e", false, fCons1, new bool[] { false, true, false, true, true }), new WordStructurePronunciationRule("à-", "ee", true), new WordStructurePronunciationRule("á-Ð", "x", false, noFCons), new WordStructurePronunciationRule("á-" + "Íç"[1], "x", false, fCons1), new WordStructurePronunciationRule("á-", "x", false, fCons1, new bool[] { false, true, false, true, true }), new WordStructurePronunciationRule("á-", "xx", true), new WordStructurePronunciationRule("â-Ð", "o", false, noFCons), new WordStructurePronunciationRule("-", "o", false, fCons1), new WordStructurePronunciationRule("â-", "oo", true), new WordStructurePronunciationRule("à-ÒÐ", "@", false, noFCons), new WordStructurePronunciationRule("-" + "Íç"[1] + "Í", "@", false, fCons1), new WordStructurePronunciationRule("-Í", "@", false, fCons1, new bool[] { false, true, false, true, true }), new WordStructurePronunciationRule("-Í", "@", false, new bool[] { true, false, false }, new string[] { "Á", "Â", "Ç", "§" }, new bool[] { false, false, true, false, false }), new WordStructurePronunciationRule("-Í", "@", false, new bool[] { false, true, false }, fCons1, new bool[] { false, false, true, false, false }), new WordStructurePronunciationRule("-Í", "@@", true), new WordStructurePronunciationRule("à-ÍÐ", "q", false, noFCons), new WordStructurePronunciationRule("à-" + "ÍÔ"[1], "q", false, fCons1, new bool[] { false, true, false, true, true }), new WordStructurePronunciationRule("à-Í", "qq", true, noFCons), new WordStructurePronunciationRule("à-" + "ÍÔ"[1], "qq", true, fCons1), new WordStructurePronunciationRule("à-" + "ÍÕ"[1] + "ÂÐ", "ia", false, noFCons), new WordStructurePronunciationRule("à-" + "ÍÕ"[1] + "Â", "iia", true), new WordStructurePronunciationRule("à-" + "Í×"[1] + "ÍÐ", "va", false, noFCons), new WordStructurePronunciationRule("à-" + "Í×"[1] + "Í", "vva", true), new WordStructurePronunciationRule("-" + "ÍÑ"[1] + "ÇÐ", "ua", false, noFCons), new WordStructurePronunciationRule("-" + "ÍÑ"[1] + "Ç", "uua", true, noFCons), new WordStructurePronunciationRule("-Ç", "uua", true, new string[] { "¹", "Á", "Â", "§", "¡", "´", "º" }), new WordStructurePronunciationRule("à-Ò", "a", true, noFCons, "Ç") ); _thaiPronunciationStructureRule = allRules; this.IsInitialized = true; }
public void InitializeThaiWordRules() { WordStructureThaiDictRule.Instance.InitializeThaiDict(); //foreach (string s in Properties.Resources.AvailableSyllableDict.Split(' ')) // if (!_availableSyllableDict.ContainsKey(s)) // _availableSyllableDict.Add(s, true); IWordStructureRule tcc; IWordStructureRule tcc1; IWordStructureRule tcc2; IWordStructureRule tcc3; IWordStructureRule exceptionRule = new WordStructureUnionRule ( "¡ç,¡éÍ", "ÍÂèÒ§,ËÚÂèÒ§", "ÍÂÙè,ËÚÂÙè", "ÍÂèÒ,ËÚÂèÒ", "ÍÂÒ¡,ËÚÂÒ¡", "Äå,Ã×Í", "ÄÒ,Ã×Í", "Æå,Å×Í", "ÆÒ,Å×Í", "Ä,ÃÖ", "ÁØ¢,ÁØ¡", "ÊØ¢,ÊØ¡", "Ä¡,àÃÔ¡", "Ä·,ÃÔ´", "¹éÓ,¹éÒÁ", "ÈÕÃ,ÊÕ", "¡ÄÉ,¡ÚÃÔ´", "ä·Â,·ÑÂ", "ä´é,´éÒÂ", "äÁé,ÁéÒÂ", "¨ÃÔ§,¨Ô§" ); IWordStructureRule leadConsRule1 = new WordStructureUnionRule ( "˧,ËÚ§", "Ë,ËÚÂ", "˹,ËÚ¹", "ËÁ,ËÚÁ", "ËÂ,ËÚÂ", "ËÃ,ËÚÃ", "ËÅ,ËÚÅ", "ËÇ,ËÚÇ", "·Ã,«", "ÊÃ,Ê", "ÈÃ,Ê" ); IWordStructureRule leadConsRule2 = new WordStructureUnionRule ( "¡Ã,¡ÚÃ", "¢Ã,¢ÚÃ", "¤Ã,¤ÚÃ", "µÃ,µÚÃ", "»Ã,»ÚÃ", "¾Ã,¾ÚÃ", "¿Ã,¿ÚÃ" ); IWordStructureRule leadConsRule3 = new WordStructureUnionRule ( "¡Å,¡ÚÅ", "¢Å,¢ÚÅ", "¤Å,¤ÚÅ", "»Å,»ÚÅ", "¾Å,¾ÚÅ", "¿Å,¿ÚÅ" ); IWordStructureRule leadConsRule4 = new WordStructureUnionRule ( "¡Ç,¡ÚÇ", "¢Ç,¢ÚÇ", "¤Ç,¤ÚÇ" ); IWordStructureRule consRule = new WordStructureUnionRule ( WordStructureChar.Cons, leadConsRule1, leadConsRule2, leadConsRule3, leadConsRule4, WordStructureTwoChar.Instance ); IWordStructureRule karunRule; IWordStructureRule middleKarunRule; { IWordStructureRule karunConsRule = WordStructureChar.Cons.RemovePronunciationDict(); IWordStructureRule wordStructureRule = new WordStructureUnionRule ( "ÉÁ³ì,", new WordStructureConcatRule(new WordStructureOptionalRule(karunConsRule), karunConsRule, "Íì"[1] + ","), new WordStructureConcatRule(karunConsRule, new WordStructureUnionRule("ÍØ"[1] + ",", "ÍÔ"[1] + ","), "Íì"[1] + ",") ); karunRule = new WordStructureOptionalRule(wordStructureRule); middleKarunRule = new WordStructureOptionalRule(new WordStructureConcatRule(karunConsRule, "Íì"[1] + ",")); } { tcc1 = new WordStructureUnionRule ( new WordStructureConcatRule(WordStructureOptionalRule.Tone, 'Ð'), new WordStructureConcatRule(WordStructureOptionalRule.Tone, 'Ò', middleKarunRule, new WordStructureOptionalRule(new WordStructureUnionRule(WordStructureChar.FCons, "µÃ,´", "µÔ,´", "¶,´", "ö,´"))), new WordStructureConcatRule(WordStructureOptionalRule.Tone, 'Ç', WordStructureChar.FCons), new WordStructureConcatRule(WordStructureOptionalRule.Tone, 'Í', middleKarunRule, WordStructureOptionalRule.FCons), new WordStructureConcatRule("Íç"[1], 'Í', middleKarunRule, WordStructureChar.FCons), new WordStructureConcatRule(WordStructureOptionalRule.Tone, WordStructureChar.FCons - 'Â' - 'Ã' - 'Ç'), new WordStructureConcatRule("ÍÔ"[1], WordStructureOptionalRule.Tone, new WordStructureOptionalRule(new WordStructureUnionRule(WordStructureChar.FConsNoYorYakRorRuer, "µÃ,´"))), new WordStructureConcatRule("ÍÕ"[1], WordStructureOptionalRule.Tone, WordStructureOptionalRule.FConsNoYorYakRorRuer), new WordStructureConcatRule("ÍÖ"[1], WordStructureOptionalRule.Tone, WordStructureOptionalRule.FConsNoRorRuer), new WordStructureConcatRule("Í×"[1], WordStructureOptionalRule.Tone, new WordStructureUnionRule(WordStructureChar.FConsNoRorRuer, 'Í')), new WordStructureConcatRule("ÍØ"[1], WordStructureOptionalRule.Tone, new WordStructureOptionalRule(new WordStructureUnionRule(WordStructureChar.FCons, "µÔ,´"))), new WordStructureConcatRule("ÍÙ"[1], WordStructureOptionalRule.Tone, WordStructureOptionalRule.FCons), new WordStructureConcatRule("," + "ÍÑ"[1], WordStructureOptionalRule.Tone, "ÍÓ"[1] + ",Á"), new WordStructureConcatRule("ÍÑ"[1], WordStructureOptionalRule.Tone, new WordStructureUnionRule(WordStructureChar.FConsNoRorRuer, "µÃ,´", "µÔ,´", "ÇÐ")) ); } { tcc2 = new WordStructureUnionRule ( new WordStructureConcatRule(WordStructureOptionalRule.Tone, new WordStructureUnionRule("Ð", "Ò", "ÒÐ", "ÍÐ")), new WordStructureConcatRule(WordStructureOptionalRule.Tone, new WordStructureUnionRule(WordStructureChar.FConsNoYorYak, "µØ,´")), new WordStructureConcatRule(WordStructureOptionalRule.Tone, 'Í'), WordStructureChar.Tone, new WordStructureConcatRule("Íç"[1], WordStructureChar.FConsNoYorYakRorRuer), new WordStructureConcatRule("ÍÔ"[1], WordStructureOptionalRule.Tone, middleKarunRule, WordStructureChar.FConsNoRorRuer), new WordStructureConcatRule("ÍÕ"[1], WordStructureOptionalRule.Tone, 'Â', new WordStructureOptionalRule(new WordStructureUnionRule(WordStructureChar.FConsNoYorYak, 'Ð'))), new WordStructureConcatRule("Í×"[1], WordStructureOptionalRule.Tone, 'Í', new WordStructureOptionalRule(new WordStructureUnionRule(WordStructureChar.FConsNoRorRuer, 'Ð'))) ); } { tcc3 = new WordStructureUnionRule ( new WordStructureConcatRule(WordStructureOptionalRule.Tone, new WordStructureUnionRule(WordStructureChar.FConsNoYorYak, 'Ð')), new WordStructureConcatRule("Íç"[1], WordStructureChar.FConsNoYorYak) ); } { IWordStructureRule wordStructureRule = new WordStructureUnionRule ( exceptionRule, new WordStructureConcatRule(new WordStructureUnionRule(WordStructureChar.Cons, WordStructureTwoChar.Instance), "ÃÃ," + "ÍÑ"[1], new WordStructureUnionRule(WordStructureChar.RorHunFCons, ",¹")), new WordStructureConcatRule(consRule, tcc1), new WordStructureConcatRule(new WordStructureUnionRule(WordStructureChar.Cons, leadConsRule1, WordStructureTwoChar.Instance), "Ã,͹"), new WordStructureConcatRule('à', consRule, "," + "ÍÔ"[1], WordStructureOptionalRule.Tone, 'Â'), new WordStructureConcatRule('à', consRule, new WordStructureOptionalRule(tcc2)), new WordStructureConcatRule('á', consRule, new WordStructureOptionalRule(tcc3)), new WordStructureConcatRule(new WordStructureUnionRule("ä,", "ã,"), consRule, "," + "ÍÑ"[1], WordStructureOptionalRule.Tone, ",Â"), new WordStructureConcatRule('â', new WordStructureUnionRule(leadConsRule2, leadConsRule3, WordStructureChar.Cons, leadConsRule1), WordStructureOptionalRule.Tone, new WordStructureOptionalRule(new WordStructureUnionRule(WordStructureChar.FCons, 'Ð'))) ); tcc = new WordStructureConcatRule(wordStructureRule, karunRule); } _thaiWordStructureRule = tcc; this.IsInitialized = true; }