Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

morpheme-match

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

morpheme-match - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

22

lib/morpheme-match.js

@@ -30,10 +30,16 @@ // LICENSE : MIT

return function (token) {
var expectedToken = matchedTokens[currentTokenPosition];
if (matchToken(token, expectedToken)) {
matchTokens.push(token);
currentTokenPosition += 1;
} else {
// reset position
matchTokens.length = 0;
currentTokenPosition = 0;
while (currentTokenPosition < tokenCount) {
var expectedToken = matchedTokens[currentTokenPosition];
if (matchToken(token, expectedToken)) {
matchTokens.push(token);
currentTokenPosition += 1;
break;
} else if (expectedToken["_skippable"]) {
currentTokenPosition += 1;
} else {
// reset position
matchTokens.length = 0;
currentTokenPosition = 0;
break;
}
}

@@ -40,0 +46,0 @@ // match all tokens

@@ -18,3 +18,3 @@ {

],
"version": "1.1.0",
"version": "1.2.0",
"main": "lib/morpheme-match.js",

@@ -21,0 +21,0 @@ "directories": {

@@ -149,5 +149,30 @@ # morpheme-match [![Build Status](https://travis-ci.org/azu/morpheme-match.svg?branch=master)](https://travis-ci.org/azu/morpheme-match)

]);
``
```
キー`_skippable`が`true`の場合はマッチしない場合は無視されます。
```js
const expectToken = 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

@@ -154,0 +179,0 @@

@@ -29,10 +29,16 @@ // LICENSE : MIT

return (token) => {
const expectedToken = matchedTokens[currentTokenPosition];
if (matchToken(token, expectedToken)) {
matchTokens.push(token);
currentTokenPosition += 1;
} else {
// reset position
matchTokens.length = 0;
currentTokenPosition = 0;
while (currentTokenPosition < tokenCount) {
const expectedToken = matchedTokens[currentTokenPosition];
if (matchToken(token, expectedToken)) {
matchTokens.push(token);
currentTokenPosition += 1;
break;
} else if (expectedToken["_skippable"]) {
currentTokenPosition += 1;
} else {
// reset position
matchTokens.length = 0;
currentTokenPosition = 0;
break;
}
}

@@ -54,2 +60,2 @@ // match all tokens

}
};
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc