Package opennlp.tools.util

Examples of opennlp.tools.util.StringList


    if (cutoffUnder > 0 || cutoffOver < Integer.MAX_VALUE) {

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

        StringList ngram = it.next();

        int count = getCount(ngram);

        if (count < cutoffUnder ||
            count > cutoffOver) {
View Full Code Here


            return mDictionaryIterator.hasNext();
          }

          public Entry next() {

            StringList tokens = mDictionaryIterator.next();

            Attributes attributes = new Attributes();

            attributes.setValue(COUNT, Integer.toString(getCount(tokens)));
View Full Code Here

          return dictionaryIterator.hasNext();
        }

        public Entry next() {

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

        public void remove() {
View Full Code Here

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

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

    return dictionary;
  }
View Full Code Here

        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

        } else {
          tokensSearching = new String[lengthSearching];
          System.arraycopy(textTokenized, offsetFrom, tokensSearching, 0,
              lengthSearching);

          StringList entryForSearch = new StringList(tokensSearching);

          if (mDictionary.contains(entryForSearch)) {
            nameFound = new Span(offsetFrom, offsetTo + 1, type);
          }
        }
View Full Code Here

   * 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

  /**
   * 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

    String a1 = "a1";
    String a2 = "a2";
    String a3 = "a3";
    String a5 = "a5";

    reference.put(new StringList(new String[]{a1, a2, a3, a5,}));

    ByteArrayOutputStream out = new ByteArrayOutputStream();

    reference.serialize(out);
View Full Code Here

      Dictionary.parseOneEntryPerLine(new StringReader(testDictionary));

    assertTrue(dictionay.size() == 4);

    assertTrue(dictionay.contains(
        new StringList(new String[]{"1a", "1b", "1c", "1d"})));

    assertTrue(dictionay.contains(
        new StringList(new String[]{"2a", "2b", "2c"})));

    assertTrue(dictionay.contains(
        new StringList(new String[]{"3a"})));

    assertTrue(dictionay.contains(
        new StringList(new String[]{"4a", "4b"})));
  }
View Full Code Here

TOP

Related Classes of opennlp.tools.util.StringList

Copyright © 2018 www.massapicom. 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.