@bitbaum/ai-kit 1.4.1 → 1.4.2

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.
@@ -183,7 +183,25 @@ function properNounRuns(text) {
183
183
  const out = [];
184
184
  // Strip fenced and inline code — quoted identifiers are usually the user's
185
185
  // own or a literal under discussion, not a claim about the world.
186
- const prose = text.replace(/```[\s\S]*?```/g, " ").replace(/`[^`]*`/g, " ");
186
+ //
187
+ // Markdown table pipes become line breaks for the same reason a full stop is
188
+ // a boundary: a cell is its own utterance, and a run must not span two of
189
+ // them. Observed on a live answer that laid its findings out as a table —
190
+ // the header row `| Category | Item | Status | Notes |` yielded the runs
191
+ // "Item" and "Item Status Notes Pending", the last of those having run on
192
+ // into the FIRST CELL OF THE NEXT ROW. The answer was entirely grounded and
193
+ // was reported as fabricating, which is the worst direction for this check
194
+ // to fail in: a warning that fires on correct answers teaches the operator
195
+ // to dismiss the warning.
196
+ //
197
+ // Splitting per cell also makes each header word cell-initial, and
198
+ // sentence-initial single words are already skipped for exactly this reason.
199
+ // Recall is barely touched: a fabricated name INSIDE a cell still trips its
200
+ // remaining tokens, the same trade already accepted at sentence starts.
201
+ const prose = text
202
+ .replace(/```[\s\S]*?```/g, " ")
203
+ .replace(/`[^`]*`/g, " ")
204
+ .replace(/\|/g, "\n");
187
205
  for (const sentence of prose.split(/(?<=[.!?:\n])\s+/)) {
188
206
  const tokens = sentence.match(/[A-Za-z][A-Za-z0-9&.'’-]*/g) ?? [];
189
207
  let run = [];
@@ -187,7 +187,25 @@ function properNounRuns(text) {
187
187
  const out = [];
188
188
  // Strip fenced and inline code — quoted identifiers are usually the user's
189
189
  // own or a literal under discussion, not a claim about the world.
190
- const prose = text.replace(/```[\s\S]*?```/g, " ").replace(/`[^`]*`/g, " ");
190
+ //
191
+ // Markdown table pipes become line breaks for the same reason a full stop is
192
+ // a boundary: a cell is its own utterance, and a run must not span two of
193
+ // them. Observed on a live answer that laid its findings out as a table —
194
+ // the header row `| Category | Item | Status | Notes |` yielded the runs
195
+ // "Item" and "Item Status Notes Pending", the last of those having run on
196
+ // into the FIRST CELL OF THE NEXT ROW. The answer was entirely grounded and
197
+ // was reported as fabricating, which is the worst direction for this check
198
+ // to fail in: a warning that fires on correct answers teaches the operator
199
+ // to dismiss the warning.
200
+ //
201
+ // Splitting per cell also makes each header word cell-initial, and
202
+ // sentence-initial single words are already skipped for exactly this reason.
203
+ // Recall is barely touched: a fabricated name INSIDE a cell still trips its
204
+ // remaining tokens, the same trade already accepted at sentence starts.
205
+ const prose = text
206
+ .replace(/```[\s\S]*?```/g, " ")
207
+ .replace(/`[^`]*`/g, " ")
208
+ .replace(/\|/g, "\n");
191
209
  for (const sentence of prose.split(/(?<=[.!?:\n])\s+/)) {
192
210
  const tokens = sentence.match(/[A-Za-z][A-Za-z0-9&.'’-]*/g) ?? [];
193
211
  let run = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbaum/ai-kit",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "license": "MIT",
5
5
  "author": "Mao Nakamoto",
6
6
  "homepage": "https://github.com/bitbaum/ai-kit#readme",
@@ -201,7 +201,25 @@ function properNounRuns(text: string): string[] {
201
201
  const out: string[] = [];
202
202
  // Strip fenced and inline code — quoted identifiers are usually the user's
203
203
  // own or a literal under discussion, not a claim about the world.
204
- const prose = text.replace(/```[\s\S]*?```/g, " ").replace(/`[^`]*`/g, " ");
204
+ //
205
+ // Markdown table pipes become line breaks for the same reason a full stop is
206
+ // a boundary: a cell is its own utterance, and a run must not span two of
207
+ // them. Observed on a live answer that laid its findings out as a table —
208
+ // the header row `| Category | Item | Status | Notes |` yielded the runs
209
+ // "Item" and "Item Status Notes Pending", the last of those having run on
210
+ // into the FIRST CELL OF THE NEXT ROW. The answer was entirely grounded and
211
+ // was reported as fabricating, which is the worst direction for this check
212
+ // to fail in: a warning that fires on correct answers teaches the operator
213
+ // to dismiss the warning.
214
+ //
215
+ // Splitting per cell also makes each header word cell-initial, and
216
+ // sentence-initial single words are already skipped for exactly this reason.
217
+ // Recall is barely touched: a fabricated name INSIDE a cell still trips its
218
+ // remaining tokens, the same trade already accepted at sentence starts.
219
+ const prose = text
220
+ .replace(/```[\s\S]*?```/g, " ")
221
+ .replace(/`[^`]*`/g, " ")
222
+ .replace(/\|/g, "\n");
205
223
 
206
224
  for (const sentence of prose.split(/(?<=[.!?:\n])\s+/)) {
207
225
  const tokens = sentence.match(/[A-Za-z][A-Za-z0-9&.'’-]*/g) ?? [];