@vertana/core 0.2.0-dev.15 → 0.2.0-dev.26

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/README.md CHANGED
@@ -18,10 +18,10 @@ orchestration.
18
18
  > This core package is for when you need fine-grained control over the
19
19
  > translation pipeline.
20
20
 
21
- [JSR]: https://jsr.io/@vertana/core
22
21
  [JSR badge]: https://jsr.io/badges/@vertana/core
23
- [npm]: https://www.npmjs.com/package/@vertana/core
22
+ [JSR]: https://jsr.io/@vertana/core
24
23
  [npm badge]: https://img.shields.io/npm/v/@vertana/core?logo=npm
24
+ [npm]: https://www.npmjs.com/package/@vertana/core
25
25
  [Vertana]: https://vertana.org/
26
26
 
27
27
 
@@ -89,7 +89,6 @@ Key modules
89
89
  multiple models
90
90
  - *Glossary*: `@vertana/core/glossary` — Dynamic term accumulation
91
91
 
92
-
93
92
  For more resources, see the [docs].
94
93
 
95
94
  [docs]: https://vertana.org/
package/dist/glossary.cjs CHANGED
@@ -0,0 +1,48 @@
1
+
2
+ //#region src/glossary.ts
3
+ /**
4
+ * Creates a glossary entry that preserves the original term without translation.
5
+ * Use this for brand names, technical terms, or any text that should remain as-is.
6
+ *
7
+ * @param term The term to preserve in its original form.
8
+ * @param options Optional settings including context for disambiguation.
9
+ * @returns A glossary entry with the same value for both original and translated.
10
+ * @since 0.2.0
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * glossary: [
15
+ * keep("React"),
16
+ * keep("TypeScript", { context: "programming language" }),
17
+ * ]
18
+ * ```
19
+ */
20
+ function keep(term, options) {
21
+ return {
22
+ original: term,
23
+ translated: term,
24
+ ...options
25
+ };
26
+ }
27
+ /**
28
+ * Alias for {@link keep}. Creates a glossary entry that preserves a proper noun
29
+ * (brand name, product name, etc.) without translation.
30
+ *
31
+ * @param term The proper noun to preserve.
32
+ * @param options Optional settings including context for disambiguation.
33
+ * @returns A glossary entry with the same value for both original and translated.
34
+ * @since 0.2.0
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * glossary: [
39
+ * properNoun("React"),
40
+ * properNoun("TypeScript"),
41
+ * ]
42
+ * ```
43
+ */
44
+ const properNoun = keep;
45
+
46
+ //#endregion
47
+ exports.keep = keep;
48
+ exports.properNoun = properNoun;
@@ -21,5 +21,46 @@ interface GlossaryEntry {
21
21
  */
22
22
  readonly context?: string;
23
23
  }
24
+ /**
25
+ * Options for the {@link keep} function.
26
+ * @since 0.2.0
27
+ */
28
+ type KeepOptions = Omit<GlossaryEntry, "original" | "translated">;
29
+ /**
30
+ * Creates a glossary entry that preserves the original term without translation.
31
+ * Use this for brand names, technical terms, or any text that should remain as-is.
32
+ *
33
+ * @param term The term to preserve in its original form.
34
+ * @param options Optional settings including context for disambiguation.
35
+ * @returns A glossary entry with the same value for both original and translated.
36
+ * @since 0.2.0
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * glossary: [
41
+ * keep("React"),
42
+ * keep("TypeScript", { context: "programming language" }),
43
+ * ]
44
+ * ```
45
+ */
46
+ declare function keep(term: string, options?: KeepOptions): GlossaryEntry;
47
+ /**
48
+ * Alias for {@link keep}. Creates a glossary entry that preserves a proper noun
49
+ * (brand name, product name, etc.) without translation.
50
+ *
51
+ * @param term The proper noun to preserve.
52
+ * @param options Optional settings including context for disambiguation.
53
+ * @returns A glossary entry with the same value for both original and translated.
54
+ * @since 0.2.0
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * glossary: [
59
+ * properNoun("React"),
60
+ * properNoun("TypeScript"),
61
+ * ]
62
+ * ```
63
+ */
64
+ declare const properNoun: typeof keep;
24
65
  //#endregion
