-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix-for-running-in-vite' of https://github.com/MijinkoS…
…D/kuromoji.ts into fix-for-running-in-vite
- Loading branch information
Showing
78 changed files
with
3,290 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import ViterbiBuilder from "./viterbi/ViterbiBuilder.js"; | ||
import ViterbiSearcher from "./viterbi/ViterbiSearcher.js"; | ||
import IpadicFormatter from "./util/IpadicFormatter.js"; | ||
import { IpadicFormatterToken } from "./util/IpadicFormatter.js"; | ||
import DynamicDictionaries from "./dict/DynamicDictionaries.js"; | ||
import ViterbiLattice from "./viterbi/ViterbiLattice.js"; | ||
declare class Tokenizer { | ||
token_info_dictionary: import("./dict/TokenInfoDictionary.js").default; | ||
unknown_dictionary: import("./dict/UnknownDictionary.js").default; | ||
viterbi_builder: ViterbiBuilder; | ||
viterbi_searcher: ViterbiSearcher; | ||
formatter: IpadicFormatter; | ||
/** | ||
* Tokenizer | ||
* @param {DynamicDictionaries} dic Dictionaries used by this tokenizer | ||
* @constructor | ||
*/ | ||
constructor(dic: DynamicDictionaries); | ||
/** | ||
* Split into sentence by punctuation | ||
* @param {string} input Input text | ||
* @returns {Array.<string>} Sentences end with punctuation | ||
*/ | ||
static splitByPunctuation(input: string): string[]; | ||
/** | ||
* Tokenize text | ||
* @param {string} text Input text to analyze | ||
* @returns {Array} Tokens | ||
*/ | ||
tokenize(text: string): IpadicFormatterToken[]; | ||
tokenizeForSentence(sentence: string, tokens?: IpadicFormatterToken[]): IpadicFormatterToken[]; | ||
/** | ||
* Build word lattice | ||
* @param {string} text Input text to analyze | ||
* @returns {ViterbiLattice} Word lattice | ||
*/ | ||
getLattice(text: string): ViterbiLattice; | ||
} | ||
export default Tokenizer; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,28 @@ | ||
import Tokenizer from "./Tokenizer.js"; | ||
export interface TokenizerBuilderOption { | ||
dicPath?: string; | ||
} | ||
/** | ||
* Callback used by build | ||
* @callback TokenizerBuilder~onLoad | ||
* @param {Object} err Error object | ||
* @param {Tokenizer} tokenizer Prepared Tokenizer | ||
*/ | ||
export type TokenizerBuilderOnLoad = (err: (Error | null)[], tokenizer?: Tokenizer) => void; | ||
declare class TokenizerBuilder { | ||
dic_path: string; | ||
/** | ||
* TokenizerBuilder create Tokenizer instance. | ||
* @param {Object} option JSON object which have key-value pairs settings | ||
* @param {string} option.dicPath Dictionary directory path (or URL using in browser) | ||
* @constructor | ||
*/ | ||
constructor(option?: TokenizerBuilderOption); | ||
/** | ||
* Build Tokenizer instance by asynchronous manner | ||
* @param {TokenizerBuilder~onLoad} callback Callback function | ||
*/ | ||
build(callback: TokenizerBuilderOnLoad): Promise<void>; | ||
buildBrowser(callback: TokenizerBuilderOnLoad): Promise<void>; | ||
} | ||
export default TokenizerBuilder; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,18 @@ | ||
declare class CharacterClass { | ||
class_id: number; | ||
class_name: string; | ||
is_always_invoke: boolean | number; | ||
is_grouping: boolean | number; | ||
max_length: number; | ||
/** | ||
* CharacterClass | ||
* @param {number} class_id | ||
* @param {string} class_name | ||
* @param {boolean} is_always_invoke | ||
* @param {boolean} is_grouping | ||
* @param {number} max_length | ||
* @constructor | ||
*/ | ||
constructor(class_id: number, class_name: string, is_always_invoke: boolean | number, is_grouping: boolean | number, max_length: number); | ||
} | ||
export default CharacterClass; |
Oops, something went wrong.