Esempio n. 1
0
  private void testSrx2Ticket1(SrxParser parser) {
    Reader reader = getReader(getResourceStream(TICKET_1_DOCUMENT_NAME));

    SrxDocument document = parser.parse(reader);

    assertTrue(document.getCascade());

    List<LanguageRule> languageRuleList = document.getLanguageRuleList("en");

    LanguageRule languageRule = languageRuleList.get(0);
    assertEquals("Default", languageRule.getName());

    List<Rule> ruleList = languageRule.getRuleList();
    assertEquals(1, ruleList.size());

    Rule rule = ruleList.get(0);
    assertEquals("[\\.!?…]['»\"”\\)\\]\\}]?\\u0002?\\s", rule.getBeforePattern());
    assertEquals("", rule.getAfterPattern());
  }
Esempio n. 2
0
  private void testSrx1(SrxParser parser) {
    Reader reader = getReader(getResourceStream(SRX_1_DOCUMENT_NAME));

    SrxDocument document = parser.parse(reader);

    assertFalse(document.getCascade());

    List<LanguageRule> languageRuleList = document.getLanguageRuleList("en");
    assertEquals(1, languageRuleList.size());

    LanguageRule languageRule = languageRuleList.get(0);
    assertEquals("Default", languageRule.getName());

    List<Rule> ruleList = languageRule.getRuleList();
    assertEquals(5, ruleList.size());

    Rule rule = ruleList.get(1);
    assertEquals("[Ee][Tt][Cc]\\.", rule.getBeforePattern());
    assertEquals("\\s[a-z]", rule.getAfterPattern());
  }
Esempio n. 3
0
  private void testSrx2(SrxParser parser) {
    Reader reader = getReader(getResourceStream(SRX_2_DOCUMENT_NAME));

    SrxDocument document = parser.parse(reader);

    assertTrue(document.getCascade());

    List<LanguageRule> languageRuleList = document.getLanguageRuleList("fr_FR");
    assertEquals(2, languageRuleList.size());

    LanguageRule languageRule = languageRuleList.get(0);
    assertEquals("French", languageRule.getName());

    List<Rule> ruleList = languageRule.getRuleList();
    assertEquals(4, ruleList.size());

    Rule rule0 = ruleList.get(0);
    assertEquals(" [Mm]lle\\.", rule0.getBeforePattern());
    assertEquals("\\s", rule0.getAfterPattern());

    Rule rule1 = ruleList.get(1);
    assertEquals("\\s[Mm]lles\\.", rule1.getBeforePattern());
    assertEquals("\\s", rule1.getAfterPattern());
  }