@lokascript/semantic 1.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.
Files changed (435) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +686 -0
  3. package/dist/browser-ar.ar.global.js +2 -0
  4. package/dist/browser-core.core.global.js +2 -0
  5. package/dist/browser-de.de.global.js +2 -0
  6. package/dist/browser-east-asian.east-asian.global.js +2 -0
  7. package/dist/browser-en-tr.en-tr.global.js +2 -0
  8. package/dist/browser-en.en.global.js +2 -0
  9. package/dist/browser-es-en.es-en.global.js +2 -0
  10. package/dist/browser-es.es.global.js +2 -0
  11. package/dist/browser-fr.fr.global.js +2 -0
  12. package/dist/browser-id.id.global.js +2 -0
  13. package/dist/browser-ja.ja.global.js +2 -0
  14. package/dist/browser-ko.ko.global.js +2 -0
  15. package/dist/browser-lazy.lazy.global.js +2 -0
  16. package/dist/browser-priority.priority.global.js +2 -0
  17. package/dist/browser-pt.pt.global.js +2 -0
  18. package/dist/browser-qu.qu.global.js +2 -0
  19. package/dist/browser-sw.sw.global.js +2 -0
  20. package/dist/browser-tr.tr.global.js +2 -0
  21. package/dist/browser-western.western.global.js +2 -0
  22. package/dist/browser-zh.zh.global.js +2 -0
  23. package/dist/browser.global.js +3 -0
  24. package/dist/browser.global.js.map +1 -0
  25. package/dist/index.cjs +35051 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/index.d.cts +3426 -0
  28. package/dist/index.d.ts +3426 -0
  29. package/dist/index.js +34890 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/languages/ar.d.ts +78 -0
  32. package/dist/languages/ar.js +1622 -0
  33. package/dist/languages/ar.js.map +1 -0
  34. package/dist/languages/de.d.ts +38 -0
  35. package/dist/languages/de.js +1168 -0
  36. package/dist/languages/de.js.map +1 -0
  37. package/dist/languages/en.d.ts +44 -0
  38. package/dist/languages/en.js +3491 -0
  39. package/dist/languages/en.js.map +1 -0
  40. package/dist/languages/es.d.ts +52 -0
  41. package/dist/languages/es.js +1493 -0
  42. package/dist/languages/es.js.map +1 -0
  43. package/dist/languages/fr.d.ts +37 -0
  44. package/dist/languages/fr.js +1159 -0
  45. package/dist/languages/fr.js.map +1 -0
  46. package/dist/languages/id.d.ts +35 -0
  47. package/dist/languages/id.js +1152 -0
  48. package/dist/languages/id.js.map +1 -0
  49. package/dist/languages/ja.d.ts +53 -0
  50. package/dist/languages/ja.js +1430 -0
  51. package/dist/languages/ja.js.map +1 -0
  52. package/dist/languages/ko.d.ts +51 -0
  53. package/dist/languages/ko.js +1729 -0
  54. package/dist/languages/ko.js.map +1 -0
  55. package/dist/languages/pt.d.ts +37 -0
  56. package/dist/languages/pt.js +1127 -0
  57. package/dist/languages/pt.js.map +1 -0
  58. package/dist/languages/qu.d.ts +36 -0
  59. package/dist/languages/qu.js +1143 -0
  60. package/dist/languages/qu.js.map +1 -0
  61. package/dist/languages/sw.d.ts +35 -0
  62. package/dist/languages/sw.js +1147 -0
  63. package/dist/languages/sw.js.map +1 -0
  64. package/dist/languages/tr.d.ts +45 -0
  65. package/dist/languages/tr.js +1529 -0
  66. package/dist/languages/tr.js.map +1 -0
  67. package/dist/languages/zh.d.ts +58 -0
  68. package/dist/languages/zh.js +1257 -0
  69. package/dist/languages/zh.js.map +1 -0
  70. package/dist/types-C4dcj53L.d.ts +600 -0
  71. package/package.json +202 -0
  72. package/src/__test-utils__/index.ts +7 -0
  73. package/src/__test-utils__/test-helpers.ts +8 -0
  74. package/src/__types__/test-helpers.ts +122 -0
  75. package/src/analysis/index.ts +479 -0
  76. package/src/ast-builder/command-mappers.ts +1133 -0
  77. package/src/ast-builder/expression-parser/index.ts +41 -0
  78. package/src/ast-builder/expression-parser/parser.ts +563 -0
  79. package/src/ast-builder/expression-parser/tokenizer.ts +394 -0
  80. package/src/ast-builder/expression-parser/types.ts +208 -0
  81. package/src/ast-builder/index.ts +536 -0
  82. package/src/ast-builder/value-converters.ts +172 -0
  83. package/src/bridge.ts +275 -0
  84. package/src/browser-ar.ts +162 -0
  85. package/src/browser-core.ts +231 -0
  86. package/src/browser-de.ts +162 -0
  87. package/src/browser-east-asian.ts +173 -0
  88. package/src/browser-en-tr.ts +165 -0
  89. package/src/browser-en.ts +157 -0
  90. package/src/browser-es-en.ts +200 -0
  91. package/src/browser-es.ts +170 -0
  92. package/src/browser-fr.ts +162 -0
  93. package/src/browser-id.ts +162 -0
  94. package/src/browser-ja.ts +162 -0
  95. package/src/browser-ko.ts +162 -0
  96. package/src/browser-lazy.ts +189 -0
  97. package/src/browser-priority.ts +214 -0
  98. package/src/browser-pt.ts +162 -0
  99. package/src/browser-qu.ts +162 -0
  100. package/src/browser-sw.ts +162 -0
  101. package/src/browser-tr.ts +162 -0
  102. package/src/browser-western.ts +181 -0
  103. package/src/browser-zh.ts +162 -0
  104. package/src/browser.ts +268 -0
  105. package/src/cache/index.ts +14 -0
  106. package/src/cache/semantic-cache.ts +344 -0
  107. package/src/core-bridge.ts +372 -0
  108. package/src/explicit/converter.ts +258 -0
  109. package/src/explicit/index.ts +18 -0
  110. package/src/explicit/parser.ts +236 -0
  111. package/src/explicit/renderer.ts +424 -0
  112. package/src/generators/command-schemas.ts +1636 -0
  113. package/src/generators/event-handler-generator.ts +109 -0
  114. package/src/generators/index.ts +117 -0
  115. package/src/generators/language-profiles.ts +139 -0
  116. package/src/generators/pattern-generator.ts +537 -0
  117. package/src/generators/profiles/arabic.ts +131 -0
  118. package/src/generators/profiles/bengali.ts +132 -0
  119. package/src/generators/profiles/chinese.ts +124 -0
  120. package/src/generators/profiles/english.ts +113 -0
  121. package/src/generators/profiles/french.ts +125 -0
  122. package/src/generators/profiles/german.ts +126 -0
  123. package/src/generators/profiles/hindi.ts +146 -0
  124. package/src/generators/profiles/index.ts +46 -0
  125. package/src/generators/profiles/indonesian.ts +125 -0
  126. package/src/generators/profiles/italian.ts +139 -0
  127. package/src/generators/profiles/japanese.ts +149 -0
  128. package/src/generators/profiles/korean.ts +127 -0
  129. package/src/generators/profiles/marker-templates.ts +288 -0
  130. package/src/generators/profiles/ms.ts +130 -0
  131. package/src/generators/profiles/polish.ts +249 -0
  132. package/src/generators/profiles/portuguese.ts +115 -0
  133. package/src/generators/profiles/quechua.ts +113 -0
  134. package/src/generators/profiles/russian.ts +260 -0
  135. package/src/generators/profiles/spanish.ts +130 -0
  136. package/src/generators/profiles/swahili.ts +129 -0
  137. package/src/generators/profiles/thai.ts +132 -0
  138. package/src/generators/profiles/tl.ts +128 -0
  139. package/src/generators/profiles/turkish.ts +124 -0
  140. package/src/generators/profiles/types.ts +165 -0
  141. package/src/generators/profiles/ukrainian.ts +270 -0
  142. package/src/generators/profiles/vietnamese.ts +133 -0
  143. package/src/generators/schema-error-codes.ts +160 -0
  144. package/src/generators/schema-validator.ts +391 -0
  145. package/src/index.ts +429 -0
  146. package/src/language-building-schema.ts +3170 -0
  147. package/src/language-loader.ts +394 -0
  148. package/src/languages/_all.ts +65 -0
  149. package/src/languages/ar.ts +15 -0
  150. package/src/languages/bn.ts +16 -0
  151. package/src/languages/de.ts +15 -0
  152. package/src/languages/en.ts +29 -0
  153. package/src/languages/es.ts +15 -0
  154. package/src/languages/fr.ts +15 -0
  155. package/src/languages/hi.ts +26 -0
  156. package/src/languages/id.ts +15 -0
  157. package/src/languages/index.ts +18 -0
  158. package/src/languages/it.ts +15 -0
  159. package/src/languages/ja.ts +15 -0
  160. package/src/languages/ko.ts +15 -0
  161. package/src/languages/ms.ts +16 -0
  162. package/src/languages/pl.ts +18 -0
  163. package/src/languages/pt.ts +15 -0
  164. package/src/languages/qu.ts +15 -0
  165. package/src/languages/ru.ts +26 -0
  166. package/src/languages/sw.ts +15 -0
  167. package/src/languages/th.ts +16 -0
  168. package/src/languages/tl.ts +16 -0
  169. package/src/languages/tr.ts +15 -0
  170. package/src/languages/uk.ts +26 -0
  171. package/src/languages/vi.ts +16 -0
  172. package/src/languages/zh.ts +15 -0
  173. package/src/parser/index.ts +15 -0
  174. package/src/parser/pattern-matcher.ts +1181 -0
  175. package/src/parser/semantic-parser.ts +573 -0
  176. package/src/parser/utils/index.ts +35 -0
  177. package/src/parser/utils/marker-resolution.ts +111 -0
  178. package/src/parser/utils/possessive-keywords.ts +43 -0
  179. package/src/parser/utils/role-positioning.ts +70 -0
  180. package/src/parser/utils/type-validation.ts +134 -0
  181. package/src/patterns/add/ar.ts +71 -0
  182. package/src/patterns/add/bn.ts +70 -0
  183. package/src/patterns/add/hi.ts +69 -0
  184. package/src/patterns/add/index.ts +87 -0
  185. package/src/patterns/add/it.ts +61 -0
  186. package/src/patterns/add/ja.ts +93 -0
  187. package/src/patterns/add/ko.ts +74 -0
  188. package/src/patterns/add/ms.ts +30 -0
  189. package/src/patterns/add/pl.ts +62 -0
  190. package/src/patterns/add/ru.ts +62 -0
  191. package/src/patterns/add/th.ts +49 -0
  192. package/src/patterns/add/tl.ts +30 -0
  193. package/src/patterns/add/tr.ts +71 -0
  194. package/src/patterns/add/uk.ts +62 -0
  195. package/src/patterns/add/vi.ts +61 -0
  196. package/src/patterns/add/zh.ts +71 -0
  197. package/src/patterns/builders.ts +207 -0
  198. package/src/patterns/decrement/bn.ts +70 -0
  199. package/src/patterns/decrement/de.ts +42 -0
  200. package/src/patterns/decrement/hi.ts +68 -0
  201. package/src/patterns/decrement/index.ts +79 -0
  202. package/src/patterns/decrement/it.ts +69 -0
  203. package/src/patterns/decrement/ms.ts +30 -0
  204. package/src/patterns/decrement/pl.ts +58 -0
  205. package/src/patterns/decrement/ru.ts +58 -0
  206. package/src/patterns/decrement/th.ts +49 -0
  207. package/src/patterns/decrement/tl.ts +30 -0
  208. package/src/patterns/decrement/tr.ts +48 -0
  209. package/src/patterns/decrement/uk.ts +58 -0
  210. package/src/patterns/decrement/vi.ts +61 -0
  211. package/src/patterns/decrement/zh.ts +32 -0
  212. package/src/patterns/en.ts +302 -0
  213. package/src/patterns/event-handler/ar.ts +151 -0
  214. package/src/patterns/event-handler/bn.ts +72 -0
  215. package/src/patterns/event-handler/de.ts +117 -0
  216. package/src/patterns/event-handler/en.ts +117 -0
  217. package/src/patterns/event-handler/es.ts +136 -0
  218. package/src/patterns/event-handler/fr.ts +117 -0
  219. package/src/patterns/event-handler/hi.ts +64 -0
  220. package/src/patterns/event-handler/id.ts +117 -0
  221. package/src/patterns/event-handler/index.ts +119 -0
  222. package/src/patterns/event-handler/it.ts +54 -0
  223. package/src/patterns/event-handler/ja.ts +118 -0
  224. package/src/patterns/event-handler/ko.ts +133 -0
  225. package/src/patterns/event-handler/ms.ts +30 -0
  226. package/src/patterns/event-handler/pl.ts +62 -0
  227. package/src/patterns/event-handler/pt.ts +117 -0
  228. package/src/patterns/event-handler/qu.ts +66 -0
  229. package/src/patterns/event-handler/ru.ts +62 -0
  230. package/src/patterns/event-handler/shared.ts +270 -0
  231. package/src/patterns/event-handler/sw.ts +117 -0
  232. package/src/patterns/event-handler/th.ts +53 -0
  233. package/src/patterns/event-handler/tl.ts +30 -0
  234. package/src/patterns/event-handler/tr.ts +170 -0
  235. package/src/patterns/event-handler/uk.ts +62 -0
  236. package/src/patterns/event-handler/vi.ts +61 -0
  237. package/src/patterns/event-handler/zh.ts +150 -0
  238. package/src/patterns/get/ar.ts +49 -0
  239. package/src/patterns/get/bn.ts +47 -0
  240. package/src/patterns/get/de.ts +32 -0
  241. package/src/patterns/get/hi.ts +52 -0
  242. package/src/patterns/get/index.ts +83 -0
  243. package/src/patterns/get/it.ts +56 -0
  244. package/src/patterns/get/ja.ts +53 -0
  245. package/src/patterns/get/ko.ts +53 -0
  246. package/src/patterns/get/ms.ts +30 -0
  247. package/src/patterns/get/pl.ts +57 -0
  248. package/src/patterns/get/ru.ts +57 -0
  249. package/src/patterns/get/th.ts +29 -0
  250. package/src/patterns/get/tl.ts +30 -0
  251. package/src/patterns/get/uk.ts +57 -0
  252. package/src/patterns/get/vi.ts +48 -0
  253. package/src/patterns/grammar-transformed/index.ts +39 -0
  254. package/src/patterns/grammar-transformed/ja.ts +1713 -0
  255. package/src/patterns/grammar-transformed/ko.ts +1311 -0
  256. package/src/patterns/grammar-transformed/tr.ts +1067 -0
  257. package/src/patterns/hide/ar.ts +67 -0
  258. package/src/patterns/hide/bn.ts +47 -0
  259. package/src/patterns/hide/de.ts +36 -0
  260. package/src/patterns/hide/hi.ts +61 -0
  261. package/src/patterns/hide/index.ts +91 -0
  262. package/src/patterns/hide/it.ts +56 -0
  263. package/src/patterns/hide/ja.ts +69 -0
  264. package/src/patterns/hide/ko.ts +69 -0
  265. package/src/patterns/hide/ms.ts +30 -0
  266. package/src/patterns/hide/pl.ts +57 -0
  267. package/src/patterns/hide/ru.ts +57 -0
  268. package/src/patterns/hide/th.ts +29 -0
  269. package/src/patterns/hide/tl.ts +30 -0
  270. package/src/patterns/hide/tr.ts +65 -0
  271. package/src/patterns/hide/uk.ts +57 -0
  272. package/src/patterns/hide/vi.ts +56 -0
  273. package/src/patterns/hide/zh.ts +68 -0
  274. package/src/patterns/increment/bn.ts +70 -0
  275. package/src/patterns/increment/de.ts +36 -0
  276. package/src/patterns/increment/hi.ts +68 -0
  277. package/src/patterns/increment/index.ts +79 -0
  278. package/src/patterns/increment/it.ts +69 -0
  279. package/src/patterns/increment/ms.ts +30 -0
  280. package/src/patterns/increment/pl.ts +58 -0
  281. package/src/patterns/increment/ru.ts +58 -0
  282. package/src/patterns/increment/th.ts +49 -0
  283. package/src/patterns/increment/tl.ts +30 -0
  284. package/src/patterns/increment/tr.ts +52 -0
  285. package/src/patterns/increment/uk.ts +58 -0
  286. package/src/patterns/increment/vi.ts +61 -0
  287. package/src/patterns/increment/zh.ts +32 -0
  288. package/src/patterns/index.ts +84 -0
  289. package/src/patterns/languages/en/control-flow.ts +93 -0
  290. package/src/patterns/languages/en/fetch.ts +62 -0
  291. package/src/patterns/languages/en/index.ts +42 -0
  292. package/src/patterns/languages/en/repeat.ts +67 -0
  293. package/src/patterns/languages/en/set.ts +48 -0
  294. package/src/patterns/languages/en/swap.ts +38 -0
  295. package/src/patterns/languages/en/temporal.ts +57 -0
  296. package/src/patterns/put/ar.ts +74 -0
  297. package/src/patterns/put/bn.ts +53 -0
  298. package/src/patterns/put/en.ts +74 -0
  299. package/src/patterns/put/es.ts +74 -0
  300. package/src/patterns/put/hi.ts +69 -0
  301. package/src/patterns/put/id.ts +96 -0
  302. package/src/patterns/put/index.ts +99 -0
  303. package/src/patterns/put/it.ts +56 -0
  304. package/src/patterns/put/ja.ts +75 -0
  305. package/src/patterns/put/ko.ts +67 -0
  306. package/src/patterns/put/ms.ts +30 -0
  307. package/src/patterns/put/pl.ts +81 -0
  308. package/src/patterns/put/ru.ts +85 -0
  309. package/src/patterns/put/th.ts +32 -0
  310. package/src/patterns/put/tl.ts +30 -0
  311. package/src/patterns/put/tr.ts +67 -0
  312. package/src/patterns/put/uk.ts +85 -0
  313. package/src/patterns/put/vi.ts +72 -0
  314. package/src/patterns/put/zh.ts +62 -0
  315. package/src/patterns/registry.ts +163 -0
  316. package/src/patterns/remove/ar.ts +71 -0
  317. package/src/patterns/remove/bn.ts +68 -0
  318. package/src/patterns/remove/hi.ts +69 -0
  319. package/src/patterns/remove/index.ts +87 -0
  320. package/src/patterns/remove/it.ts +69 -0
  321. package/src/patterns/remove/ja.ts +74 -0
  322. package/src/patterns/remove/ko.ts +78 -0
  323. package/src/patterns/remove/ms.ts +30 -0
  324. package/src/patterns/remove/pl.ts +62 -0
  325. package/src/patterns/remove/ru.ts +62 -0
  326. package/src/patterns/remove/th.ts +49 -0
  327. package/src/patterns/remove/tl.ts +30 -0
  328. package/src/patterns/remove/tr.ts +78 -0
  329. package/src/patterns/remove/uk.ts +62 -0
  330. package/src/patterns/remove/vi.ts +61 -0
  331. package/src/patterns/remove/zh.ts +72 -0
  332. package/src/patterns/set/ar.ts +84 -0
  333. package/src/patterns/set/bn.ts +53 -0
  334. package/src/patterns/set/de.ts +84 -0
  335. package/src/patterns/set/es.ts +92 -0
  336. package/src/patterns/set/fr.ts +88 -0
  337. package/src/patterns/set/hi.ts +56 -0
  338. package/src/patterns/set/id.ts +84 -0
  339. package/src/patterns/set/index.ts +107 -0
  340. package/src/patterns/set/it.ts +56 -0
  341. package/src/patterns/set/ja.ts +86 -0
  342. package/src/patterns/set/ko.ts +85 -0
  343. package/src/patterns/set/ms.ts +30 -0
  344. package/src/patterns/set/pl.ts +57 -0
  345. package/src/patterns/set/pt.ts +84 -0
  346. package/src/patterns/set/ru.ts +57 -0
  347. package/src/patterns/set/th.ts +31 -0
  348. package/src/patterns/set/tl.ts +30 -0
  349. package/src/patterns/set/tr.ts +107 -0
  350. package/src/patterns/set/uk.ts +57 -0
  351. package/src/patterns/set/vi.ts +53 -0
  352. package/src/patterns/set/zh.ts +84 -0
  353. package/src/patterns/show/ar.ts +67 -0
  354. package/src/patterns/show/bn.ts +47 -0
  355. package/src/patterns/show/de.ts +32 -0
  356. package/src/patterns/show/fr.ts +32 -0
  357. package/src/patterns/show/hi.ts +61 -0
  358. package/src/patterns/show/index.ts +95 -0
  359. package/src/patterns/show/it.ts +56 -0
  360. package/src/patterns/show/ja.ts +69 -0
  361. package/src/patterns/show/ko.ts +73 -0
  362. package/src/patterns/show/ms.ts +30 -0
  363. package/src/patterns/show/pl.ts +57 -0
  364. package/src/patterns/show/ru.ts +57 -0
  365. package/src/patterns/show/th.ts +29 -0
  366. package/src/patterns/show/tl.ts +30 -0
  367. package/src/patterns/show/tr.ts +65 -0
  368. package/src/patterns/show/uk.ts +57 -0
  369. package/src/patterns/show/vi.ts +56 -0
  370. package/src/patterns/show/zh.ts +68 -0
  371. package/src/patterns/take/ar.ts +51 -0
  372. package/src/patterns/take/index.ts +31 -0
  373. package/src/patterns/toggle/ar.ts +61 -0
  374. package/src/patterns/toggle/bn.ts +70 -0
  375. package/src/patterns/toggle/en.ts +61 -0
  376. package/src/patterns/toggle/es.ts +61 -0
  377. package/src/patterns/toggle/hi.ts +80 -0
  378. package/src/patterns/toggle/index.ts +95 -0
  379. package/src/patterns/toggle/it.ts +69 -0
  380. package/src/patterns/toggle/ja.ts +156 -0
  381. package/src/patterns/toggle/ko.ts +113 -0
  382. package/src/patterns/toggle/ms.ts +30 -0
  383. package/src/patterns/toggle/pl.ts +62 -0
  384. package/src/patterns/toggle/ru.ts +62 -0
  385. package/src/patterns/toggle/th.ts +50 -0
  386. package/src/patterns/toggle/tl.ts +30 -0
  387. package/src/patterns/toggle/tr.ts +88 -0
  388. package/src/patterns/toggle/uk.ts +62 -0
  389. package/src/patterns/toggle/vi.ts +61 -0
  390. package/src/patterns/toggle/zh.ts +99 -0
  391. package/src/public-api.ts +286 -0
  392. package/src/registry.ts +441 -0
  393. package/src/tokenizers/arabic.ts +723 -0
  394. package/src/tokenizers/base.ts +1300 -0
  395. package/src/tokenizers/bengali.ts +289 -0
  396. package/src/tokenizers/chinese.ts +481 -0
  397. package/src/tokenizers/english.ts +416 -0
  398. package/src/tokenizers/french.ts +326 -0
  399. package/src/tokenizers/german.ts +324 -0
  400. package/src/tokenizers/hindi.ts +319 -0
  401. package/src/tokenizers/index.ts +127 -0
  402. package/src/tokenizers/indonesian.ts +306 -0
  403. package/src/tokenizers/italian.ts +458 -0
  404. package/src/tokenizers/japanese.ts +447 -0
  405. package/src/tokenizers/korean.ts +642 -0
  406. package/src/tokenizers/morphology/arabic-normalizer.ts +242 -0
  407. package/src/tokenizers/morphology/french-normalizer.ts +268 -0
  408. package/src/tokenizers/morphology/german-normalizer.ts +256 -0
  409. package/src/tokenizers/morphology/index.ts +46 -0
  410. package/src/tokenizers/morphology/italian-normalizer.ts +329 -0
  411. package/src/tokenizers/morphology/japanese-normalizer.ts +288 -0
  412. package/src/tokenizers/morphology/korean-normalizer.ts +428 -0
  413. package/src/tokenizers/morphology/polish-normalizer.ts +264 -0
  414. package/src/tokenizers/morphology/portuguese-normalizer.ts +310 -0
  415. package/src/tokenizers/morphology/spanish-normalizer.ts +327 -0
  416. package/src/tokenizers/morphology/turkish-normalizer.ts +412 -0
  417. package/src/tokenizers/morphology/types.ts +211 -0
  418. package/src/tokenizers/ms.ts +198 -0
  419. package/src/tokenizers/polish.ts +354 -0
  420. package/src/tokenizers/portuguese.ts +304 -0
  421. package/src/tokenizers/quechua.ts +339 -0
  422. package/src/tokenizers/russian.ts +375 -0
  423. package/src/tokenizers/spanish.ts +403 -0
  424. package/src/tokenizers/swahili.ts +303 -0
  425. package/src/tokenizers/thai.ts +236 -0
  426. package/src/tokenizers/tl.ts +198 -0
  427. package/src/tokenizers/turkish.ts +411 -0
  428. package/src/tokenizers/ukrainian.ts +369 -0
  429. package/src/tokenizers/vietnamese.ts +410 -0
  430. package/src/types/grammar-types.ts +617 -0
  431. package/src/types/unified-profile.ts +267 -0
  432. package/src/types.ts +709 -0
  433. package/src/utils/confidence-calculator.ts +147 -0
  434. package/src/validators/command-validator.ts +380 -0
  435. package/src/validators/index.ts +15 -0
