@sharpee/lang-en-us 1.2.0 → 2.0.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/actions/about.d.ts.map +1 -1
- package/actions/about.js +8 -8
- package/actions/about.js.map +1 -1
- package/actions/again.d.ts.map +1 -1
- package/actions/again.js.map +1 -1
- package/actions/answering.d.ts.map +1 -1
- package/actions/answering.js.map +1 -1
- package/actions/asking.d.ts.map +1 -1
- package/actions/asking.js +14 -14
- package/actions/asking.js.map +1 -1
- package/actions/attacking.d.ts.map +1 -1
- package/actions/attacking.js +51 -51
- package/actions/attacking.js.map +1 -1
- package/actions/climbing.d.ts.map +1 -1
- package/actions/climbing.js +4 -4
- package/actions/climbing.js.map +1 -1
- package/actions/closing.d.ts.map +1 -1
- package/actions/closing.js +5 -5
- package/actions/closing.js.map +1 -1
- package/actions/drinking.d.ts.map +1 -1
- package/actions/drinking.js +20 -20
- package/actions/drinking.js.map +1 -1
- package/actions/dropping.d.ts.map +1 -1
- package/actions/dropping.js +3 -3
- package/actions/dropping.js.map +1 -1
- package/actions/eating.d.ts.map +1 -1
- package/actions/eating.js +20 -20
- package/actions/eating.js.map +1 -1
- package/actions/entering.d.ts.map +1 -1
- package/actions/entering.js +10 -10
- package/actions/entering.js.map +1 -1
- package/actions/examining.d.ts.map +1 -1
- package/actions/examining.js +28 -23
- package/actions/examining.js.map +1 -1
- package/actions/exiting.d.ts.map +1 -1
- package/actions/exiting.js +4 -4
- package/actions/exiting.js.map +1 -1
- package/actions/giving.d.ts.map +1 -1
- package/actions/giving.js +12 -12
- package/actions/giving.js.map +1 -1
- package/actions/going.d.ts.map +1 -1
- package/actions/going.js +7 -7
- package/actions/going.js.map +1 -1
- package/actions/help.d.ts.map +1 -1
- package/actions/help.js +2 -2
- package/actions/help.js.map +1 -1
- package/actions/hiding.d.ts.map +1 -1
- package/actions/hiding.js.map +1 -1
- package/actions/index.d.ts.map +1 -1
- package/actions/index.js.map +1 -1
- package/actions/inserting.d.ts.map +1 -1
- package/actions/inserting.js +8 -8
- package/actions/inserting.js.map +1 -1
- package/actions/inventory.d.ts.map +1 -1
- package/actions/inventory.js.map +1 -1
- package/actions/listening.d.ts.map +1 -1
- package/actions/listening.js +7 -7
- package/actions/listening.js.map +1 -1
- package/actions/locking.d.ts.map +1 -1
- package/actions/locking.js +8 -8
- package/actions/locking.js.map +1 -1
- package/actions/looking.d.ts.map +1 -1
- package/actions/looking.js +5 -5
- package/actions/looking.js.map +1 -1
- package/actions/lowering.d.ts.map +1 -1
- package/actions/lowering.js +2 -2
- package/actions/lowering.js.map +1 -1
- package/actions/opening.d.ts.map +1 -1
- package/actions/opening.js +7 -7
- package/actions/opening.js.map +1 -1
- package/actions/pulling.d.ts.map +1 -1
- package/actions/pulling.js +19 -19
- package/actions/pulling.js.map +1 -1
- package/actions/pushing.d.ts.map +1 -1
- package/actions/pushing.js +14 -14
- package/actions/pushing.js.map +1 -1
- package/actions/putting.d.ts.map +1 -1
- package/actions/putting.js +12 -12
- package/actions/putting.js.map +1 -1
- package/actions/quitting.d.ts.map +1 -1
- package/actions/quitting.js.map +1 -1
- package/actions/raising.d.ts.map +1 -1
- package/actions/raising.js +2 -2
- package/actions/raising.js.map +1 -1
- package/actions/reading.d.ts.map +1 -1
- package/actions/reading.js +7 -7
- package/actions/reading.js.map +1 -1
- package/actions/removing.d.ts.map +1 -1
- package/actions/removing.js +8 -8
- package/actions/removing.js.map +1 -1
- package/actions/restoring.d.ts.map +1 -1
- package/actions/restoring.js +6 -6
- package/actions/restoring.js.map +1 -1
- package/actions/saving.d.ts.map +1 -1
- package/actions/saving.js +6 -6
- package/actions/saving.js.map +1 -1
- package/actions/scoring.d.ts.map +1 -1
- package/actions/scoring.js.map +1 -1
- package/actions/searching.d.ts.map +1 -1
- package/actions/searching.js +7 -7
- package/actions/searching.js.map +1 -1
- package/actions/showing.d.ts.map +1 -1
- package/actions/showing.js +11 -11
- package/actions/showing.js.map +1 -1
- package/actions/sleeping.d.ts.map +1 -1
- package/actions/sleeping.js.map +1 -1
- package/actions/smelling.d.ts.map +1 -1
- package/actions/smelling.js +10 -10
- package/actions/smelling.js.map +1 -1
- package/actions/switching-off.d.ts.map +1 -1
- package/actions/switching-off.js +12 -12
- package/actions/switching-off.js.map +1 -1
- package/actions/switching-on.d.ts.map +1 -1
- package/actions/switching-on.js +12 -12
- package/actions/switching-on.js.map +1 -1
- package/actions/taking-off.d.ts.map +1 -1
- package/actions/taking-off.js +4 -4
- package/actions/taking-off.js.map +1 -1
- package/actions/taking.d.ts.map +1 -1
- package/actions/taking.js +5 -5
- package/actions/taking.js.map +1 -1
- package/actions/talking.d.ts.map +1 -1
- package/actions/talking.js +15 -15
- package/actions/talking.js.map +1 -1
- package/actions/telling.d.ts.map +1 -1
- package/actions/telling.js +13 -13
- package/actions/telling.js.map +1 -1
- package/actions/throwing.d.ts.map +1 -1
- package/actions/throwing.js +21 -21
- package/actions/throwing.js.map +1 -1
- package/actions/touching.d.ts.map +1 -1
- package/actions/touching.js +20 -20
- package/actions/touching.js.map +1 -1
- package/actions/turning.d.ts.map +1 -1
- package/actions/turning.js +24 -24
- package/actions/turning.js.map +1 -1
- package/actions/undoing.d.ts.map +1 -1
- package/actions/undoing.js.map +1 -1
- package/actions/unlocking.d.ts.map +1 -1
- package/actions/unlocking.js +8 -8
- package/actions/unlocking.js.map +1 -1
- package/actions/version.d.ts.map +1 -1
- package/actions/version.js +3 -3
- package/actions/version.js.map +1 -1
- package/actions/waiting.d.ts.map +1 -1
- package/actions/waiting.js +1 -1
- package/actions/waiting.js.map +1 -1
- package/actions/wearing.d.ts.map +1 -1
- package/actions/wearing.js +5 -5
- package/actions/wearing.js.map +1 -1
- package/assembler/english-assembler.d.ts +66 -0
- package/assembler/english-assembler.d.ts.map +1 -0
- package/assembler/english-assembler.js +806 -0
- package/assembler/english-assembler.js.map +1 -0
- package/assembler/errors.d.ts +23 -0
- package/assembler/errors.d.ts.map +1 -0
- package/assembler/errors.js +35 -0
- package/assembler/errors.js.map +1 -0
- package/assembler/index.d.ts +10 -0
- package/assembler/index.d.ts.map +1 -0
- package/assembler/index.js +17 -0
- package/assembler/index.js.map +1 -0
- package/data/events.d.ts.map +1 -1
- package/data/events.js +11 -11
- package/data/events.js.map +1 -1
- package/data/messages.d.ts.map +1 -1
- package/data/messages.js +1 -1
- package/data/messages.js.map +1 -1
- package/data/verbs.d.ts.map +1 -1
- package/data/verbs.js.map +1 -1
- package/data/words.d.ts.map +1 -1
- package/data/words.js.map +1 -1
- package/formatters/article.d.ts.map +1 -1
- package/formatters/article.js.map +1 -1
- package/formatters/index.d.ts.map +1 -1
- package/formatters/index.js.map +1 -1
- package/formatters/list.d.ts.map +1 -1
- package/formatters/list.js.map +1 -1
- package/formatters/registry.d.ts.map +1 -1
- package/formatters/registry.js.map +1 -1
- package/formatters/text.d.ts.map +1 -1
- package/formatters/text.js.map +1 -1
- package/formatters/types.d.ts.map +1 -1
- package/formatters/types.js.map +1 -1
- package/formatters/verb.d.ts.map +1 -1
- package/formatters/verb.js.map +1 -1
- package/grammar.d.ts.map +1 -1
- package/grammar.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +4 -1
- package/index.js.map +1 -1
- package/language-provider.d.ts +44 -24
- package/language-provider.d.ts.map +1 -1
- package/language-provider.js +83 -40
- package/language-provider.js.map +1 -1
- package/npc/conversation.d.ts +5 -0
- package/npc/conversation.d.ts.map +1 -1
- package/npc/conversation.js +24 -19
- package/npc/conversation.js.map +1 -1
- package/npc/index.d.ts.map +1 -1
- package/npc/index.js.map +1 -1
- package/npc/influence.d.ts.map +1 -1
- package/npc/influence.js +4 -4
- package/npc/influence.js.map +1 -1
- package/npc/npc.d.ts +6 -0
- package/npc/npc.d.ts.map +1 -1
- package/npc/npc.js +39 -33
- package/npc/npc.js.map +1 -1
- package/npc/propagation.d.ts.map +1 -1
- package/npc/propagation.js +6 -6
- package/npc/propagation.js.map +1 -1
- package/number-words.d.ts +18 -0
- package/number-words.d.ts.map +1 -1
- package/number-words.js +77 -0
- package/number-words.js.map +1 -1
- package/package.json +3 -3
- package/parser/index.d.ts +8 -0
- package/parser/index.d.ts.map +1 -0
- package/parser/index.js +13 -0
- package/parser/index.js.map +1 -0
- package/parser/parse-phrase-template.d.ts +62 -0
- package/parser/parse-phrase-template.d.ts.map +1 -0
- package/parser/parse-phrase-template.js +384 -0
- package/parser/parse-phrase-template.js.map +1 -0
- package/perspective/index.d.ts.map +1 -1
- package/perspective/index.js.map +1 -1
- package/perspective/placeholder-resolver.d.ts +1 -1
- package/perspective/placeholder-resolver.d.ts.map +1 -1
- package/perspective/placeholder-resolver.js +12 -1
- package/perspective/placeholder-resolver.js.map +1 -1
- package/pluralize.d.ts.map +1 -1
- package/pluralize.js.map +1 -1
- package/sound-messages.d.ts +8 -8
- package/sound-messages.d.ts.map +1 -1
- package/sound-messages.js +8 -8
- package/sound-messages.js.map +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file English Assembler — realizes a phrase tree to text blocks (ADR-192 §4).
|
|
3
|
+
*
|
|
4
|
+
* Purpose: the single English-locale component that walks a `Phrase` tree and
|
|
5
|
+
* is the SOLE authority for every cross-cutting correctness concern — article,
|
|
6
|
+
* agreement, punctuation, whitespace, reference, and case. It replaces the
|
|
7
|
+
* left-to-right formatter chain (`applyFormatters`) whose early collapse to a
|
|
8
|
+
* bare string lost the metadata neighbours need to agree against.
|
|
9
|
+
*
|
|
10
|
+
* Public interface: `EnglishAssembler` (implements `Assembler`),
|
|
11
|
+
* `ASSEMBLER_DEFAULT_BLOCK_KEY`, and the standalone `capitalizeSentenceStart`
|
|
12
|
+
* case-authority helper.
|
|
13
|
+
*
|
|
14
|
+
* Owner context: `@sharpee/lang-en-us` — English realization. The ADR-190 list
|
|
15
|
+
* formatter logic is reproduced here in the `PhraseList` case (the old
|
|
16
|
+
* `formatters/list.ts` is retired in Phase 3, not called from here).
|
|
17
|
+
*
|
|
18
|
+
* INVARIANT (ADR-192 §7): `realize` is a pure function of `(tree, ctx)` GIVEN the
|
|
19
|
+
* `textState` snapshot — the same tree, context, and counters yield byte-identical
|
|
20
|
+
* output. No clocks, no `Math.random`. The one declared state transition is a
|
|
21
|
+
* `Choice` advancing its `textState` counter (ADR-196 §3) — seeded, deterministic.
|
|
22
|
+
*
|
|
23
|
+
* All if-domain kinds are realized here: the foundational kinds (Literal,
|
|
24
|
+
* NounPhrase, PhraseList, Sequence, Empty) plus the `Verb` (199), `Verbatim`
|
|
25
|
+
* (200), `Numeral` (198), `Pronoun` (197), `Contents` (194), `Slot` (195), and
|
|
26
|
+
* `Optional` / `Choice` (196) atoms. `PhraseNotImplementedError` is now only a
|
|
27
|
+
* defensive guard against a future unhandled kind.
|
|
28
|
+
*/
|
|
29
|
+
import { Assembler, Phrase, RenderContext } from '@sharpee/if-domain';
|
|
30
|
+
import { ITextBlock } from '@sharpee/text-blocks';
|
|
31
|
+
/**
|
|
32
|
+
* Default channel key for a realized tree. Phase 2 emits one block; the report
|
|
33
|
+
* layer (ADR-192 §6, Phase 4) assigns real channel keys (room.name, …) as it
|
|
34
|
+
* wires per-event trees.
|
|
35
|
+
*/
|
|
36
|
+
export declare const ASSEMBLER_DEFAULT_BLOCK_KEY: "action.result";
|
|
37
|
+
/**
|
|
38
|
+
* Capitalize the first alphabetic character of a sentence. Exposed as the Case
|
|
39
|
+
* authority; the explicit `{capitalize …}` template hint is wired to it by the
|
|
40
|
+
* parser in Phase 3 (ADR-192 §5). Not auto-applied — realization preserves the
|
|
41
|
+
* author's case unless capitalization is requested.
|
|
42
|
+
*
|
|
43
|
+
* @param text the realized text
|
|
44
|
+
* @returns the text with its first letter upper-cased
|
|
45
|
+
*/
|
|
46
|
+
export declare function capitalizeSentenceStart(text: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* The English Assembler. Realizes a phrase tree to text blocks under the default
|
|
49
|
+
* channel key; the report layer re-keys per channel.
|
|
50
|
+
*/
|
|
51
|
+
export declare class EnglishAssembler implements Assembler {
|
|
52
|
+
/**
|
|
53
|
+
* Realize a phrase tree to text blocks.
|
|
54
|
+
*
|
|
55
|
+
* Newlines in the realized text are lifted to block boundaries (no block's
|
|
56
|
+
* content carries `\n`); horizontal whitespace is collapsed per block, except
|
|
57
|
+
* in verbatim runs. A single-line tree yields one block.
|
|
58
|
+
*
|
|
59
|
+
* @param tree the phrase tree to realize
|
|
60
|
+
* @param ctx the render context (world, params, settings, seams)
|
|
61
|
+
* @returns the realized text blocks
|
|
62
|
+
* @throws PhraseNotImplementedError when a reserved stub kind is encountered
|
|
63
|
+
*/
|
|
64
|
+
realize(tree: Phrase, ctx: RenderContext): ITextBlock[];
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=english-assembler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"english-assembler.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/lang-en-us/src/assembler/english-assembler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EACL,SAAS,EACT,MAAM,EAON,aAAa,EAgBd,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAA6C,MAAM,sBAAsB,CAAC;AAK7F;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,iBAAgC,CAAC;AA0ZzE;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI5D;AAiXD;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,SAAS;IAChD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,UAAU,EAAE;CAwBxD"}
|