iTranslated by AI
Released textlint-rule-a3rt-proofreading-v2
While introducing various textlint rules into my Zenn writing environment, I came across the Proofreading API, a text proofreading API operated by Recruit.
Although a plugin called textlint-rule-a3rt-proofreading already existed for textlint, it seemed that the API had changed and the URL was different, so it no longer worked.
Since I wanted to try creating a textlint plugin and needed to avoid putting the API key directly into the textlintrc file (as I didn't want to commit the API key to Git), I created a new plugin as v2. I'll outline the steps and details here.
The GitHub page for this plugin is here:
First, the Disappointing News
I actually created the plugin and ran it against some text, but this API isn't very clever and doesn't give very good suggestions 😭.
However, I realized that even for a plugin that calls an external API, the latency isn't very noticeable, so it's a viable approach. I wonder if there are any other interesting APIs out there. If you know of any, please let me know!
I originally wanted to create a textlint rule for English proofreading using Ginger, but the existing plugins don't work and it seems the Ginger API itself might be gone... which is a bit of a letdown.
Installation Method
Obtaining the API Key
To run the plugin, you first need an API key for the Proofreading API. You can issue one on the following page. After filling out the form, the API key will be sent to you via email immediately.
Installing the Plugin
Install the plugin using the following command:
npm install textlint-rule-a3rt-proofreading-v2
Updating the Configuration File
Add the configuration to your .textlintrc.json as follows:
{
"rules": {
"a3rt-proofreading-v2": {
"apiKey": "./key.yaml"
}
}
}
In the above configuration, place a key.yaml file in the root of your project and enter the API key you obtained in the following format:
version: 1
rules:
apiKey: 'APIKEY'
Running it directly looks like this:
yarn textlint --rule a3rt-proofreading-v2 hoge.txt
yarn run v1.22.19
./hoge.txt
1:1 error Suggest: 'ホ' => '「|、|の' (score:0.78) a3rt-proofreading-v2
1:2 error Suggest: 'ゲ' => 'マ|ン|ル' (score:0.76) a3rt-proofreading-v2
1:3 error Suggest: 'ホ' => 'リ|ル|・' (score:0.77) a3rt-proofreading-v2
1:4 error Suggest: 'ゲ' => 'は|を|が' (score:0.78) a3rt-proofreading-v2
1:5 error Suggest: 'ほ' => 'イ|ー|リ' (score:0.99) a3rt-proofreading-v2
1:6 error 文末が"。"で終わっていません。 ja-technical-writing/ja-no-mixed-period
✖ 6 problems (6 errors, 0 warnings)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The result includes a score, which represents how strongly the Proofreading API recommends the suggestion on a scale of 0 to 1 (where 1 is highly recommended).
Thoughts
Creating a textlint plugin is simpler than I expected, which is great.
I encountered a few stumbling blocks, so I'm thinking of writing a separate article as a "How-To" for developing textlint plugins.
If you're interested, I'd be happy if you gave it a try and installed it!
Discussion