• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dictionary

 
Shamsudeen Akanbi
Ranch Hand
Posts: 83
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Shamsudeen Akanbi
Ranch Hand
Posts: 83
1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Moores
Bartender
Pie
Posts: 2488
4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 9460
49
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic