Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a dictionary in java? [closed]

I am trying to make a offline dictionary in java where you enter a word in a text field and the meaning of that word. Does anyone know of an API that can be used to make this dictionary? Any alternatives will also be appreciated.

like image 353
awareeye Avatar asked Oct 06 '26 23:10

awareeye


1 Answers

A dictionary is nothing but a Map. It maps a keyword to a description (or a collection of descriptions).

Map<String, String> dictionary = TreeMap<String, String>();
dictionary.put("hello", "polite greeting");
System.out.println(dictionary.get("hello"));

A trivial starter is using a properties file and loading the data with/into a Properties instance.

File extract:

key=provides access to a value
value=maps to a key
hello=polite greeting
like image 157
Andreas Dolk Avatar answered Oct 09 '26 13:10

Andreas Dolk