Skip to content

Commit d1f271c

Browse files
committed
Initial commit
0 parents  commit d1f271c

9 files changed

+519
-0
lines changed

.gitignore

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
### https://raw.github.com/github/gitignore/608690d6b9a78c2a003affc792e49a84905b3118/Node.gitignore
2+
3+
# Logs
4+
logs
5+
*.log
6+
7+
# Runtime data
8+
pids
9+
*.pid
10+
*.seed
11+
12+
# Directory for instrumented libs generated by jscoverage/JSCover
13+
lib-cov
14+
15+
# Coverage directory used by tools like istanbul
16+
coverage
17+
18+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
19+
.grunt
20+
21+
# node-waf configuration
22+
.lock-wscript
23+
24+
# Compiled binary addons (http://nodejs.org/api/addons.html)
25+
build/Release
26+
27+
# Dependency directory
28+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
29+
node_modules
30+
31+
# Debug log from npm
32+
npm-debug.log
33+
34+
35+
### https://raw.github.com/github/gitignore/608690d6b9a78c2a003affc792e49a84905b3118/Global/JetBrains.gitignore
36+
37+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
38+
39+
*.iml
40+
41+
## Directory-based project format:
42+
.idea/
43+
# if you remove the above rule, at least ignore the following:
44+
45+
# User-specific stuff:
46+
# .idea/workspace.xml
47+
# .idea/tasks.xml
48+
# .idea/dictionaries
49+
50+
# Sensitive or high-churn files:
51+
# .idea/dataSources.ids
52+
# .idea/dataSources.xml
53+
# .idea/sqlDataSources.xml
54+
# .idea/dynamic.xml
55+
# .idea/uiDesigner.xml
56+
57+
# Gradle:
58+
# .idea/gradle.xml
59+
# .idea/libraries
60+
61+
# Mongo Explorer plugin:
62+
# .idea/mongoSettings.xml
63+
64+
## File-based project format:
65+
*.ipr
66+
*.iws
67+
68+
## Plugin-specific files:
69+
70+
# IntelliJ
71+
out/
72+
73+
# mpeltonen/sbt-idea plugin
74+
.idea_modules/
75+
76+
# JIRA plugin
77+
atlassian-ide-plugin.xml
78+
79+
# Crashlytics plugin (for Android Studio and IntelliJ)
80+
com_crashlytics_export_strings.xml
81+
crashlytics.properties
82+
crashlytics-build.properties
83+
84+
85+
/lib

.travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sudo: false
2+
language: node_js
3+
node_js: "stable"

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2017 azu
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19+
SOFTWARE.

