speechflow 2.2.0 → 2.2.1

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.
@@ -39,8 +39,8 @@
39
39
 
40
40
  "@vue/eslint-config-typescript": "14.7.0",
41
41
  "vue-eslint-parser": "10.4.0",
42
- "eslint": "10.0.1",
43
- "@eslint/js": "10.0.1",
42
+ "eslint": "9.39.2",
43
+ "@eslint/js": "9.39.2",
44
44
  "neostandard": "0.12.2",
45
45
  "eslint-plugin-import": "2.32.0",
46
46
  "eslint-plugin-vue": "10.8.0",
@@ -11,23 +11,24 @@
11
11
  <div class="area">
12
12
  <div class="block" ref="block">
13
13
  <span class="chunk"
14
- v-for="(chunk, idx) of text"
14
+ v-for="(chunk, cidx) of text"
15
15
  v-bind:key="`chunk-${chunk.id}`"
16
16
  v-bind:ref="`chunk-${chunk.id}`">
17
17
  <span class="chunk-frag"
18
- v-for="(frag, idx) of chunk.text">
19
- <span v-bind:key="`bg-${chunk.id}-${idx}`"
18
+ v-for="(frag, fidx) of chunk.text"
19
+ v-bind:key="`chunk-${chunk.id}-frag-${fidx}`">
20
+ <span
20
21
  class="chunk-bg"
21
22
  v-bind:class="{ intermediate: chunk.kind === 'intermediate', removed: chunk.removed }">
22
23
  {{ frag }}
23
24
  </span>
24
- <span v-bind:key="`fg-${chunk.id}-${idx}`"
25
+ <span
25
26
  class="chunk-fg"
26
27
  v-bind:class="{ intermediate: chunk.kind === 'intermediate', removed: chunk.removed }">
27
28
  {{ frag }}
28
29
  </span>
29
30
  </span>
30
- <span class="cursor" v-if="idx === (text.length - 1) && chunk.kind === 'intermediate'">
31
+ <span class="cursor" v-if="cidx === (text.length - 1) && chunk.kind === 'intermediate'">
31
32
  <spinner-grid class="spinner-grid" size="30"/>
32
33
  </span>
33
34
  </span>
@@ -126,7 +127,7 @@ type TextChunk = {
126
127
  id: string,
127
128
  timestamp: DateTime,
128
129
  kind: "intermediate" | "final",
129
- text: string,
130
+ text: string[],
130
131
  removing: boolean,
131
132
  removed: boolean
132
133
  }
