@sharpee/lang-en-us 1.5.0 → 2.1.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 +1 -0
- package/actions/about.d.ts.map +1 -1
- package/actions/about.js +15 -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 +3 -3
- package/actions/help.d.ts.map +1 -1
- package/actions/help.js +9 -7
- 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 +5 -3
- 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 +10 -8
- 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 +1 -0
- package/actions/taking.d.ts.map +1 -1
- package/actions/taking.js +7 -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/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 +50 -24
- package/language-provider.d.ts.map +1 -1
- package/language-provider.js +96 -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/platform-messages.d.ts +26 -0
- package/platform-messages.d.ts.map +1 -0
- package/platform-messages.js +31 -0
- package/platform-messages.js.map +1 -0
- 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
- package/formatters/article.d.ts +0 -41
- package/formatters/article.d.ts.map +0 -1
- package/formatters/article.js +0 -143
- package/formatters/article.js.map +0 -1
- package/formatters/index.d.ts +0 -19
- package/formatters/index.d.ts.map +0 -1
- package/formatters/index.js +0 -42
- package/formatters/index.js.map +0 -1
- package/formatters/list.d.ts +0 -56
- package/formatters/list.d.ts.map +0 -1
- package/formatters/list.js +0 -178
- package/formatters/list.js.map +0 -1
- package/formatters/registry.d.ts +0 -49
- package/formatters/registry.d.ts.map +0 -1
- package/formatters/registry.js +0 -136
- package/formatters/registry.js.map +0 -1
- package/formatters/text.d.ts +0 -33
- package/formatters/text.d.ts.map +0 -1
- package/formatters/text.js +0 -80
- package/formatters/text.js.map +0 -1
- package/formatters/types.d.ts +0 -52
- package/formatters/types.d.ts.map +0 -1
- package/formatters/types.js +0 -14
- package/formatters/types.js.map +0 -1
- package/formatters/verb.d.ts +0 -30
- package/formatters/verb.d.ts.map +0 -1
- package/formatters/verb.js +0 -59
- package/formatters/verb.js.map +0 -1
package/npc/npc.js
CHANGED
|
@@ -1,36 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* Language content for NPC system (ADR-070)
|
|
4
|
+
*
|
|
5
|
+
* Attribution lines name the acting NPC via a `speaker` NounPhrase param (ADR-203)
|
|
6
|
+
* and agree their verb with it via the ADR-199 Verb atom (`{verb:LEMMA speaker}`).
|
|
7
|
+
* The article is the ADR-192 hint (`{the speaker}` here; author-overridable). The
|
|
8
|
+
* `{capitalize …}` hint supplies the sentence-initial capital (top-level messages are
|
|
9
|
+
* not sentence-initial by default, so auto-cap does not fire here).
|
|
4
10
|
*/
|
|
5
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
12
|
exports.npcLanguage = void 0;
|
|
7
13
|
exports.npcLanguage = {
|
|
8
14
|
messages: {
|
|
9
15
|
// Movement messages (visual renderings)
|
|
10
|
-
'npc.enters': "{
|
|
11
|
-
'npc.leaves': "{
|
|
12
|
-
'npc.arrives': "{
|
|
13
|
-
'npc.departs': "{
|
|
16
|
+
'npc.enters': "{capitalize the speaker} {verb:enters speaker} from the {verbatim:direction}.",
|
|
17
|
+
'npc.leaves': "{capitalize the speaker} {verb:leaves speaker} to the {verbatim:direction}.",
|
|
18
|
+
'npc.arrives': "{capitalize the speaker} {verb:arrives speaker}.",
|
|
19
|
+
'npc.departs': "{capitalize the speaker} {verb:departs speaker}.",
|
|
14
20
|
// Movement messages (anonymized hearing renderings — heard in the dark/when blind)
|
|
15
21
|
'npc.heard_arrives': "You hear someone enter.",
|
|
16
22
|
'npc.heard_departs': "You hear someone leave.",
|
|
17
23
|
// Observation messages
|
|
18
|
-
'npc.notices_player': "{
|
|
19
|
-
'npc.ignores_player': "{
|
|
24
|
+
'npc.notices_player': "{capitalize the speaker} {verb:notices speaker} you.",
|
|
25
|
+
'npc.ignores_player': "{capitalize the speaker} {verb:ignores speaker} you.",
|
|
20
26
|
// Action messages
|
|
21
|
-
'npc.takes': "{
|
|
22
|
-
'npc.drops': "{
|
|
23
|
-
'npc.follows': "{
|
|
27
|
+
'npc.takes': "{capitalize the speaker} {verb:picks speaker} up {verbatim:itemName}.",
|
|
28
|
+
'npc.drops': "{capitalize the speaker} {verb:drops speaker} {verbatim:itemName}.",
|
|
29
|
+
'npc.follows': "{capitalize the speaker} {verb:follows speaker} you.",
|
|
24
30
|
// Guard messages
|
|
25
|
-
'npc.guard.blocks': "{
|
|
26
|
-
'npc.guard.attacks': "{
|
|
27
|
-
'npc.guard.defeated': "{
|
|
31
|
+
'npc.guard.blocks': "{capitalize the speaker} {verb:blocks speaker} your way!",
|
|
32
|
+
'npc.guard.attacks': "{capitalize the speaker} {verb:attacks speaker} you!",
|
|
33
|
+
'npc.guard.defeated': "{capitalize the speaker} {verb:is speaker} no longer a threat.",
|
|
28
34
|
// Combat messages (basic)
|
|
29
|
-
'npc.attacks': "{
|
|
30
|
-
'npc.misses': "{
|
|
31
|
-
'npc.hits': "{
|
|
32
|
-
'npc.killed': "{
|
|
33
|
-
'npc.unconscious': "{
|
|
35
|
+
'npc.attacks': "{capitalize the speaker} {verb:attacks speaker} you!",
|
|
36
|
+
'npc.misses': "{capitalize the speaker} {verb:swings speaker} at you but {verb:misses speaker}!",
|
|
37
|
+
'npc.hits': "{capitalize the speaker} {verb:hits speaker} you for {damage} damage!",
|
|
38
|
+
'npc.killed': "{capitalize the speaker} {verb:has speaker} been slain.",
|
|
39
|
+
'npc.unconscious': "{capitalize the speaker} {verb:collapses speaker}, unconscious.",
|
|
34
40
|
// NPC combat attack outcomes (canonical Zork troll messages from MDL source)
|
|
35
41
|
'npc.combat.attack.missed': "The troll swings his axe, but it misses.",
|
|
36
42
|
'npc.combat.attack.hit': "The axe gets you right in the side. Ouch!",
|
|
@@ -40,25 +46,25 @@ exports.npcLanguage = {
|
|
|
40
46
|
'npc.combat.attack.killed': "The troll lands a killing blow. You are dead.",
|
|
41
47
|
// Speech messages
|
|
42
48
|
// `npc.speech` is the generic id emitted by NpcBehavior `speak` actions:
|
|
43
|
-
// the behavior supplies the full line in `{text}`, so render it verbatim.
|
|
44
|
-
'npc.speech': "{text}",
|
|
45
|
-
'npc.speaks': "{
|
|
46
|
-
'npc.shouts': "{
|
|
47
|
-
'npc.whispers': "{
|
|
48
|
-
'npc.mutters': "{
|
|
49
|
+
// the behavior supplies the full line in `{verbatim:text}`, so render it verbatim.
|
|
50
|
+
'npc.speech': "{verbatim:text}",
|
|
51
|
+
'npc.speaks': "{capitalize the speaker} {verb:says speaker}, \"{verbatim:text}\"",
|
|
52
|
+
'npc.shouts': "{capitalize the speaker} {verb:shouts speaker}, \"{verbatim:text}\"",
|
|
53
|
+
'npc.whispers': "{capitalize the speaker} {verb:whispers speaker}, \"{verbatim:text}\"",
|
|
54
|
+
'npc.mutters': "{capitalize the speaker} {verb:mutters speaker}, \"{verbatim:text}\"",
|
|
49
55
|
// Emote messages
|
|
50
56
|
// `npc.emote` is the generic id emitted by NpcBehavior `emote` actions:
|
|
51
|
-
// the behavior supplies the full sentence in `{text}`, so render it verbatim.
|
|
52
|
-
'npc.emote': "{text}",
|
|
53
|
-
'npc.laughs': "{
|
|
54
|
-
'npc.growls': "{
|
|
55
|
-
'npc.cries': "{
|
|
56
|
-
'npc.sighs': "{
|
|
57
|
+
// the behavior supplies the full sentence in `{verbatim:text}`, so render it verbatim.
|
|
58
|
+
'npc.emote': "{verbatim:text}",
|
|
59
|
+
'npc.laughs': "{capitalize the speaker} {verb:laughs speaker}.",
|
|
60
|
+
'npc.growls': "{capitalize the speaker} {verb:growls speaker} menacingly.",
|
|
61
|
+
'npc.cries': "{capitalize the speaker} {verb:cries speaker}.",
|
|
62
|
+
'npc.sighs': "{capitalize the speaker} {verb:sighs speaker}.",
|
|
57
63
|
// Dialogue messages
|
|
58
|
-
'npc.greets': "{
|
|
59
|
-
'npc.farewell': "{
|
|
60
|
-
'npc.no_response': "{
|
|
61
|
-
'npc.confused': "{
|
|
64
|
+
'npc.greets': "{capitalize the speaker} {verb:greets speaker} you.",
|
|
65
|
+
'npc.farewell': "{capitalize the speaker} {verb:bids speaker} you farewell.",
|
|
66
|
+
'npc.no_response': "{capitalize the speaker} {verb:does speaker} not respond.",
|
|
67
|
+
'npc.confused': "{capitalize the speaker} {verb:looks speaker} confused."
|
|
62
68
|
}
|
|
63
69
|
};
|
|
64
70
|
//# sourceMappingURL=npc.js.map
|
package/npc/npc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npc.js","sourceRoot":"","sources":["../../../../../../../repos/
|
|
1
|
+
{"version":3,"file":"npc.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/lang-en-us/src/npc/npc.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEU,QAAA,WAAW,GAAG;IACzB,QAAQ,EAAE;QACR,wCAAwC;QACxC,YAAY,EAAE,+EAA+E;QAC7F,YAAY,EAAE,6EAA6E;QAC3F,aAAa,EAAE,kDAAkD;QACjE,aAAa,EAAE,kDAAkD;QAEjE,mFAAmF;QACnF,mBAAmB,EAAE,yBAAyB;QAC9C,mBAAmB,EAAE,yBAAyB;QAE9C,uBAAuB;QACvB,oBAAoB,EAAE,sDAAsD;QAC5E,oBAAoB,EAAE,sDAAsD;QAE5E,kBAAkB;QAClB,WAAW,EAAE,uEAAuE;QACpF,WAAW,EAAE,oEAAoE;QACjF,aAAa,EAAE,sDAAsD;QAErE,iBAAiB;QACjB,kBAAkB,EAAE,0DAA0D;QAC9E,mBAAmB,EAAE,sDAAsD;QAC3E,oBAAoB,EAAE,gEAAgE;QAEtF,0BAA0B;QAC1B,aAAa,EAAE,sDAAsD;QACrE,YAAY,EAAE,kFAAkF;QAChG,UAAU,EAAE,uEAAuE;QACnF,YAAY,EAAE,yDAAyD;QACvE,iBAAiB,EAAE,iEAAiE;QAEpF,6EAA6E;QAC7E,0BAA0B,EAAE,0CAA0C;QACtE,uBAAuB,EAAE,2CAA2C;QACpE,6BAA6B,EAAE,wDAAwD;QACvF,6BAA6B,EAAE,2EAA2E;QAC1G,+BAA+B,EAAE,gFAAgF;QACjH,0BAA0B,EAAE,+CAA+C;QAE3E,kBAAkB;QAClB,yEAAyE;QACzE,mFAAmF;QACnF,YAAY,EAAE,iBAAiB;QAC/B,YAAY,EAAE,mEAAmE;QACjF,YAAY,EAAE,qEAAqE;QACnF,cAAc,EAAE,uEAAuE;QACvF,aAAa,EAAE,sEAAsE;QAErF,iBAAiB;QACjB,wEAAwE;QACxE,uFAAuF;QACvF,WAAW,EAAE,iBAAiB;QAC9B,YAAY,EAAE,iDAAiD;QAC/D,YAAY,EAAE,4DAA4D;QAC1E,WAAW,EAAE,gDAAgD;QAC7D,WAAW,EAAE,gDAAgD;QAE7D,oBAAoB;QACpB,YAAY,EAAE,qDAAqD;QACnE,cAAc,EAAE,4DAA4D;QAC5E,iBAAiB,EAAE,2DAA2D;QAC9E,cAAc,EAAE,yDAAyD;KAC1E;CACF,CAAC"}
|
package/npc/propagation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propagation.d.ts","sourceRoot":"","sources":["../../../../../../../repos/
|
|
1
|
+
{"version":3,"file":"propagation.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/lang-en-us/src/npc/propagation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;CAwB/B,CAAC"}
|
package/npc/propagation.js
CHANGED
|
@@ -14,15 +14,15 @@ exports.propagationLanguage = {
|
|
|
14
14
|
// -----------------------------------------------------------------------
|
|
15
15
|
// Witnessed messages — player sees NPC-to-NPC information exchange
|
|
16
16
|
// -----------------------------------------------------------------------
|
|
17
|
-
'character.propagation.witnessed.neutral': '{speakerName} mentions something to {listenerName}.',
|
|
18
|
-
'character.propagation.witnessed.dramatic': '{speakerName} excitedly tells {listenerName} about something.',
|
|
19
|
-
'character.propagation.witnessed.vague': '{speakerName} vaguely alludes to something near {listenerName}.',
|
|
20
|
-
'character.propagation.witnessed.fearful': '{speakerName} nervously whispers something to {listenerName}.',
|
|
21
|
-
'character.propagation.witnessed.conspiratorial': '{speakerName} leans close to {listenerName}, muttering under their breath.',
|
|
17
|
+
'character.propagation.witnessed.neutral': '{verbatim:speakerName} mentions something to {verbatim:listenerName}.',
|
|
18
|
+
'character.propagation.witnessed.dramatic': '{verbatim:speakerName} excitedly tells {verbatim:listenerName} about something.',
|
|
19
|
+
'character.propagation.witnessed.vague': '{verbatim:speakerName} vaguely alludes to something near {verbatim:listenerName}.',
|
|
20
|
+
'character.propagation.witnessed.fearful': '{verbatim:speakerName} nervously whispers something to {verbatim:listenerName}.',
|
|
21
|
+
'character.propagation.witnessed.conspiratorial': '{verbatim:speakerName} leans close to {verbatim:listenerName}, muttering under their breath.',
|
|
22
22
|
// -----------------------------------------------------------------------
|
|
23
23
|
// Eavesdropped — player overhears a full exchange
|
|
24
24
|
// -----------------------------------------------------------------------
|
|
25
|
-
'character.propagation.eavesdropped': 'You overhear {speakerName} speaking to {listenerName}.',
|
|
25
|
+
'character.propagation.eavesdropped': 'You overhear {verbatim:speakerName} speaking to {verbatim:listenerName}.',
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
//# sourceMappingURL=propagation.js.map
|
package/npc/propagation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../../../../../repos/
|
|
1
|
+
{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/lang-en-us/src/npc/propagation.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEU,QAAA,mBAAmB,GAAG;IACjC,QAAQ,EAAE;QACR,0EAA0E;QAC1E,mEAAmE;QACnE,0EAA0E;QAE1E,yCAAyC,EACvC,uEAAuE;QACzE,0CAA0C,EACxC,iFAAiF;QACnF,uCAAuC,EACrC,mFAAmF;QACrF,yCAAyC,EACvC,iFAAiF;QACnF,gDAAgD,EAC9C,8FAA8F;QAEhG,0EAA0E;QAC1E,kDAAkD;QAClD,0EAA0E;QAE1E,oCAAoC,EAClC,0EAA0E;KAC7E;CACF,CAAC"}
|
package/number-words.d.ts
CHANGED
|
@@ -5,4 +5,22 @@
|
|
|
5
5
|
* @returns "one".."ten" for 1–10, otherwise the numeral as a string
|
|
6
6
|
*/
|
|
7
7
|
export declare function countWord(n: number): string;
|
|
8
|
+
/**
|
|
9
|
+
* Spell an integer in words: ones/teens/tens, hundreds with "and", and the
|
|
10
|
+
* thousand/million/billion scales. Negatives prefix "minus"; non-integers fall
|
|
11
|
+
* back to digits. The general speller for the `Numeral` atom (ADR-198) —
|
|
12
|
+
* distinct from {@link countWord}, which caps at ten for list grouping.
|
|
13
|
+
*
|
|
14
|
+
* @param value the number to spell
|
|
15
|
+
* @returns the cardinal words, e.g. 105 → "one hundred and five"
|
|
16
|
+
*/
|
|
17
|
+
export declare function numberToWords(value: number): string;
|
|
18
|
+
/**
|
|
19
|
+
* The ordinal surface of an integer: digits + suffix, handling the 11–13
|
|
20
|
+
* exception (1st, 2nd, 3rd, 4th, 11th, 21st). Non-integers fall back to digits.
|
|
21
|
+
*
|
|
22
|
+
* @param value the number to ordinalize
|
|
23
|
+
* @returns e.g. 3 → "3rd", 11 → "11th"
|
|
24
|
+
*/
|
|
25
|
+
export declare function ordinalString(value: number): string;
|
|
8
26
|
//# sourceMappingURL=number-words.d.ts.map
|
package/number-words.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-words.d.ts","sourceRoot":"","sources":["../../../../../../repos/
|
|
1
|
+
{"version":3,"file":"number-words.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee_v2/packages/lang-en-us/src/number-words.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3C;AA6BD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAmBnD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASnD"}
|
package/number-words.js
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
// by list count-grouping.
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.countWord = countWord;
|
|
9
|
+
exports.numberToWords = numberToWords;
|
|
10
|
+
exports.ordinalString = ordinalString;
|
|
9
11
|
const SMALL = [
|
|
10
12
|
'zero', 'one', 'two', 'three', 'four', 'five',
|
|
11
13
|
'six', 'seven', 'eight', 'nine', 'ten',
|
|
@@ -21,4 +23,79 @@ function countWord(n) {
|
|
|
21
23
|
return SMALL[n];
|
|
22
24
|
return String(n);
|
|
23
25
|
}
|
|
26
|
+
// --- full cardinal speller (ADR-198 Numeral atom) --------------------------
|
|
27
|
+
const ONES = [
|
|
28
|
+
'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine',
|
|
29
|
+
'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen',
|
|
30
|
+
'seventeen', 'eighteen', 'nineteen',
|
|
31
|
+
];
|
|
32
|
+
const TENS = ['', '', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety'];
|
|
33
|
+
const SCALES = [
|
|
34
|
+
[1_000_000_000, 'billion'],
|
|
35
|
+
[1_000_000, 'million'],
|
|
36
|
+
[1_000, 'thousand'],
|
|
37
|
+
];
|
|
38
|
+
/** Spell 0–999 ("one hundred and five"). */
|
|
39
|
+
function under1000(n) {
|
|
40
|
+
if (n < 20)
|
|
41
|
+
return ONES[n];
|
|
42
|
+
if (n < 100) {
|
|
43
|
+
const t = TENS[Math.floor(n / 10)];
|
|
44
|
+
const o = n % 10;
|
|
45
|
+
return o ? `${t}-${ONES[o]}` : t;
|
|
46
|
+
}
|
|
47
|
+
const h = `${ONES[Math.floor(n / 100)]} hundred`;
|
|
48
|
+
const rest = n % 100;
|
|
49
|
+
return rest ? `${h} and ${under1000(rest)}` : h;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Spell an integer in words: ones/teens/tens, hundreds with "and", and the
|
|
53
|
+
* thousand/million/billion scales. Negatives prefix "minus"; non-integers fall
|
|
54
|
+
* back to digits. The general speller for the `Numeral` atom (ADR-198) —
|
|
55
|
+
* distinct from {@link countWord}, which caps at ten for list grouping.
|
|
56
|
+
*
|
|
57
|
+
* @param value the number to spell
|
|
58
|
+
* @returns the cardinal words, e.g. 105 → "one hundred and five"
|
|
59
|
+
*/
|
|
60
|
+
function numberToWords(value) {
|
|
61
|
+
if (!Number.isFinite(value))
|
|
62
|
+
return String(value);
|
|
63
|
+
if (!Number.isInteger(value))
|
|
64
|
+
return String(value);
|
|
65
|
+
if (value === 0)
|
|
66
|
+
return 'zero';
|
|
67
|
+
if (value < 0)
|
|
68
|
+
return `minus ${numberToWords(-value)}`;
|
|
69
|
+
const parts = [];
|
|
70
|
+
let remainder = value;
|
|
71
|
+
for (const [scale, name] of SCALES) {
|
|
72
|
+
if (remainder >= scale) {
|
|
73
|
+
parts.push(`${numberToWords(Math.floor(remainder / scale))} ${name}`);
|
|
74
|
+
remainder %= scale;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (remainder > 0) {
|
|
78
|
+
// British-style "and" before a trailing <100 group when there is a higher group.
|
|
79
|
+
parts.push(parts.length && remainder < 100 ? `and ${under1000(remainder)}` : under1000(remainder));
|
|
80
|
+
}
|
|
81
|
+
return parts.join(' ');
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The ordinal surface of an integer: digits + suffix, handling the 11–13
|
|
85
|
+
* exception (1st, 2nd, 3rd, 4th, 11th, 21st). Non-integers fall back to digits.
|
|
86
|
+
*
|
|
87
|
+
* @param value the number to ordinalize
|
|
88
|
+
* @returns e.g. 3 → "3rd", 11 → "11th"
|
|
89
|
+
*/
|
|
90
|
+
function ordinalString(value) {
|
|
91
|
+
if (!Number.isInteger(value))
|
|
92
|
+
return String(value);
|
|
93
|
+
const abs = Math.abs(value) % 100;
|
|
94
|
+
const last = abs % 10;
|
|
95
|
+
let suffix = 'th';
|
|
96
|
+
if (abs < 11 || abs > 13) {
|
|
97
|
+
suffix = last === 1 ? 'st' : last === 2 ? 'nd' : last === 3 ? 'rd' : 'th';
|
|
98
|
+
}
|
|
99
|
+
return `${value}${suffix}`;
|
|
100
|
+
}
|
|
24
101
|
//# sourceMappingURL=number-words.js.map
|
package/number-words.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-words.js","sourceRoot":"","sources":["../../../../../../repos/
|
|
1
|
+
{"version":3,"file":"number-words.js","sourceRoot":"","sources":["../../../../../../repos/sharpee_v2/packages/lang-en-us/src/number-words.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/lang-en-us",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "English language implementation for Sharpee IF Engine",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sharpee/core": "^1.
|
|
16
|
-
"@sharpee/if-domain": "^1.
|
|
15
|
+
"@sharpee/core": "^2.1.0",
|
|
16
|
+
"@sharpee/if-domain": "^2.1.0"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"interactive-fiction",
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Phrase parser barrel (ADR-192).
|
|
3
|
+
*
|
|
4
|
+
* Owner context: `@sharpee/lang-en-us` — the English authoring-template parser
|
|
5
|
+
* that produces language-neutral phrase trees.
|
|
6
|
+
*/
|
|
7
|
+
export { parsePhraseTemplate, PhraseParseError } from './parse-phrase-template.js';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/lang-en-us/src/parser/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/parser/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Phrase parser barrel (ADR-192).
|
|
4
|
+
*
|
|
5
|
+
* Owner context: `@sharpee/lang-en-us` — the English authoring-template parser
|
|
6
|
+
* that produces language-neutral phrase trees.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.PhraseParseError = exports.parsePhraseTemplate = void 0;
|
|
10
|
+
var parse_phrase_template_js_1 = require("./parse-phrase-template.js");
|
|
11
|
+
Object.defineProperty(exports, "parsePhraseTemplate", { enumerable: true, get: function () { return parse_phrase_template_js_1.parsePhraseTemplate; } });
|
|
12
|
+
Object.defineProperty(exports, "PhraseParseError", { enumerable: true, get: function () { return parse_phrase_template_js_1.PhraseParseError; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/lang-en-us/src/parser/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,uEAAmF;AAA1E,+HAAA,mBAAmB,OAAA;AAAE,4HAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file parsePhraseTemplate — the phrase-tree template parser (ADR-192 §5).
|
|
3
|
+
*
|
|
4
|
+
* Purpose: parse an author template string into a `Phrase` tree, binding each
|
|
5
|
+
* placeholder to a producer/param value. Replaces `parsePlaceholder` and the
|
|
6
|
+
* `:`-chain formatter grammar. Placeholders are producer references, never
|
|
7
|
+
* formatter chains.
|
|
8
|
+
*
|
|
9
|
+
* Public interface: `parsePhraseTemplate(template, params)` and
|
|
10
|
+
* `PhraseParseError`.
|
|
11
|
+
*
|
|
12
|
+
* Owner context: `@sharpee/lang-en-us`. The grammar is English-locale authoring
|
|
13
|
+
* surface; the produced `Phrase` tree is language-neutral.
|
|
14
|
+
*
|
|
15
|
+
* Grammar (ADR-192 §5):
|
|
16
|
+
* - `{item}` / `{the item}` / `{a item}` / `{an item}` / `{some item}` /
|
|
17
|
+
* `{capitalize the item}` → `NounPhrase` (last bare token = param name,
|
|
18
|
+
* leading bare tokens = reserved hints).
|
|
19
|
+
* - `{verb:is target}` / `{verb:has target}` / `{verb:opens door}` → a `Verb`
|
|
20
|
+
* atom (ADR-199): leading bare token is the lemma, last bare token is the
|
|
21
|
+
* subject param to agree with. The subject must be a bound param.
|
|
22
|
+
* - `{verbatim:name}` → a `Verbatim` atom (ADR-200): the param's value rendered
|
|
23
|
+
* as opaque, whitespace-exempt text. The param must be bound.
|
|
24
|
+
* - `{number:coins}` / `{number:coins words}` / `{number:floor ordinal}` → a
|
|
25
|
+
* `Numeral` atom (ADR-198): the numeric param, optional format. Must be bound.
|
|
26
|
+
* - `{pronoun:subject}` / `{pronoun:object}` / `{pronoun:possessive}` → a `Pronoun`
|
|
27
|
+
* atom (ADR-197): a grammatical case; the referent is the last-mentioned entity.
|
|
28
|
+
* - `{contents:box}` → a `Contents` atom (ADR-194): the container's live contents
|
|
29
|
+
* as a grouped list, read at realize time. The container must be bound.
|
|
30
|
+
* - `{slot:here}` / `{slot:detail clause}` / `{slot:detail clause or}` → a `Slot`
|
|
31
|
+
* combinator (ADR-195): the first bare token is the contribution channel key;
|
|
32
|
+
* optional trailing hints set `mode` (`sentence` default | `clause`) and the
|
|
33
|
+
* `clause` conjunction (`and` default | `or`). The key need NOT be a bound param
|
|
34
|
+
* — an unfilled slot is valid (AC-7); a keyless `{slot:}` is a parse error (AC-9).
|
|
35
|
+
* - No `:`-chain, `?`, `|`, `#`. A `:` head whose prefix is not a known kind,
|
|
36
|
+
* an unknown leading hint, or an unbound param all raise `PhraseParseError`
|
|
37
|
+
* AT PARSE TIME (never a silent `Empty` at realize time). (AC-8, AC-11)
|
|
38
|
+
*/
|
|
39
|
+
import { Phrase } from '@sharpee/if-domain';
|
|
40
|
+
/**
|
|
41
|
+
* Raised when a template cannot be parsed: a legacy `:`-chain, an unknown
|
|
42
|
+
* kind-prefix, an unknown leading hint, or a reference to an unbound param.
|
|
43
|
+
* Carries the offending token and the full template so the author sees both.
|
|
44
|
+
*/
|
|
45
|
+
export declare class PhraseParseError extends Error {
|
|
46
|
+
readonly offendingToken: string;
|
|
47
|
+
readonly template: string;
|
|
48
|
+
readonly reason: string;
|
|
49
|
+
constructor(offendingToken: string, template: string, reason: string);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Parse a template into a phrase tree.
|
|
53
|
+
*
|
|
54
|
+
* @param template author template, e.g. "You take {the item}."
|
|
55
|
+
* @param params param/producer bindings keyed by placeholder name
|
|
56
|
+
* @returns the parsed phrase (a `Sequence` when the template mixes literal text
|
|
57
|
+
* and placeholders; the bare phrase when it is a single placeholder)
|
|
58
|
+
* @throws PhraseParseError on a legacy `:`-chain, unknown kind-prefix, unknown
|
|
59
|
+
* hint, or unbound param — synchronously, at parse time (AC-8, AC-11)
|
|
60
|
+
*/
|
|
61
|
+
export declare function parsePhraseTemplate(template: string, params?: Record<string, unknown>): Phrase;
|
|
62
|
+
//# sourceMappingURL=parse-phrase-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-phrase-template.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v2/packages/lang-en-us/src/parser/parse-phrase-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAE,MAAM,EAAoB,MAAM,oBAAoB,CAAC;AAuB9D;;;;GAIG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,cAAc,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAOrE;AAiTD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,MAAM,CAmBlG"}
|