I'm writing a program and right now i need to get definition of a word user enters.
for example users enters a sentence : Gosh C# sure is fun.
and after i split it i need to find the definition of fun.
I tried fething .html of a definition sucks as dictionary.com/browse/fun
It kinda works but i can't think of a decent way to find the definition in the html because of ... complications(spacing, random crap)
How do i do it? Any suggestions how to do it offline? I just need a solution.

Recommended Answers

I ran across this (pursuing it out of curiosity) http://services.aonaware.com/DictService/ I have never used it and I'm not sure what the licensing terms are.

Jump to Post

All 3 Replies

What is your question here -- how to look up a word definition or how to split words? For getting the words in a sentence you should use RegEx.

Here is an example:

private void button2_Click(object sender, EventArgs e)
    {
      const string sentence = "The quick, and fat, brown|lazy fox jumped. on Top _ of the_ compuer@ uh oh.";
      string[] words = Regex.Split(sentence, @"\W+");
      Console.WriteLine("Words: " + string.Join(", ", words));
    }

It splits on word boundaries and should do what you want. The output from the above code is:

Words: The, quick, and, fat, brown, lazy, fox, jumped, on, Top, _, of, the_, compuer, uh, oh,

I know how to split them I just need to find a way how to get a definition. I tried using google.com with "define:"+myWord query. It kinda worked. I got a page but im having trouble parsing it for pure definitions. And now it simply wont respond anymore. I think google kidna blocked it. ANYWAYS. can you think of any other way of finding a definition, part of speech of a word?

I ran across this (pursuing it out of curiosity) http://services.aonaware.com/DictService/ I have never used it and I'm not sure what the licensing terms are.

commented: He, great site! Even has C# code! +5
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.