private void button5_Click(object sender, EventArgs e) { string sentence = this.textBox1.Text; //test string test = "ilikegoogleman"; Hashtable ht = new Hashtable(); ht.Add("i", 1); ht.Add("like", 1); ht.Add("sam", 1); ht.Add("sung", 1); ht.Add("mobile", 1); ht.Add("ice", 1); ht.Add("cream", 1); ht.Add("icecream", 1); ht.Add("man", 1); ht.Add("go", 1); ht.Add("mango", 1); ht.Add("ilikesamsungs", 1); WorkBreak wb = new WorkBreak(ht); //int result = obj.parseSimple(0, 1); string result = wb.CanStringBeSegmentedToWordsByDPWithBacktracking(sentence); this.textBox2.Text = string.IsNullOrEmpty(result) == false ? "Yes" : "No"; this.textBox4.Text = result; }
private void button4_Click(object sender, EventArgs e) { string sentence = this.textBox1.Text; //test string test = "ilikegoogleman"; Hashtable ht = new Hashtable(); ht.Add("i", 1); ht.Add("like", 1); ht.Add("sam", 1); ht.Add("sung", 1); ht.Add("mobile", 1); ht.Add("ice", 1); ht.Add("cream", 1); ht.Add("icecream", 1); ht.Add("man", 1); ht.Add("go", 1); ht.Add("mango", 1); ht.Add("ilikesamsungs", 1); WorkBreak wb = new WorkBreak(ht); //int result = obj.parseSimple(0, 1); bool result = wb.CanStringBeSegmentedToWordsByDP(sentence); this.textBox2.Text = result == true ? "Yes" : "No"; this.textBox4.Text = ""; }