@lokascript/semantic 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ar.ar.global.js +2 -2
- package/dist/browser-core.core.global.js +2 -2
- package/dist/browser-de.de.global.js +2 -2
- package/dist/browser-east-asian.east-asian.global.js +2 -2
- package/dist/browser-en-tr.en-tr.global.js +2 -2
- package/dist/browser-en.en.global.js +2 -2
- package/dist/browser-es-en.es-en.global.js +2 -2
- package/dist/browser-es.es.global.js +2 -2
- package/dist/browser-fr.fr.global.js +2 -2
- package/dist/browser-id.id.global.js +2 -2
- package/dist/browser-ja.ja.global.js +2 -2
- package/dist/browser-ko.ko.global.js +2 -2
- package/dist/browser-lazy.lazy.global.js +2 -2
- package/dist/browser-priority.priority.global.js +2 -2
- package/dist/browser-pt.pt.global.js +2 -2
- package/dist/browser-qu.qu.global.js +2 -2
- package/dist/browser-sw.sw.global.js +2 -2
- package/dist/browser-tr.tr.global.js +2 -2
- package/dist/browser-western.western.global.js +2 -2
- package/dist/browser-zh.zh.global.js +2 -2
- package/dist/browser.global.js +2 -2
- package/dist/browser.global.js.map +1 -1
- package/dist/index.cjs +13042 -17462
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +49 -5
- package/dist/index.d.ts +49 -5
- package/dist/index.js +14044 -18464
- package/dist/index.js.map +1 -1
- package/dist/languages/ar.d.ts +1 -1
- package/dist/languages/ar.js +31 -44
- package/dist/languages/ar.js.map +1 -1
- package/dist/languages/de.d.ts +1 -1
- package/dist/languages/de.js +14 -2
- package/dist/languages/de.js.map +1 -1
- package/dist/languages/en.d.ts +1 -1
- package/dist/languages/en.js +558 -12
- package/dist/languages/en.js.map +1 -1
- package/dist/languages/es.d.ts +1 -1
- package/dist/languages/es.js +16 -0
- package/dist/languages/es.js.map +1 -1
- package/dist/languages/fr.d.ts +1 -1
- package/dist/languages/fr.js +14 -2
- package/dist/languages/fr.js.map +1 -1
- package/dist/languages/id.d.ts +1 -1
- package/dist/languages/id.js +14 -2
- package/dist/languages/id.js.map +1 -1
- package/dist/languages/ja.d.ts +1 -1
- package/dist/languages/ja.js +18 -3
- package/dist/languages/ja.js.map +1 -1
- package/dist/languages/ko.d.ts +8 -1
- package/dist/languages/ko.js +75 -43
- package/dist/languages/ko.js.map +1 -1
- package/dist/languages/pt.d.ts +1 -1
- package/dist/languages/pt.js +17 -0
- package/dist/languages/pt.js.map +1 -1
- package/dist/languages/qu.d.ts +12 -1
- package/dist/languages/qu.js +77 -2
- package/dist/languages/qu.js.map +1 -1
- package/dist/languages/sw.d.ts +1 -1
- package/dist/languages/sw.js.map +1 -1
- package/dist/languages/tr.d.ts +9 -1
- package/dist/languages/tr.js +96 -72
- package/dist/languages/tr.js.map +1 -1
- package/dist/languages/zh.d.ts +1 -1
- package/dist/languages/zh.js +16 -0
- package/dist/languages/zh.js.map +1 -1
- package/dist/{types-C4dcj53L.d.ts → types-BY3Id07j.d.ts} +20 -5
- package/package.json +20 -29
- package/src/generators/command-schemas.ts +21 -10
- package/src/generators/event-handler-generator.ts +50 -44
- package/src/generators/language-profiles.ts +6 -0
- package/src/generators/pattern-generator.ts +883 -1
- package/src/generators/profiles/arabic.ts +19 -3
- package/src/generators/profiles/bengali.ts +12 -1
- package/src/generators/profiles/chinese.ts +15 -0
- package/src/generators/profiles/french.ts +12 -1
- package/src/generators/profiles/german.ts +12 -1
- package/src/generators/profiles/hebrew.ts +148 -0
- package/src/generators/profiles/hindi.ts +12 -1
- package/src/generators/profiles/index.ts +2 -0
- package/src/generators/profiles/indonesian.ts +12 -1
- package/src/generators/profiles/italian.ts +16 -0
- package/src/generators/profiles/japanese.ts +11 -2
- package/src/generators/profiles/korean.ts +15 -1
- package/src/generators/profiles/polish.ts +12 -0
- package/src/generators/profiles/portuguese.ts +16 -0
- package/src/generators/profiles/russian.ts +11 -0
- package/src/generators/profiles/spanish.ts +15 -0
- package/src/generators/profiles/spanishMexico.ts +176 -0
- package/src/generators/profiles/thai.ts +11 -0
- package/src/generators/profiles/turkish.ts +49 -7
- package/src/generators/profiles/types.ts +21 -5
- package/src/generators/profiles/ukrainian.ts +11 -0
- package/src/generators/profiles/vietnamese.ts +11 -0
- package/src/language-building-schema.ts +111 -0
- package/src/languages/_all.ts +5 -1
- package/src/languages/es-MX.ts +32 -0
- package/src/languages/he.ts +15 -0
- package/src/parser/pattern-matcher.ts +10 -1
- package/src/parser/semantic-parser.ts +3 -0
- package/src/patterns/add/ar.ts +3 -59
- package/src/patterns/add/index.ts +5 -1
- package/src/patterns/add/ja.ts +3 -81
- package/src/patterns/add/ko.ts +3 -62
- package/src/patterns/add/qu.ts +69 -0
- package/src/patterns/add/tr.ts +3 -59
- package/src/patterns/builders.ts +1 -0
- package/src/patterns/decrement/tr.ts +3 -36
- package/src/patterns/event-handler/ar.ts +3 -139
- package/src/patterns/event-handler/he.ts +15 -0
- package/src/patterns/event-handler/index.ts +5 -1
- package/src/patterns/event-handler/ja.ts +3 -106
- package/src/patterns/event-handler/ko.ts +3 -121
- package/src/patterns/event-handler/ms.ts +45 -20
- package/src/patterns/event-handler/tr.ts +3 -158
- package/src/patterns/get/ar.ts +3 -37
- package/src/patterns/get/ja.ts +3 -41
- package/src/patterns/get/ko.ts +3 -41
- package/src/patterns/grammar-transformed/ja.ts +3 -1701
- package/src/patterns/grammar-transformed/ko.ts +3 -1299
- package/src/patterns/grammar-transformed/tr.ts +3 -1055
- package/src/patterns/hide/ar.ts +3 -55
- package/src/patterns/hide/ja.ts +3 -57
- package/src/patterns/hide/ko.ts +3 -57
- package/src/patterns/hide/tr.ts +3 -53
- package/src/patterns/increment/tr.ts +3 -40
- package/src/patterns/put/ar.ts +3 -62
- package/src/patterns/put/ja.ts +3 -63
- package/src/patterns/put/ko.ts +3 -55
- package/src/patterns/put/tr.ts +3 -55
- package/src/patterns/remove/ar.ts +3 -59
- package/src/patterns/remove/index.ts +5 -1
- package/src/patterns/remove/ja.ts +3 -62
- package/src/patterns/remove/ko.ts +3 -66
- package/src/patterns/remove/qu.ts +69 -0
- package/src/patterns/remove/tr.ts +3 -66
- package/src/patterns/set/ar.ts +3 -72
- package/src/patterns/set/ja.ts +3 -74
- package/src/patterns/set/ko.ts +3 -73
- package/src/patterns/set/tr.ts +3 -95
- package/src/patterns/show/ar.ts +3 -55
- package/src/patterns/show/ja.ts +3 -57
- package/src/patterns/show/ko.ts +3 -61
- package/src/patterns/show/tr.ts +3 -53
- package/src/patterns/take/ar.ts +3 -39
- package/src/patterns/toggle/ar.ts +3 -49
- package/src/patterns/toggle/index.ts +5 -1
- package/src/patterns/toggle/ja.ts +3 -144
- package/src/patterns/toggle/ko.ts +3 -101
- package/src/patterns/toggle/qu.ts +90 -0
- package/src/patterns/toggle/tr.ts +3 -76
- package/src/registry.ts +179 -15
- package/src/tokenizers/arabic.ts +13 -46
- package/src/tokenizers/bengali.ts +2 -16
- package/src/tokenizers/he.ts +542 -0
- package/src/tokenizers/index.ts +1 -0
- package/src/tokenizers/japanese.ts +3 -1
- package/src/tokenizers/korean.ts +104 -48
- package/src/tokenizers/ms.ts +3 -0
- package/src/tokenizers/quechua.ts +101 -2
- package/src/tokenizers/turkish.ts +64 -69
- package/src/types.ts +13 -0
|
@@ -502,7 +502,7 @@ interface PossessiveConfig {
|
|
|
502
502
|
* Complete language profile for pattern generation.
|
|
503
503
|
*/
|
|
504
504
|
interface LanguageProfile {
|
|
505
|
-
/** ISO 639-1 language code */
|
|
505
|
+
/** ISO 639-1 or BCP 47 language code (e.g., 'es' or 'es-MX') */
|
|
506
506
|
readonly code: string;
|
|
507
507
|
/** Human-readable language name */
|
|
508
508
|
readonly name: string;
|
|
@@ -541,18 +541,33 @@ interface LanguageProfile {
|
|
|
541
541
|
* Individual keywords can override this via KeywordTranslation.form
|
|
542
542
|
*/
|
|
543
543
|
readonly defaultVerbForm?: VerbForm;
|
|
544
|
+
/**
|
|
545
|
+
* Base language code to extend (for regional variants).
|
|
546
|
+
* When set, this profile inherits from the base and overrides specific fields.
|
|
547
|
+
* Example: 'es-MX' profile with extends: 'es' inherits from Spanish base.
|
|
548
|
+
*/
|
|
549
|
+
readonly extends?: string;
|
|
544
550
|
}
|
|
545
551
|
/**
|
|
546
552
|
* Configuration for event handler pattern generation.
|
|
547
|
-
*
|
|
553
|
+
* Supports both SVO and SOV/VSO languages.
|
|
548
554
|
*/
|
|
549
555
|
interface EventHandlerConfig {
|
|
550
|
-
/** Primary event keyword (e.g., 'on', 'bei', 'sur') */
|
|
551
|
-
readonly keyword
|
|
556
|
+
/** Primary event keyword (e.g., 'on', 'bei', 'sur') for SVO */
|
|
557
|
+
readonly keyword?: KeywordTranslation;
|
|
552
558
|
/** Source filter marker (e.g., 'from', 'von', 'de') */
|
|
553
|
-
readonly sourceMarker
|
|
559
|
+
readonly sourceMarker?: RoleMarker;
|
|
554
560
|
/** Conditional keyword (e.g., 'when', 'wenn', 'quand') */
|
|
555
561
|
readonly conditionalKeyword?: KeywordTranslation;
|
|
562
|
+
/** Event marker for SOV/VSO languages (e.g., で (Japanese), 할 때 (Korean), da (Turkish), عند (Arabic)) */
|
|
563
|
+
readonly eventMarker?: RoleMarker;
|
|
564
|
+
/** Temporal/conditional markers that can optionally appear with events */
|
|
565
|
+
readonly temporalMarkers?: string[];
|
|
566
|
+
/**
|
|
567
|
+
* Negation marker for expressing negated events (e.g., Arabic عدم = "not/lack of").
|
|
568
|
+
* Used in patterns like: عند عدم التركيز = "when not focusing" = "on blur"
|
|
569
|
+
*/
|
|
570
|
+
readonly negationMarker?: RoleMarker;
|
|
556
571
|
}
|
|
557
572
|
/**
|
|
558
573
|
* Verb form used for command keywords.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokascript/semantic",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Semantic multilingual parser for hyperscript (23 languages)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"require": "./dist/index.cjs"
|
|
15
15
|
},
|
|
16
16
|
"./browser": {
|
|
17
|
-
"types": "./dist/
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
18
|
"default": "./dist/browser.global.js"
|
|
19
19
|
},
|
|
20
20
|
"./browser/en": {
|
|
@@ -41,66 +41,57 @@
|
|
|
41
41
|
"./browser/lazy": {
|
|
42
42
|
"default": "./dist/browser-lazy.lazy.global.js"
|
|
43
43
|
},
|
|
44
|
-
"./languages": {
|
|
45
|
-
"types": "./dist/languages/index.d.ts",
|
|
46
|
-
"import": "./dist/languages/index.mjs"
|
|
47
|
-
},
|
|
48
44
|
"./languages/en": {
|
|
49
45
|
"types": "./dist/languages/en.d.ts",
|
|
50
|
-
"import": "./dist/languages/en.
|
|
46
|
+
"import": "./dist/languages/en.js"
|
|
51
47
|
},
|
|
52
48
|
"./languages/es": {
|
|
53
49
|
"types": "./dist/languages/es.d.ts",
|
|
54
|
-
"import": "./dist/languages/es.
|
|
50
|
+
"import": "./dist/languages/es.js"
|
|
55
51
|
},
|
|
56
52
|
"./languages/ja": {
|
|
57
53
|
"types": "./dist/languages/ja.d.ts",
|
|
58
|
-
"import": "./dist/languages/ja.
|
|
54
|
+
"import": "./dist/languages/ja.js"
|
|
59
55
|
},
|
|
60
56
|
"./languages/ar": {
|
|
61
57
|
"types": "./dist/languages/ar.d.ts",
|
|
62
|
-
"import": "./dist/languages/ar.
|
|
58
|
+
"import": "./dist/languages/ar.js"
|
|
63
59
|
},
|
|
64
60
|
"./languages/ko": {
|
|
65
61
|
"types": "./dist/languages/ko.d.ts",
|
|
66
|
-
"import": "./dist/languages/ko.
|
|
62
|
+
"import": "./dist/languages/ko.js"
|
|
67
63
|
},
|
|
68
64
|
"./languages/zh": {
|
|
69
65
|
"types": "./dist/languages/zh.d.ts",
|
|
70
|
-
"import": "./dist/languages/zh.
|
|
66
|
+
"import": "./dist/languages/zh.js"
|
|
71
67
|
},
|
|
72
68
|
"./languages/tr": {
|
|
73
69
|
"types": "./dist/languages/tr.d.ts",
|
|
74
|
-
"import": "./dist/languages/tr.
|
|
70
|
+
"import": "./dist/languages/tr.js"
|
|
75
71
|
},
|
|
76
72
|
"./languages/pt": {
|
|
77
73
|
"types": "./dist/languages/pt.d.ts",
|
|
78
|
-
"import": "./dist/languages/pt.
|
|
74
|
+
"import": "./dist/languages/pt.js"
|
|
79
75
|
},
|
|
80
76
|
"./languages/fr": {
|
|
81
77
|
"types": "./dist/languages/fr.d.ts",
|
|
82
|
-
"import": "./dist/languages/fr.
|
|
78
|
+
"import": "./dist/languages/fr.js"
|
|
83
79
|
},
|
|
84
80
|
"./languages/de": {
|
|
85
81
|
"types": "./dist/languages/de.d.ts",
|
|
86
|
-
"import": "./dist/languages/de.
|
|
82
|
+
"import": "./dist/languages/de.js"
|
|
87
83
|
},
|
|
88
84
|
"./languages/id": {
|
|
89
85
|
"types": "./dist/languages/id.d.ts",
|
|
90
|
-
"import": "./dist/languages/id.
|
|
86
|
+
"import": "./dist/languages/id.js"
|
|
91
87
|
},
|
|
92
88
|
"./languages/qu": {
|
|
93
89
|
"types": "./dist/languages/qu.d.ts",
|
|
94
|
-
"import": "./dist/languages/qu.
|
|
90
|
+
"import": "./dist/languages/qu.js"
|
|
95
91
|
},
|
|
96
92
|
"./languages/sw": {
|
|
97
93
|
"types": "./dist/languages/sw.d.ts",
|
|
98
|
-
"import": "./dist/languages/sw.
|
|
99
|
-
},
|
|
100
|
-
"./explicit": {
|
|
101
|
-
"types": "./dist/explicit/index.d.ts",
|
|
102
|
-
"import": "./dist/explicit/index.mjs",
|
|
103
|
-
"require": "./dist/explicit/index.js"
|
|
94
|
+
"import": "./dist/languages/sw.js"
|
|
104
95
|
},
|
|
105
96
|
"./browser/ja": {
|
|
106
97
|
"default": "./dist/browser-ja.ja.global.js"
|
|
@@ -141,7 +132,7 @@
|
|
|
141
132
|
},
|
|
142
133
|
"scripts": {
|
|
143
134
|
"build": "tsup",
|
|
144
|
-
"build:browser": "tsup src/browser.ts --format iife --global-name
|
|
135
|
+
"build:browser": "tsup src/browser.ts --format iife --global-name LokaScriptSemantic --minify",
|
|
145
136
|
"dev": "tsup --watch",
|
|
146
137
|
"test": "vitest",
|
|
147
138
|
"test:run": "vitest run",
|
|
@@ -159,7 +150,7 @@
|
|
|
159
150
|
},
|
|
160
151
|
"sideEffects": [
|
|
161
152
|
"./src/languages/*.ts",
|
|
162
|
-
"./dist/languages/*.
|
|
153
|
+
"./dist/languages/*.js",
|
|
163
154
|
"./src/patterns/index.ts"
|
|
164
155
|
],
|
|
165
156
|
"keywords": [
|
|
@@ -186,13 +177,13 @@
|
|
|
186
177
|
],
|
|
187
178
|
"repository": {
|
|
188
179
|
"type": "git",
|
|
189
|
-
"url": "git+https://github.com/
|
|
180
|
+
"url": "git+https://github.com/codetalcott/lokascript.git",
|
|
190
181
|
"directory": "packages/semantic"
|
|
191
182
|
},
|
|
192
183
|
"bugs": {
|
|
193
|
-
"url": "https://github.com/
|
|
184
|
+
"url": "https://github.com/codetalcott/lokascript/issues"
|
|
194
185
|
},
|
|
195
|
-
"homepage": "https://github.com/
|
|
186
|
+
"homepage": "https://github.com/codetalcott/lokascript/tree/main/packages/semantic#readme",
|
|
196
187
|
"engines": {
|
|
197
188
|
"node": ">=18.0.0"
|
|
198
189
|
},
|
|
@@ -254,7 +254,7 @@ export const putSchema: CommandSchema = {
|
|
|
254
254
|
required: true,
|
|
255
255
|
expectedTypes: ['literal', 'selector', 'reference', 'expression'],
|
|
256
256
|
svoPosition: 1,
|
|
257
|
-
sovPosition:
|
|
257
|
+
sovPosition: 1, // SOV: patient comes first (を marker)
|
|
258
258
|
},
|
|
259
259
|
{
|
|
260
260
|
role: 'destination',
|
|
@@ -262,7 +262,7 @@ export const putSchema: CommandSchema = {
|
|
|
262
262
|
required: true,
|
|
263
263
|
expectedTypes: ['selector', 'reference'],
|
|
264
264
|
svoPosition: 2,
|
|
265
|
-
sovPosition:
|
|
265
|
+
sovPosition: 2, // SOV: destination comes second (に/에/a marker)
|
|
266
266
|
},
|
|
267
267
|
],
|
|
268
268
|
// Runtime error documentation
|
|
@@ -324,13 +324,18 @@ export const setSchema: CommandSchema = {
|
|
|
324
324
|
role: 'destination',
|
|
325
325
|
description: 'The property or variable to set',
|
|
326
326
|
required: true,
|
|
327
|
-
expectedTypes: ['selector', 'reference'],
|
|
327
|
+
expectedTypes: ['selector', 'reference', 'expression'],
|
|
328
328
|
svoPosition: 1,
|
|
329
329
|
sovPosition: 1,
|
|
330
330
|
// Override destination marker for English (remove 'on', use no marker)
|
|
331
|
-
//
|
|
331
|
+
// SOV languages swap markers: variable gets patient marker (を/를/i)
|
|
332
|
+
// Arabic (VSO): no marker before variable
|
|
332
333
|
markerOverride: {
|
|
333
334
|
en: '', // No marker before destination in English: "set :x to 5"
|
|
335
|
+
ja: 'を', // "x を 10 に 設定" - variable gets object marker
|
|
336
|
+
ko: '를', // "x 를 10 으로 설정" - variable gets object marker
|
|
337
|
+
tr: 'i', // "x i 10 e ayarla" - variable gets accusative marker
|
|
338
|
+
ar: '', // "عيّن x إلى 10" - no marker before variable
|
|
334
339
|
},
|
|
335
340
|
},
|
|
336
341
|
{
|
|
@@ -341,7 +346,8 @@ export const setSchema: CommandSchema = {
|
|
|
341
346
|
svoPosition: 2,
|
|
342
347
|
sovPosition: 2,
|
|
343
348
|
// Override patient marker for SVO languages with their native prepositions
|
|
344
|
-
// SOV languages
|
|
349
|
+
// SOV languages swap markers: value gets destination marker (に/으로/e)
|
|
350
|
+
// Arabic (VSO): إلى preposition before value
|
|
345
351
|
markerOverride: {
|
|
346
352
|
en: 'to', // "set :x to 5"
|
|
347
353
|
es: 'a', // "establecer x a 10"
|
|
@@ -349,6 +355,10 @@ export const setSchema: CommandSchema = {
|
|
|
349
355
|
fr: 'à', // "définir x à 10"
|
|
350
356
|
de: 'auf', // "setze x auf 10"
|
|
351
357
|
id: 'ke', // "atur x ke 10"
|
|
358
|
+
ja: 'に', // "x を 10 に 設定" - value gets destination marker
|
|
359
|
+
ko: '으로', // "x 를 10 으로 설정" - value gets manner/instrument marker
|
|
360
|
+
tr: 'e', // "x i 10 e ayarla" - value gets dative marker
|
|
361
|
+
ar: 'إلى', // "عيّن x إلى 10" - value gets preposition "to"
|
|
352
362
|
},
|
|
353
363
|
},
|
|
354
364
|
],
|
|
@@ -716,18 +726,19 @@ export const getCommandSchema: CommandSchema = {
|
|
|
716
726
|
expectedTypes: ['selector', 'reference', 'expression'],
|
|
717
727
|
svoPosition: 1,
|
|
718
728
|
sovPosition: 2,
|
|
719
|
-
//
|
|
729
|
+
// Marker overrides for GET pattern
|
|
730
|
+
// SOV languages use object markers, SVO languages have no marker
|
|
720
731
|
markerOverride: {
|
|
721
732
|
en: '',
|
|
722
733
|
es: '',
|
|
723
734
|
pt: '',
|
|
724
735
|
fr: '',
|
|
725
736
|
de: '',
|
|
726
|
-
ja: '',
|
|
737
|
+
ja: 'を', // Japanese object marker: #element を 取得
|
|
727
738
|
zh: '',
|
|
728
|
-
ko: '',
|
|
729
|
-
ar: '',
|
|
730
|
-
tr: '',
|
|
739
|
+
ko: '를', // Korean object marker: #element 를 가져오기
|
|
740
|
+
ar: 'على', // Arabic preposition: احصل على #element
|
|
741
|
+
tr: 'i', // Turkish accusative: #element i al
|
|
731
742
|
id: '',
|
|
732
743
|
},
|
|
733
744
|
},
|
|
@@ -37,52 +37,58 @@ export function generateEventHandlerPatterns(profile: LanguageProfile): Language
|
|
|
37
37
|
|
|
38
38
|
// Pattern 1: Standard - "{keyword} {event}"
|
|
39
39
|
// e.g., "bei click", "sur click"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
40
|
+
// Only generate if keyword is defined
|
|
41
|
+
if (eh.keyword) {
|
|
42
|
+
patterns.push({
|
|
43
|
+
id: `event-${lang}-standard`,
|
|
44
|
+
language: lang,
|
|
45
|
+
command: 'on',
|
|
46
|
+
priority: 100,
|
|
47
|
+
template: {
|
|
48
|
+
format: `${eh.keyword.primary} {event}`,
|
|
49
|
+
tokens: [
|
|
50
|
+
literalToken(eh.keyword.primary, eh.keyword.alternatives),
|
|
51
|
+
{ type: 'role', role: 'event' },
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
extraction: {
|
|
55
|
+
event: { position: 1 },
|
|
56
|
+
},
|
|
57
|
+
});
|
|
56
58
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
// Pattern 2: With source - "{keyword} {event} {sourceMarker} {source}"
|
|
60
|
+
// e.g., "bei click von #button", "sur click de #button"
|
|
61
|
+
// Only generate if both keyword and sourceMarker are defined
|
|
62
|
+
if (eh.sourceMarker) {
|
|
63
|
+
const sourceMarkerValue = eh.sourceMarker.primary;
|
|
64
|
+
const sourceExtraction: { marker: string; markerAlternatives?: string[] } = {
|
|
65
|
+
marker: sourceMarkerValue,
|
|
66
|
+
};
|
|
67
|
+
if (eh.sourceMarker.alternatives && eh.sourceMarker.alternatives.length > 0) {
|
|
68
|
+
sourceExtraction.markerAlternatives = eh.sourceMarker.alternatives;
|
|
69
|
+
}
|
|
66
70
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
71
|
+
patterns.push({
|
|
72
|
+
id: `event-${lang}-source`,
|
|
73
|
+
language: lang,
|
|
74
|
+
command: 'on',
|
|
75
|
+
priority: 110, // Higher priority for more specific pattern
|
|
76
|
+
template: {
|
|
77
|
+
format: `${eh.keyword.primary} {event} ${sourceMarkerValue} {source}`,
|
|
78
|
+
tokens: [
|
|
79
|
+
literalToken(eh.keyword.primary, eh.keyword.alternatives),
|
|
80
|
+
{ type: 'role', role: 'event' },
|
|
81
|
+
literalToken(sourceMarkerValue, eh.sourceMarker.alternatives),
|
|
82
|
+
{ type: 'role', role: 'source' },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
extraction: {
|
|
86
|
+
event: { position: 1 },
|
|
87
|
+
source: sourceExtraction,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
86
92
|
|
|
87
93
|
// Pattern 3: Conditional (if defined) - "{conditionalKeyword} {event}"
|
|
88
94
|
// e.g., "wenn click", "quand click"
|
|
@@ -36,6 +36,7 @@ export { chineseProfile } from './profiles/chinese';
|
|
|
36
36
|
export { englishProfile } from './profiles/english';
|
|
37
37
|
export { frenchProfile } from './profiles/french';
|
|
38
38
|
export { germanProfile } from './profiles/german';
|
|
39
|
+
export { hebrewProfile } from './profiles/hebrew';
|
|
39
40
|
export { hindiProfile } from './profiles/hindi';
|
|
40
41
|
export { indonesianProfile } from './profiles/indonesian';
|
|
41
42
|
export { italianProfile } from './profiles/italian';
|
|
@@ -47,6 +48,7 @@ export { portugueseProfile } from './profiles/portuguese';
|
|
|
47
48
|
export { quechuaProfile } from './profiles/quechua';
|
|
48
49
|
export { russianProfile } from './profiles/russian';
|
|
49
50
|
export { spanishProfile } from './profiles/spanish';
|
|
51
|
+
export { spanishMexicoProfile } from './profiles/spanishMexico';
|
|
50
52
|
export { swahiliProfile } from './profiles/swahili';
|
|
51
53
|
export { thaiProfile } from './profiles/thai';
|
|
52
54
|
export { tagalogProfile } from './profiles/tl';
|
|
@@ -61,6 +63,7 @@ import { chineseProfile } from './profiles/chinese';
|
|
|
61
63
|
import { englishProfile } from './profiles/english';
|
|
62
64
|
import { frenchProfile } from './profiles/french';
|
|
63
65
|
import { germanProfile } from './profiles/german';
|
|
66
|
+
import { hebrewProfile } from './profiles/hebrew';
|
|
64
67
|
import { hindiProfile } from './profiles/hindi';
|
|
65
68
|
import { indonesianProfile } from './profiles/indonesian';
|
|
66
69
|
import { italianProfile } from './profiles/italian';
|
|
@@ -72,6 +75,7 @@ import { portugueseProfile } from './profiles/portuguese';
|
|
|
72
75
|
import { quechuaProfile } from './profiles/quechua';
|
|
73
76
|
import { russianProfile } from './profiles/russian';
|
|
74
77
|
import { spanishProfile } from './profiles/spanish';
|
|
78
|
+
import { spanishMexicoProfile } from './profiles/spanishMexico';
|
|
75
79
|
import { swahiliProfile } from './profiles/swahili';
|
|
76
80
|
import { thaiProfile } from './profiles/thai';
|
|
77
81
|
import { tagalogProfile } from './profiles/tl';
|
|
@@ -95,6 +99,7 @@ export const languageProfiles: Record<string, LanguageProfile> = {
|
|
|
95
99
|
en: englishProfile,
|
|
96
100
|
fr: frenchProfile,
|
|
97
101
|
de: germanProfile,
|
|
102
|
+
he: hebrewProfile,
|
|
98
103
|
hi: hindiProfile,
|
|
99
104
|
id: indonesianProfile,
|
|
100
105
|
it: italianProfile,
|
|
@@ -106,6 +111,7 @@ export const languageProfiles: Record<string, LanguageProfile> = {
|
|
|
106
111
|
qu: quechuaProfile,
|
|
107
112
|
ru: russianProfile,
|
|
108
113
|
es: spanishProfile,
|
|
114
|
+
'es-MX': spanishMexicoProfile,
|
|
109
115
|
sw: swahiliProfile,
|
|
110
116
|
th: thaiProfile,
|
|
111
117
|
tl: tagalogProfile,
|