speechflow 2.1.2 → 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.
@@ -45,14 +45,14 @@
45
45
  "eslint-plugin-import": "2.32.0",
46
46
  "eslint-plugin-vue": "10.8.0",
47
47
 
48
- "oxlint": "1.48.0",
49
- "eslint-plugin-oxlint": "1.48.0",
48
+ "oxlint": "1.50.0",
49
+ "eslint-plugin-oxlint": "1.50.0",
50
50
 
51
51
  "htmllint": "0.8.0",
52
52
  "htmllint-cli": "0.0.7",
53
53
 
54
54
  "check-dependencies": "2.0.0",
55
- "nodemon": "3.1.11",
55
+ "nodemon": "3.1.14",
56
56
  "shx": "0.4.0",
57
57
  "stylelint": "17.3.0",
58
58
  "stylelint-config-html": "1.1.0",
@@ -63,7 +63,7 @@
63
63
  "postcss-html": "1.8.1",
64
64
  "stylus": "0.64.0",
65
65
  "typescript": "5.9.3",
66
- "vue-tsc": "3.2.4",
66
+ "vue-tsc": "3.2.5",
67
67
  "delay-cli": "3.0.0",
68
68
  "cross-env": "10.1.0",
69
69
  "serve": "14.2.5",
@@ -10,13 +10,25 @@
10
10
  <div class="app">
11
11
  <div class="area">
12
12
  <div class="block" ref="block">
13
- <span v-bind:key="chunk.id"
14
- v-for="(chunk, idx) of text"
15
- class="chunk"
16
- v-bind:class="{ intermediate: chunk.kind === 'intermediate', removed: chunk.removed }"
13
+ <span class="chunk"
14
+ v-for="(chunk, cidx) of text"
15
+ v-bind:key="`chunk-${chunk.id}`"
17
16
  v-bind:ref="`chunk-${chunk.id}`">
18
- {{ chunk.text }}
19
- <span class="cursor" v-if="idx === (text.length - 1) && chunk.kind === 'intermediate'">
17
+ <span class="chunk-frag"
18
+ v-for="(frag, fidx) of chunk.text"
19
+ v-bind:key="`chunk-${chunk.id}-frag-${fidx}`">
20
+ <span
21
+ class="chunk-bg"
22
+ v-bind:class="{ intermediate: chunk.kind === 'intermediate', removed: chunk.removed }">
23
+ {{ frag }}
24
+ </span>
25
+ <span
26
+ class="chunk-fg"
27
+ v-bind:class="{ intermediate: chunk.kind === 'intermediate', removed: chunk.removed }">
28
+ {{ frag }}
29
+ </span>
30
+ </span>
31
+ <span class="cursor" v-if="cidx === (text.length - 1) && chunk.kind === 'intermediate'">
20
32
  <spinner-grid class="spinner-grid" size="30"/>
21
33
  </span>
22
34
  </span>
@@ -63,23 +75,43 @@
63
75
 
64
76
  /* content chunk */
65
77
  .chunk
66
- color: #ffffff
67
- background-color: #000000e0
68
- font-size: 2.0vw
69
- font-weight: 600
70
- line-height: 1.5
71
- padding-left: 0.20vw
72
- padding-right: 0.20vw
78
+ .chunk-frag
79
+ display: inline-block
80
+ position: relative
81
+ .chunk-fg
82
+ z-index: 20
83
+ color: #ffffff
84
+ -webkit-text-stroke: 4px #00000000
85
+ font-size: 2.0vw
86
+ font-weight: 600
87
+ line-height: 1.3
88
+ padding-left: 0.20vw
89
+ padding-right: 0.20vw
90
+ &.intermediate:last-child
91
+ color: #ffe0c0
92
+ &.removed
93
+ opacity: 0
94
+ .chunk-bg
95
+ z-index: -10
96
+ position: absolute
97
+ color: #000000
98
+ -webkit-text-stroke: 5px #000000e0
99
+ font-size: 2.0vw
100
+ font-weight: 600
101
+ line-height: 1.3
102
+ padding-left: 0.20vw
103
+ padding-right: 0.20vw
104
+ &.intermediate:last-child
105
+ color: #ffe0c0
106
+ &.removed
107
+ opacity: 0
73
108
  .cursor
74
109
  position: relative
75
110
  display: inline-block
76
111
  margin-left: 10px
77
112
  margin-right: 10px
78
- top: -5px
79
- &.intermediate:last-child
113
+ top: -7px
80
114
  color: #ffe0c0
81
- &.removed
82
- opacity: 0
83
115
  </style>
84
116
 
85
117
  <script setup lang="ts">
@@ -95,7 +127,7 @@ type TextChunk = {
95
127
  id: string,
96
128
  timestamp: DateTime,
97
129
  kind: "intermediate" | "final",
98
- text: string,
130
+ text: string[],
99
131
  removing: boolean,
100
132
  removed: boolean
101
133
  }
@@ -185,7 +217,7 @@ export default defineComponent({
185
217
  /* override previous intermediate text chunk
186
218
  with either another intermediate one or a final one */
187
219
  const lastChunk = this.text[this.text.length - 1]
188
- lastChunk.text = chunk.payload
220
+ lastChunk.text = chunk.payload.split(/\s+/)
189
221
  lastChunk.kind = chunk.kind
190
222
  lastChunk.timestamp = DateTime.now()
191
223
  }
@@ -199,7 +231,7 @@ export default defineComponent({
199
231
  /* add new text chunk */
200
232
  this.text.push({
201
233
  id: `chunk-${this.chunkIdCounter++}`,
202
- text: chunk.payload,
234
+ text: chunk.payload.split(/\s+/),
203
235
  kind: chunk.kind,
204
236
  timestamp: DateTime.now(),
205
237
  removing: false,
@@ -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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