Examples of StringList


Examples of opennlp.tools.util.StringList

        String token = iterator.next();

        Attributes attributes = new Attributes();
        attributes.setValue("operation", getOperation(token).toString());

        return new Entry(new StringList(token), attributes);
      }

      public void remove() {
        throw new UnsupportedOperationException();
      }
View Full Code Here

Examples of opennlp.tools.util.StringList

   */
  public Index(Iterator<StringList> tokenLists) {

    while (tokenLists.hasNext()) {

      StringList tokens = tokenLists.next();

      for (int i = 0; i < tokens.size(); i++) {
        this.tokens.add(tokens.getToken(i));
      }
    }
  }
View Full Code Here

Examples of opennlp.tools.util.StringList

          return dictionaryIterator.hasNext();
        }

        public Entry next() {

          StringList tokens = dictionaryIterator.next();
         
          return new Entry(tokens, new Attributes());
        }

        public void remove() {
View Full Code Here

Examples of opennlp.tools.util.StringList

        int tokenIndex = 0;
        while (whiteSpaceTokenizer.hasMoreTokens()) {
          tokens[tokenIndex++] = whiteSpaceTokenizer.nextToken();
        }

        dictionary.put(new StringList(tokens));
      }
    }

    return dictionary;
  }
View Full Code Here

Examples of opennlp.tools.util.StringList

        boolean result = false;

        if (obj instanceof String) {
          String str = (String) obj;

          result = entrySet.contains(new StringListWrapper(new StringList(str)));

        }

        return result;
      }
View Full Code Here

Examples of opennlp.tools.util.StringList

    NGramModel model = new NGramModel();
    model.add(tokens[index], minLength, maxLength);

    for (Iterator<StringList> it = model.iterator(); it.hasNext();) {

      StringList tokenList = it.next();

      if (tokenList.size() > 0) {
        features.add("ng=" + tokenList.getToken(0).toLowerCase());
      }
    }
  }
View Full Code Here

Examples of opennlp.tools.util.StringList

        String word = iterator.next();

        Attributes tagAttribute = new Attributes();
        tagAttribute.setValue("tags", tagsToString(getTags(word)));

        return new Entry(new StringList(word), tagAttribute);
      }

      public void remove() {
        throw new UnsupportedOperationException();
      }
View Full Code Here

Examples of opennlp.tools.util.StringList

        String tagString = entry.getAttributes().getValue("tags");

        String[] tags = tagString.split(" ");

        StringList word = entry.getTokens();

        if (word.size() != 1)
          throw new InvalidFormatException("Each entry must have exactly one token! "+word);

        newPosDict.dictionary.put(word.getToken(0), tags);
      }});

    newPosDict.caseSensitive = isCaseSensitive;
   
    // TODO: The dictionary API needs to be improved to do this better!
View Full Code Here

Examples of opennlp.tools.util.StringList

   * Tests a basic lookup.
   */
  @Test
  public void testLookup() {

    StringList entry1 = new StringList(new String[]{"1a", "1b"});
    StringList entry1u = new StringList(new String[]{"1A", "1B"});
    StringList entry2 = new StringList(new String[]{"1A", "1C"});

    Dictionary dict = getCaseInsensitive();

    dict.put(entry1);

View Full Code Here

Examples of opennlp.tools.util.StringList

  /**
   * Test lookup with case sensitive dictionary
   */
  @Test
  public void testLookupCaseSensitive() {
    StringList entry1 = new StringList(new String[]{"1a", "1b"});
    StringList entry1u = new StringList(new String[]{"1A", "1B"});
    StringList entry2 = new StringList(new String[]{"1A", "1C"});

    Dictionary dict = getCaseSensitive();

    dict.put(entry1);

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.