how would I download it to a stream?
Wishingchain
Posts
-
Getting first paragraph of wikipedia using Voice C# -
Getting first paragraph of wikipedia using Voice C#I figured out how to use my voice to search for stuff but now I need to get it to Speak the first paragraph...
-
Getting first paragraph of wikipedia using Voice C#yeah thats basically it..
-
Getting first paragraph of wikipedia using Voice C#Hi, My name is Wish and I have recently coded an application that recognizes commands I ask it to do(open notepad, gives time, etc.) I now want to be able to ask it a question like "who is Barack Obama" and it will respond with the first paragraph of the wikipedia article. I have this code so far which requires me to manually type in what I want to search for. This is that code
var webClient = new WebClient();
var pageSC = webClient.DownloadString("http://en.wikipedia.org/w/api.php?format=xml&action=query&prop=extracts&titles=" + textBox1.Text + "&redirects=true");
XmlDocument doc = new XmlDocument();
doc.LoadXml(pageSC);var fnode = doc.GetElementsByTagName("extract")\[0\]; try { string ss = fnode.InnerText; Regex regex = new Regex("\\\\<\[^\\\\>\]\*\\\\>"); string.Format("Before:{0}", ss); ss = regex.Replace(ss, string.Empty); string result = String.Format(ss); richTextBox2.Text = result; } catch { richTextBox2.Text = "error"; }
Any and all help will be greatly appreciated. If this is too vauge of a question please tell me and I will try to explain in more detail.
Thanks, Wish