Hi guys, how do I know if a word exists in the dictionary. I'm trying to create a program that checks if a word actually exists. I mean do I implement an interface. If I will,please give a description. Thanks in advance!
That totally depends on how your dictionary is implemented. If it's in a Map (the logical choice for a dictionary), then you can call the containsKey() method on it to see if a mapping for the specified key exists. But since you didn't say anything about how your dictionary is implemented, it's hard to give you a specific and useful answer to your question.
Does that mean I will have to start typing the whole word in the oxford dictionary, I thought java has a robust API that... Well please may be I'm not well understood. I just want my program to see if a word is a correct English word or not. How does a phone dictionary guess your correct word. Thanks in advance!
Any dictionary code will consist of at least two parts: a lengthy (though not complete) list of words, and an algorithm that can construct further words from words that are in the list. For example, if "to explain" is in the list, and you know it's a regular verb, you can deduce that "explaining", "explained", "explainer", "explainers" are also valid words, without them needing to be in the list. (The last two being uncommon, but still valid - just to make the point that a noun can be constructed from a verb.)
Shamsudeen Akanbi wrote:Does that mean I will have to start typing the whole word in the oxford dictionary
If that's what you want, then yes (about a quarter of a million at last count, as I recall).
As Bear says, there are probably several free dictionaries out in Internet-land, but I'm pretty sure that Oxford guards their word base pretty securely.
I thought java has a robust API that... Well please may be I'm not well understood.
I suspect so. Java is a programming language; it has nothing to do with dictionaries.
I just want my program to see if a word is a correct English word or not. How does a phone dictionary guess your correct word.
By having access to a real dictionary, and code that can make "guesses" from its contents (see Tim's post for a few pointers).
Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here