Last active
July 22, 2016 14:16
-
-
Save so-c/01ce93c614e6509cec02 to your computer and use it in GitHub Desktop.
RedPenのブログ下書き用設定ファイル。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<redpen-conf lang="ja"> | |
<validators> | |
<validator name="SentenceLength"> | |
<property name="max_len" value="100"/> | |
</validator> | |
<validator name="InvalidSymbol"/> | |
<!-- validator name="KatakanaEndHyphen"/ --> | |
<validator name="KatakanaSpellCheck"/> | |
<validator name="SectionLength"> | |
<property name="max_num" value="1500"/> | |
</validator> | |
<validator name="ParagraphNumber"/> | |
<!-- validator name="DoubledWord" / --> | |
<!-- validator name="SpaceBetweenAlphabeticalWord" / --> | |
<validator name="CommaNumber" /> | |
<validator name="SuccessiveWord" /> | |
<validator name="DoubleNegative" /> | |
<validator name="DoubledJoshi" /> | |
<validator name="FrequentSentenceStart" /> | |
<validator name="Okurigana" /> | |
<validator name="JavaScript"> | |
<property name="script-path" value="PATH\TO\JS\VALIDTORS" /> | |
</validator> | |
</validators> | |
<symbols> | |
<symbol name="LEFT_PARENTHESIS" value="(" before-space="true" /> | |
<symbol name="RIGHT_PARENTHESIS" value=")" after-space="true" /> | |
<symbol name="LESS_THAN_SIGN" value="<" /> | |
<symbol name="GREATER_THAN_SIGN" value=">" /> | |
</symbols> | |
</redpen-conf> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function validateSentence(sentence) { | |
sentence.tokens.forEach(function(token, index, ary) { | |
if (isKoto(token) || | |
isTori(token) || | |
isTsunagi(token) || | |
isTatsu(token) || | |
isOmoshiroi(token) || | |
isUreshii(token) || | |
isNashi(token) || | |
isAri(token) || | |
isEru(token) || | |
isOmune(token) | |
) { | |
addError('推奨しない漢字が「' + token.surface + '」で使われています。', sentence); | |
} | |
}); | |
} | |
function isKoto(token) { | |
if (token.tags[6] === '事' && | |
token.tags[0] === '名詞' && | |
token.tags[1] === '非自立') { | |
return true; | |
} | |
return false; | |
} | |
function isTori(token) { | |
if (token.tags[6] === '通り' && | |
token.tags[0] === '名詞' && | |
token.tags[1] === '一般') { | |
return true; | |
} | |
return false; | |
} | |
function isTsunagi(token) { | |
if ((token.tags[6] === '繋ぎ' && | |
token.tags[0] === '名詞' && | |
token.tags[1] === '一般') || | |
(token.tags[6] === '繋がり' && | |
token.tags[0] === '名詞' && | |
token.tags[1] === '一般') || | |
(token.tags[6] === '繋ぐ' && | |
token.tags[0] === '動詞' && | |
token.tags[1] === '自立') || | |
(token.tags[6] === '繋げる' && | |
token.tags[0] === '動詞' && | |
token.tags[1] === '自立') || | |
(token.tags[6] === '繋がる' && | |
token.tags[0] === '動詞' && | |
token.tags[1] === '自立') | |
) { | |
return true; | |
} | |
return false; | |
} | |
function isTatsu(token) { | |
if (token.tags[6] === '経つ' && | |
token.tags[0] === '動詞' && | |
token.tags[1] === '自立') { | |
return true; | |
} | |
return false; | |
} | |
function isOmoshiroi(token) { | |
if (token.tags[6] === '面白い' && | |
token.tags[0] === '形容詞' && | |
token.tags[1] === '自立') { | |
return true; | |
} | |
return false; | |
} | |
function isUreshii(token) { | |
if (token.tags[6] === '嬉しい' && | |
token.tags[0] === '形容詞' && | |
token.tags[1] === '自立') { | |
return true; | |
} | |
return false; | |
} | |
function isNashi(token) { | |
if ((token.tags[6] === '無し' && | |
token.tags[0] === '形容詞' && | |
token.tags[1] === '自立') || | |
(token.tags[6] === '無し' && | |
token.tags[0] === '名詞' && | |
token.tags[1] === '接尾') | |
) { | |
return true; | |
} | |
return false; | |
} | |
function isAri(token) { | |
if ((token.tags[6] === '有る' && | |
token.tags[0] === '動詞' && | |
token.tags[1] === '自立')) { | |
return true; | |
} | |
return false; | |
} | |
function isEru(token) { | |
if ((token.tags[6] === '得る' && | |
token.tags[0] === '動詞' && | |
token.tags[1] === '非自立') || | |
(token.tags[6] === 'やむを得ない' && | |
token.tags[0] === '形容詞' && | |
token.tags[1] === '自立') || | |
(token.tags[6] === '有り得る' && | |
token.tags[0] === '動詞' && | |
token.tags[1] === '自立') | |
) { | |
return true; | |
} | |
return false; | |
} | |
function isOmune(token) { | |
if (token.tags[6] === '概ね' && | |
token.tags[0] === '副詞' && | |
token.tags[1] === '一般') { | |
return true; | |
} | |
return false; | |
} |
次の理由でOkuriganaをdisable。
- 「明か」をチェックする。「明かるい」は避けたいけれど、「明かす」は使う。
- IME (ATOK) で2, 3試したところ、任せても大丈夫そうだった。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
JavaScript Validatorのscript-pathは適宜書き換える。