The intelligence of machines and the branch of computer science which aims to create it

Artificial Intelligence Journal

Subscribe to Artificial Intelligence Journal: eMailAlertsEmail Alerts newslettersWeekly Newsletters
Get Artificial Intelligence Journal: homepageHomepage mobileMobile rssRSS facebookFacebook twitterTwitter linkedinLinkedIn

Artificial Intelligence Authors: Elizabeth White, Pat Romanski, Liz McMillan, Corey Roth, Yeshim Deniz

Related Topics: Artificial Intelligence Journal

Artificial Intelligence: Article

Building a Simple VocabBuilder Application

Creating a good impression

Along with rapid learning mode, a customized dictionary can be provided to the user. An interface that will let the user maintain his dictionary is needed. In order to make the application compatible with a wider range of handsets, the architecture of the application needs to be as simple as possible. The database package can be used for better management, but only highly sophisticated handsets can support the Database package. Therefore, the RecordManagement Structure is needed to create, close, delete, and rebuild the database. It is important to note that the record structure doesn't support the primary key concept, so certain checks need to be implemented in the component to make it support primary key concept.

Now, let's look at the structure of the AddWordsToDictionary Class. Below (See Figure 5) is the UI that takes the user's words and stores them in the dictionary.

By providing "My dictionary", the user can maintain his or her own dictionary. In order to support this functionality, the following operations are needed:

  1. Insert
  2. Update (here Appending new meaning will be more useful)
  3. Delete (optional, but can be useful if the user is planning to have a new set of words in his dictionary everyday)
  4. View Dictionary
This class implements the first two functionalities. A Form is needed to display TextFields, from which the user can enter the data.

   wordTextField= new TextField("Enter Word", "",20, TextField.INITIAL_CAPS_WORD);
   meaningTextField= new TextField("Enter Meaining","",50, TextField.INITIAL_CAPS_WORD);

Since user-input is being handled, extra care needs to be taken in entering data into the database to ensure proper validations are performed. Numbers are not allowed in word or meaning value.

In order to perform the action, depending on the command entered by the user, a CommandListener Interface needs to be implemented.

public void commandAction(Command command, Displayable displayable)

After the user has entered the word and its meaning, the word needs to be entered into the dictionary.

    String wordField=wordTextField.getString();
    String meaningField=meaningTextField.getString();
       // Perform null input validations.
       // append new meaning
    else if(wordDatabase.getNumberOfRecords()+1 > MAX_WORDS)
       // Display Database Overflow Alert
    else //If everything is fine
    // Display Acknowledgement Alert

This class appends the new meaning to the word if the word already exists in Database.

DeleteWord Class
This interface can be used in order to view the dictionary (See Figure 6). Since the word-meaning pairs in the list are being shown, a List needs to be declared.

The following code is used to fetch the words from the database and create a list:

RecordEnumeration wordRecEnum = wordDBReference.enumerateRecords(null, null,true);
RecordEnumeration meaningRecEnum = meaningDBDatabaseReference.enumerateRecords(null, null, true);
while (wordRecEnum.hasNextElement())
    String fetchedWord = new string(wordRecEnum.nextRecord());
    String fetchedMeaning = new String(meaningRecEnum.nextRecord());
    displayList.append(fetchedWord+" : "+fetchedMeaning,bullet);

If the user selects a word to delete, then he or she needs to be shown the confirmation Alert message. If the user selects "Yes", then the Record can be deleted and the information can be displayed. The following code will delete the selected word from the database:

wordDatabase.deleteScripRecord(selection.substring(0,selection.indexOf(" ",2)));
   Alert recordsAlert = new Alert("Deletion Successful", " Word Deleted !! ", alertImage,AlertType.ERROR);

This class displays static information about the application's functionalities as shown in Figure 7.

This article demonstrates the implementation of a Simple vocabBuilder application. The application shows random adjectives/verbs/nouns depending on the user input. It also allows users to maintain their own dictionary and provides add/delete/update/view modes on a custom dictionary. There is great scope for upgrading this application to a much more sophisticated version. This enhanced version will be compatible with only recent, well-groomed handsets. An extensive database structure can be implemented in order to add Artificial Intelligence to the application. A search functionality can be implemented to search the database and return the meaning of the word entered. Since we have used a sequential file data structure for storing the words and thier meanings, a search would have consumed a greater amount of processing time. Hence, this functionality was not implemented. Using the database / RecordStore Structure, this functionality can be easily implemented by firing a SQL Statement, or by doing comparisons in case of RecordStores. Further, we can also provide some word usage statements along with antonyms and synonyms. For audio-learners, the Audio Play feature could be added to Rapid Learning mode.

More Stories By Kanchan Waikar

Kanchan Waikar is a software professional working with an IT company. She is very much inclined toward mobile programming. Her hobbies include reading novels, painting, playing table tennis, and programming.

Comments (2) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

Most Recent Comments
Mr. X 10/24/06 06:29:00 AM EDT

There's a lot of scope for improving, and seondly, think of more applications, ideas do matter!

JDJ News Desk 10/22/06 04:37:33 PM EDT

To make a good impression, one needs to have a good vocabulary. Management Professionals, University Professors, or GRE/GMAT aspirants - we all benefit from a decent set of words in this competitive world. There are different ways we can improve our vocabulary, such as reading novels, articles, dictionaries and so on, but we often find very little time to do so.