From d3b9de5cfdb6c23ad4dcad86e255000ab69a7bda Mon Sep 17 00:00:00 2001 From: Shigma <33423008+Shigma@users.noreply.github.com> Date: Fri, 17 Jan 2020 15:56:02 +0800 Subject: [PATCH] Update index.d.ts --- types/index.d.ts | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 6dbb6cf..c1408f3 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -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; }