-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(morpheme-match-textlint): add textlint wrapper (#7)
* feat(morpheme-match-textlint): add textlint wrapper * docs(morpheme-match-textlint): Update README * Update README * fix(morpheme-match): fix token type * fix(morpheme-match): Update Token type * update test * fix type * fix(website): fix (xxx) pattern * fix to use correct token
- Loading branch information
Showing
20 changed files
with
750 additions
and
83 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
# morpheme-match | ||
# morpheme-match [![Build Status](https://travis-ci.org/azu/morpheme-match.svg?branch=master)](https://travis-ci.org/azu/morpheme-match) | ||
|
||
A monorepo for morpheme-match. | ||
|
||
`morpheme-match`は日本語を形態素解析したトークンを元に、文章にマッチするかを判定するライブラリです。 | ||
文字列比較ベースでは誤検知しやすい辞書ベースのチェックを、形態素解析を使うことでより厳密に行うことが目的です。 | ||
|
||
## Demo | ||
|
||
- Visit: <https://azu.github.io/morpheme-match/> | ||
|
||
## packages | ||
|
||
- [packages/morpheme-match](packages/morpheme-match) | ||
- [morpheme-match](packages/morpheme-match) | ||
- Core library | ||
- [morpheme-match-all](packages/morpheme-match-all) | ||
- A wrapper library of morpheme-match | ||
- Easy to use edition | ||
- [morpheme-match-textlint](packages/morpheme-match-textlint) | ||
- A wrapper for textlint | ||
- Use it in textlint rule | ||
- [website](website) | ||
- Demo site | ||
- <https://azu.github.io/morpheme-match/> |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lib/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2016 azu | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# morpheme-match-textlint | ||
|
||
morpheme-match for textlint. | ||
|
||
This library provide matcher function that return reportable object for textlint. | ||
|
||
- | ||
|
||
## Install | ||
|
||
Install with [npm](https://www.npmjs.com/): | ||
|
||
npm install morpheme-match-textlint | ||
|
||
## Usage | ||
|
||
- [ ] TBO | ||
|
||
### Tips | ||
|
||
### `_capture` | ||
|
||
`_capture` is special key for replacing message and expected. | ||
|
||
|
||
```js | ||
const matchToken = createTokenMatcher([ | ||
{ | ||
"surface_form": "かも", | ||
"pos": "助詞", | ||
"pos_detail_1": "副助詞", | ||
"pos_detail_2": "*", | ||
"pos_detail_3": "*", | ||
"conjugated_type": "*", | ||
"conjugated_form": "*", | ||
"basic_form": "かも", | ||
"reading": "カモ", | ||
"pronunciation": "カモ", | ||
"_cature": "$1" | ||
} | ||
]); | ||
``` | ||
|
||
### `_skippable` | ||
|
||
If the token has `_skippable`, this token will be handled as optional token. | ||
|
||
|
||
```js | ||
const matchToken = createTokenMatcher([ | ||
{ | ||
"surface_form": "かも", | ||
}, | ||
{ | ||
"surface_form": "、", | ||
"_skippable": true, | ||
}, | ||
{ | ||
"surface_form": "しれ", | ||
}, | ||
]); | ||
``` | ||
|
||
|
||
## 関連 | ||
|
||
- [azu/morpheme-match-all: A wrapper of morpheme-match API. Match all kuromoji's tokens.](https://github.com/azu/morpheme-match-all) | ||
- A wrapper for morpheme-match | ||
- [textlint-ja/textlint-rule-morpheme-match: 形態素解析結果のTokenベースの辞書でマッチするtextlintルール](https://github.com/textlint-ja/textlint-rule-morpheme-match) | ||
|
||
## Changelog | ||
|
||
See [Releases page](https://github.com/azu/morpheme-match/releases). | ||
|
||
## Running tests | ||
|
||
Install devDependencies and Run `npm test`: | ||
|
||
npm i -d && npm test | ||
|
||
## Contributing | ||
|
||
Pull requests and stars are always welcome. | ||
For bugs and feature requests, [please create an issue](https://github.com/azu/morpheme-match/issues). | ||
|
||
1. Fork it! | ||
2. Create your feature branch: `git checkout -b my-new-feature` | ||
3. Commit your changes: `git commit -am 'Add some feature'` | ||
4. Push to the branch: `git push origin my-new-feature` | ||
5. Submit a pull request :D | ||
|
||
## Author | ||
|
||
- [github/azu](https://github.com/azu) | ||
- [twitter/azu_re](http://twitter.com/azu_re) | ||
|
||
## License | ||
|
||
MIT © azu |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "morpheme-match-textlint", | ||
"version": "1.2.1", | ||
"description": "morpheme-match for textlint rule.", | ||
"keywords": [ | ||
"japanese", | ||
"morpheme", | ||
"text", | ||
"形態素" | ||
], | ||
"homepage": "https://github.com/azu/morpheme-match", | ||
"bugs": { | ||
"url": "https://github.com/azu/morpheme-match/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/azu/morpheme-match.git" | ||
}, | ||
"license": "MIT", | ||
"author": "azu", | ||
"files": [ | ||
"src/", | ||
"lib/" | ||
], | ||
"main": "lib/morpheme-match-textlint.js", | ||
"types": "lib/morpheme-match-textlint.d.ts", | ||
"directories": { | ||
"test": "test" | ||
}, | ||
"scripts": { | ||
"build": "cross-env NODE_ENV=production tsc -p .", | ||
"build:website": "cd website && npm i && npm run build", | ||
"prepublish": "npm run --if-present build", | ||
"test": "mocha \"test/**/*.{js,ts}\"", | ||
"watch": "tsc -p . --watch" | ||
}, | ||
"dependencies": { | ||
"morpheme-match-all": "^1.2.0" | ||
}, | ||
"devDependencies": { | ||
"@types/mocha": "^5.2.7", | ||
"@types/node": "^12.0.7", | ||
"cross-env": "^5.2.0", | ||
"mocha": "^6.1.4", | ||
"ts-node": "^8.2.0", | ||
"ts-node-test-register": "^8.0.1", | ||
"typescript": "^3.5.1", | ||
"kuromojin": "^1.3.2" | ||
}, | ||
"email": "[email protected]" | ||
} |
Oops, something went wrong.