README.md

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# textlint-rule-ja-no-insert-dropping-sa
2+
3+
サ抜き、サ入れ表現の誤用をチェックするtextlintルール
4+
5+
「さ」を余計にいれている、逆に「さ」が抜けている文をチェックする[textlint](https://github.com/textlint/textlint "textlint")ルールです。
6+
7+
![img](https://monosnap.com/file/UBfxUYEvlo3vACBM9qTzZ9wyh4XxTO.png)
8+
9+
[新規サ抜き・サ入れ表現から見る誤用と正用の分析 - 寺﨑知之](http://www.anlp.jp/proceedings/annual_meeting/2012/pdf_dir/B1-2.pdf)より引用。
10+
11+
時代によって「さ」の有無が変化する単語もあるため、このルールはある種の感覚的な類推が含まれています。
12+
13+
**OK**:
14+
15+
```
16+
今年はたいそう良いことがあった。
17+
言わさせていただきます
18+
今日は暖かさそう。
19+
色々考えましたが一番いいのは食べなさそうな観葉植物にする
20+
一生お金に困らなさそうな人ってどんなイメージの人ですか
21+
大尉はいかにもすまなさそうに言った
22+
大尉はいかにもすまなそうに言った
23+
```
24+
25+
**NG**:
26+
27+
```
28+
早く終わらせて帰りたさそうなのがおかしかった。
29+
薫と巽さんがチョコを食べたさそうにしてたから、仕方なくほんの少しだけ分けてあげたから
30+
刺し身をたべたさそう。
31+
寿司が美味しさそう。
32+
辛さそうな様子だ。
33+
これは問題無そう。
34+
芸術性なんてとても関係無そう。
35+
これは良そう
36+
```
37+
38+
## Install
39+
40+
Install with [npm](https://www.npmjs.com/):
41+
42+
npm install textlint-rule-ja-no-insert-dropping-sa
43+
44+
## Usage
45+
46+
Via `.textlintrc`(Recommended)
47+
48+
```json
49+
{
50+
"rules": {
51+
"ja-no-insert-dropping-sa": true
52+
}
53+
}
54+
```
55+
56+
Via CLI
57+
58+
```
59+
textlint --rule ja-no-insert-dropping-sa README.md
60+
```
61+
62+
## 元ネタ
63+
64+
- [新規サ抜き・サ入れ表現から見る誤用と正用の分析 - 寺﨑知之](http://www.anlp.jp/proceedings/annual_meeting/2012/pdf_dir/B1-2.pdf)
65+
66+
を元にしたtextlintルールです。
67+
68+
## Changelog
69+
70+
See [Releases page](https://github.com/textlint-ja/textlint-rule-ja-no-insert-dropping-sa/releases).
71+
72+
## Running tests
73+
74+
Install devDependencies and Run `npm test`:
75+
76+
npm i -d && npm test
77+
78+
## Contributing
79+
80+
Pull requests and stars are always welcome.
81+
82+
For bugs and feature requests, [please create an issue](https://github.com/textlint-ja/textlint-rule-ja-no-insert-dropping-sa/issues).
83+
84+
1. Fork it!
85+
2. Create your feature branch: `git checkout -b my-new-feature`
86+
3. Commit your changes: `git commit -am 'Add some feature'`
87+
4. Push to the branch: `git push origin my-new-feature`
88+
5. Submit a pull request :D
89+
90+
## Author
91+
92+
- [github/azu](https://github.com/azu)
93+
- [twitter/azu_re](https://twitter.com/azu_re)
94+
95+
## License
96+
97+
MIT © azu

package.json

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"directories": {
3+
"test": "test"
4+
},
5+
"author": "azu",
6+
"license": "MIT",
7+
"files": [
8+
"bin/",
9+
"lib/",
10+
"src/"
11+
],
12+
"name": "textlint-rule-ja-no-insert-dropping-sa",
13+
"version": "1.0.0",
14+
"description": "サ抜き、サ入れ表現の誤用をチェックするtextlintルール",
15+
"main": "lib/textlint-rule-ja-no-insert-dropping-sa.js",
16+
"scripts": {
17+
"test": "textlint-scripts test",
18+
"prepublish": "npm run --if-present build",
19+
"build": "textlint-scripts build",
20+
"watch": "textlint-scripts build --watch"
21+
},
22+
"keywords": [
23+
"textlintrule"
24+
],
25+
"repository": {
26+
"type": "git",
27+
"url": "https://github.com/textlint-ja/textlint-rule-ja-no-insert-dropping-sa.git"
28+
},
29+
"bugs": {
30+
"url": "https://github.com/textlint-ja/textlint-rule-ja-no-insert-dropping-sa/issues"
31+
},
32+
"homepage": "https://github.com/textlint-ja/textlint-rule-ja-no-insert-dropping-sa",
33+
"devDependencies": {
34+
"textlint-scripts": "^1.2.4"
35+
},
36+
"dependencies": {
37+
"array-find": "^1.0.0",
38+
"array-find-index": "^1.0.2",
39+
"kuromojin": "^1.3.2",
40+
"morpheme-match-all": "^1.1.0"
41+
}
42+
}

src/dict/sa-dropping-dict.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// MIT © 2017 azu
2+
"use strict";
3+
// 「サ抜き」方向の検出
4+
// 本来あるべき「サ」が抜け落ちる「サ抜き」の場合、「サ」が確実に入る用例でおかしな「サ抜け」は、「無そう」「良そう」の2種類
5+
// http://www.anlp.jp/proceedings/annual_meeting/2012/pdf_dir/B1-2.pdf
6+
module.exports = {
7+
message: "「さ」が抜けています。",
8+
expected: "$1さ$2",
9+
// https://azu.github.io/morpheme-match/?text=これは問題無そう
10+
// https://azu.github.io/morpheme-match/?text=これは良そう
11+
// https://azu.github.io/morpheme-match/?text=芸術性なんてとても関係無そう。
12+
tokens: [
13+
{
14+
"basic_form": ["良い", "無", "無い"],
15+
"_capture": "$1"
16+
},
17+
{
18+
"surface_form": "そう",
19+
"pos_detail_1": ["接尾", "助詞類接続"],
20+
"_capture": "$2"
21+
}
22+
]
23+
};

src/dict/sa-insert-dict.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// MIT © 2017 azu
2+
"use strict";
3+
// 「サ入れ」方向の検出
4+
// 動詞+助動詞「たい」+「そう」の形式は、本来どこをとっても「サ」が入る余地の無い
5+
// 形式のはずだが、何故か「サ」が入る例が散見される
6+
// http://www.anlp.jp/proceedings/annual_meeting/2012/pdf_dir/B1-2.pdf
7+
module.exports = [
8+
{
9+
message: "不要な「さ」が挿入されています。",
10+
expected: "$2$3",
11+
// https://azu.github.io/morpheme-match/?text=寿司が美味しさそう。
12+
tokens: [
13+
{
14+
"conjugated_form": "ガル接続",
15+
"basic_form": ["辛い", "美味しい", "寒い"],
16+
"_capture": "$2"
17+
},
18+
{
19+
"surface_form": "さ",
20+
"_index": true
21+
},
22+
{
23+
"basic_form": "そう",
24+
"pos_detail_1": ["接尾", "助詞類接続"],
25+
"_capture": "$3"
26+
}
27+
]
28+
},
29+
{
30+
message: "不要な「さ」が挿入されています。",
31+
expected: "$1$2$3",
32+
// https://azu.github.io/morpheme-match/?text=早く終わらせて(帰りたさそう)なのがおかしかった.
33+
// https://azu.github.io/morpheme-match/?text=刺し身をたべたさそう。
34+
tokens: [
35+
{
36+
"pos": "動詞",
37+
"_capture": "$1"
38+
},
39+
{
40+
"surface_form": "た",
41+
"pos": "助動詞",
42+
// basic_formが"たい"ではない場合がある
43+
"_capture": "$2"
44+
},
45+
{
46+
"surface_form": "さ",
47+
"_index": true
48+
},
49+
{
50+
"basic_form": "そう",
51+
"pos_detail_1": ["接尾", "助詞類接続"],
52+
"_capture": "$3"
53+
}
54+
]
55+
}
56+
];

0 commit comments

Comments
 (0)