retext-japanese
Japanese language support for retext.
Installation
npm:
npm install retext-japanese
Usage
var retext = require('retext')
var japanese = require('retext-japanese')
var inspect = require('unist-util-inspect')
var options = {
position: true,
pos: false,
dicDir: '../dict/'
}
var text = 'タイトル\n' +
'\n' +
'1 これは前段です。これは中段(2文の場合は後段。)です。これは後段です。'
retext().use(japanese, options).use(() => {
return function (cst) {
console.log(inspect(cst))
}
}).process(text, (err, file, doc) => {
console.log('\n=== doc ===')
console.log(doc)
})
options = {
position: true,
pos: true,
dicDir: '../dict/'
}
text = 'すもももももももものうち'
retext().use(japanese, options).use(() => {
return function (cst) {
console.log(inspect(cst))
}
}).process(text, (err, file, doc) => {
console.log('\n=== doc ===')
console.log(doc)
})
API
retext.use(japanese, options)
Nothing else is needed. This will add better support for the Japanese language to retext.
Parameters
Related
License
MIT