コード例 #1
0
  @Test
  public void matchTest() throws Exception {
    String[] sentence = "the red dog whines".split(" ");
    String[] longestMatch = phrases.getLongestMatch(sentence);

    assertArrayEquals(longestMatch, "the red dog".split(" "));

    sentence = "the".split(" ");
    assertNull(phrases.getLongestMatch(sentence));

    sentence = "red dog".split(" ");
    assertNull(phrases.getLongestMatch(sentence));

    sentence = "the new".split(" ");
    assertNull(phrases.getLongestMatch(sentence));
  }