aspose file tools*
The moose likes Beginning Java and the fly likes Dictionary Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Dictionary" Watch "Dictionary" New topic
Author

Dictionary

Shamsudeen Akanbi
Ranch Hand

Joined: Dec 24, 2010
Posts: 72
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!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14276
    
  21

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Shamsudeen Akanbi
Ranch Hand

Joined: Dec 24, 2010
Posts: 72
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!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

You think that Java has a built-in English dictionary?

But, there's likely to be a number of 3rd-party spell-check libraries if you search.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
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.)
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 8016
    
  22

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).

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dictionary