morpheme-match-textlint
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -6,2 +6,13 @@ # Change Log | ||
## [2.0.3](https://github.com/azu/morpheme-match/compare/v2.0.2...v2.0.3) (2019-07-07) | ||
### Bug Fixes | ||
* **textlint:** drop generics support ([ba6cf67](https://github.com/azu/morpheme-match/commit/ba6cf67)) | ||
## [2.0.2](https://github.com/azu/morpheme-match/compare/v2.0.1...v2.0.2) (2019-07-07) | ||
@@ -8,0 +19,0 @@ |
import { ExpectedDictionary, ExpectedDictionaries } from "morpheme-match-all"; | ||
export declare type Token = { | ||
word_id: number; | ||
word_type: "KNOWN" | "UNKNOWN"; | ||
surface_form: string; | ||
pos: string; | ||
pos_detail_1: string; | ||
pos_detail_2: string; | ||
pos_detail_3: string; | ||
conjugated_type: string; | ||
conjugated_form: string; | ||
basic_form: string; | ||
reading: string; | ||
pronunciation: string; | ||
word_position: number; | ||
}; | ||
export declare type ExpectedTokenAdditional = { | ||
_skippable?: boolean; | ||
}; | ||
export declare type ExpectedToken = Partial<Token> & ExpectedTokenAdditional & { | ||
[index: string]: any; | ||
}; | ||
declare type Token = import("morpheme-match").Token; | ||
declare type ExpectedToken = import("morpheme-match").ExpectedToken; | ||
export declare type ExpectedTokenWithCapture = ExpectedToken & { | ||
@@ -49,6 +30,7 @@ _capture?: string; | ||
}; | ||
export declare const createTextlintMatcher: <T extends ExpectedTokenWithCapture>(options: ReporterOptions<T & Partial<Token> & ExpectedTokenAdditional & { | ||
[index: string]: any; | ||
} & { | ||
_capture?: string | undefined; | ||
}>) => (text: string) => Promise<MatchTextlintResult<T>[]>; | ||
/** | ||
* create textlint matcher | ||
* @param options | ||
*/ | ||
export declare const createTextlintMatcher: (options: ReporterOptions<ExpectedTokenWithCapture>) => (text: string) => Promise<MatchTextlintResult<ExpectedTokenWithCapture>[]>; | ||
export {}; |
@@ -43,2 +43,8 @@ "use strict"; | ||
}; | ||
// FIXME: Want to support generics | ||
// But some thing wrong | ||
/** | ||
* create textlint matcher | ||
* @param options | ||
*/ | ||
exports.createTextlintMatcher = function (options) { | ||
@@ -45,0 +51,0 @@ var matchAll = morpheme_match_all_1.createMatcher(options.dictionaries); |
{ | ||
"name": "morpheme-match-textlint", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "morpheme-match for textlint rule.", | ||
@@ -38,2 +38,3 @@ "keywords": [ | ||
"dependencies": { | ||
"morpheme-match": "^2.0.0", | ||
"morpheme-match-all": "^2.0.1" | ||
@@ -52,3 +53,3 @@ }, | ||
"email": "azuciao@gmail.com", | ||
"gitHead": "49d62433939b100bb1d4f1f22df90ec364e1c708" | ||
"gitHead": "e363a47d53d824734acbac3ac1cc9f850e510c74" | ||
} |
import {createMatcher as createMathAll, ExpectedDictionary, ExpectedDictionaries} from "morpheme-match-all"; | ||
export type Token = { | ||
// 辞書内での単語ID | ||
word_id: number; | ||
// 単語タイプ(辞書に登録されている単語ならKNOWN; 未知語ならUNKNOWN) | ||
word_type: "KNOWN" | "UNKNOWN"; | ||
// 表層形 | ||
surface_form: string; | ||
// 品詞 | ||
pos: string; | ||
// 品詞細分類1 | ||
pos_detail_1: string; | ||
// 品詞細分類2 | ||
pos_detail_2: string; | ||
// 品詞細分類3 | ||
pos_detail_3: string; | ||
// 活用型 | ||
conjugated_type: string; | ||
// 活用形 | ||
conjugated_form: string; | ||
// 基本形 | ||
basic_form: string; | ||
// 読み | ||
reading: string; | ||
// 発音 | ||
pronunciation: string; | ||
// 単語の開始位置 | ||
word_position: number; | ||
}; | ||
type Token = import("morpheme-match").Token; | ||
export type ExpectedTokenAdditional = { | ||
_skippable?: boolean; | ||
}; | ||
export type ExpectedToken = Partial<Token> & ExpectedTokenAdditional & { | ||
[index: string]: any; | ||
}; | ||
type ExpectedToken = import("morpheme-match").ExpectedToken; | ||
export type ExpectedTokenWithCapture = ExpectedToken & { | ||
@@ -121,3 +87,9 @@ _capture?: string | ||
export const createTextlintMatcher = <T extends ExpectedTokenWithCapture>(options: ReporterOptions<T & ExpectedTokenWithCapture>) => { | ||
// FIXME: Want to support generics | ||
// But some thing wrong | ||
/** | ||
* create textlint matcher | ||
* @param options | ||
*/ | ||
export const createTextlintMatcher = (options: ReporterOptions<ExpectedTokenWithCapture>) => { | ||
const matchAll = createMathAll(options.dictionaries); | ||
@@ -127,3 +99,3 @@ const tokenize = options.tokenize; | ||
const createExpected = options.createExpected ? options.createExpected : _createExpected; | ||
return (text: string): Promise<MatchTextlintResult<T>[]> => { | ||
return (text: string): Promise<MatchTextlintResult<ExpectedTokenWithCapture>[]> => { | ||
return tokenize(text).then(currentTokens => { | ||
@@ -130,0 +102,0 @@ const matchResults = matchAll(currentTokens); |
Sorry, the diff of this file is not supported yet
17908
2
246
+ Addedmorpheme-match@^2.0.0