import java.util.Iterator; import standup.lexicon.*; import standup.profiling.ProfileException; import standup.profiling.ProfileManager; import standup.utils.CommandLineArguments; /** * A simple program that shows how to use the STANDUP lexical database API functionality. *

* You may have to specify a larger heap size for the JVM, e.g. *

* {@code java -Xms384m -Xmx384m TestLexicon} * * @author Ruli Manurung */ public class TestLexicon { public static void main(String[] args) throws ProfileException,LexiconException { // Process any command line arguments CommandLineArguments.parseCommandLineArguments(args); // Get all senses of the word 'bank' LexemeSet bankLexemes = Dictionary.getSpelledLexemes(new WordSequence("bank")); // Print the different meanings of the various senses for (Iterator iter = bankLexemes.getLexemesIterator(); iter.hasNext();) { Lexeme lexeme = iter.next(); System.out.println("The meaning of "+lexeme+" is "+lexeme.getConcept().getBriefGloss()); } // Create a new LexicalComponents LexicalComponents lc = new LexicalComponents(); // Initialize the profile manager and create a new profile ProfileManager.initialize(); ProfileManager.createUser("username",lc); ProfileManager.useProfile("username",lc); // Create a blacklist containing the senses of "bank" and add it to the user's profile CustomLexicon myBlacklist = new CustomLexicon("myblack",bankLexemes.getLexemes()); lc.getProfile().addBlacklist(myBlacklist); // Get the user's "working lexicon" LexemeSet usersLexicon = lc.getWorkingLexicon(); // Print some statistics System.out.println("STANDUP dictionary has "+Dictionary.getAllLexemes().getLexemeCount()+" entries."); System.out.println("User's working lexicon has "+usersLexicon.getLexemeCount()+" entries."); // Save the profile ProfileManager.saveCurrentProfile(lc); } }