@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.
Files changed (259) hide show
  1. package/actions/about.d.ts +1 -0
  2. package/actions/about.d.ts.map +1 -1
  3. package/actions/about.js +15 -8
  4. package/actions/about.js.map +1 -1
  5. package/actions/again.d.ts.map +1 -1
  6. package/actions/again.js.map +1 -1
  7. package/actions/answering.d.ts.map +1 -1
  8. package/actions/answering.js.map +1 -1
  9. package/actions/asking.d.ts.map +1 -1
  10. package/actions/asking.js +14 -14
  11. package/actions/asking.js.map +1 -1
  12. package/actions/attacking.d.ts.map +1 -1
  13. package/actions/attacking.js +51 -51
  14. package/actions/attacking.js.map +1 -1
  15. package/actions/climbing.d.ts.map +1 -1
  16. package/actions/climbing.js +4 -4
  17. package/actions/climbing.js.map +1 -1
  18. package/actions/closing.d.ts.map +1 -1
  19. package/actions/closing.js +5 -5
  20. package/actions/closing.js.map +1 -1
  21. package/actions/drinking.d.ts.map +1 -1
  22. package/actions/drinking.js +20 -20
  23. package/actions/drinking.js.map +1 -1
  24. package/actions/dropping.d.ts.map +1 -1
  25. package/actions/dropping.js +3 -3
  26. package/actions/dropping.js.map +1 -1
  27. package/actions/eating.d.ts.map +1 -1
  28. package/actions/eating.js +20 -20
  29. package/actions/eating.js.map +1 -1
  30. package/actions/entering.d.ts.map +1 -1
  31. package/actions/entering.js +10 -10
  32. package/actions/entering.js.map +1 -1
  33. package/actions/examining.d.ts.map +1 -1
  34. package/actions/examining.js +28 -23
  35. package/actions/examining.js.map +1 -1
  36. package/actions/exiting.d.ts.map +1 -1
  37. package/actions/exiting.js +4 -4
  38. package/actions/exiting.js.map +1 -1
  39. package/actions/giving.d.ts.map +1 -1
  40. package/actions/giving.js +12 -12
  41. package/actions/giving.js.map +1 -1
  42. package/actions/going.d.ts.map +1 -1
  43. package/actions/going.js +7 -7
  44. package/actions/going.js.map +1 -1
  45. package/actions/help.d.ts +3 -3
  46. package/actions/help.d.ts.map +1 -1
  47. package/actions/help.js +9 -7
  48. package/actions/help.js.map +1 -1
  49. package/actions/hiding.d.ts.map +1 -1
  50. package/actions/hiding.js.map +1 -1
  51. package/actions/index.d.ts +5 -3
  52. package/actions/index.d.ts.map +1 -1
  53. package/actions/index.js.map +1 -1
  54. package/actions/inserting.d.ts.map +1 -1
  55. package/actions/inserting.js +8 -8
  56. package/actions/inserting.js.map +1 -1
  57. package/actions/inventory.d.ts.map +1 -1
  58. package/actions/inventory.js.map +1 -1
  59. package/actions/listening.d.ts.map +1 -1
  60. package/actions/listening.js +7 -7
  61. package/actions/listening.js.map +1 -1
  62. package/actions/locking.d.ts.map +1 -1
  63. package/actions/locking.js +8 -8
  64. package/actions/locking.js.map +1 -1
  65. package/actions/looking.d.ts.map +1 -1
  66. package/actions/looking.js +5 -5
  67. package/actions/looking.js.map +1 -1
  68. package/actions/lowering.d.ts.map +1 -1
  69. package/actions/lowering.js +2 -2
  70. package/actions/lowering.js.map +1 -1
  71. package/actions/opening.d.ts.map +1 -1
  72. package/actions/opening.js +7 -7
  73. package/actions/opening.js.map +1 -1
  74. package/actions/pulling.d.ts.map +1 -1
  75. package/actions/pulling.js +19 -19
  76. package/actions/pulling.js.map +1 -1
  77. package/actions/pushing.d.ts.map +1 -1
  78. package/actions/pushing.js +14 -14
  79. package/actions/pushing.js.map +1 -1
  80. package/actions/putting.d.ts.map +1 -1
  81. package/actions/putting.js +12 -12
  82. package/actions/putting.js.map +1 -1
  83. package/actions/quitting.d.ts.map +1 -1
  84. package/actions/quitting.js.map +1 -1
  85. package/actions/raising.d.ts.map +1 -1
  86. package/actions/raising.js +2 -2
  87. package/actions/raising.js.map +1 -1
  88. package/actions/reading.d.ts.map +1 -1
  89. package/actions/reading.js +10 -8
  90. package/actions/reading.js.map +1 -1
  91. package/actions/removing.d.ts.map +1 -1
  92. package/actions/removing.js +8 -8
  93. package/actions/removing.js.map +1 -1
  94. package/actions/restoring.d.ts.map +1 -1
  95. package/actions/restoring.js +6 -6
  96. package/actions/restoring.js.map +1 -1
  97. package/actions/saving.d.ts.map +1 -1
  98. package/actions/saving.js +6 -6
  99. package/actions/saving.js.map +1 -1
  100. package/actions/scoring.d.ts.map +1 -1
  101. package/actions/scoring.js.map +1 -1
  102. package/actions/searching.d.ts.map +1 -1
  103. package/actions/searching.js +7 -7
  104. package/actions/searching.js.map +1 -1
  105. package/actions/showing.d.ts.map +1 -1
  106. package/actions/showing.js +11 -11
  107. package/actions/showing.js.map +1 -1
  108. package/actions/sleeping.d.ts.map +1 -1
  109. package/actions/sleeping.js.map +1 -1
  110. package/actions/smelling.d.ts.map +1 -1
  111. package/actions/smelling.js +10 -10
  112. package/actions/smelling.js.map +1 -1
  113. package/actions/switching-off.d.ts.map +1 -1
  114. package/actions/switching-off.js +12 -12
  115. package/actions/switching-off.js.map +1 -1
  116. package/actions/switching-on.d.ts.map +1 -1
  117. package/actions/switching-on.js +12 -12
  118. package/actions/switching-on.js.map +1 -1
  119. package/actions/taking-off.d.ts.map +1 -1
  120. package/actions/taking-off.js +4 -4
  121. package/actions/taking-off.js.map +1 -1
  122. package/actions/taking.d.ts +1 -0
  123. package/actions/taking.d.ts.map +1 -1
  124. package/actions/taking.js +7 -5
  125. package/actions/taking.js.map +1 -1
  126. package/actions/talking.d.ts.map +1 -1
  127. package/actions/talking.js +15 -15
  128. package/actions/talking.js.map +1 -1
  129. package/actions/telling.d.ts.map +1 -1
  130. package/actions/telling.js +13 -13
  131. package/actions/telling.js.map +1 -1
  132. package/actions/throwing.d.ts.map +1 -1
  133. package/actions/throwing.js +21 -21
  134. package/actions/throwing.js.map +1 -1
  135. package/actions/touching.d.ts.map +1 -1
  136. package/actions/touching.js +20 -20
  137. package/actions/touching.js.map +1 -1
  138. package/actions/turning.d.ts.map +1 -1
  139. package/actions/turning.js +24 -24
  140. package/actions/turning.js.map +1 -1
  141. package/actions/undoing.d.ts.map +1 -1
  142. package/actions/undoing.js.map +1 -1
  143. package/actions/unlocking.d.ts.map +1 -1
  144. package/actions/unlocking.js +8 -8
  145. package/actions/unlocking.js.map +1 -1
  146. package/actions/version.d.ts.map +1 -1
  147. package/actions/version.js +3 -3
  148. package/actions/version.js.map +1 -1
  149. package/actions/waiting.d.ts.map +1 -1
  150. package/actions/waiting.js +1 -1
  151. package/actions/waiting.js.map +1 -1
  152. package/actions/wearing.d.ts.map +1 -1
  153. package/actions/wearing.js +5 -5
  154. package/actions/wearing.js.map +1 -1
  155. package/assembler/english-assembler.d.ts +66 -0
  156. package/assembler/english-assembler.d.ts.map +1 -0
  157. package/assembler/english-assembler.js +806 -0
  158. package/assembler/english-assembler.js.map +1 -0
  159. package/assembler/errors.d.ts +23 -0
  160. package/assembler/errors.d.ts.map +1 -0
  161. package/assembler/errors.js +35 -0
  162. package/assembler/errors.js.map +1 -0
  163. package/assembler/index.d.ts +10 -0
  164. package/assembler/index.d.ts.map +1 -0
  165. package/assembler/index.js +17 -0
  166. package/assembler/index.js.map +1 -0
  167. package/data/events.d.ts.map +1 -1
  168. package/data/events.js +11 -11
  169. package/data/events.js.map +1 -1
  170. package/data/messages.d.ts.map +1 -1
  171. package/data/messages.js +1 -1
  172. package/data/messages.js.map +1 -1
  173. package/data/verbs.d.ts.map +1 -1
  174. package/data/verbs.js.map +1 -1
  175. package/data/words.d.ts.map +1 -1
  176. package/data/words.js.map +1 -1
  177. package/grammar.d.ts.map +1 -1
  178. package/grammar.js.map +1 -1
  179. package/index.d.ts +2 -1
  180. package/index.d.ts.map +1 -1
  181. package/index.js +4 -1
  182. package/index.js.map +1 -1
  183. package/language-provider.d.ts +50 -24
  184. package/language-provider.d.ts.map +1 -1
  185. package/language-provider.js +96 -40
  186. package/language-provider.js.map +1 -1
  187. package/npc/conversation.d.ts +5 -0
  188. package/npc/conversation.d.ts.map +1 -1
  189. package/npc/conversation.js +24 -19
  190. package/npc/conversation.js.map +1 -1
  191. package/npc/index.d.ts.map +1 -1
  192. package/npc/index.js.map +1 -1
  193. package/npc/influence.d.ts.map +1 -1
  194. package/npc/influence.js +4 -4
  195. package/npc/influence.js.map +1 -1
  196. package/npc/npc.d.ts +6 -0
  197. package/npc/npc.d.ts.map +1 -1
  198. package/npc/npc.js +39 -33
  199. package/npc/npc.js.map +1 -1
  200. package/npc/propagation.d.ts.map +1 -1
  201. package/npc/propagation.js +6 -6
  202. package/npc/propagation.js.map +1 -1
  203. package/number-words.d.ts +18 -0
  204. package/number-words.d.ts.map +1 -1
  205. package/number-words.js +77 -0
  206. package/number-words.js.map +1 -1
  207. package/package.json +3 -3
  208. package/parser/index.d.ts +8 -0
  209. package/parser/index.d.ts.map +1 -0
  210. package/parser/index.js +13 -0
  211. package/parser/index.js.map +1 -0
  212. package/parser/parse-phrase-template.d.ts +62 -0
  213. package/parser/parse-phrase-template.d.ts.map +1 -0
  214. package/parser/parse-phrase-template.js +384 -0
  215. package/parser/parse-phrase-template.js.map +1 -0
  216. package/perspective/index.d.ts.map +1 -1
  217. package/perspective/index.js.map +1 -1
  218. package/perspective/placeholder-resolver.d.ts +1 -1
  219. package/perspective/placeholder-resolver.d.ts.map +1 -1
  220. package/perspective/placeholder-resolver.js +12 -1
  221. package/perspective/placeholder-resolver.js.map +1 -1
  222. package/platform-messages.d.ts +26 -0
  223. package/platform-messages.d.ts.map +1 -0
  224. package/platform-messages.js +31 -0
  225. package/platform-messages.js.map +1 -0
  226. package/pluralize.d.ts.map +1 -1
  227. package/pluralize.js.map +1 -1
  228. package/sound-messages.d.ts +8 -8
  229. package/sound-messages.d.ts.map +1 -1
  230. package/sound-messages.js +8 -8
  231. package/sound-messages.js.map +1 -1
  232. package/formatters/article.d.ts +0 -41
  233. package/formatters/article.d.ts.map +0 -1
  234. package/formatters/article.js +0 -143
  235. package/formatters/article.js.map +0 -1
  236. package/formatters/index.d.ts +0 -19
  237. package/formatters/index.d.ts.map +0 -1
  238. package/formatters/index.js +0 -42
  239. package/formatters/index.js.map +0 -1
  240. package/formatters/list.d.ts +0 -56
  241. package/formatters/list.d.ts.map +0 -1
  242. package/formatters/list.js +0 -178
  243. package/formatters/list.js.map +0 -1
  244. package/formatters/registry.d.ts +0 -49
  245. package/formatters/registry.d.ts.map +0 -1
  246. package/formatters/registry.js +0 -136
  247. package/formatters/registry.js.map +0 -1
  248. package/formatters/text.d.ts +0 -33
  249. package/formatters/text.d.ts.map +0 -1
  250. package/formatters/text.js +0 -80
  251. package/formatters/text.js.map +0 -1
  252. package/formatters/types.d.ts +0 -52
  253. package/formatters/types.d.ts.map +0 -1
  254. package/formatters/types.js +0 -14
  255. package/formatters/types.js.map +0 -1
  256. package/formatters/verb.d.ts +0 -30
  257. package/formatters/verb.d.ts.map +0 -1
  258. package/formatters/verb.js +0 -59
  259. 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': "{npcName} enters from the {direction}.",