@@ -216,7 +217,7 @@ export default defineComponent({
216
217
  /* override previous intermediate text chunk
217
218
  with either another intermediate one or a final one */
218
219
  const lastChunk = this.text[this.text.length - 1]
219
- lastChunk.text = chunk.payload.split(/\s+/),
220
+ lastChunk.text = chunk.payload.split(/\s+/)
220
221
  lastChunk.kind = chunk.kind
221
222
  lastChunk.timestamp = DateTime.now()
222
223
  }
@@ -1,11 +0,0 @@
1
- import SpeechFlowNode from "./speechflow-node";
2
- export default class SpeechFlowNodeT2TSimulator extends SpeechFlowNode {
3
- static name: string;
4
- constructor(id: string, cfg: {
5
- [id: string]: any;
6
- }, opts: {
7
- [id: string]: any;
8
- }, args: any[]);
9
- open(): Promise<void>;
10
- close(): Promise<void>;
11
- }
@@ -1,128 +0,0 @@
1
- "use strict";
2
- /*
3
- ** SpeechFlow - Speech Processing Flow Graph
4
- ** Copyright (c) 2024-2025 Dr. Ralf S. Engelschall <rse@engelschall.com>
5
- ** Licensed under GPL 3.0 <https://spdx.org/licenses/GPL-3.0-only>
6
- */
7
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
- if (k2 === undefined) k2 = k;
9
- var desc = Object.getOwnPropertyDescriptor(m, k);
10
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
- desc = { enumerable: true, get: function() { return m[k]; } };
12
- }
13
- Object.defineProperty(o, k2, desc);
14
- }) : (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- o[k2] = m[k];
17
- }));
18
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
19
- Object.defineProperty(o, "default", { enumerable: true, value: v });
20
- }) : function(o, v) {
21
- o["default"] = v;
22
- });
23
- var __importStar = (this && this.__importStar) || (function () {
24
- var ownKeys = function(o) {
25
- ownKeys = Object.getOwnPropertyNames || function (o) {
26
- var ar = [];
27
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
28
- return ar;
29
- };
30
- return ownKeys(o);
31
- };
32
- return function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- })();
40
- var __importDefault = (this && this.__importDefault) || function (mod) {
41
- return (mod && mod.__esModule) ? mod : { "default": mod };
42
- };
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- /* standard dependencies */
45
- const node_stream_1 = __importDefault(require("node:stream"));
46
- /* internal dependencies */
47
- const speechflow_node_1 = __importDefault(require("./speechflow-node"));
48
- const util = __importStar(require("./speechflow-util"));
49
- /* SpeechFlow node for text-to-text simulation of intermediate results */
50
- class SpeechFlowNodeT2TSimulator extends speechflow_node_1.default {
51
- /* declare official node name */
52
- static name = "t2t-simulator";
53
- /* construct node */
54
- constructor(id, cfg, opts, args) {
55
- super(id, cfg, opts, args);
56
- /* declare node configuration parameters */
57
- this.configure({
58
- repeat: { type: "number", pos: 0, val: 3 },
59
- noise: { type: "number", pos: 1, val: 2 }
60
- });
61
- /* declare node input/output format */
62
- this.input = "text";
63
- this.output = "text";
64
- }
65
- /* open node */
66
- async open() {
67
- /* provide text noise injection */
68
- const injectNoise = (text, count) => {
69
- if (text.length === 0 || count <= 0)
70
- return text;
71
- const chars = text.split("");
72
- const positions = new Set();
73
- const attempts = Math.min(count, chars.length);
74
- while (positions.size < attempts) {
75
- const pos = Math.floor(Math.random() * chars.length);
76
- positions.add(pos);
77
- }
78
- for (const pos of positions) {
79
- const offset = Math.floor(Math.random() * 26);
80
- const base = chars[pos] >= "A" && chars[pos] <= "Z" ? "A" : "a";
81
- chars[pos] = String.fromCharCode(base.charCodeAt(0) + offset);
82
- }
83
- return chars.join("");
84
- };
85
- /* establish a transform stream and connect it to text simulation */
86
- const repeat = this.params.repeat;
87
- const noise = this.params.noise;
88
- this.stream = new node_stream_1.default.Transform({
89
- readableObjectMode: true,
90
- writableObjectMode: true,
91
- decodeStrings: false,
92
- highWaterMark: 1,
93
- transform(chunk, encoding, callback) {
94
- if (Buffer.isBuffer(chunk.payload))
95
- callback(new Error("invalid chunk payload type"));
96
- else if (chunk.payload === "") {
97
- this.push(chunk);
98
- callback();
99
- }
100
- else {
101
- /* emit "repeat" intermediate chunks with noise */
102
- for (let i = 0; i < repeat; i++) {
103
- const chunkIntermediate = chunk.clone();
104
- chunkIntermediate.kind = "intermediate";
105
- chunkIntermediate.payload = injectNoise(chunk.payload, noise);
106
- this.push(chunkIntermediate);
107
- }
108
- /* emit the original chunk unmodified */
109
- this.push(chunk);
110
- callback();
111
- }
112
- },
113
- final(callback) {
114
- callback();
115
- }
116
- });
117
- }
118
- /* close node */
119
- async close() {
120
- /* shutdown stream */
121
- if (this.stream !== null) {
122
- await util.destroyStream(this.stream);
123
- this.stream = null;
124
- }
125
- }
126
- }
127
- exports.default = SpeechFlowNodeT2TSimulator;
128
- //# sourceMappingURL=speechflow-node-t2t-simulator.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"speechflow-node-t2t-simulator.js","sourceRoot":"","sources":["../src/speechflow-node-t2t-simulator.ts"],"names":[],"mappings":";AAAA;;;;EAIE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,6BAA6B;AAC7B,8DAAkC;AAElC,6BAA6B;AAC7B,wEAAmE;AACnE,wDAAmE;AAEnE,2EAA2E;AAC3E,MAAqB,0BAA2B,SAAQ,yBAAc;IAClE,kCAAkC;IAC3B,MAAM,CAAC,IAAI,GAAG,eAAe,CAAA;IAEpC,sBAAsB;IACtB,YAAa,EAAU,EAAE,GAA4B,EAAE,IAA6B,EAAE,IAAW;QAC7F,KAAK,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;QAE1B,6CAA6C;QAC7C,IAAI,CAAC,SAAS,CAAC;YACX,MAAM,EAAE,E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