25
- export { Glossary, GlossaryEntry };
66
+ export { Glossary, GlossaryEntry, KeepOptions, keep, properNoun };
@@ -21,5 +21,46 @@ interface GlossaryEntry {
21
21
  */
22
22
  readonly context?: string;
23
23
  }
24
+ /**
25
+ * Options for the {@link keep} function.
26
+ * @since 0.2.0
27
+ */
28
+ type KeepOptions = Omit<GlossaryEntry, "original" | "translated">;
29
+ /**
30
+ * Creates a glossary entry that preserves the original term without translation.
31
+ * Use this for brand names, technical terms, or any text that should remain as-is.
32
+ *
33
+ * @param term The term to preserve in its original form.
34
+ * @param options Optional settings including context for disambiguation.
35
+ * @returns A glossary entry with the same value for both original and translated.
36
+ * @since 0.2.0
37
+ *
38
+ * @example
39
+ * ```typescript
40
+ * glossary: [
41
+ * keep("React"),
42
+ * keep("TypeScript", { context: "programming language" }),
43
+ * ]
44
+ * ```
45
+ */
46
+ declare function keep(term: string, options?: KeepOptions): GlossaryEntry;
47
+ /**
48
+ * Alias for {@link keep}. Creates a glossary entry that preserves a proper noun
49
+ * (brand name, product name, etc.) without translation.
50
+ *
51
+ * @param term The proper noun to preserve.
52
+ * @param options Optional settings including context for disambiguation.
53
+ * @returns A glossary entry with the same value for both original and translated.
54
+ * @since 0.2.0
55
+ *
56
+ * @example
57
+ * ```typescript
58
+ * glossary: [
59
+ * properNoun("React"),
60
+ * properNoun("TypeScript"),
61
+ * ]
62
+ * ```
63
+ */
64
+ declare const properNoun: typeof keep;
24
65
  //#endregion
25
- export { Glossary, GlossaryEntry };
66
+ export { Glossary, GlossaryEntry, KeepOptions, keep, properNoun };
package/dist/glossary.js CHANGED
@@ -0,0 +1,46 @@
1
+ //#region src/glossary.ts
2
+ /**
3
+ * Creates a glossary entry that preserves the original term without translation.
4
+ * Use this for brand names, technical terms, or any text that should remain as-is.
5
+ *
6
+ * @param term The term to preserve in its original form.
7
+ * @param options Optional settings including context for disambiguation.
8
+ * @returns A glossary entry with the same value for both original and translated.
9
+ * @since 0.2.0
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * glossary: [
14
+ * keep("React"),
15
+ * keep("TypeScript", { context: "programming language" }),
16
+ * ]
17
+ * ```
18
+ */
19
+ function keep(term, options) {
20
+ return {
21
+ original: term,
22
+ translated: term,
23
+ ...options
24
+ };
25
+ }
26
+ /**
27
+ * Alias for {@link keep}. Creates a glossary entry that preserves a proper noun
28
+ * (brand name, product name, etc.) without translation.
29
+ *
30
+ * @param term The proper noun to preserve.
31
+ * @param options Optional settings including context for disambiguation.
32
+ * @returns A glossary entry with the same value for both original and translated.
33
+ * @since 0.2.0
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * glossary: [
38
+ * properNoun("React"),
39
+ * properNoun("TypeScript"),
40
+ * ]
41
+ * ```
42
+ */
43
+ const properNoun = keep;
44
+
45
+ //#endregion
46
+ export { keep, properNoun };
package/dist/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  const require_context = require('./context.cjs');
2
2
  const require_evaluation = require('./evaluation.cjs');
3
3
  const require_chunking = require('./chunking.cjs');