11
- 'npc.leaves': "{npcName} leaves to the {direction}.",
12
- 'npc.arrives': "{npcName} arrives.",
13
- 'npc.departs': "{npcName} 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': "{npcName} notices you.",
19
- 'npc.ignores_player': "{npcName} ignores you.",
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': "{npcName} picks up {itemName}.",
22
- 'npc.drops': "{npcName} drops {itemName}.",
23
- 'npc.follows': "{npcName} follows you.",
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': "{npcName} blocks your way!",
26
- 'npc.guard.attacks': "{npcName} attacks you!",
27
- 'npc.guard.defeated': "{npcName} is no longer a threat.",
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': "{npcName} attacks you!",
30
- 'npc.misses': "{npcName} swings at you but misses!",
31
- 'npc.hits': "{npcName} hits you for {damage} damage!",
32
- 'npc.killed': "{npcName} has been slain.",
33
- 'npc.unconscious': "{npcName} collapses, 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': "{npcName} says, \"{text}\"",
46
- 'npc.shouts': "{npcName} shouts, \"{text}\"",
47
- 'npc.whispers': "{npcName} whispers, \"{text}\"",
48
- 'npc.mutters': "{npcName} mutters, \"{text}\"",
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': "{npcName} laughs.",
54
- 'npc.growls': "{npcName} growls menacingly.",
55
- 'npc.cries': "{npcName} cries.",
56
- 'npc.sighs': "{npcName} 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': "{npcName} greets you.",
59
- 'npc.farewell': "{npcName} bids you farewell.",
60
- 'npc.no_response': "{npcName} doesn't respond.",
61
- 'npc.confused': "{npcName} looks 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/sharpee_v1/packages/lang-en-us/src/npc/npc.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEU,QAAA,WAAW,GAAG;IACzB,QAAQ,EAAE;QACR,wCAAwC;QACxC,YAAY,EAAE,wCAAwC;QACtD,YAAY,EAAE,sCAAsC;QACpD,aAAa,EAAE,oBAAoB;QACnC,aAAa,EAAE,oBAAoB;QAEnC,mFAAmF;QACnF,mBAAmB,EAAE,yBAAyB;QAC9C,mBAAmB,EAAE,yBAAyB;QAE9C,uBAAuB;QACvB,oBAAoB,EAAE,wBAAwB;QAC9C,oBAAoB,EAAE,wBAAwB;QAE9C,kBAAkB;QAClB,WAAW,EAAE,gCAAgC;QAC7C,WAAW,EAAE,6BAA6B;QAC1C,aAAa,EAAE,wBAAwB;QAEvC,iBAAiB;QACjB,kBAAkB,EAAE,4BAA4B;QAChD,mBAAmB,EAAE,wBAAwB;QAC7C,oBAAoB,EAAE,kCAAkC;QAExD,0BAA0B;QAC1B,aAAa,EAAE,wBAAwB;QACvC,YAAY,EAAE,qCAAqC;QACnD,UAAU,EAAE,yCAAyC;QACrD,YAAY,EAAE,2BAA2B;QACzC,iBA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,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"propagation.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/packages/lang-en-us/src/npc/propagation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;CAwB/B,CAAC"}
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"}
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee_v1/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,qDAAqD;QACvD,0CAA0C,EACxC,+DAA+D;QACjE,uCAAuC,EACrC,iEAAiE;QACnE,yCAAyC,EACvC,+DAA+D;QACjE,gDAAgD,EAC9C,4EAA4E;QAE9E,0EAA0E;QAC1E,kDAAkD;QAClD,0EAA0E;QAE1E,oCAAoC,EAClC,wDAAwD;KAC3D;CACF,CAAC"}
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
@@ -1 +1 @@
1
- {"version":3,"file":"number-words.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee_v1/packages/lang-en-us/src/number-words.ts"],"names":[],"mappings":"AAWA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG3C"}
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
@@ -1 +1 @@
1
- {"version":3,"file":"number-words.js","sourceRoot":"","sources":["../../../../../../repos/sharpee_v1/packages/lang-en-us/src/number-words.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,EAAE;AACF,yEAAyE;AACzE,iFAAiF;AACjF,0BAA0B;;AAa1B,8BAGC;AAdD,MAAM,KAAK,GAAG;IACZ,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAC7C,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;CACvC,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,CAAS;IACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC"}
1
+ {"version":3,"file":"number-words.js","sourceRoot":"","sources":["../../../../../../repos/sharpee_v2/packages/lang-en-us/src/number-words.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,EAAE;AACF,yEAAyE;AACzE,iFAAiF;AACjF,0BAA0B;;AAa1B,8BAGC;AAsCD,sCAmBC;AASD,sCASC;AAzFD,MAAM,KAAK,GAAG;IACZ,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;IAC7C,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK;CACv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E,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;IACrG,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,KAAa;IACzC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACnD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;IAClC,MAAM,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;IACtB,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,GAAG,GAAG,EAAE,IAAI,GAAG,GAAG,EAAE,EAAE,CAAC;QACzB,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5E,CAAC;IACD,OAAO,GAAG,KAAK,GAAG,MAAM,EAAE,CAAC;AAC7B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpee/lang-en-us",
3
- "version": "1.5.0",
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.5.0",
16
- "@sharpee/if-domain": "^1.5.0"
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"}
@@ -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"}