@aim-packages/subtitle 0.3.2 → 0.4.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/dist/index.d.ts CHANGED
@@ -67,6 +67,12 @@ export declare interface AimSegments {
67
67
 
68
68
  declare function assToAimSegments(text: string): Promise<AimSegments[]>;
69
69
 
70
+ export declare type Chunk = {
71
+ content: string;
72
+ index: number;
73
+ count: number;
74
+ };
75
+
70
76
  /**
71
77
  * 将字符串数组按字符限制分块
72
78
  *
@@ -107,6 +113,13 @@ declare function chunkArrayStrings(strings: string[], characterLimit: number): s
107
113
  indexResult: number[];
108
114
  };
109
115
 
116
+ /**
117
+ * Simple character-based chunker with overlap (mirrors main/embedding/chunker)
118
+ * - maxChars: max characters per chunk
119
+ * - overlap: overlapping characters between adjacent chunks to keep context
120
+ */
121
+ declare function chunkText(text: string, maxChars?: number, overlap?: number): Chunk[];
122
+
110
123
  /**
111
124
  * 清理时间显示格式,移除毫秒部分和多余的小时前缀
112
125
  *
@@ -662,6 +675,11 @@ declare function chunkArrayStrings(strings: string[], characterLimit: number): s
662
675
  */
663
676
  declare function shiftAimSegmentItems(segment: AimSegments, count?: number): AimSegments | undefined;
664
677
 
678
+ /**
679
+ * Optional paragraph-aware splitter: split by paragraph/sentence first, then pack.
680
+ */
681
+ declare function smartChunks(text: string, maxChars?: number, overlap?: number): Chunk[];
682
+
665
683
  export declare interface SpeakerData {
666
684
  settings: Record<string, {
667
685
  spk: string;
@@ -834,6 +852,8 @@ declare function chunkArrayStrings(strings: string[], characterLimit: number): s
834
852
  convertTimeToAssFormat,
835
853
  convertHexColorToFFmpegFormat,
836
854
  chunkArrayStrings,
855
+ chunkText,
856
+ smartChunks,
837
857
  chunkSegmentStringsWithIndex,
838
858
  consolidateSegments,
839
859
  joinAimSegmentItems,