4
+ const require_glossary = require('./glossary.cjs');
4
5
  const require_tokens = require('./tokens.cjs');
5
6
  const require_markdown = require('./markdown.cjs');
6
7
  const require_html = require('./html.cjs');
@@ -33,7 +34,9 @@ exports.extractTitle = require_prompt.extractTitle;
33
34
  exports.gatherRequiredContext = require_context.gatherRequiredContext;
34
35
  exports.getDefaultChunker = require_chunking.getDefaultChunker;
35
36
  exports.getLanguageName = require_prompt.getLanguageName;
37
+ exports.keep = require_glossary.keep;
36
38
  exports.maxByValue = require_accumulator.maxByValue;
39
+ exports.properNoun = require_glossary.properNoun;
37
40
  exports.refineChunks = require_refine.refineChunks;
38
41
  exports.selectBest = require_select.selectBest;
39
42
  exports.translateChunks = require_translate.translateChunks;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Glossary, GlossaryEntry } from "./glossary.cjs";
1
+ import { Glossary, GlossaryEntry, KeepOptions, keep, properNoun } from "./glossary.cjs";
2
2
  import { MediaType, SystemPromptOptions, TranslatedChunk, TranslationTone, buildSystemPrompt, buildUserPrompt, buildUserPromptWithContext, extractTitle, getLanguageName } from "./prompt.cjs";
3
3
  import { DynamicGlossaryOptions, RefinementOptions, TranslateChunksComplete, TranslateChunksEvent, TranslateChunksOptions, TranslatedChunkEvent, translateChunks } from "./translate.cjs";
4
4
  import { AccumulatorState, accumulateEvent, createInitialAccumulatorState, maxByValue } from "./accumulator.cjs";
@@ -14,4 +14,4 @@ import { BoundaryEvaluation, BoundaryIssue, RefineChunksOptions, RefineChunksRes
14
14
  import { Candidate, RankedCandidate, SelectBestOptions, SelectBestResult, selectBest } from "./select.cjs";
15
15
  import { ExtractTermsOptions, extractTerms } from "./terms.cjs";
16
16
  import { createToolSet } from "./tools.cjs";
17
- export { type AccumulatorState, type AdaptiveContextWindow, type BoundaryEvaluation, type BoundaryIssue, type Candidate, type Chunk, type ChunkTextOptions, type ChunkType, type Chunker, type ChunkerOptions, type ContextResult, type ContextSource, type ContextSourceFactory, type ContextSourceGatherOptions, type ContextWindow, type DynamicGlossaryOptions, type EvaluateOptions, type EvaluationResult, type EvaluatorOptions, type ExplicitContextWindow, type ExtractTermsOptions, type Glossary, type GlossaryEntry, type HtmlChunkerOptions, type MediaType, type PassiveContextSource, type RankedCandidate, type RefineChunksOptions, type RefineChunksResult, type RefineIteration, type RefinementOptions, type RequiredContextSource, type SelectBestOptions, type SelectBestResult, type SystemPromptOptions, type TokenCounter, type TranslateChunksComplete, type TranslateChunksEvent, type TranslateChunksOptions, type TranslatedChunk, type TranslatedChunkEvent, type TranslationEvaluator, type TranslationIssue, type TranslationIssueLocation, type TranslationIssueType, type TranslationTone, accumulateEvent, buildSystemPrompt, buildUserPrompt, buildUserPromptWithContext, chunkText, combineContextResults, countTokens, createDefaultTokenCounter, createHtmlChunker, createInitialAccumulatorState, createMarkdownChunker, createPlainTextChunker, createToolSet, evaluate, evaluateBoundary, extractTerms, extractTitle, gatherRequiredContext, getDefaultChunker, getLanguageName, maxByValue, refineChunks, selectBest, translateChunks };
17
+ export { type AccumulatorState, type AdaptiveContextWindow, type BoundaryEvaluation, type BoundaryIssue, type Candidate, type Chunk, type ChunkTextOptions, type ChunkType, type Chunker, type ChunkerOptions, type ContextResult, type ContextSource, type ContextSourceFactory, type ContextSourceGatherOptions, type ContextWindow, type DynamicGlossaryOptions, type EvaluateOptions, type EvaluationResult, type EvaluatorOptions, type ExplicitContextWindow, type ExtractTermsOptions, type Glossary, type GlossaryEntry, type HtmlChunkerOptions, type KeepOptions, type MediaType, type PassiveContextSource, type RankedCandidate, type RefineChunksOptions, type RefineChunksResult, type RefineIteration, type RefinementOptions, type RequiredContextSource, type SelectBestOptions, type SelectBestResult, type SystemPromptOptions, type TokenCounter, type TranslateChunksComplete, type TranslateChunksEvent, type TranslateChunksOptions, type TranslatedChunk, type TranslatedChunkEvent, type TranslationEvaluator, type TranslationIssue, type TranslationIssueLocation, type TranslationIssueType, type TranslationTone, accumulateEvent, buildSystemPrompt, buildUserPrompt, buildUserPromptWithContext, chunkText, combineContextResults, countTokens, createDefaultTokenCounter, createHtmlChunker, createInitialAccumulatorState, createMarkdownChunker, createPlainTextChunker, createToolSet, evaluate, evaluateBoundary, extractTerms, extractTitle, gatherRequiredContext, getDefaultChunker, getLanguageName, keep, maxByValue, properNoun, refineChunks, selectBest, translateChunks };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Glossary, GlossaryEntry } from "./glossary.js";
1
+ import { Glossary, GlossaryEntry, KeepOptions, keep, properNoun } from "./glossary.js";
2
2
  import { MediaType, SystemPromptOptions, TranslatedChunk, TranslationTone, buildSystemPrompt, buildUserPrompt, buildUserPromptWithContext, extractTitle, getLanguageName } from "./prompt.js";