@@ -0,0 +1,1713 @@
1
+ /**
2
+ * Japanese Grammar-Transformed Patterns
3
+ *
4
+ * These patterns match the hybrid output from GrammarTransformer where
5
+ * event and command are combined in SOV order:
6
+ * English: "on click toggle .active"
7
+ * Grammar output: ".active を クリック で 切り替え"
8
+ *
9
+ * Format: {patient} を {event-word} で {action-word}
10
+ *
11
+ * Tree-shakeable: Only included when Japanese is imported.
12
+ */
13
+
14
+ import type { LanguagePattern } from '../../types';
15
+
16
+ /**
17
+ * Get Japanese grammar-transformed patterns.
18
+ */
19
+ export function getGrammarTransformedPatternsJa(): LanguagePattern[] {
20
+ return [
21
+ // ==========================================================================
22
+ // Click + Toggle
23
+ // ==========================================================================
24
+ {
25
+ id: 'grammar-ja-click-toggle',
26
+ language: 'ja',
27
+ command: 'on',
28
+ priority: 75,
29
+ template: {
30
+ format: '{patient} を クリック で 切り替え',
31
+ tokens: [
32
+ { type: 'role', role: 'patient' },
33
+ { type: 'literal', value: 'を' },
34
+ { type: 'literal', value: 'クリック' },
35
+ { type: 'literal', value: 'で' },
36
+ { type: 'literal', value: '切り替え', alternatives: ['切り替える', 'トグル'] },
37
+ ],
38
+ },
39
+ extraction: {
40
+ patient: { position: 0 },
41
+ event: { default: { type: 'literal', value: 'click' } },
42
+ action: { default: { type: 'literal', value: 'toggle' } },
43
+ },
44
+ },
45
+
46
+ // ==========================================================================
47
+ // Click + Add
48
+ // ==========================================================================
49
+ {
50
+ id: 'grammar-ja-click-add',
51
+ language: 'ja',
52
+ command: 'on',
53
+ priority: 75,
54
+ template: {
55
+ format: '{patient} を クリック で 追加',
56
+ tokens: [
57
+ { type: 'role', role: 'patient' },
58
+ { type: 'literal', value: 'を' },
59
+ { type: 'literal', value: 'クリック' },
60
+ { type: 'literal', value: 'で' },
61
+ { type: 'literal', value: '追加', alternatives: ['追加する', '付ける'] },
62
+ ],
63
+ },
64
+ extraction: {
65
+ patient: { position: 0 },
66
+ event: { default: { type: 'literal', value: 'click' } },
67
+ action: { default: { type: 'literal', value: 'add' } },
68
+ },
69
+ },
70
+
71
+ // ==========================================================================
72
+ // Click + Remove
73
+ // ==========================================================================
74
+ {
75
+ id: 'grammar-ja-click-remove',
76
+ language: 'ja',
77
+ command: 'on',
78
+ priority: 75,
79
+ template: {
80
+ format: '{patient} を クリック で 削除',
81
+ tokens: [
82
+ { type: 'role', role: 'patient' },
83
+ { type: 'literal', value: 'を' },
84
+ { type: 'literal', value: 'クリック' },
85
+ { type: 'literal', value: 'で' },
86
+ { type: 'literal', value: '削除', alternatives: ['削除する', '外す', '取る'] },
87
+ ],
88
+ },
89
+ extraction: {
90
+ patient: { position: 0 },
91
+ event: { default: { type: 'literal', value: 'click' } },
92
+ action: { default: { type: 'literal', value: 'remove' } },
93
+ },
94
+ },
95
+
96
+ // ==========================================================================
97
+ // Click + Increment
98
+ // ==========================================================================
99
+ {
100
+ id: 'grammar-ja-click-increment',
101
+ language: 'ja',
102
+ command: 'on',
103
+ priority: 75,
104
+ template: {
105
+ format: '{patient} を クリック で 増加',
106
+ tokens: [
107
+ { type: 'role', role: 'patient' },
108
+ { type: 'literal', value: 'を' },
109
+ { type: 'literal', value: 'クリック' },
110
+ { type: 'literal', value: 'で' },
111
+ { type: 'literal', value: '増加', alternatives: ['増加する', '増やす'] },
112
+ ],
113
+ },
114
+ extraction: {
115
+ patient: { position: 0 },
116
+ event: { default: { type: 'literal', value: 'click' } },
117
+ action: { default: { type: 'literal', value: 'increment' } },
118
+ },
119
+ },
120
+
121
+ // ==========================================================================
122
+ // Click + Show
123
+ // ==========================================================================
124
+ {
125
+ id: 'grammar-ja-click-show',
126
+ language: 'ja',
127
+ command: 'on',
128
+ priority: 75,
129
+ template: {
130
+ format: '{patient} を クリック で 表示',
131
+ tokens: [
132
+ { type: 'role', role: 'patient' },
133
+ { type: 'literal', value: 'を' },
134
+ { type: 'literal', value: 'クリック' },
135
+ { type: 'literal', value: 'で' },
136
+ { type: 'literal', value: '表示', alternatives: ['表示する', '見せる'] },
137
+ ],
138
+ },
139
+ extraction: {
140
+ patient: { position: 0 },
141
+ event: { default: { type: 'literal', value: 'click' } },
142
+ action: { default: { type: 'literal', value: 'show' } },
143
+ },
144
+ },
145
+
146
+ // ==========================================================================
147
+ // Click + Hide
148
+ // ==========================================================================
149
+ {
150
+ id: 'grammar-ja-click-hide',
151
+ language: 'ja',
152
+ command: 'on',
153
+ priority: 75,
154
+ template: {
155
+ format: '{patient} を クリック で 隠す',
156
+ tokens: [
157
+ { type: 'role', role: 'patient' },
158
+ { type: 'literal', value: 'を' },
159
+ { type: 'literal', value: 'クリック' },
160
+ { type: 'literal', value: 'で' },
161
+ { type: 'literal', value: '隠す', alternatives: ['非表示', '隠れる'] },
162
+ ],
163
+ },
164
+ extraction: {
165
+ patient: { position: 0 },
166
+ event: { default: { type: 'literal', value: 'click' } },
167
+ action: { default: { type: 'literal', value: 'hide' } },
168
+ },
169
+ },
170
+
171
+ // ==========================================================================
172
+ // Click + Set
173
+ // ==========================================================================
174
+ {
175
+ id: 'grammar-ja-click-set',
176
+ language: 'ja',
177
+ command: 'on',
178
+ priority: 75,
179
+ template: {
180
+ format: '{patient} を クリック で 設定',
181
+ tokens: [
182
+ { type: 'role', role: 'patient' },
183
+ { type: 'literal', value: 'を' },
184
+ { type: 'literal', value: 'クリック' },
185
+ { type: 'literal', value: 'で' },
186
+ { type: 'literal', value: '設定', alternatives: ['設定する', 'セット'] },
187
+ ],
188
+ },
189
+ extraction: {
190
+ patient: { position: 0 },
191
+ event: { default: { type: 'literal', value: 'click' } },
192
+ action: { default: { type: 'literal', value: 'set' } },
193
+ },
194
+ },
195
+
196
+ // ==========================================================================
197
+ // Click + Decrement
198
+ // ==========================================================================
199
+ {
200
+ id: 'grammar-ja-click-decrement',
201
+ language: 'ja',
202
+ command: 'on',
203
+ priority: 75,
204
+ template: {
205
+ format: '{patient} を クリック で 減少',
206
+ tokens: [
207
+ { type: 'role', role: 'patient' },
208
+ { type: 'literal', value: 'を' },
209
+ { type: 'literal', value: 'クリック' },
210
+ { type: 'literal', value: 'で' },
211
+ { type: 'literal', value: '減少', alternatives: ['減少する', '減らす'] },
212
+ ],
213
+ },
214
+ extraction: {
215
+ patient: { position: 0 },
216
+ event: { default: { type: 'literal', value: 'click' } },
217
+ action: { default: { type: 'literal', value: 'decrement' } },
218
+ },
219
+ },
220
+
221
+ // ==========================================================================
222
+ // DESTINATION PATTERNS (higher priority)
223
+ // ==========================================================================
224
+
225
+ // Click + Set with destination: "{destination} を クリック で 設定 {patient} に"
226
+ {
227
+ id: 'grammar-ja-click-set-destination',
228
+ language: 'ja',
229
+ command: 'on',
230
+ priority: 80,
231
+ template: {
232
+ format: '{destination} を クリック で 設定 {patient} に',
233
+ tokens: [
234
+ { type: 'role', role: 'destination' },
235
+ { type: 'literal', value: 'を' },
236
+ { type: 'literal', value: 'クリック' },
237
+ { type: 'literal', value: 'で' },
238
+ { type: 'literal', value: '設定', alternatives: ['設定する'] },
239
+ { type: 'role', role: 'patient' },
240
+ { type: 'literal', value: 'に' },
241
+ ],
242
+ },
243
+ extraction: {
244
+ destination: { position: 0 },
245
+ patient: { marker: 'に' },
246
+ event: { default: { type: 'literal', value: 'click' } },
247
+ action: { default: { type: 'literal', value: 'set' } },
248
+ },
249
+ },
250
+
251
+ // Click + Put with destination: "{patient} を クリック で 置く {destination} に"
252
+ {
253
+ id: 'grammar-ja-click-put-destination',
254
+ language: 'ja',
255
+ command: 'on',
256
+ priority: 80,
257
+ template: {
258
+ format: '{patient} を クリック で 置く {destination} に',
259
+ tokens: [
260
+ { type: 'role', role: 'patient' },
261
+ { type: 'literal', value: 'を' },
262
+ { type: 'literal', value: 'クリック' },
263
+ { type: 'literal', value: 'で' },
264
+ { type: 'literal', value: '置く', alternatives: ['入れる'] },
265
+ { type: 'role', role: 'destination' },
266
+ { type: 'literal', value: 'に' },
267
+ ],
268
+ },
269
+ extraction: {
270
+ patient: { position: 0 },
271
+ destination: { marker: 'に' },
272
+ event: { default: { type: 'literal', value: 'click' } },
273
+ action: { default: { type: 'literal', value: 'put' } },
274
+ },
275
+ },
276
+
277
+ // Click + Add with destination: "{patient} を クリック で 追加 {destination} に"
278
+ {
279
+ id: 'grammar-ja-click-add-destination',
280
+ language: 'ja',
281
+ command: 'on',
282
+ priority: 80,
283
+ template: {
284
+ format: '{patient} を クリック で 追加 {destination} に',
285
+ tokens: [
286
+ { type: 'role', role: 'patient' },
287
+ { type: 'literal', value: 'を' },
288
+ { type: 'literal', value: 'クリック' },
289
+ { type: 'literal', value: 'で' },
290
+ { type: 'literal', value: '追加', alternatives: ['末尾追加'] },
291
+ { type: 'role', role: 'destination' },
292
+ { type: 'literal', value: 'に' },
293
+ ],
294
+ },
295
+ extraction: {
296
+ patient: { position: 0 },
297
+ destination: { marker: 'に' },
298
+ event: { default: { type: 'literal', value: 'click' } },
299
+ action: { default: { type: 'literal', value: 'add' } },
300
+ },
301
+ },
302
+
303
+ // Click + Show with style: "{patient} を クリック で 表示 {style} で"
304
+ {
305
+ id: 'grammar-ja-click-show-style',
306
+ language: 'ja',
307
+ command: 'on',
308
+ priority: 80,
309
+ template: {
310
+ format: '{patient} を クリック で 表示 {style} で',
311
+ tokens: [
312
+ { type: 'role', role: 'patient' },
313
+ { type: 'literal', value: 'を' },
314
+ { type: 'literal', value: 'クリック' },
315
+ { type: 'literal', value: 'で' },
316
+ { type: 'literal', value: '表示', alternatives: ['見せる'] },
317
+ { type: 'role', role: 'style' },
318
+ { type: 'literal', value: 'で' },
319
+ ],
320
+ },
321
+ extraction: {
322
+ patient: { position: 0 },
323
+ style: { position: 5 },
324
+ event: { default: { type: 'literal', value: 'click' } },
325
+ action: { default: { type: 'literal', value: 'show' } },
326
+ },
327
+ },
328
+
329
+ // Click + Hide with style: "{patient} を クリック で 隠す {style} で"
330
+ {
331
+ id: 'grammar-ja-click-hide-style',
332
+ language: 'ja',
333
+ command: 'on',
334
+ priority: 80,
335
+ template: {
336
+ format: '{patient} を クリック で 隠す {style} で',
337
+ tokens: [
338
+ { type: 'role', role: 'patient' },
339
+ { type: 'literal', value: 'を' },
340
+ { type: 'literal', value: 'クリック' },
341
+ { type: 'literal', value: 'で' },
342
+ { type: 'literal', value: '隠す', alternatives: ['非表示'] },
343
+ { type: 'role', role: 'style' },
344
+ { type: 'literal', value: 'で' },
345
+ ],
346
+ },
347
+ extraction: {
348
+ patient: { position: 0 },
349
+ style: { position: 5 },
350
+ event: { default: { type: 'literal', value: 'click' } },
351
+ action: { default: { type: 'literal', value: 'hide' } },
352
+ },
353
+ },
354
+
355
+ // ==========================================================================
356
+ // THEN-CHAIN PATTERNS (with continuation marker)
357
+ // Japanese uses "それから" (sorekara) for "then"
358
+ // ==========================================================================
359
+
360
+ // Click + Wait then: "{duration} を クリック で 待つ それから"
361
+ {
362
+ id: 'grammar-ja-click-wait-then',
363
+ language: 'ja',
364
+ command: 'on',
365
+ priority: 85,
366
+ template: {
367
+ format: '{duration} を クリック で 待つ それから',
368
+ tokens: [
369
+ { type: 'role', role: 'duration' },
370
+ { type: 'literal', value: 'を' },
371
+ { type: 'literal', value: 'クリック' },
372
+ { type: 'literal', value: 'で' },
373
+ { type: 'literal', value: '待つ', alternatives: ['待ち'] },
374
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
375
+ ],
376
+ },
377
+ extraction: {
378
+ duration: { position: 0 },
379
+ event: { default: { type: 'literal', value: 'click' } },
380
+ action: { default: { type: 'literal', value: 'wait' } },
381
+ continues: { default: { type: 'literal', value: 'then' } },
382
+ },
383
+ },
384
+
385
+ // Click + Toggle then: "{patient} を クリック で 切り替え それから"
386
+ {
387
+ id: 'grammar-ja-click-toggle-then',
388
+ language: 'ja',
389
+ command: 'on',
390
+ priority: 85,
391
+ template: {
392
+ format: '{patient} を クリック で 切り替え それから',
393
+ tokens: [
394
+ { type: 'role', role: 'patient' },
395
+ { type: 'literal', value: 'を' },
396
+ { type: 'literal', value: 'クリック' },
397
+ { type: 'literal', value: 'で' },
398
+ { type: 'literal', value: '切り替え', alternatives: ['トグル'] },
399
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
400
+ ],
401
+ },
402
+ extraction: {
403
+ patient: { position: 0 },
404
+ event: { default: { type: 'literal', value: 'click' } },
405
+ action: { default: { type: 'literal', value: 'toggle' } },
406
+ continues: { default: { type: 'literal', value: 'then' } },
407
+ },
408
+ },
409
+
410
+ // Click + Add then: "{patient} を クリック で 追加 それから"
411
+ {
412
+ id: 'grammar-ja-click-add-then',
413
+ language: 'ja',
414
+ command: 'on',
415
+ priority: 85,
416
+ template: {
417
+ format: '{patient} を クリック で 追加 それから',
418
+ tokens: [
419
+ { type: 'role', role: 'patient' },
420
+ { type: 'literal', value: 'を' },
421
+ { type: 'literal', value: 'クリック' },
422
+ { type: 'literal', value: 'で' },
423
+ { type: 'literal', value: '追加', alternatives: ['追加する'] },
424
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
425
+ ],
426
+ },
427
+ extraction: {
428
+ patient: { position: 0 },
429
+ event: { default: { type: 'literal', value: 'click' } },
430
+ action: { default: { type: 'literal', value: 'add' } },
431
+ continues: { default: { type: 'literal', value: 'then' } },
432
+ },
433
+ },
434
+
435
+ // Click + Remove then: "{patient} を クリック で 削除 それから"
436
+ {
437
+ id: 'grammar-ja-click-remove-then',
438
+ language: 'ja',
439
+ command: 'on',
440
+ priority: 85,
441
+ template: {
442
+ format: '{patient} を クリック で 削除 それから',
443
+ tokens: [
444
+ { type: 'role', role: 'patient' },
445
+ { type: 'literal', value: 'を' },
446
+ { type: 'literal', value: 'クリック' },
447
+ { type: 'literal', value: 'で' },
448
+ { type: 'literal', value: '削除', alternatives: ['削除する'] },
449
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
450
+ ],
451
+ },
452
+ extraction: {
453
+ patient: { position: 0 },
454
+ event: { default: { type: 'literal', value: 'click' } },
455
+ action: { default: { type: 'literal', value: 'remove' } },
456
+ continues: { default: { type: 'literal', value: 'then' } },
457
+ },
458
+ },
459
+
460
+ // Click + Show then: "{patient} を クリック で 表示 それから"
461
+ {
462
+ id: 'grammar-ja-click-show-then',
463
+ language: 'ja',
464
+ command: 'on',
465
+ priority: 85,
466
+ template: {
467
+ format: '{patient} を クリック で 表示 それから',
468
+ tokens: [
469
+ { type: 'role', role: 'patient' },
470
+ { type: 'literal', value: 'を' },
471
+ { type: 'literal', value: 'クリック' },
472
+ { type: 'literal', value: 'で' },
473
+ { type: 'literal', value: '表示', alternatives: ['見せる'] },
474
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
475
+ ],
476
+ },
477
+ extraction: {
478
+ patient: { position: 0 },
479
+ event: { default: { type: 'literal', value: 'click' } },
480
+ action: { default: { type: 'literal', value: 'show' } },
481
+ continues: { default: { type: 'literal', value: 'then' } },
482
+ },
483
+ },
484
+
485
+ // Click + Hide then: "{patient} を クリック で 隠す それから"
486
+ {
487
+ id: 'grammar-ja-click-hide-then',
488
+ language: 'ja',
489
+ command: 'on',
490
+ priority: 85,
491
+ template: {
492
+ format: '{patient} を クリック で 隠す それから',
493
+ tokens: [
494
+ { type: 'role', role: 'patient' },
495
+ { type: 'literal', value: 'を' },
496
+ { type: 'literal', value: 'クリック' },
497
+ { type: 'literal', value: 'で' },
498
+ { type: 'literal', value: '隠す', alternatives: ['非表示'] },
499
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
500
+ ],
501
+ },
502
+ extraction: {
503
+ patient: { position: 0 },
504
+ event: { default: { type: 'literal', value: 'click' } },
505
+ action: { default: { type: 'literal', value: 'hide' } },
506
+ continues: { default: { type: 'literal', value: 'then' } },
507
+ },
508
+ },
509
+
510
+ // ==========================================================================
511
+ // CONTINUATION PATTERNS (for body after then)
512
+ // These match commands that follow the "それから" keyword
513
+ // ==========================================================================
514
+
515
+ // Remove continuation: "{patient} を 削除"
516
+ {
517
+ id: 'grammar-ja-remove-continuation',
518
+ language: 'ja',
519
+ command: 'remove',
520
+ priority: 70,
521
+ template: {
522
+ format: '{patient} を 削除',
523
+ tokens: [
524
+ { type: 'role', role: 'patient' },
525
+ { type: 'literal', value: 'を' },
526
+ { type: 'literal', value: '削除', alternatives: ['削除する', '外す', '取る'] },
527
+ ],
528
+ },
529
+ extraction: {
530
+ patient: { position: 0 },
531
+ action: { default: { type: 'literal', value: 'remove' } },
532
+ },
533
+ },
534
+
535
+ // Toggle continuation: "{patient} を 切り替え"
536
+ {
537
+ id: 'grammar-ja-toggle-continuation',
538
+ language: 'ja',
539
+ command: 'toggle',
540
+ priority: 70,
541
+ template: {
542
+ format: '{patient} を 切り替え',
543
+ tokens: [
544
+ { type: 'role', role: 'patient' },
545
+ { type: 'literal', value: 'を' },
546
+ { type: 'literal', value: '切り替え', alternatives: ['切り替える', 'トグル'] },
547
+ ],
548
+ },
549
+ extraction: {
550
+ patient: { position: 0 },
551
+ action: { default: { type: 'literal', value: 'toggle' } },
552
+ },
553
+ },
554
+
555
+ // Add continuation: "{patient} を 追加"
556
+ {
557
+ id: 'grammar-ja-add-continuation',
558
+ language: 'ja',
559
+ command: 'add',
560
+ priority: 70,
561
+ template: {
562
+ format: '{patient} を 追加',
563
+ tokens: [
564
+ { type: 'role', role: 'patient' },
565
+ { type: 'literal', value: 'を' },
566
+ { type: 'literal', value: '追加', alternatives: ['追加する'] },
567
+ ],
568
+ },
569
+ extraction: {
570
+ patient: { position: 0 },
571
+ action: { default: { type: 'literal', value: 'add' } },
572
+ },
573
+ },
574
+
575
+ // Show continuation: "{patient} を 表示"
576
+ {
577
+ id: 'grammar-ja-show-continuation',
578
+ language: 'ja',
579
+ command: 'show',
580
+ priority: 70,
581
+ template: {
582
+ format: '{patient} を 表示',
583
+ tokens: [
584
+ { type: 'role', role: 'patient' },
585
+ { type: 'literal', value: 'を' },
586
+ { type: 'literal', value: '表示', alternatives: ['表示する', '見せる'] },
587
+ ],
588
+ },
589
+ extraction: {
590
+ patient: { position: 0 },
591
+ action: { default: { type: 'literal', value: 'show' } },
592
+ },
593
+ },
594
+
595
+ // Hide continuation: "{patient} を 隠す"
596
+ {
597
+ id: 'grammar-ja-hide-continuation',
598
+ language: 'ja',
599
+ command: 'hide',
600
+ priority: 70,
601
+ template: {
602
+ format: '{patient} を 隠す',
603
+ tokens: [
604
+ { type: 'role', role: 'patient' },
605
+ { type: 'literal', value: 'を' },
606
+ { type: 'literal', value: '隠す', alternatives: ['非表示', '隠れる'] },
607
+ ],
608
+ },
609
+ extraction: {
610
+ patient: { position: 0 },
611
+ action: { default: { type: 'literal', value: 'hide' } },
612
+ },
613
+ },
614
+
615
+ // Put into continuation: "{patient} を {destination} に 置く"
616
+ {
617
+ id: 'grammar-ja-put-continuation',
618
+ language: 'ja',
619
+ command: 'put',
620
+ priority: 72,
621
+ template: {
622
+ format: '{patient} を {destination} に 置く',
623
+ tokens: [
624
+ { type: 'role', role: 'patient' },
625
+ { type: 'literal', value: 'を' },
626
+ { type: 'role', role: 'destination' },
627
+ { type: 'literal', value: 'に' },
628
+ { type: 'literal', value: '置く', alternatives: ['入れる'] },
629
+ ],
630
+ },
631
+ extraction: {
632
+ patient: { position: 0 },
633
+ destination: { marker: 'に' },
634
+ action: { default: { type: 'literal', value: 'put' } },
635
+ },
636
+ },
637
+
638
+ // ==========================================================================
639
+ // PUT BEFORE/AFTER PATTERNS
640
+ // ==========================================================================
641
+
642
+ // Click + Put before: "{value} 前に {target} を クリック で 置く"
643
+ {
644
+ id: 'grammar-ja-click-put-before',
645
+ language: 'ja',
646
+ command: 'on',
647
+ priority: 78,
648
+ template: {
649
+ format: '{patient} 前に {destination} を クリック で 置く',
650
+ tokens: [
651
+ { type: 'role', role: 'patient' },
652
+ { type: 'literal', value: '前に' },
653
+ { type: 'role', role: 'destination' },
654
+ { type: 'literal', value: 'を' },
655
+ { type: 'literal', value: 'クリック' },
656
+ { type: 'literal', value: 'で' },
657
+ { type: 'literal', value: '置く', alternatives: ['入れる'] },
658
+ ],
659
+ },
660
+ extraction: {
661
+ patient: { position: 0 },
662
+ destination: { position: 1 },
663
+ event: { default: { type: 'literal', value: 'click' } },
664
+ action: { default: { type: 'literal', value: 'put' } },
665
+ position: { default: { type: 'literal', value: 'before' } },
666
+ },
667
+ },
668
+
669
+ // Click + Put after: "{value} 後に {target} を クリック で 置く"
670
+ {
671
+ id: 'grammar-ja-click-put-after',
672
+ language: 'ja',
673
+ command: 'on',
674
+ priority: 78,
675
+ template: {
676
+ format: '{patient} 後に {destination} を クリック で 置く',
677
+ tokens: [
678
+ { type: 'role', role: 'patient' },
679
+ { type: 'literal', value: '後に' },
680
+ { type: 'role', role: 'destination' },
681
+ { type: 'literal', value: 'を' },
682
+ { type: 'literal', value: 'クリック' },
683
+ { type: 'literal', value: 'で' },
684
+ { type: 'literal', value: '置く', alternatives: ['入れる'] },
685
+ ],
686
+ },
687
+ extraction: {
688
+ patient: { position: 0 },
689
+ destination: { position: 1 },
690
+ event: { default: { type: 'literal', value: 'click' } },
691
+ action: { default: { type: 'literal', value: 'put' } },
692
+ position: { default: { type: 'literal', value: 'after' } },
693
+ },
694
+ },
695
+
696
+ // ==========================================================================
697
+ // FETCH PATTERNS
698
+ // ==========================================================================
699
+
700
+ // Click + Fetch: "{source} を クリック で 取得"
701
+ {
702
+ id: 'grammar-ja-click-fetch',
703
+ language: 'ja',
704
+ command: 'on',
705
+ priority: 75,
706
+ template: {
707
+ format: '{source} を クリック で 取得',
708
+ tokens: [
709
+ { type: 'role', role: 'source' },
710
+ { type: 'literal', value: 'を' },
711
+ { type: 'literal', value: 'クリック' },
712
+ { type: 'literal', value: 'で' },
713
+ { type: 'literal', value: '取得', alternatives: ['フェッチ', '取る'] },
714
+ ],
715
+ },
716
+ extraction: {
717
+ source: { position: 0 },
718
+ event: { default: { type: 'literal', value: 'click' } },
719
+ action: { default: { type: 'literal', value: 'fetch' } },
720
+ },
721
+ },
722
+
723
+ // Click + Fetch then: "{source} を クリック で 取得 それから"
724
+ {
725
+ id: 'grammar-ja-click-fetch-then',
726
+ language: 'ja',
727
+ command: 'on',
728
+ priority: 85,
729
+ template: {
730
+ format: '{source} を クリック で 取得 それから',
731
+ tokens: [
732
+ { type: 'role', role: 'source' },
733
+ { type: 'literal', value: 'を' },
734
+ { type: 'literal', value: 'クリック' },
735
+ { type: 'literal', value: 'で' },
736
+ { type: 'literal', value: '取得', alternatives: ['フェッチ', '取る'] },
737
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
738
+ ],
739
+ },
740
+ extraction: {
741
+ source: { position: 0 },
742
+ event: { default: { type: 'literal', value: 'click' } },
743
+ action: { default: { type: 'literal', value: 'fetch' } },
744
+ continues: { default: { type: 'literal', value: 'then' } },
745
+ },
746
+ },
747
+
748
+ // ==========================================================================
749
+ // TRANSITION PATTERNS
750
+ // ==========================================================================
751
+
752
+ // Click + Transition: "{property} を クリック で 遷移 {value} に {duration}"
753
+ {
754
+ id: 'grammar-ja-click-transition',
755
+ language: 'ja',
756
+ command: 'on',
757
+ priority: 77,
758
+ template: {
759
+ format: '{patient} を クリック で 遷移 {value} に {duration}',
760
+ tokens: [
761
+ { type: 'role', role: 'patient' },
762
+ { type: 'literal', value: 'を' },
763
+ { type: 'literal', value: 'クリック' },
764
+ { type: 'literal', value: 'で' },
765
+ { type: 'literal', value: '遷移', alternatives: ['アニメーション', '推移'] },
766
+ { type: 'role', role: 'goal' },
767
+ { type: 'literal', value: 'に' },
768
+ { type: 'role', role: 'duration' },
769
+ ],
770
+ },
771
+ extraction: {
772
+ patient: { position: 0 },
773
+ goal: { position: 1 },
774
+ duration: { position: 2 },
775
+ event: { default: { type: 'literal', value: 'click' } },
776
+ action: { default: { type: 'literal', value: 'transition' } },
777
+ },
778
+ },
779
+
780
+ // Click + Transition then: "{property} を クリック で 遷移 {value} に {duration} それから"
781
+ {
782
+ id: 'grammar-ja-click-transition-then',
783
+ language: 'ja',
784
+ command: 'on',
785
+ priority: 87,
786
+ template: {
787
+ format: '{patient} を クリック で 遷移 {value} に {duration} それから',
788
+ tokens: [
789
+ { type: 'role', role: 'patient' },
790
+ { type: 'literal', value: 'を' },
791
+ { type: 'literal', value: 'クリック' },
792
+ { type: 'literal', value: 'で' },
793
+ { type: 'literal', value: '遷移', alternatives: ['アニメーション', '推移'] },
794
+ { type: 'role', role: 'goal' },
795
+ { type: 'literal', value: 'に' },
796
+ { type: 'role', role: 'duration' },
797
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
798
+ ],
799
+ },
800
+ extraction: {
801
+ patient: { position: 0 },
802
+ goal: { position: 1 },
803
+ duration: { position: 2 },
804
+ event: { default: { type: 'literal', value: 'click' } },
805
+ action: { default: { type: 'literal', value: 'transition' } },
806
+ continues: { default: { type: 'literal', value: 'then' } },
807
+ },
808
+ },
809
+
810
+ // ==========================================================================
811
+ // SEND PATTERNS
812
+ // ==========================================================================
813
+
814
+ // Click + Send: "{message} を クリック で 送る {target} に"
815
+ {
816
+ id: 'grammar-ja-click-send',
817
+ language: 'ja',
818
+ command: 'on',
819
+ priority: 77,
820
+ template: {
821
+ format: '{patient} を クリック で 送る {destination} に',
822
+ tokens: [
823
+ { type: 'role', role: 'patient' },
824
+ { type: 'literal', value: 'を' },
825
+ { type: 'literal', value: 'クリック' },
826
+ { type: 'literal', value: 'で' },
827
+ { type: 'literal', value: '送る', alternatives: ['送信', '送り'] },
828
+ { type: 'role', role: 'destination' },
829
+ { type: 'literal', value: 'に' },
830
+ ],
831
+ },
832
+ extraction: {
833
+ patient: { position: 0 },
834
+ destination: { position: 1 },
835
+ event: { default: { type: 'literal', value: 'click' } },
836
+ action: { default: { type: 'literal', value: 'send' } },
837
+ },
838
+ },
839
+
840
+ // ==========================================================================
841
+ // TRIGGER PATTERNS
842
+ // ==========================================================================
843
+
844
+ // Load + Trigger: "{event} を 読み込み で 引き金"
845
+ {
846
+ id: 'grammar-ja-load-trigger',
847
+ language: 'ja',
848
+ command: 'on',
849
+ priority: 75,
850
+ template: {
851
+ format: '{patient} を 読み込み で 引き金',
852
+ tokens: [
853
+ { type: 'role', role: 'patient' },
854
+ { type: 'literal', value: 'を' },
855
+ { type: 'literal', value: '読み込み', alternatives: ['ロード'] },
856
+ { type: 'literal', value: 'で' },
857
+ { type: 'literal', value: '引き金', alternatives: ['トリガー', '発動'] },
858
+ ],
859
+ },
860
+ extraction: {
861
+ patient: { position: 0 },
862
+ event: { default: { type: 'literal', value: 'load' } },
863
+ action: { default: { type: 'literal', value: 'trigger' } },
864
+ },
865
+ },
866
+
867
+ // ==========================================================================
868
+ // FOCUS PATTERNS
869
+ // ==========================================================================
870
+
871
+ // Click + Focus: "{target} を クリック で フォーカス"
872
+ {
873
+ id: 'grammar-ja-click-focus',
874
+ language: 'ja',
875
+ command: 'on',
876
+ priority: 75,
877
+ template: {
878
+ format: '{patient} を クリック で フォーカス',
879
+ tokens: [
880
+ { type: 'role', role: 'patient' },
881
+ { type: 'literal', value: 'を' },
882
+ { type: 'literal', value: 'クリック' },
883
+ { type: 'literal', value: 'で' },
884
+ { type: 'literal', value: 'フォーカス', alternatives: ['集中', '焦点'] },
885
+ ],
886
+ },
887
+ extraction: {
888
+ patient: { position: 0 },
889
+ event: { default: { type: 'literal', value: 'click' } },
890
+ action: { default: { type: 'literal', value: 'focus' } },
891
+ },
892
+ },
893
+
894
+ // ==========================================================================
895
+ // LOG PATTERNS
896
+ // ==========================================================================
897
+
898
+ // Click + Log: "{message} を クリック で 記録"
899
+ {
900
+ id: 'grammar-ja-click-log',
901
+ language: 'ja',
902
+ command: 'on',
903
+ priority: 75,
904
+ template: {
905
+ format: '{patient} を クリック で 記録',
906
+ tokens: [
907
+ { type: 'role', role: 'patient' },
908
+ { type: 'literal', value: 'を' },
909
+ { type: 'literal', value: 'クリック' },
910
+ { type: 'literal', value: 'で' },
911
+ { type: 'literal', value: '記録', alternatives: ['ログ', '出力'] },
912
+ ],
913
+ },
914
+ extraction: {
915
+ patient: { position: 0 },
916
+ event: { default: { type: 'literal', value: 'click' } },
917
+ action: { default: { type: 'literal', value: 'log' } },
918
+ },
919
+ },
920
+
921
+ // ==========================================================================
922
+ // GO/NAVIGATE PATTERNS
923
+ // ==========================================================================
924
+
925
+ // Click + Go back: "back を クリック で 移動"
926
+ {
927
+ id: 'grammar-ja-click-go-back',
928
+ language: 'ja',
929
+ command: 'on',
930
+ priority: 75,
931
+ template: {
932
+ format: 'back を クリック で 移動',
933
+ tokens: [
934
+ { type: 'literal', value: 'back' },
935
+ { type: 'literal', value: 'を' },
936
+ { type: 'literal', value: 'クリック' },
937
+ { type: 'literal', value: 'で' },
938
+ { type: 'literal', value: '移動', alternatives: ['いく', 'ナビゲート'] },
939
+ ],
940
+ },
941
+ extraction: {
942
+ destination: { default: { type: 'literal', value: 'back' } },
943
+ event: { default: { type: 'literal', value: 'click' } },
944
+ action: { default: { type: 'literal', value: 'go' } },
945
+ },
946
+ },
947
+
948
+ // ==========================================================================
949
+ // CALL PATTERNS
950
+ // ==========================================================================
951
+
952
+ // Click + Call: "{function} を クリック で 呼び出し"
953
+ {
954
+ id: 'grammar-ja-click-call',
955
+ language: 'ja',
956
+ command: 'on',
957
+ priority: 75,
958
+ template: {
959
+ format: '{patient} を クリック で 呼び出し',
960
+ tokens: [
961
+ { type: 'role', role: 'patient' },
962
+ { type: 'literal', value: 'を' },
963
+ { type: 'literal', value: 'クリック' },
964
+ { type: 'literal', value: 'で' },
965
+ { type: 'literal', value: '呼び出し', alternatives: ['コール', '呼ぶ'] },
966
+ ],
967
+ },
968
+ extraction: {
969
+ patient: { position: 0 },
970
+ event: { default: { type: 'literal', value: 'click' } },
971
+ action: { default: { type: 'literal', value: 'call' } },
972
+ },
973
+ },
974
+
975
+ // ==========================================================================
976
+ // BLUR PATTERNS
977
+ // ==========================================================================
978
+
979
+ // Keydown + Blur: "{target} を {event} で ぼかし"
980
+ {
981
+ id: 'grammar-ja-keydown-blur',
982
+ language: 'ja',
983
+ command: 'on',
984
+ priority: 75,
985
+ template: {
986
+ format: '{patient} を {event} で ぼかし',
987
+ tokens: [
988
+ { type: 'role', role: 'patient' },
989
+ { type: 'literal', value: 'を' },
990
+ { type: 'role', role: 'event' },
991
+ { type: 'literal', value: 'で' },
992
+ { type: 'literal', value: 'ぼかし', alternatives: ['ブラー', 'ぼかす'] },
993
+ ],
994
+ },
995
+ extraction: {
996
+ patient: { position: 0 },
997
+ event: { position: 1 },
998
+ action: { default: { type: 'literal', value: 'blur' } },
999
+ },
1000
+ },
1001
+
1002
+ // ==========================================================================
1003
+ // GET PATTERNS
1004
+ // ==========================================================================
1005
+
1006
+ // Click + Get: "{target} を クリック で 取得"
1007
+ {
1008
+ id: 'grammar-ja-click-get',
1009
+ language: 'ja',
1010
+ command: 'on',
1011
+ priority: 75,
1012
+ template: {
1013
+ format: '{patient} を クリック で 取得',
1014
+ tokens: [
1015
+ { type: 'role', role: 'patient' },
1016
+ { type: 'literal', value: 'を' },
1017
+ { type: 'literal', value: 'クリック' },
1018
+ { type: 'literal', value: 'で' },
1019
+ { type: 'literal', value: '取得', alternatives: ['ゲット', '得る'] },
1020
+ ],
1021
+ },
1022
+ extraction: {
1023
+ patient: { position: 0 },
1024
+ event: { default: { type: 'literal', value: 'click' } },
1025
+ action: { default: { type: 'literal', value: 'get' } },
1026
+ },
1027
+ },
1028
+
1029
+ // Click + Get then: "{target} を クリック で 取得 それから"
1030
+ {
1031
+ id: 'grammar-ja-click-get-then',
1032
+ language: 'ja',
1033
+ command: 'on',
1034
+ priority: 85,
1035
+ template: {
1036
+ format: '{patient} を クリック で 取得 それから',
1037
+ tokens: [
1038
+ { type: 'role', role: 'patient' },
1039
+ { type: 'literal', value: 'を' },
1040
+ { type: 'literal', value: 'クリック' },
1041
+ { type: 'literal', value: 'で' },
1042
+ { type: 'literal', value: '取得', alternatives: ['ゲット', '得る'] },
1043
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
1044
+ ],
1045
+ },
1046
+ extraction: {
1047
+ patient: { position: 0 },
1048
+ event: { default: { type: 'literal', value: 'click' } },
1049
+ action: { default: { type: 'literal', value: 'get' } },
1050
+ continues: { default: { type: 'literal', value: 'then' } },
1051
+ },
1052
+ },
1053
+
1054
+ // ==========================================================================
1055
+ // DEFAULT PATTERNS (load event)
1056
+ // ==========================================================================
1057
+
1058
+ // Load + Default: "{patient} を 読み込み で 既定 {goal} に"
1059
+ {
1060
+ id: 'grammar-ja-load-default',
1061
+ language: 'ja',
1062
+ command: 'on',
1063
+ priority: 75,
1064
+ template: {
1065
+ format: '{patient} を 読み込み で 既定 {goal} に',
1066
+ tokens: [
1067
+ { type: 'role', role: 'patient' },
1068
+ { type: 'literal', value: 'を' },
1069
+ { type: 'literal', value: '読み込み', alternatives: ['ロード'] },
1070
+ { type: 'literal', value: 'で' },
1071
+ { type: 'literal', value: '既定', alternatives: ['デフォルト', '規定'] },
1072
+ { type: 'role', role: 'goal' },
1073
+ { type: 'literal', value: 'に' },
1074
+ ],
1075
+ },
1076
+ extraction: {
1077
+ patient: { position: 0 },
1078
+ goal: { position: 1 },
1079
+ event: { default: { type: 'literal', value: 'load' } },
1080
+ action: { default: { type: 'literal', value: 'default' } },
1081
+ },
1082
+ },
1083
+
1084
+ // ==========================================================================
1085
+ // WAIT FOR EVENT PATTERNS
1086
+ // ==========================================================================
1087
+
1088
+ // Click + Wait for event: "2s を クリック で 待つ それから"
1089
+ {
1090
+ id: 'grammar-ja-click-wait-then',
1091
+ language: 'ja',
1092
+ command: 'on',
1093
+ priority: 85,
1094
+ template: {
1095
+ format: '{duration} を クリック で 待つ それから',
1096
+ tokens: [
1097
+ { type: 'role', role: 'duration' },
1098
+ { type: 'literal', value: 'を' },
1099
+ { type: 'literal', value: 'クリック' },
1100
+ { type: 'literal', value: 'で' },
1101
+ { type: 'literal', value: '待つ', alternatives: ['ウェイト', '待機'] },
1102
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
1103
+ ],
1104
+ },
1105
+ extraction: {
1106
+ duration: { position: 0 },
1107
+ event: { default: { type: 'literal', value: 'click' } },
1108
+ action: { default: { type: 'literal', value: 'wait' } },
1109
+ continues: { default: { type: 'literal', value: 'then' } },
1110
+ },
1111
+ },
1112
+
1113
+ // ==========================================================================
1114
+ // EXCHANGE/SWAP PATTERNS
1115
+ // ==========================================================================
1116
+
1117
+ // Click + Exchange: "{source} を クリック で 交換 {target} で"
1118
+ {
1119
+ id: 'grammar-ja-click-exchange',
1120
+ language: 'ja',
1121
+ command: 'on',
1122
+ priority: 76,
1123
+ template: {
1124
+ format: '{patient} を クリック で 交換 {destination} で',
1125
+ tokens: [
1126
+ { type: 'role', role: 'patient' },
1127
+ { type: 'literal', value: 'を' },
1128
+ { type: 'literal', value: 'クリック' },
1129
+ { type: 'literal', value: 'で' },
1130
+ { type: 'literal', value: '交換', alternatives: ['スワップ', '入れ替え'] },
1131
+ { type: 'role', role: 'destination' },
1132
+ { type: 'literal', value: 'で' },
1133
+ ],
1134
+ },
1135
+ extraction: {
1136
+ patient: { position: 0 },
1137
+ destination: { position: 1 },
1138
+ event: { default: { type: 'literal', value: 'click' } },
1139
+ action: { default: { type: 'literal', value: 'swap' } },
1140
+ },
1141
+ },
1142
+
1143
+ // ==========================================================================
1144
+ // PUT BEFORE/AFTER PATTERNS
1145
+ // ==========================================================================
1146
+
1147
+ // Click + Put before: "{content} 前に {target} を クリック で 置く"
1148
+ {
1149
+ id: 'grammar-ja-click-put-before',
1150
+ language: 'ja',
1151
+ command: 'on',
1152
+ priority: 76,
1153
+ template: {
1154
+ format: '{patient} 前に {destination} を クリック で 置く',
1155
+ tokens: [
1156
+ { type: 'role', role: 'patient' },
1157
+ { type: 'literal', value: '前に', alternatives: ['前'] },
1158
+ { type: 'role', role: 'destination' },
1159
+ { type: 'literal', value: 'を' },
1160
+ { type: 'literal', value: 'クリック' },
1161
+ { type: 'literal', value: 'で' },
1162
+ { type: 'literal', value: '置く', alternatives: ['入れる', 'プット'] },
1163
+ ],
1164
+ },
1165
+ extraction: {
1166
+ patient: { position: 0 },
1167
+ destination: { position: 1 },
1168
+ event: { default: { type: 'literal', value: 'click' } },
1169
+ action: { default: { type: 'literal', value: 'put' } },
1170
+ modifier: { default: { type: 'literal', value: 'before' } },
1171
+ },
1172
+ },
1173
+
1174
+ // Click + Put after: "{content} 後に {target} を クリック で 置く"
1175
+ {
1176
+ id: 'grammar-ja-click-put-after',
1177
+ language: 'ja',
1178
+ command: 'on',
1179
+ priority: 76,
1180
+ template: {
1181
+ format: '{patient} 後に {destination} を クリック で 置く',
1182
+ tokens: [
1183
+ { type: 'role', role: 'patient' },
1184
+ { type: 'literal', value: '後に', alternatives: ['後'] },
1185
+ { type: 'role', role: 'destination' },
1186
+ { type: 'literal', value: 'を' },
1187
+ { type: 'literal', value: 'クリック' },
1188
+ { type: 'literal', value: 'で' },
1189
+ { type: 'literal', value: '置く', alternatives: ['入れる', 'プット'] },
1190
+ ],
1191
+ },
1192
+ extraction: {
1193
+ patient: { position: 0 },
1194
+ destination: { position: 1 },
1195
+ event: { default: { type: 'literal', value: 'click' } },
1196
+ action: { default: { type: 'literal', value: 'put' } },
1197
+ modifier: { default: { type: 'literal', value: 'after' } },
1198
+ },
1199
+ },
1200
+
1201
+ // ==========================================================================
1202
+ // POSSESSIVE PATTERNS
1203
+ // ==========================================================================
1204
+
1205
+ // Click + Set possessive: "私の {property} を クリック で 設定 {value} に"
1206
+ {
1207
+ id: 'grammar-ja-click-set-possessive',
1208
+ language: 'ja',
1209
+ command: 'on',
1210
+ priority: 77,
1211
+ template: {
1212
+ format: '私の {patient} を クリック で 設定 {goal} に',
1213
+ tokens: [
1214
+ { type: 'literal', value: '私の', alternatives: ['あなたの', 'その'] },
1215
+ { type: 'role', role: 'patient' },
1216
+ { type: 'literal', value: 'を' },
1217
+ { type: 'literal', value: 'クリック' },
1218
+ { type: 'literal', value: 'で' },
1219
+ { type: 'literal', value: '設定', alternatives: ['セット'] },
1220
+ { type: 'role', role: 'goal' },
1221
+ { type: 'literal', value: 'に' },
1222
+ ],
1223
+ },
1224
+ extraction: {
1225
+ patient: { position: 0 },
1226
+ goal: { position: 1 },
1227
+ event: { default: { type: 'literal', value: 'click' } },
1228
+ action: { default: { type: 'literal', value: 'set' } },
1229
+ },
1230
+ },
1231
+
1232
+ // ==========================================================================
1233
+ // WAIT THEN REMOVE PATTERNS
1234
+ // ==========================================================================
1235
+
1236
+ // Click + Wait then remove: "{duration} を クリック で 待つ それから 私 を 削除"
1237
+ {
1238
+ id: 'grammar-ja-click-wait-then-remove',
1239
+ language: 'ja',
1240
+ command: 'on',
1241
+ priority: 86,
1242
+ template: {
1243
+ format: '{duration} を クリック で 待つ それから 私 を 削除',
1244
+ tokens: [
1245
+ { type: 'role', role: 'duration' },
1246
+ { type: 'literal', value: 'を' },
1247
+ { type: 'literal', value: 'クリック' },
1248
+ { type: 'literal', value: 'で' },
1249
+ { type: 'literal', value: '待つ', alternatives: ['ウェイト', '待機'] },
1250
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
1251
+ { type: 'literal', value: '私', alternatives: ['me'] },
1252
+ { type: 'literal', value: 'を' },
1253
+ { type: 'literal', value: '削除', alternatives: ['取り除く', '消す'] },
1254
+ ],
1255
+ },
1256
+ extraction: {
1257
+ duration: { position: 0 },
1258
+ patient: { default: { type: 'literal', value: 'me' } },
1259
+ event: { default: { type: 'literal', value: 'click' } },
1260
+ action: { default: { type: 'literal', value: 'wait' } },
1261
+ continues: { default: { type: 'literal', value: 'then' } },
1262
+ },
1263
+ },
1264
+
1265
+ // ==========================================================================
1266
+ // KEYDOWN/BLUR PATTERNS
1267
+ // ==========================================================================
1268
+
1269
+ // Keydown + Blur: "私 を keydown[key=="Escape"] で ぼかし"
1270
+ {
1271
+ id: 'grammar-ja-keydown-blur',
1272
+ language: 'ja',
1273
+ command: 'on',
1274
+ priority: 76,
1275
+ template: {
1276
+ format: '{patient} を {event} で ぼかし',
1277
+ tokens: [
1278
+ { type: 'role', role: 'patient' },
1279
+ { type: 'literal', value: 'を' },
1280
+ { type: 'role', role: 'event' },
1281
+ { type: 'literal', value: 'で' },
1282
+ { type: 'literal', value: 'ぼかし', alternatives: ['ブラー', 'フォーカス解除'] },
1283
+ ],
1284
+ },
1285
+ extraction: {
1286
+ patient: { position: 0 },
1287
+ event: { position: 1 },
1288
+ action: { default: { type: 'literal', value: 'blur' } },
1289
+ },
1290
+ },
1291
+
1292
+ // ==========================================================================
1293
+ // INPUT EVENT PATTERNS
1294
+ // ==========================================================================
1295
+
1296
+ // Input + Put value: "私の 値 を {destination} に 置く 入力 で"
1297
+ {
1298
+ id: 'grammar-ja-input-put-value',
1299
+ language: 'ja',
1300
+ command: 'on',
1301
+ priority: 77,
1302
+ template: {
1303
+ format: '私の 値 を {destination} に 置く 入力 で',
1304
+ tokens: [
1305
+ { type: 'literal', value: '私の', alternatives: ['あなたの', 'その'] },
1306
+ { type: 'literal', value: '値', alternatives: ['価値'] },
1307
+ { type: 'literal', value: 'を' },
1308
+ { type: 'role', role: 'destination' },
1309
+ { type: 'literal', value: 'に' },
1310
+ { type: 'literal', value: '置く', alternatives: ['入れる', 'プット'] },
1311
+ { type: 'literal', value: '入力', alternatives: ['インプット'] },
1312
+ { type: 'literal', value: 'で' },
1313
+ ],
1314
+ },
1315
+ extraction: {
1316
+ patient: { default: { type: 'literal', value: 'my value' } },
1317
+ destination: { position: 0 },
1318
+ event: { default: { type: 'literal', value: 'input' } },
1319
+ action: { default: { type: 'literal', value: 'put' } },
1320
+ },
1321
+ },
1322
+
1323
+ // Input + Set: "{property} を 入力 で 設定 {value} に"
1324
+ {
1325
+ id: 'grammar-ja-input-set',
1326
+ language: 'ja',
1327
+ command: 'on',
1328
+ priority: 76,
1329
+ template: {
1330
+ format: '{patient} を 入力 で 設定 {goal} に',
1331
+ tokens: [
1332
+ { type: 'role', role: 'patient' },
1333
+ { type: 'literal', value: 'を' },
1334
+ { type: 'literal', value: '入力', alternatives: ['インプット'] },
1335
+ { type: 'literal', value: 'で' },
1336
+ { type: 'literal', value: '設定', alternatives: ['セット'] },
1337
+ { type: 'role', role: 'goal' },
1338
+ { type: 'literal', value: 'に' },
1339
+ ],
1340
+ },
1341
+ extraction: {
1342
+ patient: { position: 0 },
1343
+ goal: { position: 1 },
1344
+ event: { default: { type: 'literal', value: 'input' } },
1345
+ action: { default: { type: 'literal', value: 'set' } },
1346
+ },
1347
+ },
1348
+
1349
+ // ==========================================================================
1350
+ // SET PREVIOUS PATTERNS
1351
+ // ==========================================================================
1352
+
1353
+ // Click + Set previous: "前 <input/>.value を クリック で 設定 "" に"
1354
+ {
1355
+ id: 'grammar-ja-click-set-previous',
1356
+ language: 'ja',
1357
+ command: 'on',
1358
+ priority: 77,
1359
+ template: {
1360
+ format: '前 {patient} を クリック で 設定 {goal} に',
1361
+ tokens: [
1362
+ { type: 'literal', value: '前', alternatives: ['前の', '以前'] },
1363
+ { type: 'role', role: 'patient' },
1364
+ { type: 'literal', value: 'を' },
1365
+ { type: 'literal', value: 'クリック' },
1366
+ { type: 'literal', value: 'で' },
1367
+ { type: 'literal', value: '設定', alternatives: ['セット'] },
1368
+ { type: 'role', role: 'goal' },
1369
+ { type: 'literal', value: 'に' },
1370
+ ],
1371
+ },
1372
+ extraction: {
1373
+ patient: { position: 0 },
1374
+ goal: { position: 1 },
1375
+ modifier: { default: { type: 'literal', value: 'previous' } },
1376
+ event: { default: { type: 'literal', value: 'click' } },
1377
+ action: { default: { type: 'literal', value: 'set' } },
1378
+ },
1379
+ },
1380
+
1381
+ // ==========================================================================
1382
+ // HIDE CLOSEST THEN PATTERNS
1383
+ // ==========================================================================
1384
+
1385
+ // Click + Hide closest then: "最も近い .modal を クリック で 隠す それから"
1386
+ {
1387
+ id: 'grammar-ja-click-hide-closest-then',
1388
+ language: 'ja',
1389
+ command: 'on',
1390
+ priority: 85,
1391
+ template: {
1392
+ format: '最も近い {patient} を クリック で 隠す それから',
1393
+ tokens: [
1394
+ { type: 'literal', value: '最も近い', alternatives: ['一番近い', '最寄りの'] },
1395
+ { type: 'role', role: 'patient' },
1396
+ { type: 'literal', value: 'を' },
1397
+ { type: 'literal', value: 'クリック' },
1398
+ { type: 'literal', value: 'で' },
1399
+ { type: 'literal', value: '隠す', alternatives: ['ハイド', '非表示'] },
1400
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
1401
+ ],
1402
+ },
1403
+ extraction: {
1404
+ patient: { position: 0 },
1405
+ event: { default: { type: 'literal', value: 'click' } },
1406
+ action: { default: { type: 'literal', value: 'hide' } },
1407
+ modifier: { default: { type: 'literal', value: 'closest' } },
1408
+ continues: { default: { type: 'literal', value: 'then' } },
1409
+ },
1410
+ },
1411
+
1412
+ // ==========================================================================
1413
+ // LOAD EVENT PATTERNS
1414
+ // ==========================================================================
1415
+
1416
+ // Load + Call: "{function} を 読み込み で 呼び出し"
1417
+ {
1418
+ id: 'grammar-ja-load-call',
1419
+ language: 'ja',
1420
+ command: 'on',
1421
+ priority: 76,
1422
+ template: {
1423
+ format: '{patient} を 読み込み で 呼び出し',
1424
+ tokens: [
1425
+ { type: 'role', role: 'patient' },
1426
+ { type: 'literal', value: 'を' },
1427
+ { type: 'literal', value: '読み込み', alternatives: ['ロード'] },
1428
+ { type: 'literal', value: 'で' },
1429
+ { type: 'literal', value: '呼び出し', alternatives: ['コール', '実行'] },
1430
+ ],
1431
+ },
1432
+ extraction: {
1433
+ patient: { position: 0 },
1434
+ event: { default: { type: 'literal', value: 'load' } },
1435
+ action: { default: { type: 'literal', value: 'call' } },
1436
+ },
1437
+ },
1438
+
1439
+ // ==========================================================================
1440
+ // STYLE PROPERTY SET PATTERNS
1441
+ // ==========================================================================
1442
+
1443
+ // Click + Set my *opacity: "私の *opacity を クリック で 設定 0.5 に"
1444
+ {
1445
+ id: 'grammar-ja-click-set-my-style',
1446
+ language: 'ja',
1447
+ command: 'on',
1448
+ priority: 77,
1449
+ template: {
1450
+ format: '私の {patient} を クリック で 設定 {goal} に',
1451
+ tokens: [
1452
+ { type: 'literal', value: '私の', alternatives: ['あなたの', 'その'] },
1453
+ { type: 'role', role: 'patient' },
1454
+ { type: 'literal', value: 'を' },
1455
+ { type: 'literal', value: 'クリック' },
1456
+ { type: 'literal', value: 'で' },
1457
+ { type: 'literal', value: '設定', alternatives: ['セット'] },
1458
+ { type: 'role', role: 'goal' },
1459
+ { type: 'literal', value: 'に' },
1460
+ ],
1461
+ },
1462
+ extraction: {
1463
+ patient: { position: 0 },
1464
+ goal: { position: 1 },
1465
+ event: { default: { type: 'literal', value: 'click' } },
1466
+ action: { default: { type: 'literal', value: 'set' } },
1467
+ },
1468
+ },
1469
+
1470
+ // ==========================================================================
1471
+ // DEFAULT ON LOAD PATTERNS
1472
+ // ==========================================================================
1473
+
1474
+ // Load + Default: "私の @data-count を 読み込み で 既定 "0" に"
1475
+ {
1476
+ id: 'grammar-ja-load-default',
1477
+ language: 'ja',
1478
+ command: 'on',
1479
+ priority: 77,
1480
+ template: {
1481
+ format: '私の {patient} を 読み込み で 既定 {goal} に',
1482
+ tokens: [
1483
+ { type: 'literal', value: '私の', alternatives: ['あなたの', 'その'] },
1484
+ { type: 'role', role: 'patient' },
1485
+ { type: 'literal', value: 'を' },
1486
+ { type: 'literal', value: '読み込み', alternatives: ['ロード'] },
1487
+ { type: 'literal', value: 'で' },
1488
+ { type: 'literal', value: '既定', alternatives: ['デフォルト', '初期値'] },
1489
+ { type: 'role', role: 'goal' },
1490
+ { type: 'literal', value: 'に' },
1491
+ ],
1492
+ },
1493
+ extraction: {
1494
+ patient: { position: 0 },
1495
+ goal: { position: 1 },
1496
+ event: { default: { type: 'literal', value: 'load' } },
1497
+ action: { default: { type: 'literal', value: 'default' } },
1498
+ },
1499
+ },
1500
+
1501
+ // ==========================================================================
1502
+ // TELL/SHOW PATTERNS
1503
+ // ==========================================================================
1504
+
1505
+ // Click + Tell show: "#modal を クリック で 伝える 表示 に"
1506
+ {
1507
+ id: 'grammar-ja-click-tell-show',
1508
+ language: 'ja',
1509
+ command: 'on',
1510
+ priority: 76,
1511
+ template: {
1512
+ format: '{patient} を クリック で 伝える 表示 に',
1513
+ tokens: [
1514
+ { type: 'role', role: 'patient' },
1515
+ { type: 'literal', value: 'を' },
1516
+ { type: 'literal', value: 'クリック' },
1517
+ { type: 'literal', value: 'で' },
1518
+ { type: 'literal', value: '伝える', alternatives: ['テル', '告げる'] },
1519
+ { type: 'literal', value: '表示', alternatives: ['ショー', '見せる'] },
1520
+ { type: 'literal', value: 'に' },
1521
+ ],
1522
+ },
1523
+ extraction: {
1524
+ patient: { position: 0 },
1525
+ goal: { default: { type: 'literal', value: 'show' } },
1526
+ event: { default: { type: 'literal', value: 'click' } },
1527
+ action: { default: { type: 'literal', value: 'tell' } },
1528
+ },
1529
+ },
1530
+
1531
+ // ==========================================================================
1532
+ // STOP EVENT THEN TOGGLE PATTERNS
1533
+ // ==========================================================================
1534
+
1535
+ // Click + Stop event then toggle: "the イベント を クリック で 停止 それから .active を 切り替え"
1536
+ {
1537
+ id: 'grammar-ja-click-stop-then-toggle',
1538
+ language: 'ja',
1539
+ command: 'on',
1540
+ priority: 86,
1541
+ template: {
1542
+ format: 'the イベント を クリック で 停止 それから {patient} を 切り替え',
1543
+ tokens: [
1544
+ { type: 'literal', value: 'the' },
1545
+ { type: 'literal', value: 'イベント', alternatives: ['event'] },
1546
+ { type: 'literal', value: 'を' },
1547
+ { type: 'literal', value: 'クリック' },
1548
+ { type: 'literal', value: 'で' },
1549
+ { type: 'literal', value: '停止', alternatives: ['ストップ', '止める'] },
1550
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
1551
+ { type: 'role', role: 'patient' },
1552
+ { type: 'literal', value: 'を' },
1553
+ { type: 'literal', value: '切り替え', alternatives: ['トグル', '切替'] },
1554
+ ],
1555
+ },
1556
+ extraction: {
1557
+ patient: { position: 0 },
1558
+ event: { default: { type: 'literal', value: 'click' } },
1559
+ action: { default: { type: 'literal', value: 'halt' } },
1560
+ continues: { default: { type: 'literal', value: 'then' } },
1561
+ },
1562
+ },
1563
+
1564
+ // ==========================================================================
1565
+ // MAKE THEN PUT PATTERNS
1566
+ // ==========================================================================
1567
+
1568
+ // Click + Make then put: "a <div.card/> を クリック で 作る それから それ を #container に 置く"
1569
+ {
1570
+ id: 'grammar-ja-click-make-then-put',
1571
+ language: 'ja',
1572
+ command: 'on',
1573
+ priority: 86,
1574
+ template: {
1575
+ format: 'a {patient} を クリック で 作る それから',
1576
+ tokens: [
1577
+ { type: 'literal', value: 'a' },
1578
+ { type: 'role', role: 'patient' },
1579
+ { type: 'literal', value: 'を' },
1580
+ { type: 'literal', value: 'クリック' },
1581
+ { type: 'literal', value: 'で' },
1582
+ { type: 'literal', value: '作る', alternatives: ['メイク', '作成'] },
1583
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
1584
+ ],
1585
+ },
1586
+ extraction: {
1587
+ patient: { position: 0 },
1588
+ event: { default: { type: 'literal', value: 'click' } },
1589
+ action: { default: { type: 'literal', value: 'make' } },
1590
+ continues: { default: { type: 'literal', value: 'then' } },
1591
+ },
1592
+ },
1593
+
1594
+ // ==========================================================================
1595
+ // WAIT THEN REMOVE PATTERNS (simpler)
1596
+ // ==========================================================================
1597
+
1598
+ // Click + Wait duration then: "{duration} を クリック で 待つ それから"
1599
+ {
1600
+ id: 'grammar-ja-click-wait-duration-then',
1601
+ language: 'ja',
1602
+ command: 'on',
1603
+ priority: 86,
1604
+ template: {
1605
+ format: '{duration} を クリック で 待つ それから',
1606
+ tokens: [
1607
+ { type: 'role', role: 'duration' },
1608
+ { type: 'literal', value: 'を' },
1609
+ { type: 'literal', value: 'クリック' },
1610
+ { type: 'literal', value: 'で' },
1611
+ { type: 'literal', value: '待つ', alternatives: ['ウェイト', '待機'] },
1612
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
1613
+ ],
1614
+ },
1615
+ extraction: {
1616
+ duration: { position: 0 },
1617
+ event: { default: { type: 'literal', value: 'click' } },
1618
+ action: { default: { type: 'literal', value: 'wait' } },
1619
+ continues: { default: { type: 'literal', value: 'then' } },
1620
+ },
1621
+ },
1622
+
1623
+ // ==========================================================================
1624
+ // REPEAT TIMES THEN PATTERNS
1625
+ // ==========================================================================
1626
+
1627
+ // Click + Repeat times then: "3 times を クリック で 繰り返し それから"
1628
+ {
1629
+ id: 'grammar-ja-click-repeat-times-then',
1630
+ language: 'ja',
1631
+ command: 'on',
1632
+ priority: 86,
1633
+ template: {
1634
+ format: '{duration} times を クリック で 繰り返し それから',
1635
+ tokens: [
1636
+ { type: 'role', role: 'duration' },
1637
+ { type: 'literal', value: 'times', alternatives: ['回'] },
1638
+ { type: 'literal', value: 'を' },
1639
+ { type: 'literal', value: 'クリック' },
1640
+ { type: 'literal', value: 'で' },
1641
+ { type: 'literal', value: '繰り返し', alternatives: ['リピート', '反復'] },
1642
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
1643
+ ],
1644
+ },
1645
+ extraction: {
1646
+ duration: { position: 0 },
1647
+ event: { default: { type: 'literal', value: 'click' } },
1648
+ action: { default: { type: 'literal', value: 'repeat' } },
1649
+ continues: { default: { type: 'literal', value: 'then' } },
1650
+ },
1651
+ },
1652
+
1653
+ // ==========================================================================
1654
+ // SEND PATTERNS
1655
+ // ==========================================================================
1656
+
1657
+ // Click + Send: "{event} を クリック で 送る {target} に"
1658
+ {
1659
+ id: 'grammar-ja-click-send',
1660
+ language: 'ja',
1661
+ command: 'on',
1662
+ priority: 76,
1663
+ template: {
1664
+ format: '{patient} を クリック で 送る {destination} に',
1665
+ tokens: [
1666
+ { type: 'role', role: 'patient' },
1667
+ { type: 'literal', value: 'を' },
1668
+ { type: 'literal', value: 'クリック' },
1669
+ { type: 'literal', value: 'で' },
1670
+ { type: 'literal', value: '送る', alternatives: ['センド', '送信'] },
1671
+ { type: 'role', role: 'destination' },
1672
+ { type: 'literal', value: 'に' },
1673
+ ],
1674
+ },
1675
+ extraction: {
1676
+ patient: { position: 0 },
1677
+ destination: { position: 1 },
1678
+ event: { default: { type: 'literal', value: 'click' } },
1679
+ action: { default: { type: 'literal', value: 'send' } },
1680
+ },
1681
+ },
1682
+
1683
+ // ==========================================================================
1684
+ // ASYNC FETCH THEN PUT PATTERNS
1685
+ // ==========================================================================
1686
+
1687
+ // Click + Async fetch then: "取得 {source} を クリック で 非同期 それから"
1688
+ {
1689
+ id: 'grammar-ja-click-async-fetch-then',
1690
+ language: 'ja',
1691
+ command: 'on',
1692
+ priority: 86,
1693
+ template: {
1694
+ format: '取得 {source} を クリック で 非同期 それから',
1695
+ tokens: [
1696
+ { type: 'literal', value: '取得', alternatives: ['フェッチ', 'ゲット'] },
1697
+ { type: 'role', role: 'source' },
1698
+ { type: 'literal', value: 'を' },
1699
+ { type: 'literal', value: 'クリック' },
1700
+ { type: 'literal', value: 'で' },
1701
+ { type: 'literal', value: '非同期', alternatives: ['アシンク', 'async'] },
1702
+ { type: 'literal', value: 'それから', alternatives: ['次に', 'そして'] },
1703
+ ],
1704
+ },
1705
+ extraction: {
1706
+ source: { position: 0 },
1707
+ event: { default: { type: 'literal', value: 'click' } },
1708
+ action: { default: { type: 'literal', value: 'fetch' } },
1709
+ continues: { default: { type: 'literal', value: 'then' } },
1710
+ },
1711
+ },
1712
+ ];
1713
+ }