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 | import { model as jaModel } from './data/models/ja.js';
|
17 | import { model as zhHansModel } from './data/models/zh-hans.js';
|
18 | import { model as zhHantModel } from './data/models/zh-hant.js';
|
19 | import { model as thModel } from './data/models/th.js';
|
20 | import { HTMLProcessingParser } from './html_processor.js';
|
21 | export { Parser } from './parser.js';
|
22 | export { HTMLProcessor, HTMLProcessingParser } from './html_processor.js';
|
23 | export { jaModel, zhHansModel, zhHantModel };
|
24 | /**
|
25 | * Loads a parser equipped with the default Japanese model.
|
26 | * @return A parser with the default Japanese model.
|
27 | */
|
28 | export const loadDefaultJapaneseParser = () => {
|
29 | return new HTMLProcessingParser(jaModel);
|
30 | };
|
31 | /**
|
32 | * Loads a parser equipped with the default Simplified Chinese model.
|
33 | * @return A parser with the default Simplified Chinese model.
|
34 | */
|
35 | export const loadDefaultSimplifiedChineseParser = () => {
|
36 | return new HTMLProcessingParser(zhHansModel);
|
37 | };
|
38 | /**
|
39 | * Loads a parser equipped with the default Traditional Chinese model.
|
40 | * @return A parser with the default Traditional Chinese model.
|
41 | */
|
42 | export const loadDefaultTraditionalChineseParser = () => {
|
43 | return new HTMLProcessingParser(zhHantModel);
|
44 | };
|
45 | /**
|
46 | * Loads a parser equipped with the default Thai model.
|
47 | * @returns A parser with the default Thai model.
|
48 | */
|
49 | export const loadDefaultThaiParser = () => {
|
50 | return new HTMLProcessingParser(thModel);
|
51 | };
|
52 | /**
|
53 | * Loads available default parsers.
|
54 | * @return A map between available lang codes and their default parsers.
|
55 | */
|
56 | export const loadDefaultParsers = () => {
|
57 | return new Map([
|
58 | ['ja', loadDefaultJapaneseParser()],
|
59 | ['zh-hans', loadDefaultSimplifiedChineseParser()],
|
60 | ['zh-hant', loadDefaultTraditionalChineseParser()],
|
61 | ['th', loadDefaultThaiParser()],
|
62 | ]);
|
63 | };
|
64 | //# sourceMappingURL=index.js.map |
\ | No newline at end of file |