예제 #1
0
  @Test
  public void testChunk() {
    String[] tokens = {
      "Rockwell",
      "said",
      "the",
      "agreement",
      "calls",
      "for",
      "it",
      "to",
      "supply",
      "200",
      "additional",
      "so-called",
      "shipsets",
      "for",
      "the",
      "planes",
      "."
    };

    String[] tags = {
      "NNP", "VBD", "DT", "NN", "VBZ", "IN", "PRP", "TO", "VB", "CD", "JJ", "JJ", "NNS", "IN", "DT",
      "NNS", "."
    };

    String[] expecteds = {
      "B-NP", "B-VP", "B-NP", "I-NP", "B-VP", "B-SBAR", "B-NP", "B-VP", "I-VP", "B-NP", "I-NP",
      "I-NP", "I-NP", "B-PP", "B-NP", "I-NP", "O"
    };

    // openNLP.createChunker(OpenNLP.DEFAUL_CHUNKER_MODEL);
    String[] actuals = openNLP.chunk(tokens, tags);

    assertArrayEquals(expecteds, actuals);
  }