Skip to content

Commit

Permalink
Merge pull request #148 from Shigma/patch-1
Browse files Browse the repository at this point in the history
Optimize Typings
  • Loading branch information
yanyiwu committed Jan 18, 2020
2 parents 53c48ca + d3b9de5 commit 2ecd101
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
declare module "nodejieba" {
export function load(dict: object): void;
export function cut(sentence: string, strict?: boolean): any;
export function cutHMM(sentence: string): any;
export function cutAll(sentence: string): any;
export function cutForSearch(sentence: string, strict?: boolean): any;
export function tag(sentence: string): any;
export function extract(sentence: string, threshold: number): any;
export function insertWord(sentence: string): any;
export function cutSmall(sentence: string, small: number): any;
export interface LoadOptions {
dict?: string;
hmmDict?: string;
userDict?: string;
idfDict?: string;
stopWordDict?: string;
}

export interface TagResult {
word: string;
tag: string;
}

export interface ExtractResult {
word: string;
weight: number;
}

export function load(dict?: LoadOptions): void;
export function cut(sentence: string, strict?: boolean): string[];
export function cutHMM(sentence: string): string[];
export function cutAll(sentence: string): string[];
export function cutForSearch(sentence: string, strict?: boolean): string[];
export function tag(sentence: string): TagResult[];
export function extract(sentence: string, threshold: number): ExtractResult[];
export function insertWord(sentence: string): boolean;
export function cutSmall(sentence: string, small: number): boolean;
}

0 comments on commit 2ecd101

Please sign in to comment.