Examples of StringList


Examples of opennlp.tools.util.StringList

  private Dictionary mDictionary = new Dictionary();
  private TokenNameFinder mNameFinder;

  public DictionaryNameFinderTest() {

    StringList vanessa = new StringList(new String[]{"Vanessa"});
    mDictionary.put(vanessa);

    StringList vanessaWilliams = new
        StringList(new String[]{"Vanessa",
        "Williams"});
    mDictionary.put(vanessaWilliams);

    StringList max = new StringList(new String[]{"Max"});
    mDictionary.put(max);
   
    StringList michaelJordan = new
        StringList(new String[]{"Michael", "Jordan"});
    mDictionary.put(michaelJordan);
  }
View Full Code Here

Examples of opennlp.tools.util.StringList

  private Dictionary mDictionary = new Dictionary();
  private TokenNameFinder mNameFinder;

  public DictionaryNameFinderTest() {

    StringList vanessa = new StringList(new String[]{"Vanessa"});
    mDictionary.put(vanessa);

    StringList vanessaWilliams = new
        StringList(new String[]{"Vanessa",
        "Williams"});
    mDictionary.put(vanessaWilliams);

    StringList max = new StringList(new String[]{"Max"});
    mDictionary.put(max);
  }
View Full Code Here

Examples of opennlp.tools.util.StringList

        newTokens[newTokens.length - 1] = token;
        tokens = newTokens;

        if (mMetaDictionary.contains(token)) {

          StringList tokenList = new StringList(tokens);

          if (mDictionary.contains(tokenList)) {
            foundName = new Span(startToken, endToken + 1);
          }
        }
View Full Code Here

Examples of opennlp.tools.util.StringList

        for (int i = textIndex; i < textIndex + lengthIndex; i++) {
          grams[i - textIndex] = ngram.getToken(i);
        }

        add(new StringList(grams));
      }
    }
  }
View Full Code Here

Examples of opennlp.tools.util.StringList

          textIndex + lengthIndex - 1 < chars.length(); textIndex++) {

        String gram =
            chars.substring(textIndex, textIndex + lengthIndex).toLowerCase();

        add(new StringList(new String[]{gram}));
      }
    }
  }
View Full Code Here

Examples of opennlp.tools.util.StringList

  public int numberOfGrams() {
    int counter = 0;

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

      StringList ngram = it.next();

      counter += getCount(ngram);
    }

    return counter;
View Full Code Here

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

Examples of opennlp.tools.util.StringList

            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

Examples of opennlp.tools.util.StringList

    DictionarySerializer.create(in, new EntryInserter() {
      public void insert(Entry entry) throws InvalidFormatException {

        String operationString = entry.getAttributes().getValue("operation");

        StringList word = entry.getTokens();

        if (word.size() != 1)
          throw new InvalidFormatException("Each entry must have exactly one token! "+word);
       
        // parse operation
        Operation operation = Operation.parse(operationString);
       
        if (operation == null)
            throw new InvalidFormatException("Unkown operation type: " + operationString);
       
        operationTable.put(word.getToken(0), operation);
      }});
  }
View Full Code Here

Examples of opennlp.tools.util.StringList

    this.lineStream = new PlainTextByLineStream(in, this.encoding);
  }

  public StringList read() throws IOException {
    String line = lineStream.read();
    StringList name = null;

    if ((line != null) &&
        (!StringUtil.isEmpty(line))) {
      String name2;
      // find the location of the name separator in the line of data.
      int pos = line.indexOf(' ');
      if ((pos != -1)) {
        String parsed = line.substring(0, pos);
        // the data is in ALL CAPS ... so the easiest way is to convert
        // back to standard mixed case.
        if ((parsed.length() > 2) &&
            (parsed.startsWith("MC"))) {
          name2 = parsed.substring(0,1).toUpperCase(locale) +
                  parsed.substring(1,2).toLowerCase(locale) +
                  parsed.substring(2,3).toUpperCase(locale) +
                  parsed.substring(3).toLowerCase(locale);
        } else {
          name2 = parsed.substring(0,1).toUpperCase(locale) +
                  parsed.substring(1).toLowerCase(locale);
        }
        name = new StringList(new String[]{name2});
      }
    }

    return name;
  }
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.