3
3
  import { DynamicGlossaryOptions, RefinementOptions, TranslateChunksComplete, TranslateChunksEvent, TranslateChunksOptions, TranslatedChunkEvent, translateChunks } from "./translate.js";
4
4
  import { AccumulatorState, accumulateEvent, createInitialAccumulatorState, maxByValue } from "./accumulator.js";
@@ -14,4 +14,4 @@ import { BoundaryEvaluation, BoundaryIssue, RefineChunksOptions, RefineChunksRes
14
14
  import { Candidate, RankedCandidate, SelectBestOptions, SelectBestResult, selectBest } from "./select.js";
15
15
  import { ExtractTermsOptions, extractTerms } from "./terms.js";
16
16
  import { createToolSet } from "./tools.js";
17
- export { type AccumulatorState, type AdaptiveContextWindow, type BoundaryEvaluation, type BoundaryIssue, type Candidate, type Chunk, type ChunkTextOptions, type ChunkType, type Chunker, type ChunkerOptions, type ContextResult, type ContextSource, type ContextSourceFactory, type ContextSourceGatherOptions, type ContextWindow, type DynamicGlossaryOptions, type EvaluateOptions, type EvaluationResult, type EvaluatorOptions, type ExplicitContextWindow, type ExtractTermsOptions, type Glossary, type GlossaryEntry, type HtmlChunkerOptions, type MediaType, type PassiveContextSource, type RankedCandidate, type RefineChunksOptions, type RefineChunksResult, type RefineIteration, type RefinementOptions, type RequiredContextSource, type SelectBestOptions, type SelectBestResult, type SystemPromptOptions, type TokenCounter, type TranslateChunksComplete, type TranslateChunksEvent, type TranslateChunksOptions, type TranslatedChunk, type TranslatedChunkEvent, type TranslationEvaluator, type TranslationIssue, type TranslationIssueLocation, type TranslationIssueType, type TranslationTone, accumulateEvent, buildSystemPrompt, buildUserPrompt, buildUserPromptWithContext, chunkText, combineContextResults, countTokens, createDefaultTokenCounter, createHtmlChunker, createInitialAccumulatorState, createMarkdownChunker, createPlainTextChunker, createToolSet, evaluate, evaluateBoundary, extractTerms, extractTitle, gatherRequiredContext, getDefaultChunker, getLanguageName, maxByValue, refineChunks, selectBest, translateChunks };
17
+ export { type AccumulatorState, type AdaptiveContextWindow, type BoundaryEvaluation, type BoundaryIssue, type Candidate, type Chunk, type ChunkTextOptions, type ChunkType, type Chunker, type ChunkerOptions, type ContextResult, type ContextSource, type ContextSourceFactory, type ContextSourceGatherOptions, type ContextWindow, type DynamicGlossaryOptions, type EvaluateOptions, type EvaluationResult, type EvaluatorOptions, type ExplicitContextWindow, type ExtractTermsOptions, type Glossary, type GlossaryEntry, type HtmlChunkerOptions, type KeepOptions, type MediaType, type PassiveContextSource, type RankedCandidate, type RefineChunksOptions, type RefineChunksResult, type RefineIteration, type RefinementOptions, type RequiredContextSource, type SelectBestOptions, type SelectBestResult, type SystemPromptOptions, type TokenCounter, type TranslateChunksComplete, type TranslateChunksEvent, type TranslateChunksOptions, type TranslatedChunk, type TranslatedChunkEvent, type TranslationEvaluator, type TranslationIssue, type TranslationIssueLocation, type TranslationIssueType, type TranslationTone, accumulateEvent, buildSystemPrompt, buildUserPrompt, buildUserPromptWithContext, chunkText, combineContextResults, countTokens, createDefaultTokenCounter, createHtmlChunker, createInitialAccumulatorState, createMarkdownChunker, createPlainTextChunker, createToolSet, evaluate, evaluateBoundary, extractTerms, extractTitle, gatherRequiredContext, getDefaultChunker, getLanguageName, keep, maxByValue, properNoun, refineChunks, selectBest, translateChunks };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { combineContextResults, gatherRequiredContext } from "./context.js";
2
2
  import { evaluate } from "./evaluation.js";
3
3
  import { chunkText, getDefaultChunker } from "./chunking.js";
4
+ import { keep, properNoun } from "./glossary.js";
4
5
  import { countTokens, createDefaultTokenCounter } from "./tokens.js";
5
6
  import { createMarkdownChunker } from "./markdown.js";
6
7
  import { createHtmlChunker } from "./html.js";
@@ -13,4 +14,4 @@ import { createToolSet } from "./tools.js";
13
14
  import { translateChunks } from "./translate.js";
14
15
  import { accumulateEvent, createInitialAccumulatorState, maxByValue } from "./accumulator.js";
15
16
 
16
- export { accumulateEvent, buildSystemPrompt, buildUserPrompt, buildUserPromptWithContext, chunkText, combineContextResults, countTokens, createDefaultTokenCounter, createHtmlChunker, createInitialAccumulatorState, createMarkdownChunker, createPlainTextChunker, createToolSet, evaluate, evaluateBoundary, extractTerms, extractTitle, gatherRequiredContext, getDefaultChunker, getLanguageName, maxByValue, refineChunks, selectBest, translateChunks };
17
+ export { accumulateEvent, buildSystemPrompt, buildUserPrompt, buildUserPromptWithContext, chunkText, combineContextResults, countTokens, createDefaultTokenCounter, createHtmlChunker, createInitialAccumulatorState, createMarkdownChunker, createPlainTextChunker, createToolSet, evaluate, evaluateBoundary, extractTerms, extractTitle, gatherRequiredContext, getDefaultChunker, getLanguageName, keep, maxByValue, properNoun, refineChunks, selectBest, translateChunks };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertana/core",
3
- "version": "0.2.0-dev.15+f34ed253",
3
+ "version": "0.2.0-dev.26+0ddb13af",
4
4
  "description": "The core library for Vertana, an LLM-powered natural language translation library",
5
5
  "keywords": [
6
6
  "LLM",