Examples of IDictionary


Examples of edu.mit.jwi.IDictionary

   * Initialize WordNet dictionary.
   */
  public static IDictionary getDictionary() throws IOException {

    URL url = new URL("file", null, wordNetPath);
    IDictionary iDictionary = new Dictionary(url);
    iDictionary.open();
   
    return iDictionary;
  }
View Full Code Here

Examples of edu.mit.jwi.IDictionary

   * Initialize WordNet dictionary.
   */
  public static IDictionary getDictionary() throws IOException {

    URL url = new URL("file", null, wordNetPath);
    IDictionary iDictionary = new Dictionary(url);
    iDictionary.open();
   
    return iDictionary;
  }
View Full Code Here

Examples of edu.mit.jwi.IDictionary

    EventSet eventSet = new EventSet();
    PorterStemmerWithIrregularEventDriver port = new PorterStemmerWithIrregularEventDriver();
    EventSet tmpevent;

    URL url = getClass().getResource(JGAAPConstants.JGAAP_RESOURCE_PACKAGE + "wordnet");
    IDictionary dict;
    if (url.getProtocol().equalsIgnoreCase("jar")) {
      throw new EventGenerationException(
          "DefinitionsEventDriver is current not able to run using the jar.  Please use ant with the source distrodution.");
    } else {
      dict = new Dictionary(url);
    }
    try {
      dict.open();
    } catch (Exception e) {
      logger.error("Could not open WordNet Dictionary " + url, e);
      throw new EventGenerationException("DefinitionsEventDriver failed to open WordNet");
    }

    String current = new String(text);

    FastTag tagger = new FastTag();

    List<String> words = Lists.newArrayList(Splitter.on(CharMatcher.WHITESPACE).trimResults().omitEmptyStrings()
        .split(current));

    List<String> tagged = tagger.tag(words);
    IIndexWord idxWord;
    List<IWordID> wordID;
    IWord word;
    StringBuilder outDef = new StringBuilder();

    for (int i = 0; i < words.size(); i++) {
      // System.out.println(i);
      String definition = "";
      if (table.containsKey(tagged.get(i))) {
        if (nouns.containsKey(words.get(i))) {
          words.set(i, nouns.get(words.get(i)));
        }
        try {
          switch (table.get(tagged.get(i))) {
          case (1):
            idxWord = dict.getIndexWord(words.get(i), POS.NOUN);
            if (idxWord == null)
              break;
            wordID = idxWord.getWordIDs();
            word = dict.getWord(wordID.get(0));
            definition = word.getSynset().getGloss();
            break;
          case (2):
            tmpevent = port.createEventSet(words.get(i).toCharArray());
            idxWord = dict.getIndexWord(tmpevent.eventAt(0).toString(), POS.VERB);
            if (idxWord == null)
              break;
            wordID = idxWord.getWordIDs();
            word = dict.getWord(wordID.get(0));
            definition = word.getSynset().getGloss();
            break;
          case (3):
            idxWord = dict.getIndexWord(words.get(i), POS.ADJECTIVE);
            if (idxWord == null)
              break;
            wordID = idxWord.getWordIDs();
            word = dict.getWord(wordID.get(0));
            definition = word.getSynset().getGloss();
            break;
          case (4):
            idxWord = dict.getIndexWord(words.get(i), POS.ADVERB);
            if (idxWord == null)
              break;
            wordID = idxWord.getWordIDs();
            word = dict.getWord(wordID.get(0));
            definition = word.getSynset().getGloss();
            break;
          }

        } catch (IllegalArgumentException e) {
View Full Code Here

Examples of org.gumtree.data.interfaces.IDictionary

      }
    }
    else {
      IGroup fileGroup = (IGroup) fileNode.getUserObject();

      IDictionary dictionary = fileGroup.findDictionary();

      // TODO pas sûr, c'est pas encore implémenté
      String path;
      Object objectByPath;
      for (String key : dictionary.getAllKeys()) {
        if (key.contains(filterKey)) {
          path = dictionary.getPath(key);
          objectByPath = fileGroup.findObjectByPath(path);
          if (objectByPath instanceof IDataItem) {
            fileNode.add(new GumTreeNode(objectByPath));
          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.