@utilix-tech/sdk 0.31.0 → 0.32.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/CHANGELOG.md +4 -0
- package/README.md +7 -3
- package/dist/{ai_agent-B-c59NXD.d.cts → ai_agent-C1zudGgT.d.cts} +24 -2
- package/dist/{ai_agent-B-c59NXD.d.ts → ai_agent-C1zudGgT.d.ts} +24 -2
- package/dist/{chunk-AFEZ6N4A.js → chunk-H2USEUHD.js} +67 -1
- package/dist/{chunk-265NPGKH.js → chunk-W3J7GZVQ.js} +25 -1
- package/dist/index.cjs +90 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{text-D1fySkCB.d.ts → text-CA-zuD0C.d.cts} +34 -2
- package/dist/{text-D1fySkCB.d.cts → text-CA-zuD0C.d.ts} +34 -2
- package/dist/tools/ai_agent.cjs +24 -0
- package/dist/tools/ai_agent.d.cts +1 -1
- package/dist/tools/ai_agent.d.ts +1 -1
- package/dist/tools/ai_agent.js +1 -1
- package/dist/tools/text.cjs +66 -0
- package/dist/tools/text.d.cts +1 -1
- package/dist/tools/text.d.ts +1 -1
- package/dist/tools/text.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Full release notes for all Utilix surfaces (browser tools, REST API, SDKs, MCP server) live at [utilix.tech/changelog](https://utilix.tech/changelog). This file tracks just this package.
|
|
4
4
|
|
|
5
|
+
## 0.32.0
|
|
6
|
+
- Add `analyzeSentenceLengths` (sentence-length-distribution): histogram of sentence lengths in words, plus mean, median, standard deviation, and a coefficient-of-variation consistency label, distinct from readability grade scores.
|
|
7
|
+
- Add `formatFewShotExamples` (few-shot-formatter): format input/output example pairs into a numbered, XML-tagged, or delimiter-separated few-shot prompt template.
|
|
8
|
+
|
|
5
9
|
## 0.31.0
|
|
6
10
|
- Add `calculateEmi` (emi-calculator): equated monthly installment, total interest, and a year-by-year principal/interest breakdown from principal, annual rate, and tenure in years or months.
|
|
7
11
|
- Add `parseFrontMatter` (markdown-front-matter-parser): split a Markdown document into its YAML front matter fields and body content, parsing scalars, inline arrays, and block lists.
|
package/README.md
CHANGED
|
@@ -140,7 +140,7 @@ generateHtpasswdFile([{ username: "alice", password: "secret" }]);
|
|
|
140
140
|
```ts
|
|
141
141
|
import { convertCase, slugify, countWords, generateWords, generateParagraphs,
|
|
142
142
|
escapeString, htmlToMarkdown, applyOps, detectPassiveVoice, scoreReadability,
|
|
143
|
-
detectFillerWords, calculateStringDistance } from "@utilix-tech/sdk/text";
|
|
143
|
+
detectFillerWords, calculateStringDistance, analyzeSentenceLengths } from "@utilix-tech/sdk/text";
|
|
144
144
|
|
|
145
145
|
convertCase("hello world", "camelCase"); // "helloWorld"
|
|
146
146
|
convertCase("hello world", "PascalCase"); // "HelloWorld"
|
|
@@ -173,6 +173,10 @@ detectFillerWords("At the end of the day, I just really think we should circle b
|
|
|
173
173
|
// Levenshtein edit distance + similarity ratio; pass mode: "damerau" to count a transposition as 1 edit
|
|
174
174
|
calculateStringDistance("kitten", "sitting");
|
|
175
175
|
// { distance: 3, similarity: 0.5714, maxLength: 7, mode: "levenshtein" }
|
|
176
|
+
|
|
177
|
+
// Histogram + mean/median/stddev of sentence lengths, distinct from readability grade scores
|
|
178
|
+
analyzeSentenceLengths("The cat sat on the mat. It was a sunny day, and the dog ran across the yard to play.");
|
|
179
|
+
// { sentenceCount: 2, meanLength: 10, stdDev: 4, consistency: "Moderate variation in sentence length", buckets: [...] }
|
|
176
180
|
```
|
|
177
181
|
|
|
178
182
|
---
|
|
@@ -654,7 +658,7 @@ readVideoInfo(new Uint8Array(videoBytes));
|
|
|
654
658
|
| `@utilix-tech/sdk/json` | Format, minify, diff, validate, JSONPath, CSV↔JSON, YAML↔JSON, TS types from data or from a JSON Schema |
|
|
655
659
|
| `@utilix-tech/sdk/encoding` | Base64, URL, HTML entities, Base32/Base58/Base62 encode/decode |
|
|
656
660
|
| `@utilix-tech/sdk/hashing` | MD5, SHA-1/256/512, bcrypt, HMAC, .htpasswd |
|
|
657
|
-
| `@utilix-tech/sdk/text` | Case convert, slugify, word count, lorem ipsum, line ops, HTML→Markdown, Levenshtein/Damerau string distance |
|
|
661
|
+
| `@utilix-tech/sdk/text` | Case convert, slugify, word count, lorem ipsum, line ops, HTML→Markdown, Levenshtein/Damerau string distance, readability scoring, sentence length distribution |
|
|
658
662
|
| `@utilix-tech/sdk/data` | CSV, YAML, TOML, XML, INI, NDJSON parse and convert, SRT/WebVTT subtitles, Markdown front matter parser |
|
|
659
663
|
| `@utilix-tech/sdk/generators` | UUID v4/v7, ULID, passwords, strength check, entropy estimator, fake data |
|
|
660
664
|
| `@utilix-tech/sdk/time` | Date diff, timezone convert, cron parse, relative time |
|
|
@@ -665,7 +669,7 @@ readVideoInfo(new Uint8Array(videoBytes));
|
|
|
665
669
|
| `@utilix-tech/sdk/color` | Hex/RGB/HSL/HSV/CMYK convert, palette generation, contrast check |
|
|
666
670
|
| `@utilix-tech/sdk/css` | CSS gradient, box-shadow, border-radius, keyframe animation generators |
|
|
667
671
|
| `@utilix-tech/sdk/misc` | SVG optimize/sanitize, file size format, Unicode inspector |
|
|
668
|
-
| `@utilix-tech/sdk/ai_agent` | Token estimate/trim, chunk text, extract URLs/JSON/keywords, sanitize HTML, flatten/merge JSON, dedupe lines, validate schema, PII/secret/injection detect, vector similarity |
|
|
672
|
+
| `@utilix-tech/sdk/ai_agent` | Token estimate/trim, chunk text, extract URLs/JSON/keywords, sanitize HTML, flatten/merge JSON, dedupe lines, validate schema, PII/secret/injection detect, vector similarity, few-shot prompt formatter |
|
|
669
673
|
| `@utilix-tech/sdk/media` | Image format & dimension reading from raw bytes (PNG, JPEG, GIF, WebP, BMP); PDF metadata reading; PDF page dimension/orientation listing; WAV audio info; ID3 tags; ICO favicon inspection; FLAC metadata reading; MP4/WebM video info |
|
|
670
674
|
|
|
671
675
|
---
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* - secret-detector : detectSecrets
|
|
9
9
|
* - prompt-injection : detectPromptInjection
|
|
10
10
|
* - json-repair : repairJson
|
|
11
|
+
* - few-shot-formatter : formatFewShotExamples
|
|
11
12
|
*/
|
|
12
13
|
interface ModelPricing {
|
|
13
14
|
model: string;
|
|
@@ -333,6 +334,23 @@ interface VectorSimilarityResult {
|
|
|
333
334
|
declare function vectorSimilarity(a: number[], b: number[]): VectorSimilarityResult | {
|
|
334
335
|
error: string;
|
|
335
336
|
};
|
|
337
|
+
type FewShotFormat = 'numbered' | 'xml' | 'delimiter';
|
|
338
|
+
interface FewShotExample {
|
|
339
|
+
input: string;
|
|
340
|
+
output: string;
|
|
341
|
+
}
|
|
342
|
+
interface FewShotFormatResult {
|
|
343
|
+
formatted: string;
|
|
344
|
+
exampleCount: number;
|
|
345
|
+
format: FewShotFormat;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Format a list of input/output example pairs into a standard few-shot
|
|
349
|
+
* prompt template, ready to paste into a system or user prompt. Examples
|
|
350
|
+
* with an empty input or output are dropped. `delimiter` only applies to
|
|
351
|
+
* the 'delimiter' format and defaults to '---'.
|
|
352
|
+
*/
|
|
353
|
+
declare function formatFewShotExamples(examples: FewShotExample[], format?: FewShotFormat, delimiter?: string): FewShotFormatResult;
|
|
336
354
|
|
|
337
355
|
type ai_agent_ChunkStrategy = ChunkStrategy;
|
|
338
356
|
type ai_agent_CompressHtmlResult = CompressHtmlResult;
|
|
@@ -349,6 +367,9 @@ type ai_agent_EntityType2 = EntityType2;
|
|
|
349
367
|
type ai_agent_ExtractJsonResult = ExtractJsonResult;
|
|
350
368
|
type ai_agent_ExtractKeywordsResult = ExtractKeywordsResult;
|
|
351
369
|
type ai_agent_ExtractUrlsResult = ExtractUrlsResult;
|
|
370
|
+
type ai_agent_FewShotExample = FewShotExample;
|
|
371
|
+
type ai_agent_FewShotFormat = FewShotFormat;
|
|
372
|
+
type ai_agent_FewShotFormatResult = FewShotFormatResult;
|
|
352
373
|
type ai_agent_InjectionDetectResult = InjectionDetectResult;
|
|
353
374
|
type ai_agent_InjectionFinding = InjectionFinding;
|
|
354
375
|
type ai_agent_JsonBlock = JsonBlock;
|
|
@@ -396,6 +417,7 @@ declare const ai_agent_extractKeywords: typeof extractKeywords;
|
|
|
396
417
|
declare const ai_agent_extractTables: typeof extractTables;
|
|
397
418
|
declare const ai_agent_extractUrls: typeof extractUrls;
|
|
398
419
|
declare const ai_agent_flattenJson: typeof flattenJson;
|
|
420
|
+
declare const ai_agent_formatFewShotExamples: typeof formatFewShotExamples;
|
|
399
421
|
declare const ai_agent_mergeJson: typeof mergeJson;
|
|
400
422
|
declare const ai_agent_redactPii: typeof redactPii;
|
|
401
423
|
declare const ai_agent_repairJson: typeof repairJson;
|
|
@@ -408,7 +430,7 @@ declare const ai_agent_unflattenJson: typeof unflattenJson;
|
|
|
408
430
|
declare const ai_agent_validateJsonSchema: typeof validateJsonSchema;
|
|
409
431
|
declare const ai_agent_vectorSimilarity: typeof vectorSimilarity;
|
|
410
432
|
declare namespace ai_agent {
|
|
411
|
-
export { type ai_agent_ChunkStrategy as ChunkStrategy, type ai_agent_CompressHtmlResult as CompressHtmlResult, type ai_agent_CompressJsonResult as CompressJsonResult, type ai_agent_CompressMarkdownResult as CompressMarkdownResult, type ai_agent_CostEstimate as CostEstimate, type ai_agent_DedupeResult as DedupeResult, type ai_agent_DedupeStrategy as DedupeStrategy, type ai_agent_DiffEntry2 as DiffEntry2, type ai_agent_DiffOp2 as DiffOp2, type ai_agent_DiffResult2 as DiffResult2, type ai_agent_Entity2 as Entity2, type ai_agent_EntityType2 as EntityType2, type ai_agent_ExtractJsonResult as ExtractJsonResult, type ai_agent_ExtractKeywordsResult as ExtractKeywordsResult, type ai_agent_ExtractUrlsResult as ExtractUrlsResult, type ai_agent_InjectionDetectResult as InjectionDetectResult, type ai_agent_InjectionFinding as InjectionFinding, type ai_agent_JsonBlock as JsonBlock, type ai_agent_JsonRepairResult as JsonRepairResult, type ai_agent_Keyword as Keyword, ai_agent_MODEL_PRICING as MODEL_PRICING, type ai_agent_MergeResult as MergeResult, type ai_agent_MergeStrategy as MergeStrategy, type ai_agent_ModelPricing as ModelPricing, type ai_agent_PiiDetectResult as PiiDetectResult, type ai_agent_PiiFinding as PiiFinding, type ai_agent_PiiType as PiiType, type ai_agent_RankedChunk as RankedChunk, type ai_agent_RelevanceResult as RelevanceResult, type ai_agent_SanitizeResult as SanitizeResult, type ai_agent_SecretDetectResult as SecretDetectResult, type ai_agent_SecretFinding as SecretFinding, type ai_agent_SecretType as SecretType, type ai_agent_SummaryResult as SummaryResult, type ai_agent_TableResult2 as TableResult2, type ai_agent_TextChunk as TextChunk, type ai_agent_TokenEstimate as TokenEstimate, type ai_agent_TokenEstimateResult as TokenEstimateResult, type ai_agent_TrimResult as TrimResult, type ai_agent_TrimStrategy as TrimStrategy, type ai_agent_UrlMatch as UrlMatch, type ai_agent_ValidationError as ValidationError, type ai_agent_ValidationResult as ValidationResult, type ai_agent_VectorSimilarityResult as VectorSimilarityResult, ai_agent_chunkText as chunkText, ai_agent_compressHtml as compressHtml, ai_agent_compressJson as compressJson, ai_agent_compressMarkdown as compressMarkdown, ai_agent_deduplicateLines as deduplicateLines, ai_agent_detectPii as detectPii, ai_agent_detectPromptInjection as detectPromptInjection, ai_agent_detectSecrets as detectSecrets, ai_agent_diffJson as diffJson, ai_agent_estimateCost as estimateCost, ai_agent_estimateTokens as estimateTokens, ai_agent_expandQuery as expandQuery, ai_agent_extractEntities as extractEntities, ai_agent_extractJson as extractJson, ai_agent_extractKeywords as extractKeywords, ai_agent_extractTables as extractTables, ai_agent_extractUrls as extractUrls, ai_agent_flattenJson as flattenJson, ai_agent_mergeJson as mergeJson, ai_agent_redactPii as redactPii, ai_agent_repairJson as repairJson, ai_agent_rerankChunks as rerankChunks, ai_agent_sanitizeHtml as sanitizeHtml, ai_agent_scoreRelevance as scoreRelevance, ai_agent_summarizeForLlm as summarizeForLlm, ai_agent_trimToTokens as trimToTokens, ai_agent_unflattenJson as unflattenJson, ai_agent_validateJsonSchema as validateJsonSchema, ai_agent_vectorSimilarity as vectorSimilarity };
|
|
433
|
+
export { type ai_agent_ChunkStrategy as ChunkStrategy, type ai_agent_CompressHtmlResult as CompressHtmlResult, type ai_agent_CompressJsonResult as CompressJsonResult, type ai_agent_CompressMarkdownResult as CompressMarkdownResult, type ai_agent_CostEstimate as CostEstimate, type ai_agent_DedupeResult as DedupeResult, type ai_agent_DedupeStrategy as DedupeStrategy, type ai_agent_DiffEntry2 as DiffEntry2, type ai_agent_DiffOp2 as DiffOp2, type ai_agent_DiffResult2 as DiffResult2, type ai_agent_Entity2 as Entity2, type ai_agent_EntityType2 as EntityType2, type ai_agent_ExtractJsonResult as ExtractJsonResult, type ai_agent_ExtractKeywordsResult as ExtractKeywordsResult, type ai_agent_ExtractUrlsResult as ExtractUrlsResult, type ai_agent_FewShotExample as FewShotExample, type ai_agent_FewShotFormat as FewShotFormat, type ai_agent_FewShotFormatResult as FewShotFormatResult, type ai_agent_InjectionDetectResult as InjectionDetectResult, type ai_agent_InjectionFinding as InjectionFinding, type ai_agent_JsonBlock as JsonBlock, type ai_agent_JsonRepairResult as JsonRepairResult, type ai_agent_Keyword as Keyword, ai_agent_MODEL_PRICING as MODEL_PRICING, type ai_agent_MergeResult as MergeResult, type ai_agent_MergeStrategy as MergeStrategy, type ai_agent_ModelPricing as ModelPricing, type ai_agent_PiiDetectResult as PiiDetectResult, type ai_agent_PiiFinding as PiiFinding, type ai_agent_PiiType as PiiType, type ai_agent_RankedChunk as RankedChunk, type ai_agent_RelevanceResult as RelevanceResult, type ai_agent_SanitizeResult as SanitizeResult, type ai_agent_SecretDetectResult as SecretDetectResult, type ai_agent_SecretFinding as SecretFinding, type ai_agent_SecretType as SecretType, type ai_agent_SummaryResult as SummaryResult, type ai_agent_TableResult2 as TableResult2, type ai_agent_TextChunk as TextChunk, type ai_agent_TokenEstimate as TokenEstimate, type ai_agent_TokenEstimateResult as TokenEstimateResult, type ai_agent_TrimResult as TrimResult, type ai_agent_TrimStrategy as TrimStrategy, type ai_agent_UrlMatch as UrlMatch, type ai_agent_ValidationError as ValidationError, type ai_agent_ValidationResult as ValidationResult, type ai_agent_VectorSimilarityResult as VectorSimilarityResult, ai_agent_chunkText as chunkText, ai_agent_compressHtml as compressHtml, ai_agent_compressJson as compressJson, ai_agent_compressMarkdown as compressMarkdown, ai_agent_deduplicateLines as deduplicateLines, ai_agent_detectPii as detectPii, ai_agent_detectPromptInjection as detectPromptInjection, ai_agent_detectSecrets as detectSecrets, ai_agent_diffJson as diffJson, ai_agent_estimateCost as estimateCost, ai_agent_estimateTokens as estimateTokens, ai_agent_expandQuery as expandQuery, ai_agent_extractEntities as extractEntities, ai_agent_extractJson as extractJson, ai_agent_extractKeywords as extractKeywords, ai_agent_extractTables as extractTables, ai_agent_extractUrls as extractUrls, ai_agent_flattenJson as flattenJson, ai_agent_formatFewShotExamples as formatFewShotExamples, ai_agent_mergeJson as mergeJson, ai_agent_redactPii as redactPii, ai_agent_repairJson as repairJson, ai_agent_rerankChunks as rerankChunks, ai_agent_sanitizeHtml as sanitizeHtml, ai_agent_scoreRelevance as scoreRelevance, ai_agent_summarizeForLlm as summarizeForLlm, ai_agent_trimToTokens as trimToTokens, ai_agent_unflattenJson as unflattenJson, ai_agent_validateJsonSchema as validateJsonSchema, ai_agent_vectorSimilarity as vectorSimilarity };
|
|
412
434
|
}
|
|
413
435
|
|
|
414
|
-
export {
|
|
436
|
+
export { detectPii as $, type SummaryResult as A, type TextChunk as B, type ChunkStrategy as C, type DedupeResult as D, type Entity2 as E, type FewShotExample as F, type TokenEstimate as G, type TokenEstimateResult as H, type InjectionDetectResult as I, type JsonBlock as J, type Keyword as K, type TrimResult as L, MODEL_PRICING as M, type TrimStrategy as N, type ValidationResult as O, type PiiDetectResult as P, type VectorSimilarityResult as Q, type RankedChunk as R, type SanitizeResult as S, type TableResult2 as T, type UrlMatch as U, type ValidationError as V, chunkText as W, compressHtml as X, compressJson as Y, compressMarkdown as Z, deduplicateLines as _, ai_agent as a, detectPromptInjection as a0, detectSecrets as a1, diffJson as a2, estimateCost as a3, estimateTokens as a4, expandQuery as a5, extractEntities as a6, extractJson as a7, extractKeywords as a8, extractTables as a9, extractUrls as aa, flattenJson as ab, formatFewShotExamples as ac, mergeJson as ad, redactPii as ae, repairJson as af, rerankChunks as ag, sanitizeHtml as ah, scoreRelevance as ai, summarizeForLlm as aj, trimToTokens as ak, unflattenJson as al, validateJsonSchema as am, vectorSimilarity as an, type CompressHtmlResult as b, type CompressJsonResult as c, type CompressMarkdownResult as d, type CostEstimate as e, type DedupeStrategy as f, type DiffEntry2 as g, type DiffOp2 as h, type DiffResult2 as i, type EntityType2 as j, type ExtractJsonResult as k, type ExtractKeywordsResult as l, type ExtractUrlsResult as m, type FewShotFormat as n, type FewShotFormatResult as o, type InjectionFinding as p, type JsonRepairResult as q, type MergeResult as r, type MergeStrategy as s, type ModelPricing as t, type PiiFinding as u, type PiiType as v, type RelevanceResult as w, type SecretDetectResult as x, type SecretFinding as y, type SecretType as z };
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* - secret-detector : detectSecrets
|
|
9
9
|
* - prompt-injection : detectPromptInjection
|
|
10
10
|
* - json-repair : repairJson
|
|
11
|
+
* - few-shot-formatter : formatFewShotExamples
|
|
11
12
|
*/
|
|
12
13
|
interface ModelPricing {
|
|
13
14
|
model: string;
|
|
@@ -333,6 +334,23 @@ interface VectorSimilarityResult {
|
|
|
333
334
|
declare function vectorSimilarity(a: number[], b: number[]): VectorSimilarityResult | {
|
|
334
335
|
error: string;
|
|
335
336
|
};
|
|
337
|
+
type FewShotFormat = 'numbered' | 'xml' | 'delimiter';
|
|
338
|
+
interface FewShotExample {
|
|
339
|
+
input: string;
|
|
340
|
+
output: string;
|
|
341
|
+
}
|
|
342
|
+
interface FewShotFormatResult {
|
|
343
|
+
formatted: string;
|
|
344
|
+
exampleCount: number;
|
|
345
|
+
format: FewShotFormat;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Format a list of input/output example pairs into a standard few-shot
|
|
349
|
+
* prompt template, ready to paste into a system or user prompt. Examples
|
|
350
|
+
* with an empty input or output are dropped. `delimiter` only applies to
|
|
351
|
+
* the 'delimiter' format and defaults to '---'.
|
|
352
|
+
*/
|
|
353
|
+
declare function formatFewShotExamples(examples: FewShotExample[], format?: FewShotFormat, delimiter?: string): FewShotFormatResult;
|
|
336
354
|
|
|
337
355
|
type ai_agent_ChunkStrategy = ChunkStrategy;
|
|
338
356
|
type ai_agent_CompressHtmlResult = CompressHtmlResult;
|
|
@@ -349,6 +367,9 @@ type ai_agent_EntityType2 = EntityType2;
|
|
|
349
367
|
type ai_agent_ExtractJsonResult = ExtractJsonResult;
|
|
350
368
|
type ai_agent_ExtractKeywordsResult = ExtractKeywordsResult;
|
|
351
369
|
type ai_agent_ExtractUrlsResult = ExtractUrlsResult;
|
|
370
|
+
type ai_agent_FewShotExample = FewShotExample;
|
|
371
|
+
type ai_agent_FewShotFormat = FewShotFormat;
|
|
372
|
+
type ai_agent_FewShotFormatResult = FewShotFormatResult;
|
|
352
373
|
type ai_agent_InjectionDetectResult = InjectionDetectResult;
|
|
353
374
|
type ai_agent_InjectionFinding = InjectionFinding;
|
|
354
375
|
type ai_agent_JsonBlock = JsonBlock;
|
|
@@ -396,6 +417,7 @@ declare const ai_agent_extractKeywords: typeof extractKeywords;
|
|
|
396
417
|
declare const ai_agent_extractTables: typeof extractTables;
|
|
397
418
|
declare const ai_agent_extractUrls: typeof extractUrls;
|
|
398
419
|
declare const ai_agent_flattenJson: typeof flattenJson;
|
|
420
|
+
declare const ai_agent_formatFewShotExamples: typeof formatFewShotExamples;
|
|
399
421
|
declare const ai_agent_mergeJson: typeof mergeJson;
|
|
400
422
|
declare const ai_agent_redactPii: typeof redactPii;
|
|
401
423
|
declare const ai_agent_repairJson: typeof repairJson;
|
|
@@ -408,7 +430,7 @@ declare const ai_agent_unflattenJson: typeof unflattenJson;
|
|
|
408
430
|
declare const ai_agent_validateJsonSchema: typeof validateJsonSchema;
|
|
409
431
|
declare const ai_agent_vectorSimilarity: typeof vectorSimilarity;
|
|
410
432
|
declare namespace ai_agent {
|
|
411
|
-
export { type ai_agent_ChunkStrategy as ChunkStrategy, type ai_agent_CompressHtmlResult as CompressHtmlResult, type ai_agent_CompressJsonResult as CompressJsonResult, type ai_agent_CompressMarkdownResult as CompressMarkdownResult, type ai_agent_CostEstimate as CostEstimate, type ai_agent_DedupeResult as DedupeResult, type ai_agent_DedupeStrategy as DedupeStrategy, type ai_agent_DiffEntry2 as DiffEntry2, type ai_agent_DiffOp2 as DiffOp2, type ai_agent_DiffResult2 as DiffResult2, type ai_agent_Entity2 as Entity2, type ai_agent_EntityType2 as EntityType2, type ai_agent_ExtractJsonResult as ExtractJsonResult, type ai_agent_ExtractKeywordsResult as ExtractKeywordsResult, type ai_agent_ExtractUrlsResult as ExtractUrlsResult, type ai_agent_InjectionDetectResult as InjectionDetectResult, type ai_agent_InjectionFinding as InjectionFinding, type ai_agent_JsonBlock as JsonBlock, type ai_agent_JsonRepairResult as JsonRepairResult, type ai_agent_Keyword as Keyword, ai_agent_MODEL_PRICING as MODEL_PRICING, type ai_agent_MergeResult as MergeResult, type ai_agent_MergeStrategy as MergeStrategy, type ai_agent_ModelPricing as ModelPricing, type ai_agent_PiiDetectResult as PiiDetectResult, type ai_agent_PiiFinding as PiiFinding, type ai_agent_PiiType as PiiType, type ai_agent_RankedChunk as RankedChunk, type ai_agent_RelevanceResult as RelevanceResult, type ai_agent_SanitizeResult as SanitizeResult, type ai_agent_SecretDetectResult as SecretDetectResult, type ai_agent_SecretFinding as SecretFinding, type ai_agent_SecretType as SecretType, type ai_agent_SummaryResult as SummaryResult, type ai_agent_TableResult2 as TableResult2, type ai_agent_TextChunk as TextChunk, type ai_agent_TokenEstimate as TokenEstimate, type ai_agent_TokenEstimateResult as TokenEstimateResult, type ai_agent_TrimResult as TrimResult, type ai_agent_TrimStrategy as TrimStrategy, type ai_agent_UrlMatch as UrlMatch, type ai_agent_ValidationError as ValidationError, type ai_agent_ValidationResult as ValidationResult, type ai_agent_VectorSimilarityResult as VectorSimilarityResult, ai_agent_chunkText as chunkText, ai_agent_compressHtml as compressHtml, ai_agent_compressJson as compressJson, ai_agent_compressMarkdown as compressMarkdown, ai_agent_deduplicateLines as deduplicateLines, ai_agent_detectPii as detectPii, ai_agent_detectPromptInjection as detectPromptInjection, ai_agent_detectSecrets as detectSecrets, ai_agent_diffJson as diffJson, ai_agent_estimateCost as estimateCost, ai_agent_estimateTokens as estimateTokens, ai_agent_expandQuery as expandQuery, ai_agent_extractEntities as extractEntities, ai_agent_extractJson as extractJson, ai_agent_extractKeywords as extractKeywords, ai_agent_extractTables as extractTables, ai_agent_extractUrls as extractUrls, ai_agent_flattenJson as flattenJson, ai_agent_mergeJson as mergeJson, ai_agent_redactPii as redactPii, ai_agent_repairJson as repairJson, ai_agent_rerankChunks as rerankChunks, ai_agent_sanitizeHtml as sanitizeHtml, ai_agent_scoreRelevance as scoreRelevance, ai_agent_summarizeForLlm as summarizeForLlm, ai_agent_trimToTokens as trimToTokens, ai_agent_unflattenJson as unflattenJson, ai_agent_validateJsonSchema as validateJsonSchema, ai_agent_vectorSimilarity as vectorSimilarity };
|
|
433
|
+
export { type ai_agent_ChunkStrategy as ChunkStrategy, type ai_agent_CompressHtmlResult as CompressHtmlResult, type ai_agent_CompressJsonResult as CompressJsonResult, type ai_agent_CompressMarkdownResult as CompressMarkdownResult, type ai_agent_CostEstimate as CostEstimate, type ai_agent_DedupeResult as DedupeResult, type ai_agent_DedupeStrategy as DedupeStrategy, type ai_agent_DiffEntry2 as DiffEntry2, type ai_agent_DiffOp2 as DiffOp2, type ai_agent_DiffResult2 as DiffResult2, type ai_agent_Entity2 as Entity2, type ai_agent_EntityType2 as EntityType2, type ai_agent_ExtractJsonResult as ExtractJsonResult, type ai_agent_ExtractKeywordsResult as ExtractKeywordsResult, type ai_agent_ExtractUrlsResult as ExtractUrlsResult, type ai_agent_FewShotExample as FewShotExample, type ai_agent_FewShotFormat as FewShotFormat, type ai_agent_FewShotFormatResult as FewShotFormatResult, type ai_agent_InjectionDetectResult as InjectionDetectResult, type ai_agent_InjectionFinding as InjectionFinding, type ai_agent_JsonBlock as JsonBlock, type ai_agent_JsonRepairResult as JsonRepairResult, type ai_agent_Keyword as Keyword, ai_agent_MODEL_PRICING as MODEL_PRICING, type ai_agent_MergeResult as MergeResult, type ai_agent_MergeStrategy as MergeStrategy, type ai_agent_ModelPricing as ModelPricing, type ai_agent_PiiDetectResult as PiiDetectResult, type ai_agent_PiiFinding as PiiFinding, type ai_agent_PiiType as PiiType, type ai_agent_RankedChunk as RankedChunk, type ai_agent_RelevanceResult as RelevanceResult, type ai_agent_SanitizeResult as SanitizeResult, type ai_agent_SecretDetectResult as SecretDetectResult, type ai_agent_SecretFinding as SecretFinding, type ai_agent_SecretType as SecretType, type ai_agent_SummaryResult as SummaryResult, type ai_agent_TableResult2 as TableResult2, type ai_agent_TextChunk as TextChunk, type ai_agent_TokenEstimate as TokenEstimate, type ai_agent_TokenEstimateResult as TokenEstimateResult, type ai_agent_TrimResult as TrimResult, type ai_agent_TrimStrategy as TrimStrategy, type ai_agent_UrlMatch as UrlMatch, type ai_agent_ValidationError as ValidationError, type ai_agent_ValidationResult as ValidationResult, type ai_agent_VectorSimilarityResult as VectorSimilarityResult, ai_agent_chunkText as chunkText, ai_agent_compressHtml as compressHtml, ai_agent_compressJson as compressJson, ai_agent_compressMarkdown as compressMarkdown, ai_agent_deduplicateLines as deduplicateLines, ai_agent_detectPii as detectPii, ai_agent_detectPromptInjection as detectPromptInjection, ai_agent_detectSecrets as detectSecrets, ai_agent_diffJson as diffJson, ai_agent_estimateCost as estimateCost, ai_agent_estimateTokens as estimateTokens, ai_agent_expandQuery as expandQuery, ai_agent_extractEntities as extractEntities, ai_agent_extractJson as extractJson, ai_agent_extractKeywords as extractKeywords, ai_agent_extractTables as extractTables, ai_agent_extractUrls as extractUrls, ai_agent_flattenJson as flattenJson, ai_agent_formatFewShotExamples as formatFewShotExamples, ai_agent_mergeJson as mergeJson, ai_agent_redactPii as redactPii, ai_agent_repairJson as repairJson, ai_agent_rerankChunks as rerankChunks, ai_agent_sanitizeHtml as sanitizeHtml, ai_agent_scoreRelevance as scoreRelevance, ai_agent_summarizeForLlm as summarizeForLlm, ai_agent_trimToTokens as trimToTokens, ai_agent_unflattenJson as unflattenJson, ai_agent_validateJsonSchema as validateJsonSchema, ai_agent_vectorSimilarity as vectorSimilarity };
|
|
412
434
|
}
|
|
413
435
|
|
|
414
|
-
export {
|
|
436
|
+
export { detectPii as $, type SummaryResult as A, type TextChunk as B, type ChunkStrategy as C, type DedupeResult as D, type Entity2 as E, type FewShotExample as F, type TokenEstimate as G, type TokenEstimateResult as H, type InjectionDetectResult as I, type JsonBlock as J, type Keyword as K, type TrimResult as L, MODEL_PRICING as M, type TrimStrategy as N, type ValidationResult as O, type PiiDetectResult as P, type VectorSimilarityResult as Q, type RankedChunk as R, type SanitizeResult as S, type TableResult2 as T, type UrlMatch as U, type ValidationError as V, chunkText as W, compressHtml as X, compressJson as Y, compressMarkdown as Z, deduplicateLines as _, ai_agent as a, detectPromptInjection as a0, detectSecrets as a1, diffJson as a2, estimateCost as a3, estimateTokens as a4, expandQuery as a5, extractEntities as a6, extractJson as a7, extractKeywords as a8, extractTables as a9, extractUrls as aa, flattenJson as ab, formatFewShotExamples as ac, mergeJson as ad, redactPii as ae, repairJson as af, rerankChunks as ag, sanitizeHtml as ah, scoreRelevance as ai, summarizeForLlm as aj, trimToTokens as ak, unflattenJson as al, validateJsonSchema as am, vectorSimilarity as an, type CompressHtmlResult as b, type CompressJsonResult as c, type CompressMarkdownResult as d, type CostEstimate as e, type DedupeStrategy as f, type DiffEntry2 as g, type DiffOp2 as h, type DiffResult2 as i, type EntityType2 as j, type ExtractJsonResult as k, type ExtractKeywordsResult as l, type ExtractUrlsResult as m, type FewShotFormat as n, type FewShotFormatResult as o, type InjectionFinding as p, type JsonRepairResult as q, type MergeResult as r, type MergeStrategy as s, type ModelPricing as t, type PiiFinding as u, type PiiType as v, type RelevanceResult as w, type SecretDetectResult as x, type SecretFinding as y, type SecretType as z };
|
|
@@ -10,6 +10,7 @@ __export(text_exports, {
|
|
|
10
10
|
LINE_OPS: () => LINE_OPS,
|
|
11
11
|
MORSE_CODE: () => MORSE_CODE,
|
|
12
12
|
addBorder: () => addBorder,
|
|
13
|
+
analyzeSentenceLengths: () => analyzeSentenceLengths,
|
|
13
14
|
analyzeText: () => analyzeText,
|
|
14
15
|
applyOp: () => applyOp,
|
|
15
16
|
applyOps: () => applyOps,
|
|
@@ -2598,5 +2599,70 @@ function calculateStringDistance(a, b, options) {
|
|
|
2598
2599
|
const similarity = maxLength === 0 ? 1 : Math.round((1 - distance / maxLength) * 1e4) / 1e4;
|
|
2599
2600
|
return { a, b, distance, similarity, maxLength, mode };
|
|
2600
2601
|
}
|
|
2602
|
+
function splitIntoSentencesForLengthDist(text) {
|
|
2603
|
+
const matches = text.match(/[^.!?]+[.!?]*/g);
|
|
2604
|
+
if (!matches) return [];
|
|
2605
|
+
return matches.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
2606
|
+
}
|
|
2607
|
+
function countWordsInSentence(sentence) {
|
|
2608
|
+
return (sentence.match(/[a-zA-Z']+/g) ?? []).length;
|
|
2609
|
+
}
|
|
2610
|
+
function analyzeSentenceLengths(text) {
|
|
2611
|
+
const sentences = splitIntoSentencesForLengthDist(text);
|
|
2612
|
+
const lengths = sentences.map(countWordsInSentence).filter((n) => n > 0);
|
|
2613
|
+
if (lengths.length === 0) {
|
|
2614
|
+
return {
|
|
2615
|
+
sentenceCount: 0,
|
|
2616
|
+
lengths: [],
|
|
2617
|
+
minLength: 0,
|
|
2618
|
+
maxLength: 0,
|
|
2619
|
+
meanLength: 0,
|
|
2620
|
+
medianLength: 0,
|
|
2621
|
+
stdDev: 0,
|
|
2622
|
+
coefficientOfVariation: 0,
|
|
2623
|
+
consistency: "No sentences to analyze",
|
|
2624
|
+
buckets: []
|
|
2625
|
+
};
|
|
2626
|
+
}
|
|
2627
|
+
const sentenceCount2 = lengths.length;
|
|
2628
|
+
const minLength = Math.min(...lengths);
|
|
2629
|
+
const maxLength = Math.max(...lengths);
|
|
2630
|
+
const meanLength = lengths.reduce((a, b) => a + b, 0) / sentenceCount2;
|
|
2631
|
+
const sorted = [...lengths].sort((a, b) => a - b);
|
|
2632
|
+
const mid = Math.floor(sorted.length / 2);
|
|
2633
|
+
const medianLength = sorted.length % 2 === 0 ? (sorted[mid - 1] + sorted[mid]) / 2 : sorted[mid];
|
|
2634
|
+
const variance = lengths.reduce((sum, n) => sum + (n - meanLength) ** 2, 0) / sentenceCount2;
|
|
2635
|
+
const stdDev = Math.sqrt(variance);
|
|
2636
|
+
const coefficientOfVariation = meanLength > 0 ? stdDev / meanLength : 0;
|
|
2637
|
+
let consistency;
|
|
2638
|
+
if (coefficientOfVariation < 0.3) consistency = "Consistent \u2014 sentence lengths vary little";
|
|
2639
|
+
else if (coefficientOfVariation < 0.6) consistency = "Moderate variation in sentence length";
|
|
2640
|
+
else consistency = "Highly variable sentence length";
|
|
2641
|
+
const bucketWidth = 5;
|
|
2642
|
+
const bucketCount = Math.max(1, Math.ceil(maxLength / bucketWidth));
|
|
2643
|
+
const buckets = [];
|
|
2644
|
+
for (let i = 0; i < bucketCount; i++) {
|
|
2645
|
+
const min = i * bucketWidth + 1;
|
|
2646
|
+
const max = (i + 1) * bucketWidth;
|
|
2647
|
+
buckets.push({ label: `${min}-${max}`, min, max, count: 0 });
|
|
2648
|
+
}
|
|
2649
|
+
for (const len of lengths) {
|
|
2650
|
+
const idx = Math.min(Math.floor((len - 1) / bucketWidth), bucketCount - 1);
|
|
2651
|
+
buckets[idx].count++;
|
|
2652
|
+
}
|
|
2653
|
+
const round2 = (n) => Math.round(n * 100) / 100;
|
|
2654
|
+
return {
|
|
2655
|
+
sentenceCount: sentenceCount2,
|
|
2656
|
+
lengths,
|
|
2657
|
+
minLength,
|
|
2658
|
+
maxLength,
|
|
2659
|
+
meanLength: round2(meanLength),
|
|
2660
|
+
medianLength: round2(medianLength),
|
|
2661
|
+
stdDev: round2(stdDev),
|
|
2662
|
+
coefficientOfVariation: round2(coefficientOfVariation),
|
|
2663
|
+
consistency,
|
|
2664
|
+
buckets
|
|
2665
|
+
};
|
|
2666
|
+
}
|
|
2601
2667
|
|
|
2602
|
-
export { CASE_FORMATS, DEFAULT_CONVERT_OPTIONS, ESCAPE_MODES, LINE_OPS, MORSE_CODE, addBorder, analyzeText, applyOp, applyOps, calculateStringDistance, centerText, convertAll, convertCase, countWords, csvToHtml, csvToMarkdown, detectDelimiter, detectFillerWords, detectPassiveVoice, diffLines, diffLinesSimple, diffStats, escapeAll, escapeString, extractHeadings, formatReadingTime, generate, generateDiff, generateHtmlTable, generateMarkdownTable, generateParagraphs, generateSentences, generateWords, getAvailableFonts, getMorseForChar, getMorseTiming, htmlToMarkdown, isValidMorse, markdownToHtml, morseToText, numberToOrdinal, numberToRoman, numberToWords, ordinalWords, parseDiff, parseTableData, readabilityScore, renderMarkdown, romanToNumber, scoreReadability, sentenceCount, slugify, slugifyAll, syllableCount, textToAscii, textToMorse, text_exports, unescapeString, wordFrequency };
|
|
2668
|
+
export { CASE_FORMATS, DEFAULT_CONVERT_OPTIONS, ESCAPE_MODES, LINE_OPS, MORSE_CODE, addBorder, analyzeSentenceLengths, analyzeText, applyOp, applyOps, calculateStringDistance, centerText, convertAll, convertCase, countWords, csvToHtml, csvToMarkdown, detectDelimiter, detectFillerWords, detectPassiveVoice, diffLines, diffLinesSimple, diffStats, escapeAll, escapeString, extractHeadings, formatReadingTime, generate, generateDiff, generateHtmlTable, generateMarkdownTable, generateParagraphs, generateSentences, generateWords, getAvailableFonts, getMorseForChar, getMorseTiming, htmlToMarkdown, isValidMorse, markdownToHtml, morseToText, numberToOrdinal, numberToRoman, numberToWords, ordinalWords, parseDiff, parseTableData, readabilityScore, renderMarkdown, romanToNumber, scoreReadability, sentenceCount, slugify, slugifyAll, syllableCount, textToAscii, textToMorse, text_exports, unescapeString, wordFrequency };
|
|
@@ -22,6 +22,7 @@ __export(ai_agent_exports, {
|
|
|
22
22
|
extractTables: () => extractTables,
|
|
23
23
|
extractUrls: () => extractUrls,
|
|
24
24
|
flattenJson: () => flattenJson,
|
|
25
|
+
formatFewShotExamples: () => formatFewShotExamples,
|
|
25
26
|
mergeJson: () => mergeJson,
|
|
26
27
|
redactPii: () => redactPii,
|
|
27
28
|
repairJson: () => repairJson,
|
|
@@ -979,5 +980,28 @@ function vectorSimilarity(a, b) {
|
|
|
979
980
|
magnitudeB: round6(magB)
|
|
980
981
|
};
|
|
981
982
|
}
|
|
983
|
+
function formatFewShotExamples(examples, format = "numbered", delimiter = "---") {
|
|
984
|
+
const valid = (examples ?? []).filter((e) => e?.input?.trim() && e?.output?.trim());
|
|
985
|
+
if (valid.length === 0) {
|
|
986
|
+
return { formatted: "", exampleCount: 0, format };
|
|
987
|
+
}
|
|
988
|
+
let formatted;
|
|
989
|
+
if (format === "xml") {
|
|
990
|
+
formatted = valid.map((e) => `<example>
|
|
991
|
+
<input>${e.input.trim()}</input>
|
|
992
|
+
<output>${e.output.trim()}</output>
|
|
993
|
+
</example>`).join("\n\n");
|
|
994
|
+
} else if (format === "delimiter") {
|
|
995
|
+
formatted = valid.map((e) => `Input: ${e.input.trim()}
|
|
996
|
+
Output: ${e.output.trim()}`).join(`
|
|
997
|
+
${delimiter}
|
|
998
|
+
`);
|
|
999
|
+
} else {
|
|
1000
|
+
formatted = valid.map((e, i) => `Example ${i + 1}:
|
|
1001
|
+
Input: ${e.input.trim()}
|
|
1002
|
+
Output: ${e.output.trim()}`).join("\n\n");
|
|
1003
|
+
}
|
|
1004
|
+
return { formatted, exampleCount: valid.length, format };
|
|
1005
|
+
}
|
|
982
1006
|
|
|
983
|
-
export { MODEL_PRICING, ai_agent_exports, chunkText, compressHtml, compressJson, compressMarkdown, deduplicateLines, detectPii, detectPromptInjection, detectSecrets, diffJson, estimateCost, estimateTokens, expandQuery, extractEntities, extractJson, extractKeywords, extractTables, extractUrls, flattenJson, mergeJson, redactPii, repairJson, rerankChunks, sanitizeHtml, scoreRelevance, summarizeForLlm, trimToTokens, unflattenJson, validateJsonSchema, vectorSimilarity };
|
|
1007
|
+
export { MODEL_PRICING, ai_agent_exports, chunkText, compressHtml, compressJson, compressMarkdown, deduplicateLines, detectPii, detectPromptInjection, detectSecrets, diffJson, estimateCost, estimateTokens, expandQuery, extractEntities, extractJson, extractKeywords, extractTables, extractUrls, flattenJson, formatFewShotExamples, mergeJson, redactPii, repairJson, rerankChunks, sanitizeHtml, scoreRelevance, summarizeForLlm, trimToTokens, unflattenJson, validateJsonSchema, vectorSimilarity };
|
package/dist/index.cjs
CHANGED
|
@@ -2017,6 +2017,7 @@ __export(text_exports, {
|
|
|
2017
2017
|
LINE_OPS: () => LINE_OPS,
|
|
2018
2018
|
MORSE_CODE: () => MORSE_CODE,
|
|
2019
2019
|
addBorder: () => addBorder,
|
|
2020
|
+
analyzeSentenceLengths: () => analyzeSentenceLengths,
|
|
2020
2021
|
analyzeText: () => analyzeText,
|
|
2021
2022
|
applyOp: () => applyOp,
|
|
2022
2023
|
applyOps: () => applyOps,
|
|
@@ -4605,6 +4606,71 @@ function calculateStringDistance(a, b, options) {
|
|
|
4605
4606
|
const similarity = maxLength === 0 ? 1 : Math.round((1 - distance / maxLength) * 1e4) / 1e4;
|
|
4606
4607
|
return { a, b, distance, similarity, maxLength, mode };
|
|
4607
4608
|
}
|
|
4609
|
+
function splitIntoSentencesForLengthDist(text) {
|
|
4610
|
+
const matches = text.match(/[^.!?]+[.!?]*/g);
|
|
4611
|
+
if (!matches) return [];
|
|
4612
|
+
return matches.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
4613
|
+
}
|
|
4614
|
+
function countWordsInSentence(sentence) {
|
|
4615
|
+
return (sentence.match(/[a-zA-Z']+/g) ?? []).length;
|
|
4616
|
+
}
|
|
4617
|
+
function analyzeSentenceLengths(text) {
|
|
4618
|
+
const sentences = splitIntoSentencesForLengthDist(text);
|
|
4619
|
+
const lengths = sentences.map(countWordsInSentence).filter((n) => n > 0);
|
|
4620
|
+
if (lengths.length === 0) {
|
|
4621
|
+
return {
|
|
4622
|
+
sentenceCount: 0,
|
|
4623
|
+
lengths: [],
|
|
4624
|
+
minLength: 0,
|
|
4625
|
+
maxLength: 0,
|
|
4626
|
+
meanLength: 0,
|
|
4627
|
+
medianLength: 0,
|
|
4628
|
+
stdDev: 0,
|
|
4629
|
+
coefficientOfVariation: 0,
|
|
4630
|
+
consistency: "No sentences to analyze",
|
|
4631
|
+
buckets: []
|
|
4632
|
+
};
|
|
4633
|
+
}
|
|
4634
|
+
const sentenceCount2 = lengths.length;
|
|
4635
|
+
const minLength = Math.min(...lengths);
|
|
4636
|
+
const maxLength = Math.max(...lengths);
|
|
4637
|
+
const meanLength = lengths.reduce((a, b) => a + b, 0) / sentenceCount2;
|
|
4638
|
+
const sorted = [...lengths].sort((a, b) => a - b);
|
|
4639
|
+
const mid = Math.floor(sorted.length / 2);
|
|
4640
|
+
const medianLength = sorted.length % 2 === 0 ? (sorted[mid - 1] + sorted[mid]) / 2 : sorted[mid];
|
|
4641
|
+
const variance = lengths.reduce((sum, n) => sum + (n - meanLength) ** 2, 0) / sentenceCount2;
|
|
4642
|
+
const stdDev = Math.sqrt(variance);
|
|
4643
|
+
const coefficientOfVariation = meanLength > 0 ? stdDev / meanLength : 0;
|
|
4644
|
+
let consistency;
|
|
4645
|
+
if (coefficientOfVariation < 0.3) consistency = "Consistent \u2014 sentence lengths vary little";
|
|
4646
|
+
else if (coefficientOfVariation < 0.6) consistency = "Moderate variation in sentence length";
|
|
4647
|
+
else consistency = "Highly variable sentence length";
|
|
4648
|
+
const bucketWidth = 5;
|
|
4649
|
+
const bucketCount = Math.max(1, Math.ceil(maxLength / bucketWidth));
|
|
4650
|
+
const buckets = [];
|
|
4651
|
+
for (let i = 0; i < bucketCount; i++) {
|
|
4652
|
+
const min = i * bucketWidth + 1;
|
|
4653
|
+
const max = (i + 1) * bucketWidth;
|
|
4654
|
+
buckets.push({ label: `${min}-${max}`, min, max, count: 0 });
|
|
4655
|
+
}
|
|
4656
|
+
for (const len of lengths) {
|
|
4657
|
+
const idx = Math.min(Math.floor((len - 1) / bucketWidth), bucketCount - 1);
|
|
4658
|
+
buckets[idx].count++;
|
|
4659
|
+
}
|
|
4660
|
+
const round23 = (n) => Math.round(n * 100) / 100;
|
|
4661
|
+
return {
|
|
4662
|
+
sentenceCount: sentenceCount2,
|
|
4663
|
+
lengths,
|
|
4664
|
+
minLength,
|
|
4665
|
+
maxLength,
|
|
4666
|
+
meanLength: round23(meanLength),
|
|
4667
|
+
medianLength: round23(medianLength),
|
|
4668
|
+
stdDev: round23(stdDev),
|
|
4669
|
+
coefficientOfVariation: round23(coefficientOfVariation),
|
|
4670
|
+
consistency,
|
|
4671
|
+
buckets
|
|
4672
|
+
};
|
|
4673
|
+
}
|
|
4608
4674
|
|
|
4609
4675
|
// src/tools/data.ts
|
|
4610
4676
|
var data_exports = {};
|
|
@@ -18686,6 +18752,7 @@ __export(ai_agent_exports, {
|
|
|
18686
18752
|
extractTables: () => extractTables,
|
|
18687
18753
|
extractUrls: () => extractUrls,
|
|
18688
18754
|
flattenJson: () => flattenJson,
|
|
18755
|
+
formatFewShotExamples: () => formatFewShotExamples,
|
|
18689
18756
|
mergeJson: () => mergeJson,
|
|
18690
18757
|
redactPii: () => redactPii,
|
|
18691
18758
|
repairJson: () => repairJson,
|
|
@@ -19643,6 +19710,29 @@ function vectorSimilarity(a, b) {
|
|
|
19643
19710
|
magnitudeB: round6(magB)
|
|
19644
19711
|
};
|
|
19645
19712
|
}
|
|
19713
|
+
function formatFewShotExamples(examples, format = "numbered", delimiter = "---") {
|
|
19714
|
+
const valid = (examples ?? []).filter((e) => e?.input?.trim() && e?.output?.trim());
|
|
19715
|
+
if (valid.length === 0) {
|
|
19716
|
+
return { formatted: "", exampleCount: 0, format };
|
|
19717
|
+
}
|
|
19718
|
+
let formatted;
|
|
19719
|
+
if (format === "xml") {
|
|
19720
|
+
formatted = valid.map((e) => `<example>
|
|
19721
|
+
<input>${e.input.trim()}</input>
|
|
19722
|
+
<output>${e.output.trim()}</output>
|
|
19723
|
+
</example>`).join("\n\n");
|
|
19724
|
+
} else if (format === "delimiter") {
|
|
19725
|
+
formatted = valid.map((e) => `Input: ${e.input.trim()}
|
|
19726
|
+
Output: ${e.output.trim()}`).join(`
|
|
19727
|
+
${delimiter}
|
|
19728
|
+
`);
|
|
19729
|
+
} else {
|
|
19730
|
+
formatted = valid.map((e, i) => `Example ${i + 1}:
|
|
19731
|
+
Input: ${e.input.trim()}
|
|
19732
|
+
Output: ${e.output.trim()}`).join("\n\n");
|
|
19733
|
+
}
|
|
19734
|
+
return { formatted, exampleCount: valid.length, format };
|
|
19735
|
+
}
|
|
19646
19736
|
|
|
19647
19737
|
// src/tools/media.ts
|
|
19648
19738
|
var media_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { j as json } from './json-Ta9JykSB.cjs';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.cjs';
|
|
3
3
|
export { h as hashing } from './hashing-CnetQFD_.cjs';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-CA-zuD0C.cjs';
|
|
5
5
|
export { d as data } from './data-C4lCByXw.cjs';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
@@ -12,7 +12,7 @@ export { c as code } from './code-DaRvff2v.cjs';
|
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.cjs';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.cjs';
|
|
15
|
-
export { a as ai_agent } from './ai_agent-
|
|
15
|
+
export { a as ai_agent } from './ai_agent-C1zudGgT.cjs';
|
|
16
16
|
export { m as media } from './media-fD8dJ5qR.cjs';
|
|
17
17
|
|
|
18
18
|
declare const version = "0.1.0";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { j as json } from './json-Ta9JykSB.js';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.js';
|
|
3
3
|
export { h as hashing } from './hashing-CnetQFD_.js';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-CA-zuD0C.js';
|
|
5
5
|
export { d as data } from './data-C4lCByXw.js';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
@@ -12,7 +12,7 @@ export { c as code } from './code-DaRvff2v.js';
|
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.js';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.js';
|
|
15
|
-
export { a as ai_agent } from './ai_agent-
|
|
15
|
+
export { a as ai_agent } from './ai_agent-C1zudGgT.js';
|
|
16
16
|
export { m as media } from './media-fD8dJ5qR.js';
|
|
17
17
|
|
|
18
18
|
declare const version = "0.1.0";
|
package/dist/index.js
CHANGED
|
@@ -6,11 +6,11 @@ export { code_exports as code } from './chunk-LXKIPPDG.js';
|
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
7
7
|
export { css_exports as css } from './chunk-6YPV2AB5.js';
|
|
8
8
|
export { misc_exports as misc } from './chunk-GX7H6TAX.js';
|
|
9
|
-
export { ai_agent_exports as ai_agent } from './chunk-
|
|
9
|
+
export { ai_agent_exports as ai_agent } from './chunk-W3J7GZVQ.js';
|
|
10
10
|
export { json_exports as json } from './chunk-WVEKRKGU.js';
|
|
11
11
|
export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
|
|
12
12
|
export { hashing_exports as hashing } from './chunk-GEFVMGZR.js';
|
|
13
|
-
export { text_exports as text } from './chunk-
|
|
13
|
+
export { text_exports as text } from './chunk-H2USEUHD.js';
|
|
14
14
|
export { data_exports as data } from './chunk-6FIB72KX.js';
|
|
15
15
|
export { generators_exports as generators } from './chunk-3TYWIX3B.js';
|
|
16
16
|
export { time_exports as time } from './chunk-IEPWZERQ.js';
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* - passive-voice-detector: detectPassiveVoice
|
|
23
23
|
* - readability-score: scoreReadability
|
|
24
24
|
* - filler-word-detector: detectFillerWords
|
|
25
|
+
* - sentence-length-distribution: analyzeSentenceLengths
|
|
25
26
|
*/
|
|
26
27
|
interface WordCountResult {
|
|
27
28
|
words: number;
|
|
@@ -327,6 +328,34 @@ declare function calculateStringDistance(a: string, b: string, options?: {
|
|
|
327
328
|
}): StringDistanceResult | {
|
|
328
329
|
error: string;
|
|
329
330
|
};
|
|
331
|
+
interface SentenceLengthBucket {
|
|
332
|
+
label: string;
|
|
333
|
+
min: number;
|
|
334
|
+
max: number;
|
|
335
|
+
count: number;
|
|
336
|
+
}
|
|
337
|
+
interface SentenceLengthDistribution {
|
|
338
|
+
sentenceCount: number;
|
|
339
|
+
lengths: number[];
|
|
340
|
+
minLength: number;
|
|
341
|
+
maxLength: number;
|
|
342
|
+
meanLength: number;
|
|
343
|
+
medianLength: number;
|
|
344
|
+
stdDev: number;
|
|
345
|
+
coefficientOfVariation: number;
|
|
346
|
+
consistency: string;
|
|
347
|
+
buckets: SentenceLengthBucket[];
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Split text into sentences and report a histogram of sentence lengths (in
|
|
351
|
+
* words), plus mean/median/standard-deviation stats and a coefficient of
|
|
352
|
+
* variation, which is a distinct signal from the Flesch/Fog readability
|
|
353
|
+
* scores: two paragraphs can share the same reading grade while one alternates
|
|
354
|
+
* short and long sentences and the other stays uniform. Sentence splitting
|
|
355
|
+
* uses simple terminal-punctuation matching, so it can miscount abbreviations
|
|
356
|
+
* (e.g. "Dr.") as sentence boundaries.
|
|
357
|
+
*/
|
|
358
|
+
declare function analyzeSentenceLengths(text: string): SentenceLengthDistribution;
|
|
330
359
|
|
|
331
360
|
type text_AsciiFont = AsciiFont;
|
|
332
361
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -359,6 +388,8 @@ type text_PassiveVoiceResult = PassiveVoiceResult;
|
|
|
359
388
|
type text_PassiveVoiceSentence = PassiveVoiceSentence;
|
|
360
389
|
type text_ReadabilityResult = ReadabilityResult;
|
|
361
390
|
type text_ReadabilityScore = ReadabilityScore;
|
|
391
|
+
type text_SentenceLengthBucket = SentenceLengthBucket;
|
|
392
|
+
type text_SentenceLengthDistribution = SentenceLengthDistribution;
|
|
362
393
|
type text_SlugSeparator = SlugSeparator;
|
|
363
394
|
type text_StringDistanceMode = StringDistanceMode;
|
|
364
395
|
type text_StringDistanceResult = StringDistanceResult;
|
|
@@ -366,6 +397,7 @@ type text_TableOptions = TableOptions;
|
|
|
366
397
|
type text_TextAnalysis = TextAnalysis;
|
|
367
398
|
type text_WordCountResult = WordCountResult;
|
|
368
399
|
declare const text_addBorder: typeof addBorder;
|
|
400
|
+
declare const text_analyzeSentenceLengths: typeof analyzeSentenceLengths;
|
|
369
401
|
declare const text_analyzeText: typeof analyzeText;
|
|
370
402
|
declare const text_applyOp: typeof applyOp;
|
|
371
403
|
declare const text_applyOps: typeof applyOps;
|
|
@@ -419,7 +451,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
419
451
|
declare const text_unescapeString: typeof unescapeString;
|
|
420
452
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
421
453
|
declare namespace text {
|
|
422
|
-
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
454
|
+
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
423
455
|
}
|
|
424
456
|
|
|
425
|
-
export {
|
|
457
|
+
export { detectFillerWords as $, type AsciiFont as A, type StringDistanceResult as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, type FillerCategory as F, type TextAnalysis as G, addBorder as H, analyzeSentenceLengths as I, analyzeText as J, applyOp as K, LINE_OPS as L, MORSE_CODE as M, applyOps as N, calculateStringDistance as O, type ParsedDiff as P, centerText as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type TableOptions as T, convertAll as U, convertCase as V, type WordCountResult as W, countWords as X, csvToHtml as Y, csvToMarkdown as Z, detectDelimiter as _, type AsciiOptions as a, detectPassiveVoice as a0, diffLines as a1, diffLinesSimple as a2, diffStats as a3, escapeAll as a4, escapeString as a5, extractHeadings as a6, formatReadingTime as a7, generate as a8, generateDiff as a9, textToAscii as aA, textToMorse as aB, unescapeString as aC, wordFrequency as aD, generateHtmlTable as aa, generateMarkdownTable as ab, generateParagraphs as ac, generateSentences as ad, generateWords as ae, getAvailableFonts as af, getMorseForChar as ag, getMorseTiming as ah, htmlToMarkdown as ai, isValidMorse as aj, markdownToHtml as ak, morseToText as al, numberToOrdinal as am, numberToRoman as an, numberToWords as ao, ordinalWords as ap, parseDiff as aq, parseTableData as ar, readabilityScore as as, renderMarkdown as at, romanToNumber as au, scoreReadability as av, sentenceCount as aw, slugify as ax, slugifyAll as ay, syllableCount as az, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type FillerMatch as k, type FillerWordResult as l, type LineOp as m, type LineType as n, type LoremUnit as o, type MarkdownResult as p, type MorseOptions as q, type ParsedTable as r, type PassiveVoiceMatch as s, text as t, type PassiveVoiceResult as u, type PassiveVoiceSentence as v, type ReadabilityScore as w, type SentenceLengthDistribution as x, type SlugSeparator as y, type StringDistanceMode as z };
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
* - passive-voice-detector: detectPassiveVoice
|
|
23
23
|
* - readability-score: scoreReadability
|
|
24
24
|
* - filler-word-detector: detectFillerWords
|
|
25
|
+
* - sentence-length-distribution: analyzeSentenceLengths
|
|
25
26
|
*/
|
|
26
27
|
interface WordCountResult {
|
|
27
28
|
words: number;
|
|
@@ -327,6 +328,34 @@ declare function calculateStringDistance(a: string, b: string, options?: {
|
|
|
327
328
|
}): StringDistanceResult | {
|
|
328
329
|
error: string;
|
|
329
330
|
};
|
|
331
|
+
interface SentenceLengthBucket {
|
|
332
|
+
label: string;
|
|
333
|
+
min: number;
|
|
334
|
+
max: number;
|
|
335
|
+
count: number;
|
|
336
|
+
}
|
|
337
|
+
interface SentenceLengthDistribution {
|
|
338
|
+
sentenceCount: number;
|
|
339
|
+
lengths: number[];
|
|
340
|
+
minLength: number;
|
|
341
|
+
maxLength: number;
|
|
342
|
+
meanLength: number;
|
|
343
|
+
medianLength: number;
|
|
344
|
+
stdDev: number;
|
|
345
|
+
coefficientOfVariation: number;
|
|
346
|
+
consistency: string;
|
|
347
|
+
buckets: SentenceLengthBucket[];
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Split text into sentences and report a histogram of sentence lengths (in
|
|
351
|
+
* words), plus mean/median/standard-deviation stats and a coefficient of
|
|
352
|
+
* variation, which is a distinct signal from the Flesch/Fog readability
|
|
353
|
+
* scores: two paragraphs can share the same reading grade while one alternates
|
|
354
|
+
* short and long sentences and the other stays uniform. Sentence splitting
|
|
355
|
+
* uses simple terminal-punctuation matching, so it can miscount abbreviations
|
|
356
|
+
* (e.g. "Dr.") as sentence boundaries.
|
|
357
|
+
*/
|
|
358
|
+
declare function analyzeSentenceLengths(text: string): SentenceLengthDistribution;
|
|
330
359
|
|
|
331
360
|
type text_AsciiFont = AsciiFont;
|
|
332
361
|
type text_AsciiOptions = AsciiOptions;
|
|
@@ -359,6 +388,8 @@ type text_PassiveVoiceResult = PassiveVoiceResult;
|
|
|
359
388
|
type text_PassiveVoiceSentence = PassiveVoiceSentence;
|
|
360
389
|
type text_ReadabilityResult = ReadabilityResult;
|
|
361
390
|
type text_ReadabilityScore = ReadabilityScore;
|
|
391
|
+
type text_SentenceLengthBucket = SentenceLengthBucket;
|
|
392
|
+
type text_SentenceLengthDistribution = SentenceLengthDistribution;
|
|
362
393
|
type text_SlugSeparator = SlugSeparator;
|
|
363
394
|
type text_StringDistanceMode = StringDistanceMode;
|
|
364
395
|
type text_StringDistanceResult = StringDistanceResult;
|
|
@@ -366,6 +397,7 @@ type text_TableOptions = TableOptions;
|
|
|
366
397
|
type text_TextAnalysis = TextAnalysis;
|
|
367
398
|
type text_WordCountResult = WordCountResult;
|
|
368
399
|
declare const text_addBorder: typeof addBorder;
|
|
400
|
+
declare const text_analyzeSentenceLengths: typeof analyzeSentenceLengths;
|
|
369
401
|
declare const text_analyzeText: typeof analyzeText;
|
|
370
402
|
declare const text_applyOp: typeof applyOp;
|
|
371
403
|
declare const text_applyOps: typeof applyOps;
|
|
@@ -419,7 +451,7 @@ declare const text_textToMorse: typeof textToMorse;
|
|
|
419
451
|
declare const text_unescapeString: typeof unescapeString;
|
|
420
452
|
declare const text_wordFrequency: typeof wordFrequency;
|
|
421
453
|
declare namespace text {
|
|
422
|
-
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
454
|
+
export { type text_AsciiFont as AsciiFont, type text_AsciiOptions as AsciiOptions, text_CASE_FORMATS as CASE_FORMATS, type text_CaseFormat as CaseFormat, type text_ConvertOptions as ConvertOptions, text_DEFAULT_CONVERT_OPTIONS as DEFAULT_CONVERT_OPTIONS, type text_DiffFile as DiffFile, type text_DiffHunk as DiffHunk, type text_DiffLine as DiffLine, type text_DiffResult as DiffResult, type text_DiffType as DiffType, type text_DiffViewerLine as DiffViewerLine, text_ESCAPE_MODES as ESCAPE_MODES, type text_EscapeMode as EscapeMode, type text_FillerCategory as FillerCategory, type text_FillerMatch as FillerMatch, type text_FillerWordResult as FillerWordResult, text_LINE_OPS as LINE_OPS, type text_LineOp as LineOp, type text_LineType as LineType, type text_LoremUnit as LoremUnit, text_MORSE_CODE as MORSE_CODE, type text_MarkdownResult as MarkdownResult, type text_MorseOptions as MorseOptions, type text_ParsedDiff as ParsedDiff, type text_ParsedTable as ParsedTable, type text_PassiveVoiceMatch as PassiveVoiceMatch, type text_PassiveVoiceResult as PassiveVoiceResult, type text_PassiveVoiceSentence as PassiveVoiceSentence, type text_ReadabilityResult as ReadabilityResult, type text_ReadabilityScore as ReadabilityScore, type text_SentenceLengthBucket as SentenceLengthBucket, type text_SentenceLengthDistribution as SentenceLengthDistribution, type text_SlugSeparator as SlugSeparator, type text_StringDistanceMode as StringDistanceMode, type text_StringDistanceResult as StringDistanceResult, type text_TableOptions as TableOptions, type text_TextAnalysis as TextAnalysis, type text_WordCountResult as WordCountResult, text_addBorder as addBorder, text_analyzeSentenceLengths as analyzeSentenceLengths, text_analyzeText as analyzeText, text_applyOp as applyOp, text_applyOps as applyOps, text_calculateStringDistance as calculateStringDistance, text_centerText as centerText, text_convertAll as convertAll, text_convertCase as convertCase, text_countWords as countWords, text_csvToHtml as csvToHtml, text_csvToMarkdown as csvToMarkdown, text_detectDelimiter as detectDelimiter, text_detectFillerWords as detectFillerWords, text_detectPassiveVoice as detectPassiveVoice, text_diffLines as diffLines, text_diffLinesSimple as diffLinesSimple, text_diffStats as diffStats, text_escapeAll as escapeAll, text_escapeString as escapeString, text_extractHeadings as extractHeadings, text_formatReadingTime as formatReadingTime, text_generate as generate, text_generateDiff as generateDiff, text_generateHtmlTable as generateHtmlTable, text_generateMarkdownTable as generateMarkdownTable, text_generateParagraphs as generateParagraphs, text_generateSentences as generateSentences, text_generateWords as generateWords, text_getAvailableFonts as getAvailableFonts, text_getMorseForChar as getMorseForChar, text_getMorseTiming as getMorseTiming, text_htmlToMarkdown as htmlToMarkdown, text_isValidMorse as isValidMorse, text_markdownToHtml as markdownToHtml, text_morseToText as morseToText, text_numberToOrdinal as numberToOrdinal, text_numberToRoman as numberToRoman, text_numberToWords as numberToWords, text_ordinalWords as ordinalWords, text_parseDiff as parseDiff, text_parseTableData as parseTableData, text_readabilityScore as readabilityScore, text_renderMarkdown as renderMarkdown, text_romanToNumber as romanToNumber, text_scoreReadability as scoreReadability, text_sentenceCount as sentenceCount, text_slugify as slugify, text_slugifyAll as slugifyAll, text_syllableCount as syllableCount, text_textToAscii as textToAscii, text_textToMorse as textToMorse, text_unescapeString as unescapeString, text_wordFrequency as wordFrequency };
|
|
423
455
|
}
|
|
424
456
|
|
|
425
|
-
export {
|
|
457
|
+
export { detectFillerWords as $, type AsciiFont as A, type StringDistanceResult as B, CASE_FORMATS as C, DEFAULT_CONVERT_OPTIONS as D, ESCAPE_MODES as E, type FillerCategory as F, type TextAnalysis as G, addBorder as H, analyzeSentenceLengths as I, analyzeText as J, applyOp as K, LINE_OPS as L, MORSE_CODE as M, applyOps as N, calculateStringDistance as O, type ParsedDiff as P, centerText as Q, type ReadabilityResult as R, type SentenceLengthBucket as S, type TableOptions as T, convertAll as U, convertCase as V, type WordCountResult as W, countWords as X, csvToHtml as Y, csvToMarkdown as Z, detectDelimiter as _, type AsciiOptions as a, detectPassiveVoice as a0, diffLines as a1, diffLinesSimple as a2, diffStats as a3, escapeAll as a4, escapeString as a5, extractHeadings as a6, formatReadingTime as a7, generate as a8, generateDiff as a9, textToAscii as aA, textToMorse as aB, unescapeString as aC, wordFrequency as aD, generateHtmlTable as aa, generateMarkdownTable as ab, generateParagraphs as ac, generateSentences as ad, generateWords as ae, getAvailableFonts as af, getMorseForChar as ag, getMorseTiming as ah, htmlToMarkdown as ai, isValidMorse as aj, markdownToHtml as ak, morseToText as al, numberToOrdinal as am, numberToRoman as an, numberToWords as ao, ordinalWords as ap, parseDiff as aq, parseTableData as ar, readabilityScore as as, renderMarkdown as at, romanToNumber as au, scoreReadability as av, sentenceCount as aw, slugify as ax, slugifyAll as ay, syllableCount as az, type CaseFormat as b, type ConvertOptions as c, type DiffFile as d, type DiffHunk as e, type DiffLine as f, type DiffResult as g, type DiffType as h, type DiffViewerLine as i, type EscapeMode as j, type FillerMatch as k, type FillerWordResult as l, type LineOp as m, type LineType as n, type LoremUnit as o, type MarkdownResult as p, type MorseOptions as q, type ParsedTable as r, type PassiveVoiceMatch as s, text as t, type PassiveVoiceResult as u, type PassiveVoiceSentence as v, type ReadabilityScore as w, type SentenceLengthDistribution as x, type SlugSeparator as y, type StringDistanceMode as z };
|
package/dist/tools/ai_agent.cjs
CHANGED
|
@@ -946,6 +946,29 @@ function vectorSimilarity(a, b) {
|
|
|
946
946
|
magnitudeB: round6(magB)
|
|
947
947
|
};
|
|
948
948
|
}
|
|
949
|
+
function formatFewShotExamples(examples, format = "numbered", delimiter = "---") {
|
|
950
|
+
const valid = (examples ?? []).filter((e) => e?.input?.trim() && e?.output?.trim());
|
|
951
|
+
if (valid.length === 0) {
|
|
952
|
+
return { formatted: "", exampleCount: 0, format };
|
|
953
|
+
}
|
|
954
|
+
let formatted;
|
|
955
|
+
if (format === "xml") {
|
|
956
|
+
formatted = valid.map((e) => `<example>
|
|
957
|
+
<input>${e.input.trim()}</input>
|
|
958
|
+
<output>${e.output.trim()}</output>
|
|
959
|
+
</example>`).join("\n\n");
|
|
960
|
+
} else if (format === "delimiter") {
|
|
961
|
+
formatted = valid.map((e) => `Input: ${e.input.trim()}
|
|
962
|
+
Output: ${e.output.trim()}`).join(`
|
|
963
|
+
${delimiter}
|
|
964
|
+
`);
|
|
965
|
+
} else {
|
|
966
|
+
formatted = valid.map((e, i) => `Example ${i + 1}:
|
|
967
|
+
Input: ${e.input.trim()}
|
|
968
|
+
Output: ${e.output.trim()}`).join("\n\n");
|
|
969
|
+
}
|
|
970
|
+
return { formatted, exampleCount: valid.length, format };
|
|
971
|
+
}
|
|
949
972
|
|
|
950
973
|
exports.MODEL_PRICING = MODEL_PRICING;
|
|
951
974
|
exports.chunkText = chunkText;
|
|
@@ -966,6 +989,7 @@ exports.extractKeywords = extractKeywords;
|
|
|
966
989
|
exports.extractTables = extractTables;
|
|
967
990
|
exports.extractUrls = extractUrls;
|
|
968
991
|
exports.flattenJson = flattenJson;
|
|
992
|
+
exports.formatFewShotExamples = formatFewShotExamples;
|
|
969
993
|
exports.mergeJson = mergeJson;
|
|
970
994
|
exports.redactPii = redactPii;
|
|
971
995
|
exports.repairJson = repairJson;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ChunkStrategy, b as CompressHtmlResult, c as CompressJsonResult, d as CompressMarkdownResult, e as CostEstimate, D as DedupeResult, f as DedupeStrategy, g as DiffEntry2, h as DiffOp2, i as DiffResult2, E as Entity2, j as EntityType2, k as ExtractJsonResult, l as ExtractKeywordsResult, m as ExtractUrlsResult, I as InjectionDetectResult,
|
|
1
|
+
export { C as ChunkStrategy, b as CompressHtmlResult, c as CompressJsonResult, d as CompressMarkdownResult, e as CostEstimate, D as DedupeResult, f as DedupeStrategy, g as DiffEntry2, h as DiffOp2, i as DiffResult2, E as Entity2, j as EntityType2, k as ExtractJsonResult, l as ExtractKeywordsResult, m as ExtractUrlsResult, F as FewShotExample, n as FewShotFormat, o as FewShotFormatResult, I as InjectionDetectResult, p as InjectionFinding, J as JsonBlock, q as JsonRepairResult, K as Keyword, M as MODEL_PRICING, r as MergeResult, s as MergeStrategy, t as ModelPricing, P as PiiDetectResult, u as PiiFinding, v as PiiType, R as RankedChunk, w as RelevanceResult, S as SanitizeResult, x as SecretDetectResult, y as SecretFinding, z as SecretType, A as SummaryResult, T as TableResult2, B as TextChunk, G as TokenEstimate, H as TokenEstimateResult, L as TrimResult, N as TrimStrategy, U as UrlMatch, V as ValidationError, O as ValidationResult, Q as VectorSimilarityResult, W as chunkText, X as compressHtml, Y as compressJson, Z as compressMarkdown, _ as deduplicateLines, $ as detectPii, a0 as detectPromptInjection, a1 as detectSecrets, a2 as diffJson, a3 as estimateCost, a4 as estimateTokens, a5 as expandQuery, a6 as extractEntities, a7 as extractJson, a8 as extractKeywords, a9 as extractTables, aa as extractUrls, ab as flattenJson, ac as formatFewShotExamples, ad as mergeJson, ae as redactPii, af as repairJson, ag as rerankChunks, ah as sanitizeHtml, ai as scoreRelevance, aj as summarizeForLlm, ak as trimToTokens, al as unflattenJson, am as validateJsonSchema, an as vectorSimilarity } from '../ai_agent-C1zudGgT.cjs';
|
package/dist/tools/ai_agent.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { C as ChunkStrategy, b as CompressHtmlResult, c as CompressJsonResult, d as CompressMarkdownResult, e as CostEstimate, D as DedupeResult, f as DedupeStrategy, g as DiffEntry2, h as DiffOp2, i as DiffResult2, E as Entity2, j as EntityType2, k as ExtractJsonResult, l as ExtractKeywordsResult, m as ExtractUrlsResult, I as InjectionDetectResult,
|
|
1
|
+
export { C as ChunkStrategy, b as CompressHtmlResult, c as CompressJsonResult, d as CompressMarkdownResult, e as CostEstimate, D as DedupeResult, f as DedupeStrategy, g as DiffEntry2, h as DiffOp2, i as DiffResult2, E as Entity2, j as EntityType2, k as ExtractJsonResult, l as ExtractKeywordsResult, m as ExtractUrlsResult, F as FewShotExample, n as FewShotFormat, o as FewShotFormatResult, I as InjectionDetectResult, p as InjectionFinding, J as JsonBlock, q as JsonRepairResult, K as Keyword, M as MODEL_PRICING, r as MergeResult, s as MergeStrategy, t as ModelPricing, P as PiiDetectResult, u as PiiFinding, v as PiiType, R as RankedChunk, w as RelevanceResult, S as SanitizeResult, x as SecretDetectResult, y as SecretFinding, z as SecretType, A as SummaryResult, T as TableResult2, B as TextChunk, G as TokenEstimate, H as TokenEstimateResult, L as TrimResult, N as TrimStrategy, U as UrlMatch, V as ValidationError, O as ValidationResult, Q as VectorSimilarityResult, W as chunkText, X as compressHtml, Y as compressJson, Z as compressMarkdown, _ as deduplicateLines, $ as detectPii, a0 as detectPromptInjection, a1 as detectSecrets, a2 as diffJson, a3 as estimateCost, a4 as estimateTokens, a5 as expandQuery, a6 as extractEntities, a7 as extractJson, a8 as extractKeywords, a9 as extractTables, aa as extractUrls, ab as flattenJson, ac as formatFewShotExamples, ad as mergeJson, ae as redactPii, af as repairJson, ag as rerankChunks, ah as sanitizeHtml, ai as scoreRelevance, aj as summarizeForLlm, ak as trimToTokens, al as unflattenJson, am as validateJsonSchema, an as vectorSimilarity } from '../ai_agent-C1zudGgT.js';
|
package/dist/tools/ai_agent.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { MODEL_PRICING, chunkText, compressHtml, compressJson, compressMarkdown, deduplicateLines, detectPii, detectPromptInjection, detectSecrets, diffJson, estimateCost, estimateTokens, expandQuery, extractEntities, extractJson, extractKeywords, extractTables, extractUrls, flattenJson, mergeJson, redactPii, repairJson, rerankChunks, sanitizeHtml, scoreRelevance, summarizeForLlm, trimToTokens, unflattenJson, validateJsonSchema, vectorSimilarity } from '../chunk-
|
|
1
|
+
export { MODEL_PRICING, chunkText, compressHtml, compressJson, compressMarkdown, deduplicateLines, detectPii, detectPromptInjection, detectSecrets, diffJson, estimateCost, estimateTokens, expandQuery, extractEntities, extractJson, extractKeywords, extractTables, extractUrls, flattenJson, formatFewShotExamples, mergeJson, redactPii, repairJson, rerankChunks, sanitizeHtml, scoreRelevance, summarizeForLlm, trimToTokens, unflattenJson, validateJsonSchema, vectorSimilarity } from '../chunk-W3J7GZVQ.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/dist/tools/text.cjs
CHANGED
|
@@ -2538,6 +2538,71 @@ function calculateStringDistance(a, b, options) {
|
|
|
2538
2538
|
const similarity = maxLength === 0 ? 1 : Math.round((1 - distance / maxLength) * 1e4) / 1e4;
|
|
2539
2539
|
return { a, b, distance, similarity, maxLength, mode };
|
|
2540
2540
|
}
|
|
2541
|
+
function splitIntoSentencesForLengthDist(text) {
|
|
2542
|
+
const matches = text.match(/[^.!?]+[.!?]*/g);
|
|
2543
|
+
if (!matches) return [];
|
|
2544
|
+
return matches.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
2545
|
+
}
|
|
2546
|
+
function countWordsInSentence(sentence) {
|
|
2547
|
+
return (sentence.match(/[a-zA-Z']+/g) ?? []).length;
|
|
2548
|
+
}
|
|
2549
|
+
function analyzeSentenceLengths(text) {
|
|
2550
|
+
const sentences = splitIntoSentencesForLengthDist(text);
|
|
2551
|
+
const lengths = sentences.map(countWordsInSentence).filter((n) => n > 0);
|
|
2552
|
+
if (lengths.length === 0) {
|
|
2553
|
+
return {
|
|
2554
|
+
sentenceCount: 0,
|
|
2555
|
+
lengths: [],
|
|
2556
|
+
minLength: 0,
|
|
2557
|
+
maxLength: 0,
|
|
2558
|
+
meanLength: 0,
|
|
2559
|
+
medianLength: 0,
|
|
2560
|
+
stdDev: 0,
|
|
2561
|
+
coefficientOfVariation: 0,
|
|
2562
|
+
consistency: "No sentences to analyze",
|
|
2563
|
+
buckets: []
|
|
2564
|
+
};
|
|
2565
|
+
}
|
|
2566
|
+
const sentenceCount2 = lengths.length;
|
|
2567
|
+
const minLength = Math.min(...lengths);
|
|
2568
|
+
const maxLength = Math.max(...lengths);
|
|
2569
|
+
const meanLength = lengths.reduce((a, b) => a + b, 0) / sentenceCount2;
|
|
2570
|
+
const sorted = [...lengths].sort((a, b) => a - b);
|
|
2571
|
+
const mid = Math.floor(sorted.length / 2);
|
|
2572
|
+
const medianLength = sorted.length % 2 === 0 ? (sorted[mid - 1] + sorted[mid]) / 2 : sorted[mid];
|
|
2573
|
+
const variance = lengths.reduce((sum, n) => sum + (n - meanLength) ** 2, 0) / sentenceCount2;
|
|
2574
|
+
const stdDev = Math.sqrt(variance);
|
|
2575
|
+
const coefficientOfVariation = meanLength > 0 ? stdDev / meanLength : 0;
|
|
2576
|
+
let consistency;
|
|
2577
|
+
if (coefficientOfVariation < 0.3) consistency = "Consistent \u2014 sentence lengths vary little";
|
|
2578
|
+
else if (coefficientOfVariation < 0.6) consistency = "Moderate variation in sentence length";
|
|
2579
|
+
else consistency = "Highly variable sentence length";
|
|
2580
|
+
const bucketWidth = 5;
|
|
2581
|
+
const bucketCount = Math.max(1, Math.ceil(maxLength / bucketWidth));
|
|
2582
|
+
const buckets = [];
|
|
2583
|
+
for (let i = 0; i < bucketCount; i++) {
|
|
2584
|
+
const min = i * bucketWidth + 1;
|
|
2585
|
+
const max = (i + 1) * bucketWidth;
|
|
2586
|
+
buckets.push({ label: `${min}-${max}`, min, max, count: 0 });
|
|
2587
|
+
}
|
|
2588
|
+
for (const len of lengths) {
|
|
2589
|
+
const idx = Math.min(Math.floor((len - 1) / bucketWidth), bucketCount - 1);
|
|
2590
|
+
buckets[idx].count++;
|
|
2591
|
+
}
|
|
2592
|
+
const round2 = (n) => Math.round(n * 100) / 100;
|
|
2593
|
+
return {
|
|
2594
|
+
sentenceCount: sentenceCount2,
|
|
2595
|
+
lengths,
|
|
2596
|
+
minLength,
|
|
2597
|
+
maxLength,
|
|
2598
|
+
meanLength: round2(meanLength),
|
|
2599
|
+
medianLength: round2(medianLength),
|
|
2600
|
+
stdDev: round2(stdDev),
|
|
2601
|
+
coefficientOfVariation: round2(coefficientOfVariation),
|
|
2602
|
+
consistency,
|
|
2603
|
+
buckets
|
|
2604
|
+
};
|
|
2605
|
+
}
|
|
2541
2606
|
|
|
2542
2607
|
exports.CASE_FORMATS = CASE_FORMATS;
|
|
2543
2608
|
exports.DEFAULT_CONVERT_OPTIONS = DEFAULT_CONVERT_OPTIONS;
|
|
@@ -2545,6 +2610,7 @@ exports.ESCAPE_MODES = ESCAPE_MODES;
|
|
|
2545
2610
|
exports.LINE_OPS = LINE_OPS;
|
|
2546
2611
|
exports.MORSE_CODE = MORSE_CODE;
|
|
2547
2612
|
exports.addBorder = addBorder;
|
|
2613
|
+
exports.analyzeSentenceLengths = analyzeSentenceLengths;
|
|
2548
2614
|
exports.analyzeText = analyzeText;
|
|
2549
2615
|
exports.applyOp = applyOp;
|
|
2550
2616
|
exports.applyOps = applyOps;
|
package/dist/tools/text.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AsciiFont, a as AsciiOptions, C as CASE_FORMATS, b as CaseFormat, c as ConvertOptions, D as DEFAULT_CONVERT_OPTIONS, d as DiffFile, e as DiffHunk, f as DiffLine, g as DiffResult, h as DiffType, i as DiffViewerLine, E as ESCAPE_MODES, j as EscapeMode, F as FillerCategory, k as FillerMatch, l as FillerWordResult, L as LINE_OPS, m as LineOp, n as LineType, o as LoremUnit, M as MORSE_CODE, p as MarkdownResult, q as MorseOptions, P as ParsedDiff, r as ParsedTable, s as PassiveVoiceMatch, u as PassiveVoiceResult, v as PassiveVoiceSentence, R as ReadabilityResult, w as ReadabilityScore, S as
|
|
1
|
+
export { A as AsciiFont, a as AsciiOptions, C as CASE_FORMATS, b as CaseFormat, c as ConvertOptions, D as DEFAULT_CONVERT_OPTIONS, d as DiffFile, e as DiffHunk, f as DiffLine, g as DiffResult, h as DiffType, i as DiffViewerLine, E as ESCAPE_MODES, j as EscapeMode, F as FillerCategory, k as FillerMatch, l as FillerWordResult, L as LINE_OPS, m as LineOp, n as LineType, o as LoremUnit, M as MORSE_CODE, p as MarkdownResult, q as MorseOptions, P as ParsedDiff, r as ParsedTable, s as PassiveVoiceMatch, u as PassiveVoiceResult, v as PassiveVoiceSentence, R as ReadabilityResult, w as ReadabilityScore, S as SentenceLengthBucket, x as SentenceLengthDistribution, y as SlugSeparator, z as StringDistanceMode, B as StringDistanceResult, T as TableOptions, G as TextAnalysis, W as WordCountResult, H as addBorder, I as analyzeSentenceLengths, J as analyzeText, K as applyOp, N as applyOps, O as calculateStringDistance, Q as centerText, U as convertAll, V as convertCase, X as countWords, Y as csvToHtml, Z as csvToMarkdown, _ as detectDelimiter, $ as detectFillerWords, a0 as detectPassiveVoice, a1 as diffLines, a2 as diffLinesSimple, a3 as diffStats, a4 as escapeAll, a5 as escapeString, a6 as extractHeadings, a7 as formatReadingTime, a8 as generate, a9 as generateDiff, aa as generateHtmlTable, ab as generateMarkdownTable, ac as generateParagraphs, ad as generateSentences, ae as generateWords, af as getAvailableFonts, ag as getMorseForChar, ah as getMorseTiming, ai as htmlToMarkdown, aj as isValidMorse, ak as markdownToHtml, al as morseToText, am as numberToOrdinal, an as numberToRoman, ao as numberToWords, ap as ordinalWords, aq as parseDiff, ar as parseTableData, as as readabilityScore, at as renderMarkdown, au as romanToNumber, av as scoreReadability, aw as sentenceCount, ax as slugify, ay as slugifyAll, az as syllableCount, aA as textToAscii, aB as textToMorse, aC as unescapeString, aD as wordFrequency } from '../text-CA-zuD0C.cjs';
|
package/dist/tools/text.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AsciiFont, a as AsciiOptions, C as CASE_FORMATS, b as CaseFormat, c as ConvertOptions, D as DEFAULT_CONVERT_OPTIONS, d as DiffFile, e as DiffHunk, f as DiffLine, g as DiffResult, h as DiffType, i as DiffViewerLine, E as ESCAPE_MODES, j as EscapeMode, F as FillerCategory, k as FillerMatch, l as FillerWordResult, L as LINE_OPS, m as LineOp, n as LineType, o as LoremUnit, M as MORSE_CODE, p as MarkdownResult, q as MorseOptions, P as ParsedDiff, r as ParsedTable, s as PassiveVoiceMatch, u as PassiveVoiceResult, v as PassiveVoiceSentence, R as ReadabilityResult, w as ReadabilityScore, S as
|
|
1
|
+
export { A as AsciiFont, a as AsciiOptions, C as CASE_FORMATS, b as CaseFormat, c as ConvertOptions, D as DEFAULT_CONVERT_OPTIONS, d as DiffFile, e as DiffHunk, f as DiffLine, g as DiffResult, h as DiffType, i as DiffViewerLine, E as ESCAPE_MODES, j as EscapeMode, F as FillerCategory, k as FillerMatch, l as FillerWordResult, L as LINE_OPS, m as LineOp, n as LineType, o as LoremUnit, M as MORSE_CODE, p as MarkdownResult, q as MorseOptions, P as ParsedDiff, r as ParsedTable, s as PassiveVoiceMatch, u as PassiveVoiceResult, v as PassiveVoiceSentence, R as ReadabilityResult, w as ReadabilityScore, S as SentenceLengthBucket, x as SentenceLengthDistribution, y as SlugSeparator, z as StringDistanceMode, B as StringDistanceResult, T as TableOptions, G as TextAnalysis, W as WordCountResult, H as addBorder, I as analyzeSentenceLengths, J as analyzeText, K as applyOp, N as applyOps, O as calculateStringDistance, Q as centerText, U as convertAll, V as convertCase, X as countWords, Y as csvToHtml, Z as csvToMarkdown, _ as detectDelimiter, $ as detectFillerWords, a0 as detectPassiveVoice, a1 as diffLines, a2 as diffLinesSimple, a3 as diffStats, a4 as escapeAll, a5 as escapeString, a6 as extractHeadings, a7 as formatReadingTime, a8 as generate, a9 as generateDiff, aa as generateHtmlTable, ab as generateMarkdownTable, ac as generateParagraphs, ad as generateSentences, ae as generateWords, af as getAvailableFonts, ag as getMorseForChar, ah as getMorseTiming, ai as htmlToMarkdown, aj as isValidMorse, ak as markdownToHtml, al as morseToText, am as numberToOrdinal, an as numberToRoman, ao as numberToWords, ap as ordinalWords, aq as parseDiff, ar as parseTableData, as as readabilityScore, at as renderMarkdown, au as romanToNumber, av as scoreReadability, aw as sentenceCount, ax as slugify, ay as slugifyAll, az as syllableCount, aA as textToAscii, aB as textToMorse, aC as unescapeString, aD as wordFrequency } from '../text-CA-zuD0C.js';
|
package/dist/tools/text.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CASE_FORMATS, DEFAULT_CONVERT_OPTIONS, ESCAPE_MODES, LINE_OPS, MORSE_CODE, addBorder, analyzeText, applyOp, applyOps, calculateStringDistance, centerText, convertAll, convertCase, countWords, csvToHtml, csvToMarkdown, detectDelimiter, detectFillerWords, detectPassiveVoice, diffLines, diffLinesSimple, diffStats, escapeAll, escapeString, extractHeadings, formatReadingTime, generate, generateDiff, generateHtmlTable, generateMarkdownTable, generateParagraphs, generateSentences, generateWords, getAvailableFonts, getMorseForChar, getMorseTiming, htmlToMarkdown, isValidMorse, markdownToHtml, morseToText, numberToOrdinal, numberToRoman, numberToWords, ordinalWords, parseDiff, parseTableData, readabilityScore, renderMarkdown, romanToNumber, scoreReadability, sentenceCount, slugify, slugifyAll, syllableCount, textToAscii, textToMorse, unescapeString, wordFrequency } from '../chunk-
|
|
1
|
+
export { CASE_FORMATS, DEFAULT_CONVERT_OPTIONS, ESCAPE_MODES, LINE_OPS, MORSE_CODE, addBorder, analyzeSentenceLengths, analyzeText, applyOp, applyOps, calculateStringDistance, centerText, convertAll, convertCase, countWords, csvToHtml, csvToMarkdown, detectDelimiter, detectFillerWords, detectPassiveVoice, diffLines, diffLinesSimple, diffStats, escapeAll, escapeString, extractHeadings, formatReadingTime, generate, generateDiff, generateHtmlTable, generateMarkdownTable, generateParagraphs, generateSentences, generateWords, getAvailableFonts, getMorseForChar, getMorseTiming, htmlToMarkdown, isValidMorse, markdownToHtml, morseToText, numberToOrdinal, numberToRoman, numberToWords, ordinalWords, parseDiff, parseTableData, readabilityScore, renderMarkdown, romanToNumber, scoreReadability, sentenceCount, slugify, slugifyAll, syllableCount, textToAscii, textToMorse, unescapeString, wordFrequency } from '../chunk-H2USEUHD.js';
|
|
2
2
|
import '../chunk-MLKGABMK.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@utilix-tech/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.0",
|
|
4
4
|
"description": "154+ developer utility tools for Node.js: JSON, encoding, hashing, color, CSS, network and more. Runs locally, no API key required.",
|
|
5
5
|
"author": "Utilix <hello@utilix.tech>",
|
|
6
6
|
"license": "MIT",
|