Exemplo n.º 1
0
  @Test
  public void testFixFunctionTags() {
    String filename = "src/test/resources/constituent/functionTags.parse";
    CTReader reader = new CTReader(IOUtils.createFileInputStream(filename));
    CTTree tree;
    String[] parses = {
      "(TOP (S (NP-SBJ (NP (CC both) (NNP Bush) (CC and) (NNP Rice))) (VP (VBP have) (VP (VBN delivered) (NP (NP (NNS speeches)) (, ,) (SBAR (WHNP-1 (WDT which)) (S (NP-SBJ (-NONE- *T*-1)) (VP (VBP are) (ADJP-PRD (RB very) (JJ clear))))))))))",
      "(TOP (S (NP-SBJ-1 (NNP Mr.) (NNP Clinton)) (VP (VBD was) (VP (VBN joined) (NP (-NONE- *-1)) (PP-LGS (IN by) (NP (JJ several) (JJ key) (NN republican) (NNS leaders))))) (. .)))",
      "(TOP (SBARQ (WHNP-1 (WP Who)) (SQ (VBZ is) (NP-SBJ (PRP it)) (NP-PRD (-NONE- *T*-1)) (SBAR-CLF (WHNP-2 (WDT that)) (S (NP-SBJ-3 (-NONE- *T*-2)) (NP-TMP (NN today)) (VP (VBZ wants) (S (NP-SBJ (-NONE- *PRO*-3)) (VP (TO to) (VP (VB blow) (NP (NNS things)) (PRT (RP up)) (PP-LOC (IN in) (NP (NNP Lebanon))))))))) (, ,) (NP-VOC (NNP Doctor))) (. ?)))"
    };
    int i, size = parses.length;

    for (i = 0; i < size; i++) {
      tree = reader.nextTree();
      CTLibEn.fixFunctionTags(tree);
      assertEquals(parses[i], tree.toStringLine());
    }

    reader.close();
  }