Skip to content

Commit

Permalink
Merge branch 'fix-for-running-in-vite' of https://github.com/MijinkoS…
Browse files Browse the repository at this point in the history
…D/kuromoji.ts into fix-for-running-in-vite
  • Loading branch information
MijinkoSD committed May 6, 2024
2 parents 32715fe + dabc797 commit 326de64
Show file tree
Hide file tree
Showing 78 changed files with 3,290 additions and 0 deletions.
39 changes: 39 additions & 0 deletions dist/Tokenizer.d.ts
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;
154 changes: 154 additions & 0 deletions dist/Tokenizer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/Tokenizer.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions dist/TokenizerBuilder.d.ts
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;
92 changes: 92 additions & 0 deletions dist/TokenizerBuilder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/TokenizerBuilder.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions dist/dict/CharacterClass.d.ts
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;
Loading

0 comments on commit 326de64

Please sign in to comment.