Skip to content

Commit

Permalink
Merge pull request #739 from takahi-i/remove-colon-as-invalid-char
Browse files Browse the repository at this point in the history
Remove colon from invalid character list in Japanese default setting
  • Loading branch information
takahi-i committed Feb 19, 2017
2 parents 2a863dd + 84502a5 commit 46280c1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
8 changes: 4 additions & 4 deletions redpen-core/src/main/java/cc/redpen/config/SymbolTable.java
Expand Up @@ -266,11 +266,11 @@ private static Map<SymbolType, Symbol> initializeSymbols(Symbol... newSymbols) {
, new Symbol(PLUS_SIGN, '+', "")
, new Symbol(HYPHEN_SIGN, 'ー', "")
, new Symbol(SLASH, '/', "")
, new Symbol(COLON, ':', ":")
, new Symbol(SEMICOLON, ';', ";")
, new Symbol(LESS_THAN_SIGN, '<', "<")
, new Symbol(COLON, ':', "")
, new Symbol(SEMICOLON, ';', "")
, new Symbol(LESS_THAN_SIGN, '<', "")
, new Symbol(EQUAL_SIGN, '=', "")
, new Symbol(GREATER_THAN_SIGN, '>', ">")
, new Symbol(GREATER_THAN_SIGN, '>', "")
, new Symbol(AT_MARK, '@', "@")
, new Symbol(LEFT_SQUARE_BRACKET, '「', "")
, new Symbol(RIGHT_SQUARE_BRACKET, '」', "")
Expand Down
Expand Up @@ -55,14 +55,14 @@ public void testDetectDoubledJoshi() throws Exception {
public void testNotDetectSingleJoshi() throws Exception {
List<Document> documents = new ArrayList<>();
documents.add(Document.builder(new JapaneseTokenizer())
.addSection(1)
.addParagraph()
.addSentence(new Sentence("私は彼が好き。", 1))
.build());
.addSection(1)
.addParagraph()
.addSentence(new Sentence("私は彼が好き。", 1))
.build());

Configuration config = Configuration.builder("ja")
.addValidatorConfig(new ValidatorConfiguration("DoubledJoshi"))
.build();
.addValidatorConfig(new ValidatorConfiguration("DoubledJoshi"))
.build();

RedPen redPen = new RedPen(config);
Map<Document, List<ValidationError>> errors = redPen.validate(documents);
Expand Down
Expand Up @@ -146,4 +146,19 @@ public void testFloatingNumberInTheEndOfSentence() throws RedPenException {
Map<Document, List<ValidationError>> errors = redPen.validate(documents);
Assert.assertEquals(0, errors.get(documents.get(0)).size());
}

@Test
public void testDefaultJapaneseSetting() throws Exception {
List<Document> documents = new ArrayList<>();
documents.add(Document.builder(new JapaneseTokenizer())
.addSection(1)
.addParagraph()
.addSentence(new Sentence("Re:VIEW フォーマットが好きだ。", 1)).build());
Configuration config = Configuration.builder("ja")
.addValidatorConfig(new ValidatorConfiguration("InvalidSymbol")).build();

RedPen redPen = new RedPen(config);
Map<Document, List<ValidationError>> errors = redPen.validate(documents);
assertEquals(0, errors.get(documents.get(0)).size());
}
}

0 comments on commit 46280c1

Please sign in to comment.