예제 #1
0
  @Test
  public void testSeparators() {
    Matcher m;

    m = PatternConst.PUNCT_SEPARATORS.matcher("-*=~,`'");
    assertFalse(m.find());

    String[] s = {"--", "***", "==", "~~~", ",,", "```", "''"};
    m = PatternConst.PUNCT_SEPARATORS.matcher(Joiner.join(s, ""));
    int i, size = s.length;

    for (i = 0; i < size; i++) {
      m.find();
      assertEquals(s[i], m.group());
    }
  }
  @Override
  /* This is wrong! Relaxed String Match = Dropping relative clauses, PP, and participial modifiers */
  protected String getWordSequence(AbstractMention mention) {
    if (mention.getSubTreeNodes() != null) {
      List<DEPNode> l_subNodes = new ArrayList<>(mention.getSubTreeNodes());
      DEPNode node = mention.getNode();

      removePunctuations(l_subNodes, node);
      removeRelativeClause(l_subNodes, node);
      removePrepositionalMod(l_subNodes, node);
      //		removeParticipialMod(l_subNodes, node);

      return Joiner.join(
          l_subNodes.stream().map(n -> n.getWordForm()).collect(Collectors.toList()), " ");
    }
    return null;
  }