Package opennlp.tools.util

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


        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

   * 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

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

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.