@allpaqa/multilingual-katakana 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.ja.md +184 -0
- package/README.md +193 -0
- package/dist/index.cjs +2923 -0
- package/dist/index.d.cts +53 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.js +2877 -0
- package/package.json +59 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
interface KatakanaOptions {
|
|
2
|
+
enableCyrillic?: boolean;
|
|
3
|
+
enableKorean?: boolean;
|
|
4
|
+
enableChinese?: boolean;
|
|
5
|
+
enableSpanish?: boolean;
|
|
6
|
+
enableSlang?: boolean;
|
|
7
|
+
enableEnglish?: boolean;
|
|
8
|
+
normalizeProsody?: boolean;
|
|
9
|
+
exclude?: (string | RegExp)[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare function escapeExcluded(text: string, exclude?: (string | RegExp)[]): {
|
|
13
|
+
text: string;
|
|
14
|
+
tokenMap: Map<string, string>;
|
|
15
|
+
};
|
|
16
|
+
declare function restoreExcluded(text: string, tokenMap: Map<string, string> | Record<string, string>): string;
|
|
17
|
+
declare function resolveWord(match: string, opts: KatakanaOptions): string;
|
|
18
|
+
declare class KatakanaConverter {
|
|
19
|
+
private defaultOptions?;
|
|
20
|
+
constructor(defaultOptions?: KatakanaOptions | undefined);
|
|
21
|
+
resolveWord(match: string, opts: KatakanaOptions): string;
|
|
22
|
+
convert(text: string, options?: KatakanaOptions): string;
|
|
23
|
+
transform(text: string, options?: KatakanaOptions): string;
|
|
24
|
+
}
|
|
25
|
+
declare function toKatakana(text: string, options?: KatakanaOptions): string;
|
|
26
|
+
|
|
27
|
+
declare function isChinese(text: string): boolean;
|
|
28
|
+
declare function replaceTaiwanPhrases(text: string): string;
|
|
29
|
+
declare function convertChinese(text: string): string;
|
|
30
|
+
|
|
31
|
+
declare function isCyrillic(text: string): boolean;
|
|
32
|
+
declare function convertCyrillic(text: string): string;
|
|
33
|
+
|
|
34
|
+
declare function getEnglishWord(word: string): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Fallback phonics-based converter for words not in the pre-converted dictionary
|
|
37
|
+
* (slang, character elongations like 'aaaaaaa', usernames, typos).
|
|
38
|
+
*/
|
|
39
|
+
declare function phonicsToKatakana(rawWord: string): string;
|
|
40
|
+
|
|
41
|
+
declare function isKorean(text: string): boolean;
|
|
42
|
+
declare function convertKorean(text: string): string;
|
|
43
|
+
|
|
44
|
+
declare function replaceSlangPhrases(text: string): string;
|
|
45
|
+
declare function getSlangWord(word: string): string | undefined;
|
|
46
|
+
|
|
47
|
+
declare function spanishPreprocess(text: string): string;
|
|
48
|
+
declare function replaceSpanishPhrases(text: string): string;
|
|
49
|
+
declare function getSpanishWord(word: string): string | undefined;
|
|
50
|
+
|
|
51
|
+
declare function normalizeProsody(text: string): string;
|
|
52
|
+
|
|
53
|
+
export { KatakanaConverter, type KatakanaOptions, convertChinese, convertCyrillic, convertKorean, escapeExcluded, getEnglishWord, getSlangWord, getSpanishWord, isChinese, isCyrillic, isKorean, normalizeProsody, phonicsToKatakana, replaceSlangPhrases, replaceSpanishPhrases, replaceTaiwanPhrases, resolveWord, restoreExcluded, spanishPreprocess, toKatakana };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
interface KatakanaOptions {
|
|
2
|
+
enableCyrillic?: boolean;
|
|
3
|
+
enableKorean?: boolean;
|
|
4
|
+
enableChinese?: boolean;
|
|
5
|
+
enableSpanish?: boolean;
|
|
6
|
+
enableSlang?: boolean;
|
|
7
|
+
enableEnglish?: boolean;
|
|
8
|
+
normalizeProsody?: boolean;
|
|
9
|
+
exclude?: (string | RegExp)[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare function escapeExcluded(text: string, exclude?: (string | RegExp)[]): {
|
|
13
|
+
text: string;
|
|
14
|
+
tokenMap: Map<string, string>;
|
|
15
|
+
};
|
|
16
|
+
declare function restoreExcluded(text: string, tokenMap: Map<string, string> | Record<string, string>): string;
|
|
17
|
+
declare function resolveWord(match: string, opts: KatakanaOptions): string;
|
|
18
|
+
declare class KatakanaConverter {
|
|
19
|
+
private defaultOptions?;
|
|
20
|
+
constructor(defaultOptions?: KatakanaOptions | undefined);
|
|
21
|
+
resolveWord(match: string, opts: KatakanaOptions): string;
|
|
22
|
+
convert(text: string, options?: KatakanaOptions): string;
|
|
23
|
+
transform(text: string, options?: KatakanaOptions): string;
|
|
24
|
+
}
|
|
25
|
+
declare function toKatakana(text: string, options?: KatakanaOptions): string;
|
|
26
|
+
|
|
27
|
+
declare function isChinese(text: string): boolean;
|
|
28
|
+
declare function replaceTaiwanPhrases(text: string): string;
|
|
29
|
+
declare function convertChinese(text: string): string;
|
|
30
|
+
|
|
31
|
+
declare function isCyrillic(text: string): boolean;
|
|
32
|
+
declare function convertCyrillic(text: string): string;
|
|
33
|
+
|
|
34
|
+
declare function getEnglishWord(word: string): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Fallback phonics-based converter for words not in the pre-converted dictionary
|
|
37
|
+
* (slang, character elongations like 'aaaaaaa', usernames, typos).
|
|
38
|
+
*/
|
|
39
|
+
declare function phonicsToKatakana(rawWord: string): string;
|
|
40
|
+
|
|
41
|
+
declare function isKorean(text: string): boolean;
|
|
42
|
+
declare function convertKorean(text: string): string;
|
|
43
|
+
|
|
44
|
+
declare function replaceSlangPhrases(text: string): string;
|
|
45
|
+
declare function getSlangWord(word: string): string | undefined;
|
|
46
|
+
|
|
47
|
+
declare function spanishPreprocess(text: string): string;
|
|
48
|
+
declare function replaceSpanishPhrases(text: string): string;
|
|
49
|
+
declare function getSpanishWord(word: string): string | undefined;
|
|
50
|
+
|
|
51
|
+
declare function normalizeProsody(text: string): string;
|
|
52
|
+
|
|
53
|
+
export { KatakanaConverter, type KatakanaOptions, convertChinese, convertCyrillic, convertKorean, escapeExcluded, getEnglishWord, getSlangWord, getSpanishWord, isChinese, isCyrillic, isKorean, normalizeProsody, phonicsToKatakana, replaceSlangPhrases, replaceSpanishPhrases, replaceTaiwanPhrases, resolveWord, restoreExcluded, spanishPreprocess, toKatakana };
|