Skip to content

Instantly share code, notes, and snippets.

@takahi-i
Last active July 7, 2016 05:27
Show Gist options
  • Save takahi-i/0aba0d2b144bd2011898630f7a1cddc3 to your computer and use it in GitHub Desktop.
Save takahi-i/0aba0d2b144bd2011898630f7a1cddc3 to your computer and use it in GitHub Desktop.

Configuration

<redpen-conf lang="en">
    <validators>
        <validator name="SentenceLength" level="warn" >
            <property name="max_len" value="200"/>
        </validator>
        <validator name="InvalidSymbol" level="info" />
        <validator name="SpaceWithSymbol" level="error" />
        <validator name="SectionLength">
            <property name="max_num" value="2000"/>
        </validator>
        <validator name="ParagraphNumber" />
    </validators>
    <symbols>
         <symbol name="EXCLAMATION_MARK" value="!" invalid-chars="!" after-space="true" />
         <symbol name="LEFT_QUOTATION_MARK" value="\'"  invalid-chars="“" before-space="true" />
    </symbols>
</redpen-conf>

json

[
    {
        "document": "sample.txt",
        "errors": [
            {
                "sentence": "これはは嬉しい。",
                "endPosition": {
                    "offset": 4,
                    "lineNum": 1
                },
                "validator": "DoubledWord",
                "lineNum": 1,
                "sentenceStartColumnNum": 0,
                "message": "Found repeated word \"は\".",
                "startPosition": {
                    "offset": 3,
                    "lineNum": 1
                }
            }
        ]
        "warnings" : [
            {
                "sentence": "これはは嬉しい。",
                "endPosition": {
                    "offset": 4,
                    "lineNum": 1
                },
                "validator": "SuccessiveWord",
                "lineNum": 1,
                "sentenceStartColumnNum": 0,
                "message": "Found word \"は\" repeated twice in succession.",
                "startPosition": {
                    "offset": 3,
                    "lineNum": 1
                }
            }
        ]
    }
]

json2

[
    {
        "document": "sample.txt",
        "errors": [
            {
                "sentence": "これはは嬉しい。",
                "position": {
                    "start": {
                        "offset": 0,
                        "line": 1
                    },
                    "end": {
                        "offset": 7,
                        "line": 1
                    }
                },
                "errors": [
                    {
                        "subsentence": {
                            "offset": 3,
                            "length": 1
                        },
                        "validator": "DoubledWord",
                        "position": {
                            "start": {
                                "offset": 3,
                                "line": 1
                            },
                            "end": {
                                "offset": 4,
                                "line": 1
                            }
                        },
                        "message": "Found repeated word \"は\"."
                    }
                ],
                "warnings" : [
                    {
                        "subsentence": {
                            "offset": 3,
                            "length": 1
                        },
                        "validator": "SuccessiveWord",
                        "position": {
                            "start": {
                                "offset": 3,
                                "line": 1
                            },
                            "end": {
                                "offset": 4,
                                "line": 1
                            }
                        },
                        "message": "Found word \"は\" repeated twice in succession."
                    }                
                ]
            }
        ]
    }
]

plain

FILE_NAME:LINE_NUM: ValidationError[ERROR_TYPE], ERROR_MESSAGE at line: SENTENCE
FILE_NAME:LINE_NUM: Warning[ERROR_TYPE], ERROR_MESSAGE at line: SENTENCE
FILE_NAME:LINE_NUM: Info[ERROR_TYPE], ERROR_MESSAGE at line: SENTENCE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment