6

I am developing a JAVA application where user enters a word in textbox,the synonyms of the word has to be autoprompted to him.

Given a word,is it possible to find its synonyms and its root in JAVA?should i use a dictionary?

eg:

word:   killer
synonym: murderer butcher hitman

word:   killing
root:   kill
psy
  • 914
  • 3
  • 10
  • 31
  • 1
    yes you will need some kind of lookup. – Randy Feb 07 '11 at 16:14
  • How large is the universe of words the user can enter? I've read that there are close to 1 million english words. So there are some memory constraints. Secondly, I don't think you want to store words multiple times, this could really explode your memory usage exponentially. For example in a dictionary killer would point to murderer, butcher, hitman... but then murderer would also point to killer, butcher, hitman, etc... Ideally you want these synonym sets of words pointing to themselves so maybe a graph structure would be better – Girish Rao Feb 07 '11 at 16:16
  • 1
    This has nothing much to do with Java. – Ondra Žižka Feb 07 '11 at 16:17
  • possible duplicate of [Java synonyms api](http://stackoverflow.com/questions/4202441/java-synonyms-api) – dogbane Feb 07 '11 at 16:20
  • 1
    @Ondra Žižka: Except for the fact that the asker is trying to *implement* this in Java. It's a whole lot easier to answer a question when you know the language that the asker is seeking a solution in. – Cody Gray - on strike Feb 07 '11 at 16:41

4 Answers4

4

One option would be to use WordNet with a Java API, e.g. JAWS: http://lyle.smu.edu/~tspell/jaws

Fabian Steeg
  • 44,988
  • 7
  • 85
  • 112
3

As for roots this process is called stemming (google for that). There are some (Java) libraries like that: http://snowball.tartarus.org/download.php

PeterMmm
  • 24,152
  • 13
  • 73
  • 111
1

I would suggest looking for an API for a online site where you can access a synonym dictionary instead of having to build your own. It will be large enough that you will not want to keep it in memory therefore you are going to have to have some external storage location if you are going to do it yourself.

jzd
  • 23,473
  • 9
  • 54
  • 76
0

You definitely have to use a dictionary, at least for the synonyms, as there are no standard "synonym-lists" available in the JRE.

kohlehydrat
  • 503
  • 1
  • 3
  • 19