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 }
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/>"); }
private Dictionary <string, string> ColorizedText() { Dictionary <string, string> dictionary = Recode.GetDictionary(); Dictionary <string, string> dictionaryOut = new Dictionary <string, string>(); foreach (string word in dictionary.Keys) { string formated; if ((from c in new string[] { "la", "li", "e", "o", "pi" } where word == c select c).Count() == 1) { //Is thingy. formated = "<span class=\"function\">" + word + "</span>"; } else if ((from c in new string[] { "ni", "ona", "mi", "sina" } where word == c select c).Count() == 1) { formated = "<span class=\"anaphora\">" + word + "</span>"; } else if (word == "anu" || word == "en") { formated = "<span class=\"conjunction\">" + word + "</span>"; } else if (PrepositionStyle.SelectedValue == "do" && (from c in new string[] { "kepeken", "poka", "lon", "tawa", "sama", "tan" } where word == c select c).Count() == 1) { formated = "<span class=\"prep\">" + word + "</span>"; } else { formated = "<span class=\"content\">" + word + "</span>"; } dictionaryOut.Add(word, formated); } return(dictionaryOut); }
protected void Page_Load(object sender, EventArgs e) { Dictionary <string, string> allWords = Recode.GetDictionary(); StringBuilder sb = new StringBuilder(); foreach (var word in allWords) { if (word.Key.Length > 3) { sb.Append("<tr>"); sb.Append("<td><a href=\"http://" + word.Key + ".com\">" + word.Key + ".com</a>"); string domain = word.Key + ".com"; try { //performs the DNS lookup IPHostEntry he = Dns.GetHostByName(domain); IPAddress[] ip_addrs = he.AddressList; foreach (IPAddress ip in ip_addrs) { sb.Append(ip); sb.Append("<br/>"); } } catch (System.Exception ex) { sb.Append(ex.ToString()); } sb.Append("</td>"); sb.Append("<td><a href=\"http://" + word.Key + ".org\">" + word.Key + ".org</a>"); domain = word.Key + ".org"; try { //performs the DNS lookup IPHostEntry he = Dns.GetHostByName(domain); IPAddress[] ip_addrs = he.AddressList; foreach (IPAddress ip in ip_addrs) { sb.Append(ip); sb.Append("<br/>"); } } catch (System.Exception ex) { sb.Append(ex.ToString()); } sb.Append("</td>"); sb.Append("<td><a href=\"http://" + word.Key + ".net\">" + word.Key + ".net</a>"); domain = word.Key + ".net"; try { //performs the DNS lookup IPHostEntry he = Dns.GetHostByName(domain); IPAddress[] ip_addrs = he.AddressList; foreach (IPAddress ip in ip_addrs) { sb.Append(ip); sb.Append("<br/>"); } } catch (System.Exception ex) { sb.Append(ex.ToString()); } sb.Append("</td>"); sb.Append("<td><a href=\"http://" + word.Key + ".info\">" + word.Key + ".info</a>"); domain = word.Key + ".info"; try { //performs the DNS lookup IPHostEntry he = Dns.GetHostByName(domain); IPAddress[] ip_addrs = he.AddressList; foreach (IPAddress ip in ip_addrs) { sb.Append(ip); sb.Append("<br/>"); break;//one is fine.. } } catch (System.Exception) { sb.Append("No DNS Entry"); } sb.Append("</td>"); sb.Append("</tr>"); } } this.rows.Text = sb.ToString(); }