Java: create a dictionary/ vocab list

  • Java
  • Thread starter LindaS
  • Start date
  • Tags
    Java List
In summary, you can use a web-based scripting system to parse a web-page and look for the definitions of the words contained therein. Once you have the list of words, you can use a web service to get the definitions.
  • #1
LindaS
3
0
Is there a way I can get the definitions from, say, dictionary.com?
Does much method already exist or do I have to go about creating one? How would I get a specific something from a specific website?

I prefer using java, but if there's another language that makes it easier, I also know C++ and VB.
 
Technology news on Phys.org
  • #2
LindaS said:
Is there a way I can get the definitions from, say, dictionary.com?
Does much method already exist or do I have to go about creating one? How would I get a specific something from a specific website?

I prefer using java, but if there's another language that makes it easier, I also know C++ and VB.

You are probably better off using a web-based scripting system to not only parse a web-page, but to also do the searching and web-page request if you need to.

But in order to do this, you will need to first get the list of words you want to search for. For this you will need to download a standard text file or equivalent that contains just the terms and then use this in your script to search for the definition or if the website has a standard structure (like Wikipedia), you can just load the page directly and then parse the contents directly.

After looking at dictionary.com, it does look like it has a standard address structure like Wikipedia in the form of http://www.dictionary.com/browse/word where word is the word you are looking for.

If you wanted to do it in Java, you need the following routines:

a) Make a connection to get the contents of a particular web-page
b) Take the web-page and put it into some kind of structure like a graph or some more useful graph/other hybrid structure
c) A way to search for the particular content you need
d) A way to extract the structure you are searching for so that you can parse it easily and put it in another structure for your specific application.

I haven't used Java in a very long time, but I imagine that routines should exist to do this kind of thing at least somewhere.
 
  • #5


I am not an expert in programming languages, but I can offer some insight on how you could approach this task.

Firstly, there are several existing methods and libraries in Java that can help you create a dictionary or vocabulary list. One option is to use the Java Collection Framework, which includes the HashMap class that allows you to store key-value pairs. You can use this to store words as keys and their definitions as values. Another option is to use external libraries such as Apache Lucene or ElasticSearch, which have built-in capabilities for indexing and searching text documents, including dictionaries.

As for getting definitions from a specific website, you can use web scraping techniques to extract information from websites. Java has libraries such as Jsoup that can help with this. Web scraping involves parsing through the HTML of a website and extracting the desired information, in this case, the definitions. However, please note that web scraping may not be allowed by all websites, so it is important to check their terms of use before proceeding.

In terms of other languages, C++ and VB also have libraries and methods that can help you create dictionaries and perform web scraping. It ultimately depends on your familiarity and comfort with these languages.

Overall, there are various methods and libraries available in Java and other languages that can assist in creating a dictionary or vocabulary list and extracting definitions from websites. It would be best to research and explore these options to find the one that best suits your needs and abilities.
 

Related to Java: create a dictionary/ vocab list

1. What is Java?

Java is a high-level, object-oriented programming language commonly used for developing applications and websites. It was created by James Gosling and released by Sun Microsystems in 1995.

2. How do I create a dictionary or vocab list in Java?

To create a dictionary or vocab list in Java, you can use the HashMap data structure. This allows you to store key-value pairs, with the key being the word and the value being the definition. You can also use the TreeMap data structure if you want your dictionary to be sorted alphabetically.

3. What are the benefits of creating a dictionary or vocab list in Java?

Creating a dictionary or vocab list in Java allows you to easily store and access a large amount of words and their corresponding definitions. It also allows you to perform operations such as searching for a specific word, adding new words and definitions, and sorting the dictionary.

4. Can I use a pre-made dictionary or vocab list in Java?

Yes, there are several open-source and paid dictionaries and vocab lists available for use in Java. However, it's important to make sure that the dictionary or vocab list you choose is compatible with your version of Java and your specific project requirements.

5. How can I display the dictionary or vocab list in my Java program?

To display the dictionary or vocab list in your Java program, you can use a for loop to iterate through the key-value pairs and print them out in a formatted manner. You can also use the Java Swing library to create a graphical user interface for the dictionary or vocab list.

Similar threads

  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
3
Views
3K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
3
Views
4K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
Replies
21
Views
12K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
1
Views
3K
Back
Top