-
-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #148 from Shigma/patch-1
Optimize Typings
- Loading branch information
Showing
1 changed file
with
27 additions
and
9 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 |
---|---|---|
@@ -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; | ||
} |