Package opennlp.tools.util

Examples of opennlp.tools.util.StringList


  /**
   * Tests for the {@link Dictionary#equals(Object)} method.
   */
  @Test
  public void testEquals() {
    StringList entry1 = new StringList(new String[]{"1a", "1b"});
    StringList entry2 = new StringList(new String[]{"2a", "2b"});

    Dictionary dictA = getCaseInsensitive();
    dictA.put(entry1);
    dictA.put(entry2);

View Full Code Here


  /**
   * Tests the {@link Dictionary#hashCode()} method.
   */
  @Test
  public void testHashCode() {
    StringList entry1 = new StringList(new String[]{"1a", "1b"});
    StringList entry2 = new StringList(new String[]{"1A", "1B"});

    Dictionary dictA = getCaseInsensitive();
    dictA.put(entry1);

    Dictionary dictB = getCaseInsensitive();
View Full Code Here

  /**
   * Tests for the {@link Dictionary#toString()} method.
   */
  @Test
  public void testToString() {
    StringList entry1 = new StringList(new String[]{"1a", "1b"});

    Dictionary dictA = getCaseInsensitive();

    dictA.toString();

View Full Code Here

   * Tests the lookup of tokens of different case.
   */
  @Test
  public void testDifferentCaseLookup() {

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

    Dictionary dict = getCaseInsensitive();

    dict.put(entry1);

View Full Code Here

    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("Unknown operation type: " + operationString);
       
        operationTable.put(word.getToken(0), operation);
      }});
  }
View Full Code Here

        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

   * Tests the lookup of tokens of different case.
   */
  @Test
  public void testDifferentCaseLookupCaseSensitive() {

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

    Dictionary dict = getCaseSensitive();

    dict.put(entry1);

View Full Code Here

   * @throws IOException IOException
   */
  public static Dictionary createDictionary(ObjectStream<StringList> sampleStream) throws IOException {

    Dictionary mNameDictionary = new Dictionary(true);
    StringList entry;

    entry = sampleStream.read();
    while (entry != null) {
      if (!mNameDictionary.contains(entry)) {
        mNameDictionary.put(entry);
View Full Code Here

  private Dictionary getDict() {
    return new Dictionary(true);
  }
 
  private StringList asSL(String str) {
    return new StringList(str);
  }
View Full Code Here

      sample = sampleStream.read();
    }
    sampleStream.close();
    Dictionary dictionary = new Dictionary(true);
    for (String[] entry : entries) {
      StringList dicEntry = new StringList(entry);
      dictionary.put(dicEntry);
    }
    return dictionary;
  }
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.