コード例 #1
0
        protected void Degenerate_Click(object sender, EventArgs args)
        {
            //Transform
            Dictionary <string, string> words    = Recode.GetDictionary();
            Dictionary <char, string>   alphabet = new Dictionary <char, string>();

            alphabet.Add('a', HttpUtility.HtmlEncode(a.Text));
            alphabet.Add('e', HttpUtility.HtmlEncode(e.Text));
            alphabet.Add('i', HttpUtility.HtmlEncode(i.Text));
            alphabet.Add('o', HttpUtility.HtmlEncode(o.Text));
            alphabet.Add('u', HttpUtility.HtmlEncode(u.Text));
            alphabet.Add('j', HttpUtility.HtmlEncode(j.Text));
            alphabet.Add('k', HttpUtility.HtmlEncode(k.Text));
            alphabet.Add('l', HttpUtility.HtmlEncode(l.Text));
            alphabet.Add('m', HttpUtility.HtmlEncode(m.Text));
            alphabet.Add('n', HttpUtility.HtmlEncode(n.Text));
            alphabet.Add('p', HttpUtility.HtmlEncode(p.Text));
            alphabet.Add('s', HttpUtility.HtmlEncode(s.Text));
            alphabet.Add('t', HttpUtility.HtmlEncode(t.Text));
            alphabet.Add('w', HttpUtility.HtmlEncode(w.Text));


            Dictionary <string, string> mutated = new Dictionary <string, string>(words.Count);

            foreach (string key in words.Keys)
            {
                StringBuilder sb = new StringBuilder();
                foreach (char c in key)
                {
                    sb.Append(alphabet[c]);
                }
                mutated.Add(key, sb.ToString());
            }

            var sortedDict = (from entry in mutated orderby entry.Value ascending select entry);


            StringBuilder newWordList = new StringBuilder();

            foreach (var pair in sortedDict)
            {
                newWordList.Append("<b>");
                newWordList.Append(pair.Key);
                newWordList.Append("</b> : ");
                newWordList.Append(pair.Value);
                newWordList.Append("<br/>");
            }
            txtOutput.Text = newWordList.ToString();

            Recode recoder = new Recode();

            txtSampleText.Text = recoder.ShortenToAnyDictionary(
                HttpUtility.HtmlEncode(txtInput.Text),
                mutated, Recode.ModifierStyle.CapitalizeFirst, Recode.PunctuationStyle.Western
                ).Replace("\n", "<br/>");
            //Apply common processes (reduplicatoin, gemmination, errosion, rebracketing)
            //Check for validity
            //Re-do if invalid
        }
コード例 #2
0
        protected void btnCompress_Click(object sender, EventArgs e)
        {
            string toConvert = Server.HtmlEncode(txtInput.Text);

            images.InnerHtml = recoder.ShortenToAnyDictionary(
                HttpUtility.HtmlEncode(toConvert),
                Recode.GetHeiroglyphDictionary(),
                Recode.ModifierStyle.CapitalizeFirst, Recode.PunctuationStyle.Western
                ).Replace("\n", "<br/>");
        }
コード例 #3
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;
        }
コード例 #4
0
        private void Colorize(string value)
        {
            Recode c = new Recode();

            CorpusText.Text =
                c.ShortenToAnyDictionary(
                    value,
                    ColorizedText(),
                    Recode.ModifierStyle.CapitalizeFirst,
                    Recode.PunctuationStyle.Western,
                    "<span class=\"proper\">",
                    "</span>"
                    ).Replace(Environment.NewLine, "<br/>").Replace("\n", "<br/>");
            Graph.Text = "\n" +
                         CreateGraph(value);
        }
コード例 #5
0
        protected void btnGloss_Click(object sender, EventArgs e)
        {
            string toConvert = Server.HtmlEncode(txtInput.Text);

            Dictionary <string, string> words = Recode.GetDictionary();
            Dictionary <string, string> links = new Dictionary <string, string>(words.Count);

            foreach (var word in words)
            {
                links.Add(word.Key, string.Format("<a href=\"ClassicWordList.aspx#{0}\">{0}</a>", word.Key));
            }

            txtOutput.Text = recoder.ShortenToAnyDictionary(
                toConvert,
                links,
                Recode.ModifierStyle.CapitalizeFirst,
                Recode.PunctuationStyle.Western
                ).Replace("\n", "<br/>");
        }