Example #1
0
        protected void btnCompress_Click(object sender, EventArgs e)
        {
            string toConvert = Server.HtmlEncode(txtInput.Text);

            Dictionary <string, string> target;

            if (TargetLanguage.SelectedValue == "Latin")
            {
                target = Recode.GetLatinRelex();
            }
            else if (TargetLanguage.SelectedValue == "Russian")
            {
                target = Recode.GetRussianRelex();
            }
            else if (TargetLanguage.SelectedValue == "Icelandic")
            {
                target = Recode.GetIcelandicRelex();
            }
            else
            {
                target = Recode.GetEnglishRelex();
            }

            StringBuilder sb = new StringBuilder();

            foreach (var foo in target)
            {
                sb.Append(foo.Key.ToLower());
                sb.Append("\t");
                sb.Append(foo.Value);
                sb.Append("\n");
            }
            RelexDictionary.Controls.Add(new Literal {
                Text = sb.ToString()
            });
            string relexFirstPass = recoder.ShortenToAnyDictionary(
                toConvert,
                target,
                Recode.ModifierStyle.CapitalizeFirst,
                Recode.PunctuationStyle.Western
                ).Replace("\n", "<br/>");

            if (phonotactics.SelectedValue == "forceTp")
            {
                TransliterateEngine transliterator = new TransliterateEngine();
                string trace;
                relexFirstPass = transliterator.Transliterate(
                    relexFirstPass,
                    out trace,
                    TransliterateEngine.DefaultOptions()).ToLower();
            }


            txtOutput.Text = relexFirstPass;
        }