@aim-packages/subtitle 0.0.7 → 0.0.9
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/dist/index.cjs.js +2765 -11
- package/dist/index.d.ts +37 -3
- package/dist/index.es.js +4781 -855
- package/package.json +6 -2
package/dist/index.d.ts
CHANGED
|
@@ -99,6 +99,15 @@ declare function create(options?: ParserOptions<AimSegments[], AimSegments[], st
|
|
|
99
99
|
|
|
100
100
|
declare function create_2(options?: ParserOptions<RequiredByKey<Partial<AimSegments>, "index">[], Partial<AimSegments>[], string>): Parser<string>;
|
|
101
101
|
|
|
102
|
+
declare function create_3(options?: ParserOptions<AimSegments[], AimSegments[], AimSegments[]> & {
|
|
103
|
+
sentenceLength?: number;
|
|
104
|
+
repeatString?: string[];
|
|
105
|
+
}): Parser<AimSegments[]>;
|
|
106
|
+
|
|
107
|
+
declare function detectAllLanguage(text: string): LanguageDetectionResultsEntry[];
|
|
108
|
+
|
|
109
|
+
declare function detectLanguage(text: string): LanguageDetectionResultsEntry;
|
|
110
|
+
|
|
102
111
|
export declare namespace filter {
|
|
103
112
|
export {
|
|
104
113
|
StreamFilter
|
|
@@ -114,6 +123,23 @@ export declare namespace filter {
|
|
|
114
123
|
*/
|
|
115
124
|
declare function formatTime(seconds: number): string;
|
|
116
125
|
|
|
126
|
+
declare type LanguageCode = "auto" | "none" | "zh" | "zh_cn" | "zh_tw" | "yue" | "en" | "ja" | "ko" | "fr" | "es" | "ru" | "de" | "it" | "tr" | "pt" | "vi" | "id" | "th" | "ms" | "ar" | "hi" | "ro" | "ug" | "uz" | "kk" | "az" | "ky" | "fa" | "tg";
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 将语言代码转换为名称
|
|
130
|
+
*
|
|
131
|
+
* @export
|
|
132
|
+
* @param {LanguageCode} languageCode
|
|
133
|
+
* @return {*}
|
|
134
|
+
*/
|
|
135
|
+
declare function languageCodeToName(languageCode: LanguageCode): string;
|
|
136
|
+
|
|
137
|
+
declare interface LanguageDetectionResultsEntry {
|
|
138
|
+
language: LanguageCode;
|
|
139
|
+
languageName: string;
|
|
140
|
+
probability: number;
|
|
141
|
+
}
|
|
142
|
+
|
|
117
143
|
declare interface OpenAIResult {
|
|
118
144
|
task: string;
|
|
119
145
|
language: string;
|
|
@@ -194,7 +220,8 @@ export declare namespace parser {
|
|
|
194
220
|
tingwuToAimSegments,
|
|
195
221
|
openaiToAimSegments,
|
|
196
222
|
create as createWhisperStreamParser,
|
|
197
|
-
create_2 as createTranslateStreamParser
|
|
223
|
+
create_2 as createTranslateStreamParser,
|
|
224
|
+
create_3 as createSegmentStreamParser
|
|
198
225
|
}
|
|
199
226
|
}
|
|
200
227
|
|
|
@@ -236,6 +263,8 @@ declare interface RepeatCheckOption {
|
|
|
236
263
|
|
|
237
264
|
declare type RequiredByKey<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
238
265
|
|
|
266
|
+
declare function splitToSentences(text: string, languageCode?: LanguageCode): string[];
|
|
267
|
+
|
|
239
268
|
declare function srtToAimSegments(text: string): Promise<AimSegments[]>;
|
|
240
269
|
|
|
241
270
|
declare class StreamFilter {
|
|
@@ -305,7 +334,11 @@ export declare namespace tools {
|
|
|
305
334
|
subtitleOptimization,
|
|
306
335
|
RepeatCheckOption,
|
|
307
336
|
RepeatCheck,
|
|
308
|
-
subtitleOptimizationRegExp
|
|
337
|
+
subtitleOptimizationRegExp,
|
|
338
|
+
detectAllLanguage,
|
|
339
|
+
detectLanguage,
|
|
340
|
+
LanguageDetectionResultsEntry,
|
|
341
|
+
splitToSentences
|
|
309
342
|
}
|
|
310
343
|
}
|
|
311
344
|
|
|
@@ -314,7 +347,8 @@ export declare namespace utils {
|
|
|
314
347
|
padNumber,
|
|
315
348
|
formatTime,
|
|
316
349
|
convertToSeconds,
|
|
317
|
-
containsCJKCharacters
|
|
350
|
+
containsCJKCharacters,
|
|
351
|
+
languageCodeToName
|
|
318
352
|
}
|
|
319
353
|
}
|
|
320
354
|
|