Using the Java dictionary and thesaurus APIs in Java applications
The Java dictionary and Thesaurus API (JADT) is an API for Alphaworks published on the dictionary and is a standards-based class library for accessing language features in Java applications. It provides a transparent Java-centric approach for Java programmers to access dictionaries and unstructured words, as well as information about them. This article is part 1th of a two-part series that covers the development of Java applications using JADT to enhance dictionaries and dictionaries. The 2nd part provides a detailed review of the architecture and APIs.
JADT Overview
JADT is an API for accessing thesaurus data from the Java programming language. It provides a common interface that can be used in Java applications, independent of the implementation of the dictionary/data provider. With JADT, applications written in the Java language can access the definition, pronunciation, synonyms, antonyms, and other information of a specific word.
The features of JADT include:
Access to dictionaries, dictionaries, and other service interfaces
Multi-Language Conversion interface
Driver-based Access Protocol
APIs for dictionary providers and driver developers
Access to back-end dictionaries or dictionaries, such as databases, file systems, or xml-based files (as long as they implement their drivers)
JADT is a useful API for Thesaurus data access applications because it provides a simple, standard technique for performing such tasks. It frees application developers from the pain of maintaining data and data access points.
The implementation of this API is useful for many applications that use multilingual features, localization, and similar features. For example, when editing, editors can use this technique to check spelling, or to get suggestions for more appropriate words. Another example application might be to allow multilingual dictionaries and dictionaries to be used by applications that need to be translated.
In addition, JADT provides a language-neutral interface that allows it to be used in a variety of languages and dialects. Furthermore, since ADT is written in the Java language, its sample driver is also implemented in the Java language, so it is platform independent.
JADT Data structure
JADT includes a variety of components and services, depending on the characteristics of the JADT or specific subset used. The first stop of your JADT journey is a set of classes and interfaces that provide a general method of data organization. Because all services use these data structures, it is important for JADT users to understand them.
Word list
The Wordlist class is the container of a word. It does not fetch data from back-end resources. Wordlist is generally used to pass, obtain, or contain a group of words. In addition, there is an option to find all words that meet a particular rule. For example, it currently supports finding words with similar prefixes or suffixes, and supports the search of words that share certain substrings. It is different from the Wordlister service because it does not take words from the background resource, so it is just a wrapper class. It can also be used for word collections, as shown in Listing 1:
Listing 1. Wordlist as the use of collections
WordList wordlist= wordlister.findWithPrefix("un");
//Getting collection of words one by one
wordlist.start();
while(wordlist.hasMoreWords())
{
Word word=wordlist.getNext();
}
// Using WordList further to narrow down the search
// www.bianceng.cn
WordList wordlist2= wordlist.findWithSuffix("ing");