UNPKG

1.38 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2021 Google LLC
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16/**
17 * Base BudouX parser.
18 */
19export declare class Parser {
20 /** BudouX model data */
21 private readonly model;
22 private readonly baseScore;
23 /**
24 * Constructs a BudouX parser.
25 * @param model A model data.
26 */
27 constructor(model: {
28 [key: string]: {
29 [key: string]: number;
30 };
31 });
32 /**
33 * Parses the input sentence and returns a list of semantic chunks.
34 *
35 * @param sentence An input sentence.
36 * @return The retrieved chunks.
37 */
38 parse(sentence: string): string[];
39 /**
40 * Parses the input sentence and returns a list of boundaries.
41 *
42 * @param sentence An input sentence.
43 * @return The list of boundaries.
44 */
45 parseBoundaries(sentence: string): number[];
46}