@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.
- package/LICENSE +21 -0
- package/README.md +686 -0
- package/dist/browser-ar.ar.global.js +2 -0
- package/dist/browser-core.core.global.js +2 -0
- package/dist/browser-de.de.global.js +2 -0
- package/dist/browser-east-asian.east-asian.global.js +2 -0
- package/dist/browser-en-tr.en-tr.global.js +2 -0
- package/dist/browser-en.en.global.js +2 -0
- package/dist/browser-es-en.es-en.global.js +2 -0
- package/dist/browser-es.es.global.js +2 -0
- package/dist/browser-fr.fr.global.js +2 -0
- package/dist/browser-id.id.global.js +2 -0
- package/dist/browser-ja.ja.global.js +2 -0
- package/dist/browser-ko.ko.global.js +2 -0
- package/dist/browser-lazy.lazy.global.js +2 -0
- package/dist/browser-priority.priority.global.js +2 -0
- package/dist/browser-pt.pt.global.js +2 -0
- package/dist/browser-qu.qu.global.js +2 -0
- package/dist/browser-sw.sw.global.js +2 -0
- package/dist/browser-tr.tr.global.js +2 -0
- package/dist/browser-western.western.global.js +2 -0
- package/dist/browser-zh.zh.global.js +2 -0
- package/dist/browser.global.js +3 -0
- package/dist/browser.global.js.map +1 -0
- package/dist/index.cjs +35051 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3426 -0
- package/dist/index.d.ts +3426 -0
- package/dist/index.js +34890 -0
- package/dist/index.js.map +1 -0
- package/dist/languages/ar.d.ts +78 -0
- package/dist/languages/ar.js +1622 -0
- package/dist/languages/ar.js.map +1 -0
- package/dist/languages/de.d.ts +38 -0
- package/dist/languages/de.js +1168 -0
- package/dist/languages/de.js.map +1 -0
- package/dist/languages/en.d.ts +44 -0
- package/dist/languages/en.js +3491 -0
- package/dist/languages/en.js.map +1 -0
- package/dist/languages/es.d.ts +52 -0
- package/dist/languages/es.js +1493 -0
- package/dist/languages/es.js.map +1 -0
- package/dist/languages/fr.d.ts +37 -0
- package/dist/languages/fr.js +1159 -0
- package/dist/languages/fr.js.map +1 -0
- package/dist/languages/id.d.ts +35 -0
- package/dist/languages/id.js +1152 -0
- package/dist/languages/id.js.map +1 -0
- package/dist/languages/ja.d.ts +53 -0
- package/dist/languages/ja.js +1430 -0
- package/dist/languages/ja.js.map +1 -0
- package/dist/languages/ko.d.ts +51 -0
- package/dist/languages/ko.js +1729 -0
- package/dist/languages/ko.js.map +1 -0
- package/dist/languages/pt.d.ts +37 -0
- package/dist/languages/pt.js +1127 -0
- package/dist/languages/pt.js.map +1 -0
- package/dist/languages/qu.d.ts +36 -0
- package/dist/languages/qu.js +1143 -0
- package/dist/languages/qu.js.map +1 -0
- package/dist/languages/sw.d.ts +35 -0
- package/dist/languages/sw.js +1147 -0
- package/dist/languages/sw.js.map +1 -0
- package/dist/languages/tr.d.ts +45 -0
- package/dist/languages/tr.js +1529 -0
- package/dist/languages/tr.js.map +1 -0
- package/dist/languages/zh.d.ts +58 -0
- package/dist/languages/zh.js +1257 -0
- package/dist/languages/zh.js.map +1 -0
- package/dist/types-C4dcj53L.d.ts +600 -0
- package/package.json +202 -0
- package/src/__test-utils__/index.ts +7 -0
- package/src/__test-utils__/test-helpers.ts +8 -0
- package/src/__types__/test-helpers.ts +122 -0
- package/src/analysis/index.ts +479 -0
- package/src/ast-builder/command-mappers.ts +1133 -0
- package/src/ast-builder/expression-parser/index.ts +41 -0
- package/src/ast-builder/expression-parser/parser.ts +563 -0
- package/src/ast-builder/expression-parser/tokenizer.ts +394 -0
- package/src/ast-builder/expression-parser/types.ts +208 -0
- package/src/ast-builder/index.ts +536 -0
- package/src/ast-builder/value-converters.ts +172 -0
- package/src/bridge.ts +275 -0
- package/src/browser-ar.ts +162 -0
- package/src/browser-core.ts +231 -0
- package/src/browser-de.ts +162 -0
- package/src/browser-east-asian.ts +173 -0
- package/src/browser-en-tr.ts +165 -0
- package/src/browser-en.ts +157 -0
- package/src/browser-es-en.ts +200 -0
- package/src/browser-es.ts +170 -0
- package/src/browser-fr.ts +162 -0
- package/src/browser-id.ts +162 -0
- package/src/browser-ja.ts +162 -0
- package/src/browser-ko.ts +162 -0
- package/src/browser-lazy.ts +189 -0
- package/src/browser-priority.ts +214 -0
- package/src/browser-pt.ts +162 -0
- package/src/browser-qu.ts +162 -0
- package/src/browser-sw.ts +162 -0
- package/src/browser-tr.ts +162 -0
- package/src/browser-western.ts +181 -0
- package/src/browser-zh.ts +162 -0
- package/src/browser.ts +268 -0
- package/src/cache/index.ts +14 -0
- package/src/cache/semantic-cache.ts +344 -0
- package/src/core-bridge.ts +372 -0
- package/src/explicit/converter.ts +258 -0
- package/src/explicit/index.ts +18 -0
- package/src/explicit/parser.ts +236 -0
- package/src/explicit/renderer.ts +424 -0
- package/src/generators/command-schemas.ts +1636 -0
- package/src/generators/event-handler-generator.ts +109 -0
- package/src/generators/index.ts +117 -0
- package/src/generators/language-profiles.ts +139 -0
- package/src/generators/pattern-generator.ts +537 -0
- package/src/generators/profiles/arabic.ts +131 -0
- package/src/generators/profiles/bengali.ts +132 -0
- package/src/generators/profiles/chinese.ts +124 -0
- package/src/generators/profiles/english.ts +113 -0
- package/src/generators/profiles/french.ts +125 -0
- package/src/generators/profiles/german.ts +126 -0
- package/src/generators/profiles/hindi.ts +146 -0
- package/src/generators/profiles/index.ts +46 -0
- package/src/generators/profiles/indonesian.ts +125 -0
- package/src/generators/profiles/italian.ts +139 -0
- package/src/generators/profiles/japanese.ts +149 -0
- package/src/generators/profiles/korean.ts +127 -0
- package/src/generators/profiles/marker-templates.ts +288 -0
- package/src/generators/profiles/ms.ts +130 -0
- package/src/generators/profiles/polish.ts +249 -0
- package/src/generators/profiles/portuguese.ts +115 -0
- package/src/generators/profiles/quechua.ts +113 -0
- package/src/generators/profiles/russian.ts +260 -0
- package/src/generators/profiles/spanish.ts +130 -0
- package/src/generators/profiles/swahili.ts +129 -0
- package/src/generators/profiles/thai.ts +132 -0
- package/src/generators/profiles/tl.ts +128 -0
- package/src/generators/profiles/turkish.ts +124 -0
- package/src/generators/profiles/types.ts +165 -0
- package/src/generators/profiles/ukrainian.ts +270 -0
- package/src/generators/profiles/vietnamese.ts +133 -0
- package/src/generators/schema-error-codes.ts +160 -0
- package/src/generators/schema-validator.ts +391 -0
- package/src/index.ts +429 -0
- package/src/language-building-schema.ts +3170 -0
- package/src/language-loader.ts +394 -0
- package/src/languages/_all.ts +65 -0
- package/src/languages/ar.ts +15 -0
- package/src/languages/bn.ts +16 -0
- package/src/languages/de.ts +15 -0
- package/src/languages/en.ts +29 -0
- package/src/languages/es.ts +15 -0
- package/src/languages/fr.ts +15 -0
- package/src/languages/hi.ts +26 -0
- package/src/languages/id.ts +15 -0
- package/src/languages/index.ts +18 -0
- package/src/languages/it.ts +15 -0
- package/src/languages/ja.ts +15 -0
- package/src/languages/ko.ts +15 -0
- package/src/languages/ms.ts +16 -0
- package/src/languages/pl.ts +18 -0
- package/src/languages/pt.ts +15 -0
- package/src/languages/qu.ts +15 -0
- package/src/languages/ru.ts +26 -0
- package/src/languages/sw.ts +15 -0
- package/src/languages/th.ts +16 -0
- package/src/languages/tl.ts +16 -0
- package/src/languages/tr.ts +15 -0
- package/src/languages/uk.ts +26 -0
- package/src/languages/vi.ts +16 -0
- package/src/languages/zh.ts +15 -0
- package/src/parser/index.ts +15 -0
- package/src/parser/pattern-matcher.ts +1181 -0
- package/src/parser/semantic-parser.ts +573 -0
- package/src/parser/utils/index.ts +35 -0
- package/src/parser/utils/marker-resolution.ts +111 -0
- package/src/parser/utils/possessive-keywords.ts +43 -0
- package/src/parser/utils/role-positioning.ts +70 -0
- package/src/parser/utils/type-validation.ts +134 -0
- package/src/patterns/add/ar.ts +71 -0
- package/src/patterns/add/bn.ts +70 -0
- package/src/patterns/add/hi.ts +69 -0
- package/src/patterns/add/index.ts +87 -0
- package/src/patterns/add/it.ts +61 -0
- package/src/patterns/add/ja.ts +93 -0
- package/src/patterns/add/ko.ts +74 -0
- package/src/patterns/add/ms.ts +30 -0
- package/src/patterns/add/pl.ts +62 -0
- package/src/patterns/add/ru.ts +62 -0
- package/src/patterns/add/th.ts +49 -0
- package/src/patterns/add/tl.ts +30 -0
- package/src/patterns/add/tr.ts +71 -0
- package/src/patterns/add/uk.ts +62 -0
- package/src/patterns/add/vi.ts +61 -0
- package/src/patterns/add/zh.ts +71 -0
- package/src/patterns/builders.ts +207 -0
- package/src/patterns/decrement/bn.ts +70 -0
- package/src/patterns/decrement/de.ts +42 -0
- package/src/patterns/decrement/hi.ts +68 -0
- package/src/patterns/decrement/index.ts +79 -0
- package/src/patterns/decrement/it.ts +69 -0
- package/src/patterns/decrement/ms.ts +30 -0
- package/src/patterns/decrement/pl.ts +58 -0
- package/src/patterns/decrement/ru.ts +58 -0
- package/src/patterns/decrement/th.ts +49 -0
- package/src/patterns/decrement/tl.ts +30 -0
- package/src/patterns/decrement/tr.ts +48 -0
- package/src/patterns/decrement/uk.ts +58 -0
- package/src/patterns/decrement/vi.ts +61 -0
- package/src/patterns/decrement/zh.ts +32 -0
- package/src/patterns/en.ts +302 -0
- package/src/patterns/event-handler/ar.ts +151 -0
- package/src/patterns/event-handler/bn.ts +72 -0
- package/src/patterns/event-handler/de.ts +117 -0
- package/src/patterns/event-handler/en.ts +117 -0
- package/src/patterns/event-handler/es.ts +136 -0
- package/src/patterns/event-handler/fr.ts +117 -0
- package/src/patterns/event-handler/hi.ts +64 -0
- package/src/patterns/event-handler/id.ts +117 -0
- package/src/patterns/event-handler/index.ts +119 -0
- package/src/patterns/event-handler/it.ts +54 -0
- package/src/patterns/event-handler/ja.ts +118 -0
- package/src/patterns/event-handler/ko.ts +133 -0
- package/src/patterns/event-handler/ms.ts +30 -0
- package/src/patterns/event-handler/pl.ts +62 -0
- package/src/patterns/event-handler/pt.ts +117 -0
- package/src/patterns/event-handler/qu.ts +66 -0
- package/src/patterns/event-handler/ru.ts +62 -0
- package/src/patterns/event-handler/shared.ts +270 -0
- package/src/patterns/event-handler/sw.ts +117 -0
- package/src/patterns/event-handler/th.ts +53 -0
- package/src/patterns/event-handler/tl.ts +30 -0
- package/src/patterns/event-handler/tr.ts +170 -0
- package/src/patterns/event-handler/uk.ts +62 -0
- package/src/patterns/event-handler/vi.ts +61 -0
- package/src/patterns/event-handler/zh.ts +150 -0
- package/src/patterns/get/ar.ts +49 -0
- package/src/patterns/get/bn.ts +47 -0
- package/src/patterns/get/de.ts +32 -0
- package/src/patterns/get/hi.ts +52 -0
- package/src/patterns/get/index.ts +83 -0
- package/src/patterns/get/it.ts +56 -0
- package/src/patterns/get/ja.ts +53 -0
- package/src/patterns/get/ko.ts +53 -0
- package/src/patterns/get/ms.ts +30 -0
- package/src/patterns/get/pl.ts +57 -0
- package/src/patterns/get/ru.ts +57 -0
- package/src/patterns/get/th.ts +29 -0
- package/src/patterns/get/tl.ts +30 -0
- package/src/patterns/get/uk.ts +57 -0
- package/src/patterns/get/vi.ts +48 -0
- package/src/patterns/grammar-transformed/index.ts +39 -0
- package/src/patterns/grammar-transformed/ja.ts +1713 -0
- package/src/patterns/grammar-transformed/ko.ts +1311 -0
- package/src/patterns/grammar-transformed/tr.ts +1067 -0
- package/src/patterns/hide/ar.ts +67 -0
- package/src/patterns/hide/bn.ts +47 -0
- package/src/patterns/hide/de.ts +36 -0
- package/src/patterns/hide/hi.ts +61 -0
- package/src/patterns/hide/index.ts +91 -0
- package/src/patterns/hide/it.ts +56 -0
- package/src/patterns/hide/ja.ts +69 -0
- package/src/patterns/hide/ko.ts +69 -0
- package/src/patterns/hide/ms.ts +30 -0
- package/src/patterns/hide/pl.ts +57 -0
- package/src/patterns/hide/ru.ts +57 -0
- package/src/patterns/hide/th.ts +29 -0
- package/src/patterns/hide/tl.ts +30 -0
- package/src/patterns/hide/tr.ts +65 -0
- package/src/patterns/hide/uk.ts +57 -0
- package/src/patterns/hide/vi.ts +56 -0
- package/src/patterns/hide/zh.ts +68 -0
- package/src/patterns/increment/bn.ts +70 -0
- package/src/patterns/increment/de.ts +36 -0
- package/src/patterns/increment/hi.ts +68 -0
- package/src/patterns/increment/index.ts +79 -0
- package/src/patterns/increment/it.ts +69 -0
- package/src/patterns/increment/ms.ts +30 -0
- package/src/patterns/increment/pl.ts +58 -0
- package/src/patterns/increment/ru.ts +58 -0
- package/src/patterns/increment/th.ts +49 -0
- package/src/patterns/increment/tl.ts +30 -0
- package/src/patterns/increment/tr.ts +52 -0
- package/src/patterns/increment/uk.ts +58 -0
- package/src/patterns/increment/vi.ts +61 -0
- package/src/patterns/increment/zh.ts +32 -0
- package/src/patterns/index.ts +84 -0
- package/src/patterns/languages/en/control-flow.ts +93 -0
- package/src/patterns/languages/en/fetch.ts +62 -0
- package/src/patterns/languages/en/index.ts +42 -0
- package/src/patterns/languages/en/repeat.ts +67 -0
- package/src/patterns/languages/en/set.ts +48 -0
- package/src/patterns/languages/en/swap.ts +38 -0
- package/src/patterns/languages/en/temporal.ts +57 -0
- package/src/patterns/put/ar.ts +74 -0
- package/src/patterns/put/bn.ts +53 -0
- package/src/patterns/put/en.ts +74 -0
- package/src/patterns/put/es.ts +74 -0
- package/src/patterns/put/hi.ts +69 -0
- package/src/patterns/put/id.ts +96 -0
- package/src/patterns/put/index.ts +99 -0
- package/src/patterns/put/it.ts +56 -0
- package/src/patterns/put/ja.ts +75 -0
- package/src/patterns/put/ko.ts +67 -0
- package/src/patterns/put/ms.ts +30 -0
- package/src/patterns/put/pl.ts +81 -0
- package/src/patterns/put/ru.ts +85 -0
- package/src/patterns/put/th.ts +32 -0
- package/src/patterns/put/tl.ts +30 -0
- package/src/patterns/put/tr.ts +67 -0
- package/src/patterns/put/uk.ts +85 -0
- package/src/patterns/put/vi.ts +72 -0
- package/src/patterns/put/zh.ts +62 -0
- package/src/patterns/registry.ts +163 -0
- package/src/patterns/remove/ar.ts +71 -0
- package/src/patterns/remove/bn.ts +68 -0
- package/src/patterns/remove/hi.ts +69 -0
- package/src/patterns/remove/index.ts +87 -0
- package/src/patterns/remove/it.ts +69 -0
- package/src/patterns/remove/ja.ts +74 -0
- package/src/patterns/remove/ko.ts +78 -0
- package/src/patterns/remove/ms.ts +30 -0
- package/src/patterns/remove/pl.ts +62 -0
- package/src/patterns/remove/ru.ts +62 -0
- package/src/patterns/remove/th.ts +49 -0
- package/src/patterns/remove/tl.ts +30 -0
- package/src/patterns/remove/tr.ts +78 -0
- package/src/patterns/remove/uk.ts +62 -0
- package/src/patterns/remove/vi.ts +61 -0
- package/src/patterns/remove/zh.ts +72 -0
- package/src/patterns/set/ar.ts +84 -0
- package/src/patterns/set/bn.ts +53 -0
- package/src/patterns/set/de.ts +84 -0
- package/src/patterns/set/es.ts +92 -0
- package/src/patterns/set/fr.ts +88 -0
- package/src/patterns/set/hi.ts +56 -0
- package/src/patterns/set/id.ts +84 -0
- package/src/patterns/set/index.ts +107 -0
- package/src/patterns/set/it.ts +56 -0
- package/src/patterns/set/ja.ts +86 -0
- package/src/patterns/set/ko.ts +85 -0
- package/src/patterns/set/ms.ts +30 -0
- package/src/patterns/set/pl.ts +57 -0
- package/src/patterns/set/pt.ts +84 -0
- package/src/patterns/set/ru.ts +57 -0
- package/src/patterns/set/th.ts +31 -0
- package/src/patterns/set/tl.ts +30 -0
- package/src/patterns/set/tr.ts +107 -0
- package/src/patterns/set/uk.ts +57 -0
- package/src/patterns/set/vi.ts +53 -0
- package/src/patterns/set/zh.ts +84 -0
- package/src/patterns/show/ar.ts +67 -0
- package/src/patterns/show/bn.ts +47 -0
- package/src/patterns/show/de.ts +32 -0
- package/src/patterns/show/fr.ts +32 -0
- package/src/patterns/show/hi.ts +61 -0
- package/src/patterns/show/index.ts +95 -0
- package/src/patterns/show/it.ts +56 -0
- package/src/patterns/show/ja.ts +69 -0
- package/src/patterns/show/ko.ts +73 -0
- package/src/patterns/show/ms.ts +30 -0
- package/src/patterns/show/pl.ts +57 -0
- package/src/patterns/show/ru.ts +57 -0
- package/src/patterns/show/th.ts +29 -0
- package/src/patterns/show/tl.ts +30 -0
- package/src/patterns/show/tr.ts +65 -0
- package/src/patterns/show/uk.ts +57 -0
- package/src/patterns/show/vi.ts +56 -0
- package/src/patterns/show/zh.ts +68 -0
- package/src/patterns/take/ar.ts +51 -0
- package/src/patterns/take/index.ts +31 -0
- package/src/patterns/toggle/ar.ts +61 -0
- package/src/patterns/toggle/bn.ts +70 -0
- package/src/patterns/toggle/en.ts +61 -0
- package/src/patterns/toggle/es.ts +61 -0
- package/src/patterns/toggle/hi.ts +80 -0
- package/src/patterns/toggle/index.ts +95 -0
- package/src/patterns/toggle/it.ts +69 -0
- package/src/patterns/toggle/ja.ts +156 -0
- package/src/patterns/toggle/ko.ts +113 -0
- package/src/patterns/toggle/ms.ts +30 -0
- package/src/patterns/toggle/pl.ts +62 -0
- package/src/patterns/toggle/ru.ts +62 -0
- package/src/patterns/toggle/th.ts +50 -0
- package/src/patterns/toggle/tl.ts +30 -0
- package/src/patterns/toggle/tr.ts +88 -0
- package/src/patterns/toggle/uk.ts +62 -0
- package/src/patterns/toggle/vi.ts +61 -0
- package/src/patterns/toggle/zh.ts +99 -0
- package/src/public-api.ts +286 -0
- package/src/registry.ts +441 -0
- package/src/tokenizers/arabic.ts +723 -0
- package/src/tokenizers/base.ts +1300 -0
- package/src/tokenizers/bengali.ts +289 -0
- package/src/tokenizers/chinese.ts +481 -0
- package/src/tokenizers/english.ts +416 -0
- package/src/tokenizers/french.ts +326 -0
- package/src/tokenizers/german.ts +324 -0
- package/src/tokenizers/hindi.ts +319 -0
- package/src/tokenizers/index.ts +127 -0
- package/src/tokenizers/indonesian.ts +306 -0
- package/src/tokenizers/italian.ts +458 -0
- package/src/tokenizers/japanese.ts +447 -0
- package/src/tokenizers/korean.ts +642 -0
- package/src/tokenizers/morphology/arabic-normalizer.ts +242 -0
- package/src/tokenizers/morphology/french-normalizer.ts +268 -0
- package/src/tokenizers/morphology/german-normalizer.ts +256 -0
- package/src/tokenizers/morphology/index.ts +46 -0
- package/src/tokenizers/morphology/italian-normalizer.ts +329 -0
- package/src/tokenizers/morphology/japanese-normalizer.ts +288 -0
- package/src/tokenizers/morphology/korean-normalizer.ts +428 -0
- package/src/tokenizers/morphology/polish-normalizer.ts +264 -0
- package/src/tokenizers/morphology/portuguese-normalizer.ts +310 -0
- package/src/tokenizers/morphology/spanish-normalizer.ts +327 -0
- package/src/tokenizers/morphology/turkish-normalizer.ts +412 -0
- package/src/tokenizers/morphology/types.ts +211 -0
- package/src/tokenizers/ms.ts +198 -0
- package/src/tokenizers/polish.ts +354 -0
- package/src/tokenizers/portuguese.ts +304 -0
- package/src/tokenizers/quechua.ts +339 -0
- package/src/tokenizers/russian.ts +375 -0
- package/src/tokenizers/spanish.ts +403 -0
- package/src/tokenizers/swahili.ts +303 -0
- package/src/tokenizers/thai.ts +236 -0
- package/src/tokenizers/tl.ts +198 -0
- package/src/tokenizers/turkish.ts +411 -0
- package/src/tokenizers/ukrainian.ts +369 -0
- package/src/tokenizers/vietnamese.ts +410 -0
- package/src/types/grammar-types.ts +617 -0
- package/src/types/unified-profile.ts +267 -0
- package/src/types.ts +709 -0
- package/src/utils/confidence-calculator.ts +147 -0
- package/src/validators/command-validator.ts +380 -0
- package/src/validators/index.ts +15 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/registry.ts","../../src/tokenizers/base.ts","../../src/tokenizers/morphology/types.ts","../../src/tokenizers/morphology/korean-normalizer.ts","../../src/generators/profiles/korean.ts","../../src/tokenizers/korean.ts","../../src/languages/ko.ts"],"sourcesContent":["/**\n * Language Registry\n *\n * Central registration point for language support in the semantic parser.\n * Languages self-register when their modules are imported, enabling\n * tree-shaking for minimal bundles.\n *\n * @example\n * ```typescript\n * // Import only the languages you need\n * import '@lokascript/semantic/languages/en';\n * import '@lokascript/semantic/languages/es';\n *\n * // Now parse works for registered languages\n * import { parse } from '@lokascript/semantic';\n * parse('toggle .active', 'en'); // Works\n * parse('alternar .activo', 'es'); // Works\n * parse('切り替え .active', 'ja'); // Error: Language not registered\n * ```\n */\n\nimport type { LanguageTokenizer, LanguagePattern, TokenStream } from './types';\n\n// Re-export profile types from generators for convenience\nexport type {\n LanguageProfile,\n WordOrder,\n MarkingStrategy,\n RoleMarker,\n VerbConfig,\n PossessiveConfig,\n KeywordTranslation,\n TokenizationConfig,\n} from './generators/language-profiles';\n\nimport type { LanguageProfile } from './generators/language-profiles';\n\n// =============================================================================\n// External Pattern Source Interface\n// =============================================================================\n\n/**\n * Interface for external pattern sources (e.g., @lokascript/patterns-reference database).\n * External sources can provide additional patterns at runtime.\n */\nexport interface ExternalPatternsSource {\n /** Unique identifier for the source */\n id: string;\n /** Human-readable name */\n name: string;\n /** Get patterns for a specific language */\n getPatternsForLanguage(language: string): Promise<ExternalPatternEntry[]>;\n /** Get patterns for a specific command */\n getPatternsForCommand(command: string, language?: string): Promise<ExternalPatternEntry[]>;\n /** Check if source has patterns for a language */\n hasPatterns(language: string): Promise<boolean>;\n /** Get all supported languages */\n getSupportedLanguages(): Promise<string[]>;\n}\n\n/**\n * Pattern entry from external source.\n */\nexport interface ExternalPatternEntry {\n id: string;\n code: string;\n command: string | null;\n language: string;\n confidence: number;\n verified: boolean;\n title?: string;\n category?: string;\n}\n\n// =============================================================================\n// Registry State\n// =============================================================================\n\nconst tokenizers = new Map<string, LanguageTokenizer>();\nconst profiles = new Map<string, LanguageProfile>();\nconst patternCache = new Map<string, LanguagePattern[]>();\n\n// External pattern sources (e.g., @lokascript/patterns-reference database)\nconst externalSources = new Map<string, ExternalPatternsSource>();\n\n// Pattern generator function - set by patterns module to avoid circular deps\nlet patternGenerator: ((profile: LanguageProfile) => LanguagePattern[]) | null = null;\n\n// =============================================================================\n// Registration Functions\n// =============================================================================\n\n/**\n * Register a language with its tokenizer and profile.\n * Called automatically by language modules when imported.\n */\nexport function registerLanguage(\n code: string,\n tokenizer: LanguageTokenizer,\n profile: LanguageProfile\n): void {\n tokenizers.set(code, tokenizer);\n profiles.set(code, profile);\n // Clear pattern cache for this language if it was previously cached\n patternCache.delete(code);\n}\n\n/**\n * Register only a tokenizer (for backwards compatibility).\n */\nexport function registerTokenizer(tokenizer: LanguageTokenizer): void {\n tokenizers.set(tokenizer.language, tokenizer);\n}\n\n/**\n * Register only a profile (for backwards compatibility).\n */\nexport function registerProfile(profile: LanguageProfile): void {\n profiles.set(profile.code, profile);\n patternCache.delete(profile.code);\n}\n\n/**\n * Set the pattern generator function.\n * Called by patterns module to inject the generator without circular deps.\n */\nexport function setPatternGenerator(\n generator: (profile: LanguageProfile) => LanguagePattern[]\n): void {\n patternGenerator = generator;\n}\n\n// Direct pattern registration map (for tree-shaking)\nconst registeredPatterns = new Map<string, LanguagePattern[]>();\n\n/**\n * Register patterns directly for a language.\n * This enables tree-shaking by allowing each language module to register\n * only its own patterns.\n */\nexport function registerPatterns(code: string, patterns: LanguagePattern[]): void {\n registeredPatterns.set(code, patterns);\n // Clear cached patterns if any\n patternCache.delete(code);\n}\n\n/**\n * Check if patterns are directly registered for a language.\n */\nexport function hasRegisteredPatterns(code: string): boolean {\n return registeredPatterns.has(code);\n}\n\n/**\n * Get directly registered patterns for a language.\n */\nexport function getRegisteredPatterns(code: string): LanguagePattern[] | undefined {\n return registeredPatterns.get(code);\n}\n\n// =============================================================================\n// External Pattern Sources\n// =============================================================================\n\n/**\n * Register an external pattern source.\n * External sources (like @lokascript/patterns-reference) can provide\n * additional patterns at runtime.\n *\n * @example\n * ```typescript\n * import { registerPatternsSource } from '@lokascript/semantic';\n * import { createPatternsProvider } from '@lokascript/patterns-reference';\n *\n * const provider = createPatternsProvider();\n * registerPatternsSource(provider);\n * ```\n */\nexport function registerPatternsSource(source: ExternalPatternsSource): void {\n externalSources.set(source.id, source);\n}\n\n/**\n * Unregister an external pattern source.\n */\nexport function unregisterPatternsSource(sourceId: string): boolean {\n return externalSources.delete(sourceId);\n}\n\n/**\n * Get a registered external pattern source.\n */\nexport function getPatternsSource(sourceId: string): ExternalPatternsSource | undefined {\n return externalSources.get(sourceId);\n}\n\n/**\n * Get all registered external pattern sources.\n */\nexport function getAllPatternsSources(): ExternalPatternsSource[] {\n return Array.from(externalSources.values());\n}\n\n/**\n * Check if any external pattern sources are registered.\n */\nexport function hasExternalSources(): boolean {\n return externalSources.size > 0;\n}\n\n/**\n * Query patterns from all external sources for a language.\n * Returns patterns sorted by confidence.\n */\nexport async function queryExternalPatterns(language: string): Promise<ExternalPatternEntry[]> {\n if (externalSources.size === 0) {\n return [];\n }\n\n const allPatterns: ExternalPatternEntry[] = [];\n\n for (const source of externalSources.values()) {\n try {\n const patterns = await source.getPatternsForLanguage(language);\n allPatterns.push(...patterns);\n } catch (error) {\n console.warn(\n `[Registry] Failed to query patterns from ${source.name}:`,\n error instanceof Error ? error.message : String(error)\n );\n }\n }\n\n // Sort by confidence (highest first)\n return allPatterns.sort((a, b) => b.confidence - a.confidence);\n}\n\n/**\n * Query patterns from all external sources for a command.\n */\nexport async function queryExternalPatternsForCommand(\n command: string,\n language?: string\n): Promise<ExternalPatternEntry[]> {\n if (externalSources.size === 0) {\n return [];\n }\n\n const allPatterns: ExternalPatternEntry[] = [];\n\n for (const source of externalSources.values()) {\n try {\n const patterns = await source.getPatternsForCommand(command, language);\n allPatterns.push(...patterns);\n } catch (error) {\n console.warn(\n `[Registry] Failed to query patterns from ${source.name}:`,\n error instanceof Error ? error.message : String(error)\n );\n }\n }\n\n return allPatterns.sort((a, b) => b.confidence - a.confidence);\n}\n\n// =============================================================================\n// Query Functions\n// =============================================================================\n\n/**\n * Get a tokenizer for the specified language.\n * @throws Error if language is not registered\n */\nexport function getTokenizer(code: string): LanguageTokenizer {\n const tokenizer = tokenizers.get(code);\n if (!tokenizer) {\n const registered = Array.from(tokenizers.keys()).join(', ');\n throw new Error(\n `Language '${code}' is not registered. ` +\n `Registered languages: ${registered || 'none'}. ` +\n `Import the language module first: import '@lokascript/semantic/languages/${code}';`\n );\n }\n return tokenizer;\n}\n\n/**\n * Get a profile for the specified language.\n * @throws Error if language is not registered\n */\nexport function getProfile(code: string): LanguageProfile {\n const profile = profiles.get(code);\n if (!profile) {\n const registered = Array.from(profiles.keys()).join(', ');\n throw new Error(\n `Language profile '${code}' is not registered. ` +\n `Registered languages: ${registered || 'none'}. ` +\n `Import the language module first: import '@lokascript/semantic/languages/${code}';`\n );\n }\n return profile;\n}\n\n/**\n * Try to get a tokenizer, returning undefined if not registered.\n */\nexport function tryGetTokenizer(code: string): LanguageTokenizer | undefined {\n return tokenizers.get(code);\n}\n\n/**\n * Try to get a profile, returning undefined if not registered.\n */\nexport function tryGetProfile(code: string): LanguageProfile | undefined {\n return profiles.get(code);\n}\n\n/**\n * Get all registered language codes.\n */\nexport function getRegisteredLanguages(): string[] {\n return Array.from(tokenizers.keys());\n}\n\n/**\n * Check if a language is registered.\n */\nexport function isLanguageRegistered(code: string): boolean {\n return tokenizers.has(code) && profiles.has(code);\n}\n\n/**\n * Check if a language is supported (alias for isLanguageRegistered).\n * For backwards compatibility with tokenizers API.\n */\nexport function isLanguageSupported(code: string): boolean {\n return tokenizers.has(code);\n}\n\n// =============================================================================\n// Tokenization\n// =============================================================================\n\n/**\n * Tokenize input in the specified language.\n * @throws Error if language is not registered\n */\nexport function tokenize(input: string, language: string): TokenStream {\n const tokenizer = getTokenizer(language);\n return tokenizer.tokenize(input);\n}\n\n// =============================================================================\n// Pattern Access (Lazy Generation)\n// =============================================================================\n\n/**\n * Get patterns for a specific language.\n * First checks for directly registered patterns (for tree-shaking),\n * then falls back to pattern generator.\n * @throws Error if language is not registered\n */\nexport function getPatternsForLanguage(code: string): LanguagePattern[] {\n // Check cache first\n const cached = patternCache.get(code);\n if (cached) {\n return cached;\n }\n\n // Check for directly registered patterns (tree-shakeable path)\n const registered = registeredPatterns.get(code);\n if (registered) {\n patternCache.set(code, registered);\n return registered;\n }\n\n // Fall back to pattern generator\n if (!patternGenerator) {\n throw new Error(\n `No patterns registered for language '${code}'. ` +\n 'Either import the language module or set a pattern generator.'\n );\n }\n\n // Get profile (throws if not registered)\n const profile = getProfile(code);\n const patterns = patternGenerator(profile);\n patternCache.set(code, patterns);\n return patterns;\n}\n\n/**\n * Get patterns for a specific language and command.\n */\nexport function getPatternsForLanguageAndCommand(\n language: string,\n command: string\n): LanguagePattern[] {\n return getPatternsForLanguage(language)\n .filter(p => p.command === command)\n .sort((a, b) => b.priority - a.priority);\n}\n\n/**\n * Clear the pattern cache for a language (useful for testing).\n */\nexport function clearPatternCache(code?: string): void {\n if (code) {\n patternCache.delete(code);\n } else {\n patternCache.clear();\n }\n}\n\n// =============================================================================\n// Backwards Compatibility\n// =============================================================================\n\n/**\n * Get all profiles as a record (for backwards compatibility).\n * Note: Only returns registered profiles.\n */\nexport function getAllProfiles(): Record<string, LanguageProfile> {\n const result: Record<string, LanguageProfile> = {};\n for (const [code, profile] of profiles) {\n result[code] = profile;\n }\n return result;\n}\n\n/**\n * Get all tokenizers as a record (for backwards compatibility).\n * Note: Only returns registered tokenizers.\n */\nexport function getAllTokenizers(): Record<string, LanguageTokenizer> {\n const result: Record<string, LanguageTokenizer> = {};\n for (const [code, tokenizer] of tokenizers) {\n result[code] = tokenizer;\n }\n return result;\n}\n","/**\n * Base Tokenizer\n *\n * Provides the TokenStream implementation and shared tokenization utilities.\n * Language-specific tokenizers extend these base utilities.\n */\n\nimport type {\n LanguageToken,\n TokenKind,\n TokenStream,\n StreamMark,\n SourcePosition,\n LanguageTokenizer,\n} from '../types';\nimport type { MorphologicalNormalizer, NormalizationResult } from './morphology/types';\n\n// =============================================================================\n// Time Unit Configuration\n// =============================================================================\n\n/**\n * Configuration for a native language time unit pattern.\n * Used by tryNumberWithTimeUnits() to match language-specific time units.\n */\nexport interface TimeUnitMapping {\n /** The pattern to match (e.g., 'segundos', 'ミリ秒') */\n readonly pattern: string;\n /** The standard suffix to use (ms, s, m, h) */\n readonly suffix: string;\n /** Length of the pattern (for optimization) */\n readonly length: number;\n /** Whether to check for word boundary after the pattern */\n readonly checkBoundary?: boolean;\n /** Character that cannot follow the pattern (e.g., 's' for 'm' to avoid 'ms') */\n readonly notFollowedBy?: string;\n /** Whether to do case-insensitive matching */\n readonly caseInsensitive?: boolean;\n}\n\n// =============================================================================\n// Token Stream Implementation\n// =============================================================================\n\n/**\n * Concrete implementation of TokenStream.\n */\nexport class TokenStreamImpl implements TokenStream {\n readonly tokens: readonly LanguageToken[];\n readonly language: string;\n private pos: number = 0;\n\n constructor(tokens: LanguageToken[], language: string) {\n this.tokens = tokens;\n this.language = language;\n }\n\n peek(offset: number = 0): LanguageToken | null {\n const index = this.pos + offset;\n if (index < 0 || index >= this.tokens.length) {\n return null;\n }\n return this.tokens[index];\n }\n\n advance(): LanguageToken {\n if (this.isAtEnd()) {\n throw new Error('Unexpected end of token stream');\n }\n return this.tokens[this.pos++];\n }\n\n isAtEnd(): boolean {\n return this.pos >= this.tokens.length;\n }\n\n mark(): StreamMark {\n return { position: this.pos };\n }\n\n reset(mark: StreamMark): void {\n this.pos = mark.position;\n }\n\n position(): number {\n return this.pos;\n }\n\n /**\n * Get remaining tokens as an array.\n */\n remaining(): LanguageToken[] {\n return this.tokens.slice(this.pos);\n }\n\n /**\n * Consume tokens while predicate is true.\n */\n takeWhile(predicate: (token: LanguageToken) => boolean): LanguageToken[] {\n const result: LanguageToken[] = [];\n while (!this.isAtEnd() && predicate(this.peek()!)) {\n result.push(this.advance());\n }\n return result;\n }\n\n /**\n * Skip tokens while predicate is true.\n */\n skipWhile(predicate: (token: LanguageToken) => boolean): void {\n while (!this.isAtEnd() && predicate(this.peek()!)) {\n this.advance();\n }\n }\n}\n\n// =============================================================================\n// Shared Tokenization Utilities\n// =============================================================================\n\n/**\n * Create a source position from start and end offsets.\n */\nexport function createPosition(start: number, end: number): SourcePosition {\n return { start, end };\n}\n\n/**\n * Options for creating a token with optional morphological data.\n */\nexport interface CreateTokenOptions {\n /** Explicitly normalized form from keyword map */\n normalized?: string;\n /** Morphologically normalized stem */\n stem?: string;\n /** Confidence in the stem (0.0-1.0) */\n stemConfidence?: number;\n}\n\n/**\n * Create a language token.\n */\nexport function createToken(\n value: string,\n kind: TokenKind,\n position: SourcePosition,\n normalizedOrOptions?: string | CreateTokenOptions\n): LanguageToken {\n // Handle legacy string argument for backward compatibility\n if (typeof normalizedOrOptions === 'string') {\n return { value, kind, position, normalized: normalizedOrOptions };\n }\n\n // Handle options object\n if (normalizedOrOptions) {\n const { normalized, stem, stemConfidence } = normalizedOrOptions;\n const token: LanguageToken = { value, kind, position };\n\n // Build token with only defined properties\n if (normalized !== undefined) {\n (token as any).normalized = normalized;\n }\n if (stem !== undefined) {\n (token as any).stem = stem;\n if (stemConfidence !== undefined) {\n (token as any).stemConfidence = stemConfidence;\n }\n }\n\n return token;\n }\n\n return { value, kind, position };\n}\n\n/**\n * Check if a character is whitespace.\n */\nexport function isWhitespace(char: string): boolean {\n return /\\s/.test(char);\n}\n\n/**\n * Check if a string starts with a CSS selector prefix.\n * Includes JSX-style element selectors: <form />, <div>\n */\nexport function isSelectorStart(char: string): boolean {\n return (\n char === '#' || char === '.' || char === '[' || char === '@' || char === '*' || char === '<'\n );\n}\n\n/**\n * Check if a character is a quote (string delimiter).\n */\nexport function isQuote(char: string): boolean {\n return char === '\"' || char === \"'\" || char === '`' || char === '「' || char === '」';\n}\n\n/**\n * Check if a character is a digit.\n */\nexport function isDigit(char: string): boolean {\n return /\\d/.test(char);\n}\n\n/**\n * Check if a character is an ASCII letter.\n */\nexport function isAsciiLetter(char: string): boolean {\n return /[a-zA-Z]/.test(char);\n}\n\n/**\n * Check if a character is part of an ASCII identifier.\n */\nexport function isAsciiIdentifierChar(char: string): boolean {\n return /[a-zA-Z0-9_-]/.test(char);\n}\n\n// =============================================================================\n// Unicode Range Classification\n// =============================================================================\n\n/**\n * Unicode range tuple: [start, end] (inclusive).\n */\nexport type UnicodeRange = readonly [number, number];\n\n/**\n * Create a character classifier for Unicode ranges.\n * Returns a function that checks if a character's code point falls within any of the ranges.\n *\n * @example\n * // Japanese Hiragana\n * const isHiragana = createUnicodeRangeClassifier([[0x3040, 0x309f]]);\n *\n * // Korean (Hangul syllables + Jamo)\n * const isKorean = createUnicodeRangeClassifier([\n * [0xac00, 0xd7a3], // Hangul syllables\n * [0x1100, 0x11ff], // Hangul Jamo\n * [0x3130, 0x318f], // Hangul Compatibility Jamo\n * ]);\n */\nexport function createUnicodeRangeClassifier(\n ranges: readonly UnicodeRange[]\n): (char: string) => boolean {\n return (char: string): boolean => {\n const code = char.charCodeAt(0);\n return ranges.some(([start, end]) => code >= start && code <= end);\n };\n}\n\n/**\n * Combine multiple character classifiers into one.\n * Returns true if any of the classifiers return true.\n *\n * @example\n * const isJapanese = combineClassifiers(isHiragana, isKatakana, isKanji);\n */\nexport function combineClassifiers(\n ...classifiers: Array<(char: string) => boolean>\n): (char: string) => boolean {\n return (char: string): boolean => classifiers.some(fn => fn(char));\n}\n\n/**\n * Character classifiers for a Latin-based language.\n */\nexport interface LatinCharClassifiers {\n /** Check if character is a letter in this language (including accented chars). */\n isLetter: (char: string) => boolean;\n /** Check if character is part of an identifier (letter, digit, underscore, hyphen). */\n isIdentifierChar: (char: string) => boolean;\n}\n\n/**\n * Create character classifiers for a Latin-based language.\n * Returns isLetter and isIdentifierChar functions based on the provided regex.\n *\n * @example\n * // Spanish letters\n * const { isLetter, isIdentifierChar } = createLatinCharClassifiers(/[a-zA-ZáéíóúüñÁÉÍÓÚÜÑ]/);\n *\n * // German letters\n * const { isLetter, isIdentifierChar } = createLatinCharClassifiers(/[a-zA-ZäöüÄÖÜß]/);\n */\nexport function createLatinCharClassifiers(letterPattern: RegExp): LatinCharClassifiers {\n const isLetter = (char: string): boolean => letterPattern.test(char);\n const isIdentifierChar = (char: string): boolean => isLetter(char) || /[0-9_-]/.test(char);\n return { isLetter, isIdentifierChar };\n}\n\n// =============================================================================\n// CSS Selector Tokenization\n// =============================================================================\n\n/**\n * Extract a CSS selector from the input string starting at pos.\n * CSS selectors are universal across languages.\n *\n * Supported formats:\n * - #id\n * - .class\n * - [attribute]\n * - [attribute=value]\n * - @attribute (shorthand)\n * - *property (CSS property shorthand)\n * - Complex selectors with combinators (limited)\n *\n * Method call handling:\n * - #dialog.showModal() → stops after #dialog (method call, not compound selector)\n * - #box.active → compound selector (no parens)\n */\nexport function extractCssSelector(input: string, startPos: number): string | null {\n if (startPos >= input.length) return null;\n\n const char = input[startPos];\n if (!isSelectorStart(char)) return null;\n\n let pos = startPos;\n let selector = '';\n\n // Handle different selector types\n if (char === '#' || char === '.') {\n // ID or class selector: #id, .class\n selector += input[pos++];\n while (pos < input.length && isAsciiIdentifierChar(input[pos])) {\n selector += input[pos++];\n }\n // Must have at least one character after prefix\n if (selector.length <= 1) return null;\n\n // Check for method call pattern: #id.method() or .class.method()\n // If we see .identifier followed by (, don't consume it - it's a method call\n if (pos < input.length && input[pos] === '.' && char === '#') {\n // Look ahead to see if this is a method call\n const methodStart = pos + 1;\n let methodEnd = methodStart;\n while (methodEnd < input.length && isAsciiIdentifierChar(input[methodEnd])) {\n methodEnd++;\n }\n // If followed by (, it's a method call - stop here\n if (methodEnd < input.length && input[methodEnd] === '(') {\n return selector;\n }\n }\n } else if (char === '[') {\n // Attribute selector: [attr] or [attr=value] or [attr=\"value\"]\n // Need to track quote state to avoid counting brackets inside quotes\n let depth = 1;\n let inQuote = false;\n let quoteChar: string | null = null;\n let escaped = false;\n\n selector += input[pos++]; // [\n\n while (pos < input.length && depth > 0) {\n const c = input[pos];\n selector += c;\n\n if (escaped) {\n // Skip escaped character\n escaped = false;\n } else if (c === '\\\\') {\n // Next character is escaped\n escaped = true;\n } else if (inQuote) {\n // Inside a quoted string\n if (c === quoteChar) {\n inQuote = false;\n quoteChar = null;\n }\n } else {\n // Not inside a quoted string\n if (c === '\"' || c === \"'\" || c === '`') {\n inQuote = true;\n quoteChar = c;\n } else if (c === '[') {\n depth++;\n } else if (c === ']') {\n depth--;\n }\n }\n pos++;\n }\n if (depth !== 0) return null;\n } else if (char === '@') {\n // Attribute shorthand: @disabled\n selector += input[pos++];\n while (pos < input.length && isAsciiIdentifierChar(input[pos])) {\n selector += input[pos++];\n }\n if (selector.length <= 1) return null;\n } else if (char === '*') {\n // CSS property shorthand: *display\n selector += input[pos++];\n while (pos < input.length && isAsciiIdentifierChar(input[pos])) {\n selector += input[pos++];\n }\n if (selector.length <= 1) return null;\n } else if (char === '<') {\n // HTML literal selector with optional modifiers and attributes:\n // - <div>\n // - <div.class>\n // - <div#id>\n // - <div.class#id>\n // - <button[disabled]/>\n // - <div.card/>\n // - <div.class#id[attr=\"value\"]/>\n selector += input[pos++]; // <\n\n // Must be followed by an identifier (tag name)\n if (pos >= input.length || !isAsciiLetter(input[pos])) return null;\n\n // Extract tag name\n while (pos < input.length && isAsciiIdentifierChar(input[pos])) {\n selector += input[pos++];\n }\n\n // Process modifiers and attributes\n // Can have multiple .class, one #id, and multiple [attr] in any order\n while (pos < input.length) {\n const modChar = input[pos];\n\n if (modChar === '.') {\n // Class modifier\n selector += input[pos++]; // .\n if (pos >= input.length || !isAsciiIdentifierChar(input[pos])) {\n return null; // Invalid - class name required after .\n }\n while (pos < input.length && isAsciiIdentifierChar(input[pos])) {\n selector += input[pos++];\n }\n } else if (modChar === '#') {\n // ID modifier\n selector += input[pos++]; // #\n if (pos >= input.length || !isAsciiIdentifierChar(input[pos])) {\n return null; // Invalid - ID required after #\n }\n while (pos < input.length && isAsciiIdentifierChar(input[pos])) {\n selector += input[pos++];\n }\n } else if (modChar === '[') {\n // Attribute modifier: [disabled] or [type=\"button\"]\n // Need to track quote state to avoid counting brackets inside quotes\n let depth = 1;\n let inQuote = false;\n let quoteChar: string | null = null;\n let escaped = false;\n\n selector += input[pos++]; // [\n\n while (pos < input.length && depth > 0) {\n const c = input[pos];\n selector += c;\n\n if (escaped) {\n escaped = false;\n } else if (c === '\\\\') {\n escaped = true;\n } else if (inQuote) {\n if (c === quoteChar) {\n inQuote = false;\n quoteChar = null;\n }\n } else {\n if (c === '\"' || c === \"'\" || c === '`') {\n inQuote = true;\n quoteChar = c;\n } else if (c === '[') {\n depth++;\n } else if (c === ']') {\n depth--;\n }\n }\n pos++;\n }\n if (depth !== 0) return null; // Unclosed bracket\n } else {\n // No more modifiers\n break;\n }\n }\n\n // Skip whitespace before optional self-closing /\n while (pos < input.length && isWhitespace(input[pos])) {\n selector += input[pos++];\n }\n\n // Optional self-closing /\n if (pos < input.length && input[pos] === '/') {\n selector += input[pos++];\n // Skip whitespace after /\n while (pos < input.length && isWhitespace(input[pos])) {\n selector += input[pos++];\n }\n }\n\n // Must end with >\n if (pos >= input.length || input[pos] !== '>') return null;\n selector += input[pos++]; // >\n }\n\n return selector || null;\n}\n\n// =============================================================================\n// String Literal Tokenization\n// =============================================================================\n\n/**\n * Check if a single quote at pos is a possessive marker ('s).\n * Returns true if this looks like possessive, not a string start.\n *\n * Examples:\n * - #element's *opacity → possessive (returns true)\n * - 'hello' → string (returns false)\n * - it's value → possessive (returns true)\n */\nexport function isPossessiveMarker(input: string, pos: number): boolean {\n if (pos >= input.length || input[pos] !== \"'\") return false;\n\n // Check if followed by 's' or 'S'\n if (pos + 1 >= input.length) return false;\n const nextChar = input[pos + 1].toLowerCase();\n if (nextChar !== 's') return false;\n\n // After 's, should be end, whitespace, or special char (not alphanumeric)\n if (pos + 2 >= input.length) return true; // end of input\n const afterS = input[pos + 2];\n return isWhitespace(afterS) || afterS === '*' || !isAsciiIdentifierChar(afterS);\n}\n\n/**\n * Extract a string literal from the input starting at pos.\n * Handles both ASCII quotes and Unicode quotes.\n *\n * Note: Single quotes that look like possessive markers ('s) are skipped.\n */\nexport function extractStringLiteral(input: string, startPos: number): string | null {\n if (startPos >= input.length) return null;\n\n const openQuote = input[startPos];\n if (!isQuote(openQuote)) return null;\n\n // Check for possessive marker - don't treat as string\n if (openQuote === \"'\" && isPossessiveMarker(input, startPos)) {\n return null;\n }\n\n // Map opening quotes to closing quotes\n const closeQuoteMap: Record<string, string> = {\n '\"': '\"',\n \"'\": \"'\",\n '`': '`',\n '「': '」',\n };\n\n const closeQuote = closeQuoteMap[openQuote];\n if (!closeQuote) return null;\n\n let pos = startPos + 1;\n let literal = openQuote;\n let escaped = false;\n\n while (pos < input.length) {\n const char = input[pos];\n literal += char;\n\n if (escaped) {\n escaped = false;\n } else if (char === '\\\\') {\n escaped = true;\n } else if (char === closeQuote) {\n // Found closing quote\n return literal;\n }\n pos++;\n }\n\n // Unclosed string - return what we have\n return literal;\n}\n\n// =============================================================================\n// URL Tokenization\n// =============================================================================\n\n/**\n * Check if the input at position starts a URL.\n * Detects: /path, ./path, ../path, //domain.com, http://, https://\n */\nexport function isUrlStart(input: string, pos: number): boolean {\n if (pos >= input.length) return false;\n\n const char = input[pos];\n const next = input[pos + 1] || '';\n const third = input[pos + 2] || '';\n\n // Absolute path: /something (but not just /)\n // Must be followed by alphanumeric or path char, not another / (that's protocol-relative)\n if (char === '/' && next !== '/' && /[a-zA-Z0-9._-]/.test(next)) {\n return true;\n }\n\n // Protocol-relative: //domain.com\n if (char === '/' && next === '/' && /[a-zA-Z]/.test(third)) {\n return true;\n }\n\n // Relative path: ./ or ../\n if (char === '.' && (next === '/' || (next === '.' && third === '/'))) {\n return true;\n }\n\n // Full URL: http:// or https://\n const slice = input.slice(pos, pos + 8).toLowerCase();\n if (slice.startsWith('http://') || slice.startsWith('https://')) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Extract a URL from the input starting at pos.\n * Handles paths, query strings, and fragments.\n *\n * Fragment (#) handling:\n * - /page#section → includes fragment as part of URL\n * - #id alone → not a URL (CSS selector)\n */\nexport function extractUrl(input: string, startPos: number): string | null {\n if (!isUrlStart(input, startPos)) return null;\n\n let pos = startPos;\n let url = '';\n\n // Core URL characters (RFC 3986 unreserved + sub-delims + path/query chars)\n // Includes: letters, digits, and - . _ ~ : / ? # [ ] @ ! $ & ' ( ) * + , ; = %\n const urlChars = /[a-zA-Z0-9/:._\\-?&=%@+~!$'()*,;[\\]]/;\n\n while (pos < input.length) {\n const char = input[pos];\n\n // Special handling for #\n if (char === '#') {\n // Only include # if we have path content before it (it's a fragment)\n // If # appears at URL start or after certain chars, stop (might be CSS selector)\n if (url.length > 0 && /[a-zA-Z0-9/.]$/.test(url)) {\n // Include fragment\n url += char;\n pos++;\n // Consume fragment identifier (letters, digits, underscore, hyphen)\n while (pos < input.length && /[a-zA-Z0-9_-]/.test(input[pos])) {\n url += input[pos++];\n }\n }\n // Stop either way - fragment consumed or # is separate token\n break;\n }\n\n if (urlChars.test(char)) {\n url += char;\n pos++;\n } else {\n break;\n }\n }\n\n // Minimum length validation\n if (url.length < 2) return null;\n\n return url;\n}\n\n// =============================================================================\n// Number Tokenization\n// =============================================================================\n\n/**\n * Extract a number from the input starting at pos.\n * Handles integers and decimals.\n */\nexport function extractNumber(input: string, startPos: number): string | null {\n if (startPos >= input.length) return null;\n\n const char = input[startPos];\n if (!isDigit(char) && char !== '-' && char !== '+') return null;\n\n let pos = startPos;\n let number = '';\n\n // Optional sign\n if (input[pos] === '-' || input[pos] === '+') {\n number += input[pos++];\n }\n\n // Must have at least one digit\n if (pos >= input.length || !isDigit(input[pos])) {\n return null;\n }\n\n // Integer part\n while (pos < input.length && isDigit(input[pos])) {\n number += input[pos++];\n }\n\n // Optional decimal part\n if (pos < input.length && input[pos] === '.') {\n number += input[pos++];\n while (pos < input.length && isDigit(input[pos])) {\n number += input[pos++];\n }\n }\n\n // Optional duration suffix (s, ms, m, h)\n if (pos < input.length) {\n const suffix = input.slice(pos, pos + 2);\n if (suffix === 'ms') {\n number += 'ms';\n } else if (input[pos] === 's' || input[pos] === 'm' || input[pos] === 'h') {\n number += input[pos];\n }\n }\n\n return number;\n}\n\n// =============================================================================\n// Base Tokenizer Class\n// =============================================================================\n\n/**\n * Keyword entry for tokenizer - maps native word to normalized English form.\n */\nexport interface KeywordEntry {\n readonly native: string;\n readonly normalized: string;\n}\n\n/**\n * Profile interface for keyword derivation.\n * Matches the structure of LanguageProfile but only includes fields needed for tokenization.\n */\nexport interface TokenizerProfile {\n readonly keywords?: Record<\n string,\n { primary: string; alternatives?: string[]; normalized?: string }\n >;\n readonly references?: Record<string, string>;\n readonly roleMarkers?: Record<\n string,\n { primary: string; alternatives?: string[]; position?: string }\n >;\n}\n\n/**\n * Abstract base class for language-specific tokenizers.\n * Provides common functionality for CSS selectors, strings, and numbers.\n */\nexport abstract class BaseTokenizer implements LanguageTokenizer {\n abstract readonly language: string;\n abstract readonly direction: 'ltr' | 'rtl';\n\n /** Optional morphological normalizer for this language */\n protected normalizer?: MorphologicalNormalizer;\n\n /** Keywords derived from profile, sorted longest-first for greedy matching */\n protected profileKeywords: KeywordEntry[] = [];\n\n /** Map for O(1) keyword lookups by lowercase native word */\n protected profileKeywordMap: Map<string, KeywordEntry> = new Map();\n\n abstract tokenize(input: string): TokenStream;\n abstract classifyToken(token: string): TokenKind;\n\n /**\n * Initialize keyword mappings from a language profile.\n * Builds a list of native→english mappings from:\n * - profile.keywords (primary + alternatives)\n * - profile.references (me, it, you, etc.)\n * - profile.roleMarkers (into, from, with, etc.)\n *\n * Results are sorted longest-first for greedy matching (important for non-space languages).\n * Extras take precedence over profile entries when there are duplicates.\n *\n * @param profile - Language profile containing keyword translations\n * @param extras - Additional keyword entries to include (literals, positional, events)\n */\n protected initializeKeywordsFromProfile(\n profile: TokenizerProfile,\n extras: KeywordEntry[] = []\n ): void {\n // Use a Map to deduplicate, with extras taking precedence\n const keywordMap = new Map<string, KeywordEntry>();\n\n // Extract from keywords (command translations)\n if (profile.keywords) {\n for (const [normalized, translation] of Object.entries(profile.keywords)) {\n // Primary translation\n keywordMap.set(translation.primary, {\n native: translation.primary,\n normalized: translation.normalized || normalized,\n });\n\n // Alternative forms\n if (translation.alternatives) {\n for (const alt of translation.alternatives) {\n keywordMap.set(alt, {\n native: alt,\n normalized: translation.normalized || normalized,\n });\n }\n }\n }\n }\n\n // Extract from references (me, it, you, etc.)\n if (profile.references) {\n for (const [normalized, native] of Object.entries(profile.references)) {\n keywordMap.set(native, { native, normalized });\n }\n }\n\n // Extract from roleMarkers (into, from, with, etc.)\n if (profile.roleMarkers) {\n for (const [role, marker] of Object.entries(profile.roleMarkers)) {\n if (marker.primary) {\n keywordMap.set(marker.primary, { native: marker.primary, normalized: role });\n }\n if (marker.alternatives) {\n for (const alt of marker.alternatives) {\n keywordMap.set(alt, { native: alt, normalized: role });\n }\n }\n }\n }\n\n // Add extra entries (literals, positional, events) - these OVERRIDE profile entries\n for (const extra of extras) {\n keywordMap.set(extra.native, extra);\n }\n\n // Convert to array and sort longest-first for greedy matching\n this.profileKeywords = Array.from(keywordMap.values()).sort(\n (a, b) => b.native.length - a.native.length\n );\n\n // Build Map for O(1) lookups (case-insensitive + diacritic-insensitive)\n // This allows matching both 'بدّل' (with shadda) and 'بدل' (without) to the same entry\n this.profileKeywordMap = new Map();\n for (const keyword of this.profileKeywords) {\n // Add original form (with diacritics if present)\n this.profileKeywordMap.set(keyword.native.toLowerCase(), keyword);\n\n // Add diacritic-normalized form (for Arabic, Turkish, etc.)\n const normalized = this.removeDiacritics(keyword.native);\n if (normalized !== keyword.native && !this.profileKeywordMap.has(normalized.toLowerCase())) {\n this.profileKeywordMap.set(normalized.toLowerCase(), keyword);\n }\n }\n }\n\n /**\n * Remove diacritical marks from a word for normalization.\n * Primarily for Arabic (shadda, fatha, kasra, damma, sukun, etc.)\n * but could be extended for other languages.\n *\n * @param word - Word to normalize\n * @returns Word without diacritics\n */\n protected removeDiacritics(word: string): string {\n // Arabic diacritics: U+064B-U+0652 (fatha, kasra, damma, sukun, shadda, etc.)\n // U+0670 (superscript alif)\n return word.replace(/[\\u064B-\\u0652\\u0670]/g, '');\n }\n\n /**\n * Try to match a keyword from profile at the current position.\n * Uses longest-first greedy matching (important for non-space languages).\n *\n * @param input - Input string\n * @param pos - Current position\n * @returns Token if matched, null otherwise\n */\n protected tryProfileKeyword(input: string, pos: number): LanguageToken | null {\n for (const entry of this.profileKeywords) {\n if (input.slice(pos).startsWith(entry.native)) {\n return createToken(\n entry.native,\n 'keyword',\n createPosition(pos, pos + entry.native.length),\n entry.normalized\n );\n }\n }\n return null;\n }\n\n /**\n * Check if the remaining input starts with any known keyword.\n * Useful for non-space languages to detect word boundaries.\n *\n * @param input - Input string\n * @param pos - Current position\n * @returns true if a keyword starts at this position\n */\n protected isKeywordStart(input: string, pos: number): boolean {\n const remaining = input.slice(pos);\n return this.profileKeywords.some(entry => remaining.startsWith(entry.native));\n }\n\n /**\n * Look up a keyword by native word (case-insensitive).\n * O(1) lookup using the keyword map.\n *\n * @param native - Native word to look up\n * @returns KeywordEntry if found, undefined otherwise\n */\n protected lookupKeyword(native: string): KeywordEntry | undefined {\n return this.profileKeywordMap.get(native.toLowerCase());\n }\n\n /**\n * Check if a word is a known keyword (case-insensitive).\n * O(1) lookup using the keyword map.\n *\n * @param native - Native word to check\n * @returns true if the word is a keyword\n */\n protected isKeyword(native: string): boolean {\n return this.profileKeywordMap.has(native.toLowerCase());\n }\n\n /**\n * Set the morphological normalizer for this tokenizer.\n */\n setNormalizer(normalizer: MorphologicalNormalizer): void {\n this.normalizer = normalizer;\n }\n\n /**\n * Try to normalize a word using the morphological normalizer.\n * Returns null if no normalizer is set or normalization fails.\n *\n * Note: We don't check isNormalizable() here because the individual tokenizers\n * historically called normalize() directly without that check. The normalize()\n * method itself handles returning noChange() for words that can't be normalized.\n */\n protected tryNormalize(word: string): NormalizationResult | null {\n if (!this.normalizer) return null;\n\n const result = this.normalizer.normalize(word);\n\n // Only return if actually normalized (stem differs from input)\n if (result.stem !== word && result.confidence >= 0.7) {\n return result;\n }\n\n return null;\n }\n\n /**\n * Try morphological normalization and keyword lookup.\n *\n * If the word can be normalized to a stem that matches a known keyword,\n * returns a keyword token with morphological metadata (stem, stemConfidence).\n *\n * This is the common pattern for handling conjugated verbs across languages:\n * 1. Normalize the word (e.g., \"toggled\" → \"toggle\")\n * 2. Look up the stem in the keyword map\n * 3. Create a token with both the original form and stem metadata\n *\n * @param word - The word to normalize and look up\n * @param startPos - Start position for the token\n * @param endPos - End position for the token\n * @returns Token if stem matches a keyword, null otherwise\n */\n protected tryMorphKeywordMatch(\n word: string,\n startPos: number,\n endPos: number\n ): LanguageToken | null {\n const result = this.tryNormalize(word);\n if (!result) return null;\n\n // Check if the stem is a known keyword\n const stemEntry = this.lookupKeyword(result.stem);\n if (!stemEntry) return null;\n\n const tokenOptions: CreateTokenOptions = {\n normalized: stemEntry.normalized,\n stem: result.stem,\n stemConfidence: result.confidence,\n };\n return createToken(word, 'keyword', createPosition(startPos, endPos), tokenOptions);\n }\n\n /**\n * Try to extract a CSS selector at the current position.\n */\n protected trySelector(input: string, pos: number): LanguageToken | null {\n const selector = extractCssSelector(input, pos);\n if (selector) {\n return createToken(selector, 'selector', createPosition(pos, pos + selector.length));\n }\n return null;\n }\n\n /**\n * Try to extract an event modifier at the current position.\n * Event modifiers are .once, .debounce(N), .throttle(N), .queue(strategy)\n */\n protected tryEventModifier(input: string, pos: number): LanguageToken | null {\n // Must start with a dot\n if (input[pos] !== '.') {\n return null;\n }\n\n // Match pattern: .(once|debounce|throttle|queue) followed by optional (value)\n const match = input\n .slice(pos)\n .match(/^\\.(?:once|debounce|throttle|queue)(?:\\(([^)]+)\\))?(?:\\s|$|\\.)/);\n if (!match) {\n return null;\n }\n\n const fullMatch = match[0].replace(/(\\s|\\.)$/, ''); // Remove trailing space or dot\n const modifierName = fullMatch.slice(1).split('(')[0]; // Extract modifier name\n const value = match[1]; // Extract value from parentheses if present\n\n // Create token with metadata\n const token = createToken(\n fullMatch,\n 'event-modifier',\n createPosition(pos, pos + fullMatch.length)\n );\n\n // Add metadata for the modifier\n return {\n ...token,\n metadata: {\n modifierName,\n value: value ? (modifierName === 'queue' ? value : parseInt(value, 10)) : undefined,\n },\n };\n }\n\n /**\n * Try to extract a string literal at the current position.\n */\n protected tryString(input: string, pos: number): LanguageToken | null {\n const literal = extractStringLiteral(input, pos);\n if (literal) {\n return createToken(literal, 'literal', createPosition(pos, pos + literal.length));\n }\n return null;\n }\n\n /**\n * Try to extract a number at the current position.\n */\n protected tryNumber(input: string, pos: number): LanguageToken | null {\n const number = extractNumber(input, pos);\n if (number) {\n return createToken(number, 'literal', createPosition(pos, pos + number.length));\n }\n return null;\n }\n\n /**\n * Configuration for native language time units.\n * Maps patterns to their standard suffix (ms, s, m, h).\n */\n protected static readonly STANDARD_TIME_UNITS: readonly TimeUnitMapping[] = [\n { pattern: 'ms', suffix: 'ms', length: 2 },\n { pattern: 's', suffix: 's', length: 1, checkBoundary: true },\n { pattern: 'm', suffix: 'm', length: 1, checkBoundary: true, notFollowedBy: 's' },\n { pattern: 'h', suffix: 'h', length: 1, checkBoundary: true },\n ];\n\n /**\n * Try to match a time unit from a list of patterns.\n *\n * @param input - Input string\n * @param pos - Position after the number\n * @param timeUnits - Array of time unit mappings (native pattern → standard suffix)\n * @param skipWhitespace - Whether to skip whitespace before time unit (default: false)\n * @returns Object with matched suffix and new position, or null if no match\n */\n protected tryMatchTimeUnit(\n input: string,\n pos: number,\n timeUnits: readonly TimeUnitMapping[],\n skipWhitespace = false\n ): { suffix: string; endPos: number } | null {\n let unitPos = pos;\n\n // Optionally skip whitespace before time unit\n if (skipWhitespace) {\n while (unitPos < input.length && isWhitespace(input[unitPos])) {\n unitPos++;\n }\n }\n\n const remaining = input.slice(unitPos);\n\n // Check each time unit pattern\n for (const unit of timeUnits) {\n const candidate = remaining.slice(0, unit.length);\n const matches = unit.caseInsensitive\n ? candidate.toLowerCase() === unit.pattern.toLowerCase()\n : candidate === unit.pattern;\n\n if (matches) {\n // Check notFollowedBy constraint (e.g., 'm' should not match 'ms')\n if (unit.notFollowedBy) {\n const nextChar = remaining[unit.length] || '';\n if (nextChar === unit.notFollowedBy) continue;\n }\n\n // Check word boundary if required\n if (unit.checkBoundary) {\n const nextChar = remaining[unit.length] || '';\n if (isAsciiIdentifierChar(nextChar)) continue;\n }\n\n return { suffix: unit.suffix, endPos: unitPos + unit.length };\n }\n }\n\n return null;\n }\n\n /**\n * Parse a base number (sign, integer, decimal) without time units.\n * Returns the number string and end position.\n *\n * @param input - Input string\n * @param startPos - Start position\n * @param allowSign - Whether to allow +/- sign (default: true)\n * @returns Object with number string and end position, or null\n */\n protected parseBaseNumber(\n input: string,\n startPos: number,\n allowSign = true\n ): { number: string; endPos: number } | null {\n let pos = startPos;\n let number = '';\n\n // Optional sign\n if (allowSign && (input[pos] === '-' || input[pos] === '+')) {\n number += input[pos++];\n }\n\n // Must have at least one digit\n if (pos >= input.length || !isDigit(input[pos])) {\n return null;\n }\n\n // Integer part\n while (pos < input.length && isDigit(input[pos])) {\n number += input[pos++];\n }\n\n // Optional decimal\n if (pos < input.length && input[pos] === '.') {\n number += input[pos++];\n while (pos < input.length && isDigit(input[pos])) {\n number += input[pos++];\n }\n }\n\n if (!number || number === '-' || number === '+') return null;\n\n return { number, endPos: pos };\n }\n\n /**\n * Try to extract a number with native language time units.\n *\n * This is a template method that handles the common pattern:\n * 1. Parse the base number (sign, integer, decimal)\n * 2. Try to match native language time units\n * 3. Fall back to standard time units (ms, s, m, h)\n *\n * @param input - Input string\n * @param pos - Start position\n * @param nativeTimeUnits - Language-specific time unit mappings\n * @param options - Configuration options\n * @returns Token if number found, null otherwise\n */\n protected tryNumberWithTimeUnits(\n input: string,\n pos: number,\n nativeTimeUnits: readonly TimeUnitMapping[],\n options: { allowSign?: boolean; skipWhitespace?: boolean } = {}\n ): LanguageToken | null {\n const { allowSign = true, skipWhitespace = false } = options;\n\n // Parse base number\n const baseResult = this.parseBaseNumber(input, pos, allowSign);\n if (!baseResult) return null;\n\n let { number, endPos } = baseResult;\n\n // Try native time units first, then standard\n const allUnits = [...nativeTimeUnits, ...BaseTokenizer.STANDARD_TIME_UNITS];\n const timeMatch = this.tryMatchTimeUnit(input, endPos, allUnits, skipWhitespace);\n\n if (timeMatch) {\n number += timeMatch.suffix;\n endPos = timeMatch.endPos;\n }\n\n return createToken(number, 'literal', createPosition(pos, endPos));\n }\n\n /**\n * Try to extract a URL at the current position.\n * Handles /path, ./path, ../path, //domain.com, http://, https://\n */\n protected tryUrl(input: string, pos: number): LanguageToken | null {\n const url = extractUrl(input, pos);\n if (url) {\n return createToken(url, 'url', createPosition(pos, pos + url.length));\n }\n return null;\n }\n\n /**\n * Try to extract a variable reference (:varname) at the current position.\n * In hyperscript, :x refers to a local variable named x.\n */\n protected tryVariableRef(input: string, pos: number): LanguageToken | null {\n if (input[pos] !== ':') return null;\n if (pos + 1 >= input.length) return null;\n if (!isAsciiIdentifierChar(input[pos + 1])) return null;\n\n let endPos = pos + 1;\n while (endPos < input.length && isAsciiIdentifierChar(input[endPos])) {\n endPos++;\n }\n\n const varRef = input.slice(pos, endPos);\n return createToken(varRef, 'identifier', createPosition(pos, endPos));\n }\n\n /**\n * Try to extract an operator or punctuation token at the current position.\n * Handles two-character operators (==, !=, etc.) and single-character operators.\n */\n protected tryOperator(input: string, pos: number): LanguageToken | null {\n // Two-character operators\n const twoChar = input.slice(pos, pos + 2);\n if (['==', '!=', '<=', '>=', '&&', '||', '->'].includes(twoChar)) {\n return createToken(twoChar, 'operator', createPosition(pos, pos + 2));\n }\n\n // Single-character operators\n const oneChar = input[pos];\n if (['<', '>', '!', '+', '-', '*', '/', '='].includes(oneChar)) {\n return createToken(oneChar, 'operator', createPosition(pos, pos + 1));\n }\n\n // Punctuation\n if (['(', ')', '{', '}', ',', ';', ':'].includes(oneChar)) {\n return createToken(oneChar, 'punctuation', createPosition(pos, pos + 1));\n }\n\n return null;\n }\n\n /**\n * Try to match a multi-character particle from a list.\n *\n * Used by languages like Japanese, Korean, and Chinese that have\n * multi-character particles (e.g., Japanese から, まで, より).\n *\n * @param input - Input string\n * @param pos - Current position\n * @param particles - Array of multi-character particles to match\n * @returns Token if matched, null otherwise\n */\n protected tryMultiCharParticle(\n input: string,\n pos: number,\n particles: readonly string[]\n ): LanguageToken | null {\n for (const particle of particles) {\n if (input.slice(pos, pos + particle.length) === particle) {\n return createToken(particle, 'particle', createPosition(pos, pos + particle.length));\n }\n }\n return null;\n }\n}\n","/**\n * Morphological Normalizer Types\n *\n * Defines interfaces for language-specific morphological analysis.\n * Normalizers reduce conjugated/inflected forms to canonical stems\n * that can be matched against keyword dictionaries.\n */\n\n/**\n * Result of morphological normalization.\n */\nexport interface NormalizationResult {\n /** The extracted stem/root form */\n readonly stem: string;\n\n /** Confidence in the normalization (0.0-1.0) */\n readonly confidence: number;\n\n /** Optional metadata about the transformation */\n readonly metadata?: NormalizationMetadata;\n}\n\n/**\n * Metadata about morphological transformations applied.\n */\nexport interface NormalizationMetadata {\n /** Prefixes that were removed */\n readonly removedPrefixes?: readonly string[];\n\n /** Suffixes that were removed */\n readonly removedSuffixes?: readonly string[];\n\n /** Type of conjugation detected */\n readonly conjugationType?: ConjugationType;\n\n /** Original form classification */\n readonly originalForm?: string;\n\n /** Applied transformation rules (for debugging) */\n readonly appliedRules?: readonly string[];\n}\n\n/**\n * Types of verb conjugation/inflection.\n */\nexport type ConjugationType =\n // Tense\n | 'present'\n | 'past'\n | 'future'\n | 'progressive'\n | 'perfect'\n // Mood\n | 'imperative'\n | 'subjunctive'\n | 'conditional'\n // Voice\n | 'passive'\n | 'causative'\n // Politeness (Japanese/Korean)\n | 'polite'\n | 'humble'\n | 'honorific'\n // Form\n | 'negative'\n | 'potential'\n | 'volitional'\n // Japanese conditional forms\n | 'conditional-tara' // たら/したら - if/when (completed action)\n | 'conditional-to' // と/すると - when (habitual/expected)\n | 'conditional-ba' // ば/すれば - if (hypothetical)\n // Korean-specific\n | 'connective' // 하고, 해서 etc.\n | 'conditional-myeon' // -(으)면 - if/when (general conditional)\n | 'temporal-ttae' // -(으)ㄹ 때 - when (at the time of)\n | 'causal-nikka' // -(으)니까 - because/since\n // Korean honorific forms (-시- infix)\n | 'honorific-conditional' // -하시면 - if (honorific)\n | 'honorific-temporal' // -하실 때 - when (honorific)\n | 'honorific-causal' // -하시니까 - because (honorific)\n | 'honorific-past' // -하셨어요 - past (honorific)\n | 'honorific-polite' // -하십니다 - polite (honorific)\n // Korean sequential forms\n | 'sequential-after' // -고 나서 - after doing\n | 'sequential-before' // -기 전에 - before doing\n | 'immediate' // -자마자 - as soon as\n | 'obligation' // -아야/어야 해 - must do, should do\n // Spanish-specific\n | 'reflexive'\n | 'reflexive-imperative'\n | 'gerund'\n | 'participle'\n // Arabic-specific\n | 'conditional-idha' // إذا - if/when (hypothetical)\n | 'temporal-indama' // عندما - when (temporal conjunction)\n | 'temporal-hina' // حين - at the time of\n | 'temporal-lamma' // لمّا - when (past emphasis)\n | 'past-verb' // فعل ماضي - past tense verb\n // Turkish-specific\n | 'conditional-se' // -se/-sa - if (hypothetical)\n | 'temporal-ince' // -ince/-ınca/-unca/-ünce - when/as\n | 'temporal-dikce' // -dikçe/-dıkça/-dukça/-dükçe - as/while\n | 'aorist' // -ir/-ar - habitual/general\n | 'optative' // -eyim/-ayım/-elim/-alım - let me/us\n | 'necessitative' // -meli/-malı - must/should\n // Japanese request/contracted forms\n | 'request' // てください/でください - polite request\n | 'casual-request' // てくれ/でくれ - casual request\n | 'contracted' // ちゃう/じゃう - contracted completion (てしまう)\n | 'contracted-past' // ちゃった/じゃった - contracted past completion\n // Compound\n | 'compound' // Multi-layer suffixes (ていなかった, 하고나서였어)\n | 'te-form' // Japanese て-form\n | 'dictionary'; // Base/infinitive form\n\n/**\n * Interface for language-specific morphological normalizers.\n *\n * Normalizers attempt to reduce inflected word forms to their\n * canonical stems. This enables matching conjugated verbs against\n * keyword dictionaries that only contain base forms.\n *\n * Example (Japanese):\n * 切り替えた (past) → { stem: '切り替え', confidence: 0.85 }\n * 切り替えます (polite) → { stem: '切り替え', confidence: 0.85 }\n *\n * Example (Spanish):\n * mostrarse (reflexive infinitive) → { stem: 'mostrar', confidence: 0.85 }\n * alternando (gerund) → { stem: 'alternar', confidence: 0.85 }\n */\nexport interface MorphologicalNormalizer {\n /** Language code this normalizer handles */\n readonly language: string;\n\n /**\n * Normalize a word to its canonical stem form.\n *\n * @param word - The word to normalize\n * @returns Normalization result with stem and confidence\n */\n normalize(word: string): NormalizationResult;\n\n /**\n * Check if a word appears to be a verb form that can be normalized.\n * Optional optimization to skip normalization for non-verb tokens.\n *\n * @param word - The word to check\n * @returns true if the word might be a normalizable verb form\n */\n isNormalizable?(word: string): boolean;\n}\n\n/**\n * Configuration for suffix-based normalization rules.\n * Used by agglutinative languages (Japanese, Korean, Turkish).\n */\nexport interface SuffixRule {\n /** The suffix pattern to match */\n readonly pattern: string;\n\n /** Confidence when this suffix is stripped */\n readonly confidence: number;\n\n /** What to replace the suffix with (empty string for simple removal) */\n readonly replacement?: string;\n\n /** Conjugation type this suffix indicates */\n readonly conjugationType?: ConjugationType;\n\n /** Minimum stem length after stripping (to avoid over-stripping) */\n readonly minStemLength?: number;\n}\n\n/**\n * Configuration for prefix-based normalization rules.\n * Used primarily by Arabic for article/conjunction prefixes.\n */\nexport interface PrefixRule {\n /** The prefix pattern to match */\n readonly pattern: string;\n\n /** Confidence penalty when this prefix is stripped */\n readonly confidencePenalty: number;\n\n /** What the prefix indicates (for metadata) */\n readonly prefixType?: 'article' | 'conjunction' | 'preposition' | 'verb-marker';\n\n /** Minimum remaining characters after stripping (to avoid over-stripping) */\n readonly minRemaining?: number;\n}\n\n/**\n * Helper to create a \"no change\" normalization result.\n */\nexport function noChange(word: string): NormalizationResult {\n return { stem: word, confidence: 1.0 };\n}\n\n/**\n * Helper to create a normalization result with metadata.\n */\nexport function normalized(\n stem: string,\n confidence: number,\n metadata?: NormalizationMetadata\n): NormalizationResult {\n if (metadata) {\n return { stem, confidence, metadata };\n }\n return { stem, confidence };\n}\n","/**\n * Korean Morphological Normalizer\n *\n * Reduces Korean verb conjugations to their stem forms.\n * Korean verbs conjugate by modifying their endings:\n *\n * Base: 토글 (togeul) - \"toggle\" (loanword)\n * 다 ending: 토글하다 (togeul-hada) - \"to toggle\" (dictionary form)\n * 요 ending: 토글해요 (togeul-haeyo) - polite present\n * 니다 ending: 토글합니다 (togeul-hamnida) - formal present\n * 세요 ending: 토글하세요 (togeul-haseyo) - honorific request\n * 았/었 past: 토글했어 (togeul-haesseo) - informal past\n *\n * Korean also has vowel harmony affecting suffix forms.\n *\n * This normalizer strips these suffixes to find the stem,\n * which can then be matched against keyword dictionaries.\n */\n\nimport type {\n MorphologicalNormalizer,\n NormalizationResult,\n SuffixRule,\n ConjugationType,\n} from './types';\nimport { noChange, normalized } from './types';\n\n/**\n * Check if a character is a Korean syllable block (Hangul).\n * Korean syllables are in the range U+AC00 to U+D7A3.\n */\nfunction isHangul(char: string): boolean {\n const code = char.charCodeAt(0);\n return code >= 0xac00 && code <= 0xd7a3;\n}\n\n/**\n * Check if a word contains Korean characters.\n */\nfunction containsKorean(word: string): boolean {\n for (const char of word) {\n if (isHangul(char)) return true;\n }\n return false;\n}\n\n/**\n * Suffix rules for Korean verb conjugation.\n * Ordered by length (longest first) to ensure greedy matching.\n */\nconst KOREAN_SUFFIX_RULES: readonly SuffixRule[] = [\n // Honorific conditional/temporal forms (-시- infix)\n // These are critical for polite/formal Korean\n { pattern: '하시니까', confidence: 0.85, conjugationType: 'honorific-causal', minStemLength: 1 },\n { pattern: '하실때', confidence: 0.88, conjugationType: 'honorific-temporal', minStemLength: 1 },\n { pattern: '하실 때', confidence: 0.88, conjugationType: 'honorific-temporal', minStemLength: 1 },\n {\n pattern: '하시면',\n confidence: 0.88,\n conjugationType: 'honorific-conditional',\n minStemLength: 1,\n },\n {\n pattern: '으시면',\n confidence: 0.85,\n conjugationType: 'honorific-conditional',\n minStemLength: 2,\n },\n { pattern: '시면', confidence: 0.82, conjugationType: 'honorific-conditional', minStemLength: 2 },\n\n // Sequential/temporal forms - \"after doing\", \"before doing\", \"as soon as\"\n { pattern: '하고나서', confidence: 0.85, conjugationType: 'sequential-after', minStemLength: 1 },\n { pattern: '하고 나서', confidence: 0.85, conjugationType: 'sequential-after', minStemLength: 1 },\n { pattern: '하고서', confidence: 0.85, conjugationType: 'sequential-after', minStemLength: 1 },\n { pattern: '고나서', confidence: 0.82, conjugationType: 'sequential-after', minStemLength: 2 },\n { pattern: '고 나서', confidence: 0.82, conjugationType: 'sequential-after', minStemLength: 2 },\n { pattern: '고서', confidence: 0.82, conjugationType: 'sequential-after', minStemLength: 2 },\n { pattern: '하기전에', confidence: 0.85, conjugationType: 'sequential-before', minStemLength: 1 },\n {\n pattern: '하기 전에',\n confidence: 0.85,\n conjugationType: 'sequential-before',\n minStemLength: 1,\n },\n { pattern: '기전에', confidence: 0.82, conjugationType: 'sequential-before', minStemLength: 2 },\n { pattern: '기 전에', confidence: 0.82, conjugationType: 'sequential-before', minStemLength: 2 },\n { pattern: '하자마자', confidence: 0.88, conjugationType: 'immediate', minStemLength: 1 },\n { pattern: '자마자', confidence: 0.85, conjugationType: 'immediate', minStemLength: 2 },\n\n // Obligation forms - \"must do\", \"should do\"\n { pattern: '해야해요', confidence: 0.85, conjugationType: 'obligation', minStemLength: 1 },\n { pattern: '해야해', confidence: 0.85, conjugationType: 'obligation', minStemLength: 1 },\n { pattern: '해야하다', confidence: 0.85, conjugationType: 'obligation', minStemLength: 1 },\n { pattern: '어야해요', confidence: 0.82, conjugationType: 'obligation', minStemLength: 2 },\n { pattern: '어야해', confidence: 0.82, conjugationType: 'obligation', minStemLength: 2 },\n { pattern: '아야해요', confidence: 0.82, conjugationType: 'obligation', minStemLength: 2 },\n { pattern: '아야해', confidence: 0.82, conjugationType: 'obligation', minStemLength: 2 },\n\n // Conditional forms - most natural for event handlers (longest first)\n // These are critical for native Korean idioms like \"클릭하면 증가\"\n { pattern: '하니까', confidence: 0.85, conjugationType: 'causal-nikka', minStemLength: 1 },\n { pattern: '할때', confidence: 0.88, conjugationType: 'temporal-ttae', minStemLength: 1 },\n { pattern: '할 때', confidence: 0.88, conjugationType: 'temporal-ttae', minStemLength: 1 },\n { pattern: '을때', confidence: 0.85, conjugationType: 'temporal-ttae', minStemLength: 2 },\n { pattern: '을 때', confidence: 0.85, conjugationType: 'temporal-ttae', minStemLength: 2 },\n { pattern: '하면', confidence: 0.88, conjugationType: 'conditional-myeon', minStemLength: 1 },\n { pattern: '으면', confidence: 0.85, conjugationType: 'conditional-myeon', minStemLength: 2 },\n { pattern: '니까', confidence: 0.82, conjugationType: 'causal-nikka', minStemLength: 2 },\n { pattern: '면', confidence: 0.8, conjugationType: 'conditional-myeon', minStemLength: 2 },\n\n // Formal polite forms (longest first)\n { pattern: '하였습니다', confidence: 0.85, conjugationType: 'past', minStemLength: 1 },\n { pattern: '했습니다', confidence: 0.85, conjugationType: 'past', minStemLength: 1 },\n { pattern: '합니다', confidence: 0.85, conjugationType: 'polite', minStemLength: 1 },\n { pattern: '습니다', confidence: 0.82, conjugationType: 'polite', minStemLength: 2 },\n { pattern: '됩니다', confidence: 0.82, conjugationType: 'polite', minStemLength: 1 },\n { pattern: 'ㅂ니다', confidence: 0.82, conjugationType: 'polite', minStemLength: 2 },\n\n // Honorific request forms\n { pattern: '하세요', confidence: 0.85, conjugationType: 'honorific', minStemLength: 1 },\n { pattern: '하십시오', confidence: 0.85, conjugationType: 'honorific', minStemLength: 1 },\n { pattern: '세요', confidence: 0.82, conjugationType: 'honorific', minStemLength: 2 },\n { pattern: '십시오', confidence: 0.82, conjugationType: 'honorific', minStemLength: 2 },\n\n // Informal polite (요) forms\n { pattern: '하고있어요', confidence: 0.82, conjugationType: 'progressive', minStemLength: 1 },\n { pattern: '하고있어', confidence: 0.82, conjugationType: 'progressive', minStemLength: 1 },\n { pattern: '했어요', confidence: 0.85, conjugationType: 'past', minStemLength: 1 },\n { pattern: '해요', confidence: 0.85, conjugationType: 'polite', minStemLength: 1 },\n { pattern: '어요', confidence: 0.82, conjugationType: 'polite', minStemLength: 2 },\n { pattern: '아요', confidence: 0.82, conjugationType: 'polite', minStemLength: 2 },\n\n // Informal (반말) forms\n { pattern: '했어', confidence: 0.85, conjugationType: 'past', minStemLength: 1 },\n { pattern: '해', confidence: 0.8, conjugationType: 'present', minStemLength: 1 },\n { pattern: '었어', confidence: 0.82, conjugationType: 'past', minStemLength: 2 },\n { pattern: '았어', confidence: 0.82, conjugationType: 'past', minStemLength: 2 },\n\n // Progressive forms\n { pattern: '하고있다', confidence: 0.82, conjugationType: 'progressive', minStemLength: 1 },\n { pattern: '고있다', confidence: 0.8, conjugationType: 'progressive', minStemLength: 2 },\n { pattern: '고있어', confidence: 0.8, conjugationType: 'progressive', minStemLength: 2 },\n\n // Dictionary/infinitive form (하다 verbs)\n { pattern: '하다', confidence: 0.88, conjugationType: 'dictionary', minStemLength: 1 },\n\n // Negative forms\n { pattern: '하지않다', confidence: 0.82, conjugationType: 'negative', minStemLength: 1 },\n { pattern: '안하다', confidence: 0.82, conjugationType: 'negative', minStemLength: 1 },\n { pattern: '지않다', confidence: 0.8, conjugationType: 'negative', minStemLength: 2 },\n\n // Imperative forms\n { pattern: '해라', confidence: 0.82, conjugationType: 'imperative', minStemLength: 1 },\n { pattern: '하라', confidence: 0.82, conjugationType: 'imperative', minStemLength: 1 },\n\n // Generic verb endings (lower confidence)\n { pattern: '다', confidence: 0.75, conjugationType: 'dictionary', minStemLength: 2 },\n];\n\n/**\n * 하다 verb pattern - very common pattern in Korean.\n * Noun + 하다 forms a verb.\n * e.g., 토글 + 하다 = 토글하다 (to toggle)\n */\nconst HADA_PATTERNS: readonly {\n pattern: string;\n confidence: number;\n conjugationType: ConjugationType;\n}[] = [\n // Honorific forms (-시- infix) - polite/formal Korean\n // 클릭하시면 → 클릭 (if you click - honorific)\n { pattern: '하시니까', confidence: 0.88, conjugationType: 'honorific-causal' },\n { pattern: '하실때', confidence: 0.88, conjugationType: 'honorific-temporal' },\n { pattern: '하실 때', confidence: 0.88, conjugationType: 'honorific-temporal' },\n { pattern: '하시면', confidence: 0.88, conjugationType: 'honorific-conditional' },\n { pattern: '하셨어요', confidence: 0.85, conjugationType: 'honorific-past' },\n { pattern: '하셨어', confidence: 0.85, conjugationType: 'honorific-past' },\n { pattern: '하십니다', confidence: 0.85, conjugationType: 'honorific-polite' },\n\n // Sequential/temporal forms - \"after doing\", \"before doing\", \"as soon as\"\n { pattern: '하고나서', confidence: 0.88, conjugationType: 'sequential-after' },\n { pattern: '하고 나서', confidence: 0.88, conjugationType: 'sequential-after' },\n { pattern: '하고서', confidence: 0.88, conjugationType: 'sequential-after' },\n { pattern: '하기전에', confidence: 0.88, conjugationType: 'sequential-before' },\n { pattern: '하기 전에', confidence: 0.88, conjugationType: 'sequential-before' },\n { pattern: '하자마자', confidence: 0.88, conjugationType: 'immediate' },\n\n // Obligation forms - \"must do\", \"should do\"\n { pattern: '해야해요', confidence: 0.88, conjugationType: 'obligation' },\n { pattern: '해야해', confidence: 0.88, conjugationType: 'obligation' },\n { pattern: '해야하다', confidence: 0.88, conjugationType: 'obligation' },\n\n // Conditional forms - most natural for event handlers (highest priority)\n // 클릭하면 → 클릭 (if clicked)\n { pattern: '하니까', confidence: 0.88, conjugationType: 'causal-nikka' },\n { pattern: '할때', confidence: 0.88, conjugationType: 'temporal-ttae' },\n { pattern: '할 때', confidence: 0.88, conjugationType: 'temporal-ttae' },\n { pattern: '하면', confidence: 0.88, conjugationType: 'conditional-myeon' },\n\n // Formal\n { pattern: '하였습니다', confidence: 0.85, conjugationType: 'past' },\n { pattern: '했습니다', confidence: 0.85, conjugationType: 'past' },\n { pattern: '합니다', confidence: 0.85, conjugationType: 'polite' },\n { pattern: '하십시오', confidence: 0.85, conjugationType: 'honorific' },\n { pattern: '하세요', confidence: 0.85, conjugationType: 'honorific' },\n // Informal polite\n { pattern: '했어요', confidence: 0.85, conjugationType: 'past' },\n { pattern: '해요', confidence: 0.85, conjugationType: 'polite' },\n // Informal\n { pattern: '했어', confidence: 0.85, conjugationType: 'past' },\n { pattern: '해', confidence: 0.8, conjugationType: 'present' },\n // Progressive\n { pattern: '하고있어요', confidence: 0.82, conjugationType: 'progressive' },\n { pattern: '하고있어', confidence: 0.82, conjugationType: 'progressive' },\n { pattern: '하고있다', confidence: 0.82, conjugationType: 'progressive' },\n // Connective forms (해서 = because/so, 하고 = and)\n { pattern: '해서', confidence: 0.82, conjugationType: 'connective' },\n { pattern: '하고', confidence: 0.8, conjugationType: 'connective' },\n // Negative\n { pattern: '하지않아요', confidence: 0.82, conjugationType: 'negative' },\n { pattern: '하지않다', confidence: 0.82, conjugationType: 'negative' },\n { pattern: '안해요', confidence: 0.82, conjugationType: 'negative' },\n { pattern: '안해', confidence: 0.82, conjugationType: 'negative' },\n // Imperative\n { pattern: '해라', confidence: 0.82, conjugationType: 'imperative' },\n { pattern: '하라', confidence: 0.82, conjugationType: 'imperative' },\n // Dictionary form\n { pattern: '하다', confidence: 0.88, conjugationType: 'dictionary' },\n];\n\n/**\n * Korean morphological normalizer.\n */\nexport class KoreanMorphologicalNormalizer implements MorphologicalNormalizer {\n readonly language = 'ko';\n\n /**\n * Check if a word might be a Korean verb that can be normalized.\n */\n isNormalizable(word: string): boolean {\n // Must contain Korean characters\n if (!containsKorean(word)) return false;\n\n // Must be at least 2 characters\n if (word.length < 2) return false;\n\n return true;\n }\n\n /**\n * Normalize a Korean word to its stem form.\n */\n normalize(word: string): NormalizationResult {\n // Check for compound conjugations first (multi-layer suffixes)\n const compoundResult = this.normalizeCompound(word);\n if (compoundResult) return compoundResult;\n\n // Check for 하다 verb patterns (most common verb type)\n const hadaResult = this.tryHadaNormalization(word);\n if (hadaResult) return hadaResult;\n\n // Try general suffix rules\n for (const rule of KOREAN_SUFFIX_RULES) {\n if (word.endsWith(rule.pattern)) {\n const stem = word.slice(0, -rule.pattern.length);\n\n // Validate stem length\n const minLength = rule.minStemLength ?? 2;\n if (stem.length < minLength) continue;\n\n const metadata: {\n removedSuffixes: string[];\n conjugationType?: typeof rule.conjugationType;\n } = {\n removedSuffixes: [rule.pattern],\n };\n if (rule.conjugationType) {\n metadata.conjugationType = rule.conjugationType;\n }\n return normalized(stem, rule.confidence, metadata);\n }\n }\n\n // No normalization needed\n return noChange(word);\n }\n\n /**\n * Try to normalize a 하다 verb.\n * 하다 verbs are formed by noun + 하다, very common in Korean.\n */\n private tryHadaNormalization(word: string): NormalizationResult | null {\n for (const pattern of HADA_PATTERNS) {\n if (word.endsWith(pattern.pattern)) {\n const stem = word.slice(0, -pattern.pattern.length);\n\n // 하다 verbs need at least one character for the noun part\n if (stem.length < 1) continue;\n\n // Return the noun part (without 하다 conjugation)\n return normalized(stem, pattern.confidence, {\n removedSuffixes: [pattern.pattern],\n conjugationType: pattern.conjugationType,\n originalForm: 'hada-verb',\n });\n }\n }\n return null;\n }\n\n /**\n * Normalize compound conjugations (multi-layer suffixes).\n * Korean has complex compound forms that combine multiple grammatical elements.\n */\n private normalizeCompound(word: string): NormalizationResult | null {\n // Compound patterns with sequential/modal forms\n const compoundPatterns: readonly {\n pattern: string;\n suffixes: string[];\n confidence: number;\n conjugationType: ConjugationType;\n minStemLength: number;\n }[] = [\n // Sequential past forms (after doing, was)\n {\n pattern: '하고나서였어',\n suffixes: ['하고나서', '였어'],\n confidence: 0.78,\n conjugationType: 'sequential-after',\n minStemLength: 2,\n },\n {\n pattern: '하고나서였다',\n suffixes: ['하고나서', '였다'],\n confidence: 0.78,\n conjugationType: 'sequential-after',\n minStemLength: 2,\n },\n {\n pattern: '하고나서',\n suffixes: ['하고', '나서'],\n confidence: 0.85,\n conjugationType: 'sequential-after',\n minStemLength: 2,\n },\n\n // Modal necessity past forms (had to do)\n {\n pattern: '해야했어',\n suffixes: ['해야', '했어'],\n confidence: 0.8,\n conjugationType: 'obligation',\n minStemLength: 2,\n },\n {\n pattern: '해야했다',\n suffixes: ['해야', '했다'],\n confidence: 0.8,\n conjugationType: 'obligation',\n minStemLength: 2,\n },\n {\n pattern: '해야했습니다',\n suffixes: ['해야', '했습니다'],\n confidence: 0.8,\n conjugationType: 'obligation',\n minStemLength: 2,\n },\n\n // Honorific simultaneous forms (while doing, honorific)\n {\n pattern: '하시면서',\n suffixes: ['하시', '면서'],\n confidence: 0.82,\n conjugationType: 'connective',\n minStemLength: 2,\n },\n {\n pattern: '하시며',\n suffixes: ['하시', '며'],\n confidence: 0.82,\n conjugationType: 'connective',\n minStemLength: 2,\n },\n\n // Progressive forms with copula\n {\n pattern: '하고있었어',\n suffixes: ['하고', '있었어'],\n confidence: 0.8,\n conjugationType: 'progressive',\n minStemLength: 2,\n },\n {\n pattern: '하고있었다',\n suffixes: ['하고', '있었다'],\n confidence: 0.8,\n conjugationType: 'progressive',\n minStemLength: 2,\n },\n ];\n\n for (const {\n pattern,\n suffixes,\n confidence,\n conjugationType,\n minStemLength,\n } of compoundPatterns) {\n if (word.endsWith(pattern)) {\n const stem = word.slice(0, -pattern.length);\n\n // Validate minimum stem length\n if (stem.length < minStemLength) continue;\n\n return normalized(stem, confidence, {\n removedSuffixes: suffixes,\n conjugationType,\n });\n }\n }\n\n return null;\n }\n}\n\n// Export singleton instance\nexport const koreanMorphologicalNormalizer = new KoreanMorphologicalNormalizer();\n","/**\n * Korean Language Profile\n *\n * SOV word order, particles (을/를, 에, 에서, etc.), space-separated between words.\n * Agglutinative language with particles attaching to words.\n */\n\nimport type { LanguageProfile } from './types';\n\nexport const koreanProfile: LanguageProfile = {\n code: 'ko',\n name: 'Korean',\n nativeName: '한국어',\n direction: 'ltr',\n wordOrder: 'SOV',\n markingStrategy: 'particle',\n usesSpaces: true, // Korean uses spaces between words, but particles attach\n verb: {\n position: 'end',\n suffixes: ['다', '요', '니다', '세요'],\n subjectDrop: true,\n },\n references: {\n me: '나', // \"I/me\" (informal)\n it: '그것', // \"it\"\n you: '너', // \"you\" (informal)\n result: '결과',\n event: '이벤트',\n target: '대상',\n body: '본문',\n },\n possessive: {\n marker: '의', // Possessive particle\n markerPosition: 'between',\n specialForms: {\n me: '내', // Contracted form of 나의 (my)\n it: '그것의', // \"its\"\n you: '네', // Contracted form of 너의 (your)\n },\n keywords: {\n 내: 'me', // nae (my)\n 네: 'you', // ne (your)\n 그의: 'it', // geu-ui (its/his)\n },\n },\n roleMarkers: {\n patient: { primary: '을', alternatives: ['를'], position: 'after' },\n destination: { primary: '에', alternatives: ['으로', '로', '에서'], position: 'after' },\n source: { primary: '에서', alternatives: ['부터'], position: 'after' },\n style: { primary: '로', alternatives: ['으로'], position: 'after' },\n event: { primary: '을', alternatives: ['를'], position: 'after' }, // Event as object marker\n },\n keywords: {\n // Class/Attribute operations\n toggle: { primary: '토글', alternatives: ['전환'], normalized: 'toggle' },\n add: { primary: '추가', normalized: 'add' },\n remove: { primary: '제거', alternatives: ['삭제'], normalized: 'remove' },\n // Content operations\n put: { primary: '넣다', alternatives: ['넣기', '놓기'], normalized: 'put' },\n append: { primary: '추가', normalized: 'append' },\n take: { primary: '가져오다', normalized: 'take' },\n make: { primary: '만들다', normalized: 'make' },\n clone: { primary: '복사', normalized: 'clone' },\n swap: { primary: '교환', alternatives: ['바꾸다'], normalized: 'swap' },\n morph: { primary: '변형', alternatives: ['변환'], normalized: 'morph' },\n // Variable operations\n set: { primary: '설정', normalized: 'set' },\n get: { primary: '얻다', alternatives: ['가져오기'], normalized: 'get' },\n increment: { primary: '증가', normalized: 'increment' },\n decrement: { primary: '감소', normalized: 'decrement' },\n log: { primary: '로그', normalized: 'log' },\n // Visibility\n show: { primary: '보이다', alternatives: ['표시', '보이기'], normalized: 'show' },\n hide: { primary: '숨기다', alternatives: ['숨기기'], normalized: 'hide' },\n transition: { primary: '전환', normalized: 'transition' },\n // Events\n on: { primary: '에', alternatives: ['시', '때', '할 때'], normalized: 'on' },\n trigger: { primary: '트리거', normalized: 'trigger' },\n send: { primary: '보내다', normalized: 'send' },\n // DOM focus\n focus: { primary: '포커스', normalized: 'focus' },\n blur: { primary: '블러', normalized: 'blur' },\n // Navigation\n go: { primary: '이동', normalized: 'go' },\n // Async\n wait: { primary: '대기', normalized: 'wait' },\n fetch: { primary: '가져오기', normalized: 'fetch' },\n settle: { primary: '안정', normalized: 'settle' },\n // Control flow\n if: { primary: '만약', normalized: 'if' },\n when: { primary: '때', normalized: 'when' },\n where: { primary: '어디', normalized: 'where' },\n else: { primary: '아니면', normalized: 'else' },\n repeat: { primary: '반복', normalized: 'repeat' },\n for: { primary: '동안', normalized: 'for' },\n while: { primary: '동안', normalized: 'while' },\n continue: { primary: '계속', normalized: 'continue' },\n halt: { primary: '정지', normalized: 'halt' },\n throw: { primary: '던지다', normalized: 'throw' },\n call: { primary: '호출', normalized: 'call' },\n return: { primary: '반환', normalized: 'return' },\n then: { primary: '그다음', alternatives: ['그리고', '그런후'], normalized: 'then' },\n and: { primary: '그리고', alternatives: ['또한', '및'], normalized: 'and' },\n end: { primary: '끝', alternatives: ['종료', '마침'], normalized: 'end' },\n // Advanced\n js: { primary: 'JS실행', alternatives: ['js'], normalized: 'js' },\n async: { primary: '비동기', normalized: 'async' },\n tell: { primary: '말하다', normalized: 'tell' },\n default: { primary: '기본값', normalized: 'default' },\n init: { primary: '초기화', normalized: 'init' },\n behavior: { primary: '동작', normalized: 'behavior' },\n install: { primary: '설치', normalized: 'install' },\n measure: { primary: '측정', normalized: 'measure' },\n // Modifiers\n into: { primary: '으로', normalized: 'into' },\n before: { primary: '전에', normalized: 'before' },\n after: { primary: '후에', normalized: 'after' },\n // Event modifiers (for repeat until event)\n until: { primary: '까지', normalized: 'until' },\n event: { primary: '이벤트', normalized: 'event' },\n from: { primary: '에서', normalized: 'from' },\n },\n tokenization: {\n particles: ['을', '를', '이', '가', '은', '는', '에', '에서', '으로', '로', '와', '과', '도'],\n boundaryStrategy: 'space',\n },\n};\n","/**\n * Korean Tokenizer\n *\n * Tokenizes Korean hyperscript input.\n * Korean is an agglutinative language with:\n * - Hangul syllable blocks (가-힣)\n * - Particles (조사) mark grammatical roles\n * - 하다 verbs (noun + 하다)\n * - CSS selectors are embedded ASCII\n */\n\nimport type { LanguageToken, TokenKind, TokenStream } from '../types';\nimport {\n BaseTokenizer,\n TokenStreamImpl,\n createToken,\n createPosition,\n createUnicodeRangeClassifier,\n combineClassifiers,\n isWhitespace,\n isSelectorStart,\n isQuote,\n isDigit,\n isAsciiIdentifierChar,\n isUrlStart,\n type KeywordEntry,\n type TimeUnitMapping,\n} from './base';\nimport { KoreanMorphologicalNormalizer } from './morphology/korean-normalizer';\nimport { koreanProfile } from '../generators/profiles/korean';\n\n// =============================================================================\n// Korean Character Classification\n// =============================================================================\n\n/** Check if character is a Korean syllable block (U+AC00-U+D7A3). */\nconst isHangul = createUnicodeRangeClassifier([[0xac00, 0xd7a3]]);\n\n/** Check if character is a Hangul Jamo (U+1100-U+11FF, U+3130-U+318F). */\nconst isJamo = createUnicodeRangeClassifier([\n [0x1100, 0x11ff], // Hangul Jamo\n [0x3130, 0x318f], // Hangul Compatibility Jamo\n]);\n\n/** Check if character is Korean (Hangul syllable or Jamo). */\nconst isKorean = combineClassifiers(isHangul, isJamo);\n\n// =============================================================================\n// Korean Particles (조사)\n// =============================================================================\n\n/**\n * Korean particles that mark grammatical roles.\n * These appear after nouns and vary based on vowel harmony.\n */\nconst PARTICLES = new Set([\n // Subject markers\n '이', // i - after consonant\n '가', // ga - after vowel\n // Object markers\n '을', // eul - after consonant\n '를', // reul - after vowel\n // Topic markers\n '은', // eun - after consonant\n '는', // neun - after vowel\n // Location/time markers\n '에', // e - at, to\n '에서', // eseo - at (action location), from\n '로', // ro - to, by means (after vowel or ㄹ)\n '으로', // euro - to, by means (after consonant)\n // Others\n '와', // wa - and, with (after vowel)\n '과', // gwa - and, with (after consonant)\n '의', // ui - possessive ('s)\n '도', // do - also\n '만', // man - only\n '부터', // buteo - from\n '까지', // kkaji - until\n '처럼', // cheoreom - like\n '보다', // boda - than\n]);\n\n/**\n * Single-character particles.\n */\nconst SINGLE_CHAR_PARTICLES = new Set([\n '이',\n '가',\n '을',\n '를',\n '은',\n '는',\n '에',\n '로',\n '와',\n '과',\n '의',\n '도',\n '만',\n]);\n\n/**\n * Multi-character particles.\n */\nconst MULTI_CHAR_PARTICLES = ['에서', '으로', '부터', '까지', '처럼', '보다'];\n\n/**\n * Particle metadata mapping particles to semantic roles, confidence scores,\n * and vowel harmony variants. Korean particles change based on whether the\n * preceding syllable ends in a consonant or vowel.\n */\ninterface ParticleMetadata {\n readonly role: string; // SemanticRole\n readonly confidence: number;\n readonly variant?: 'consonant' | 'vowel'; // For vowel harmony pairs\n readonly description?: string;\n}\n\nconst PARTICLE_ROLES = new Map<string, ParticleMetadata>([\n // Subject markers (vowel harmony pair)\n [\n '이',\n {\n role: 'agent',\n confidence: 0.85,\n variant: 'consonant',\n description: 'subject marker (after consonant)',\n },\n ],\n [\n '가',\n {\n role: 'agent',\n confidence: 0.85,\n variant: 'vowel',\n description: 'subject marker (after vowel)',\n },\n ],\n\n // Object markers (vowel harmony pair)\n [\n '을',\n {\n role: 'patient',\n confidence: 0.95,\n variant: 'consonant',\n description: 'object marker (after consonant)',\n },\n ],\n [\n '를',\n {\n role: 'patient',\n confidence: 0.95,\n variant: 'vowel',\n description: 'object marker (after vowel)',\n },\n ],\n\n // Topic markers (vowel harmony pair)\n [\n '은',\n {\n role: 'agent',\n confidence: 0.75,\n variant: 'consonant',\n description: 'topic marker (after consonant)',\n },\n ],\n [\n '는',\n {\n role: 'agent',\n confidence: 0.75,\n variant: 'vowel',\n description: 'topic marker (after vowel)',\n },\n ],\n\n // Location/time markers\n ['에', { role: 'destination', confidence: 0.85, description: 'at/to marker' }],\n ['에서', { role: 'source', confidence: 0.8, description: 'at/from marker (action location)' }],\n\n // Direction/means markers (vowel harmony pair)\n [\n '로',\n {\n role: 'destination',\n confidence: 0.85,\n variant: 'vowel',\n description: 'to/by means (after vowel or ㄹ)',\n },\n ],\n [\n '으로',\n {\n role: 'destination',\n confidence: 0.85,\n variant: 'consonant',\n description: 'to/by means (after consonant)',\n },\n ],\n\n // And/with markers (vowel harmony pair)\n [\n '와',\n { role: 'style', confidence: 0.7, variant: 'vowel', description: 'and/with (after vowel)' },\n ],\n [\n '과',\n {\n role: 'style',\n confidence: 0.7,\n variant: 'consonant',\n description: 'and/with (after consonant)',\n },\n ],\n\n // Other markers\n ['의', { role: 'patient', confidence: 0.6, description: 'possessive marker' }],\n ['도', { role: 'patient', confidence: 0.65, description: 'also/too marker' }],\n ['만', { role: 'patient', confidence: 0.65, description: 'only marker' }],\n ['부터', { role: 'source', confidence: 0.9, description: 'from/since marker' }],\n ['까지', { role: 'destination', confidence: 0.75, description: 'until/to marker' }],\n ['처럼', { role: 'manner', confidence: 0.8, description: 'like/as marker' }],\n ['보다', { role: 'source', confidence: 0.75, description: 'than marker' }],\n]);\n\n// =============================================================================\n// Korean Extras (keywords not in profile)\n// =============================================================================\n\n/**\n * Extra keywords not covered by the profile:\n * - Literals (true, false, null, undefined)\n * - Positional words\n * - Event names\n * - Attached particle forms (native idioms)\n * - Conditional event forms\n * - Time units\n */\nconst KOREAN_EXTRAS: KeywordEntry[] = [\n // Values/Literals\n { native: '참', normalized: 'true' },\n { native: '거짓', normalized: 'false' },\n { native: '널', normalized: 'null' },\n { native: '미정의', normalized: 'undefined' },\n\n // Positional\n { native: '첫번째', normalized: 'first' },\n { native: '마지막', normalized: 'last' },\n { native: '다음', normalized: 'next' },\n { native: '이전', normalized: 'previous' },\n { native: '가장가까운', normalized: 'closest' },\n { native: '부모', normalized: 'parent' },\n\n // Events\n { native: '클릭', normalized: 'click' },\n { native: '더블클릭', normalized: 'dblclick' },\n { native: '변경', normalized: 'change' },\n { native: '제출', normalized: 'submit' },\n { native: '입력', normalized: 'input' },\n { native: '로드', normalized: 'load' },\n { native: '스크롤', normalized: 'scroll' },\n { native: '키다운', normalized: 'keydown' },\n { native: '키업', normalized: 'keyup' },\n { native: '마우스오버', normalized: 'mouseover' },\n { native: '마우스아웃', normalized: 'mouseout' },\n\n // References (additional forms)\n { native: '내', normalized: 'my' },\n { native: '그것의', normalized: 'its' },\n\n // Conditional event forms (native idioms)\n { native: '하면', normalized: 'on' },\n { native: '으면', normalized: 'on' },\n { native: '면', normalized: 'on' },\n { native: '할때', normalized: 'on' },\n { native: '할 때', normalized: 'on' },\n { native: '을때', normalized: 'on' },\n { native: '을 때', normalized: 'on' },\n { native: '하니까', normalized: 'on' },\n { native: '니까', normalized: 'on' },\n\n // Control flow helpers\n { native: '그러면', normalized: 'then' },\n { native: '그렇지않으면', normalized: 'otherwise' },\n { native: '중단', normalized: 'break' },\n\n // Logical\n { native: '그리고', normalized: 'and' },\n { native: '또는', normalized: 'or' },\n { native: '아니', normalized: 'not' },\n { native: '이다', normalized: 'is' },\n\n // Command overrides (ensure correct mapping when profile has multiple meanings)\n { native: '추가', normalized: 'add' }, // Profile may have this as 'append'\n\n // Attached particle forms (native idioms - particle + verb without space)\n // Object particle 를 (after vowel)\n { native: '를토글', normalized: 'toggle' },\n { native: '를전환', normalized: 'toggle' },\n { native: '를추가', normalized: 'add' },\n { native: '를제거', normalized: 'remove' },\n { native: '를삭제', normalized: 'remove' },\n { native: '를증가', normalized: 'increment' },\n { native: '를감소', normalized: 'decrement' },\n { native: '를표시', normalized: 'show' },\n { native: '를숨기다', normalized: 'hide' },\n { native: '를설정', normalized: 'set' },\n // Object particle 을 (after consonant)\n { native: '을토글', normalized: 'toggle' },\n { native: '을전환', normalized: 'toggle' },\n { native: '을추가', normalized: 'add' },\n { native: '을제거', normalized: 'remove' },\n { native: '을삭제', normalized: 'remove' },\n { native: '을증가', normalized: 'increment' },\n { native: '을감소', normalized: 'decrement' },\n { native: '을표시', normalized: 'show' },\n { native: '을숨기다', normalized: 'hide' },\n { native: '을설정', normalized: 'set' },\n\n // Time units\n { native: '초', normalized: 's' },\n { native: '밀리초', normalized: 'ms' },\n { native: '분', normalized: 'm' },\n { native: '시간', normalized: 'h' },\n];\n\n// =============================================================================\n// Korean Time Units\n// =============================================================================\n\n/**\n * Korean time unit patterns for number parsing.\n * Sorted by length (longest first) to ensure correct matching.\n * Korean time units attach directly without whitespace.\n */\nconst KOREAN_TIME_UNITS: readonly TimeUnitMapping[] = [\n { pattern: '밀리초', suffix: 'ms', length: 3 },\n { pattern: '시간', suffix: 'h', length: 2 },\n { pattern: '초', suffix: 's', length: 1 },\n { pattern: '분', suffix: 'm', length: 1 },\n];\n\n// =============================================================================\n// Korean Tokenizer Implementation\n// =============================================================================\n\nexport class KoreanTokenizer extends BaseTokenizer {\n readonly language = 'ko';\n readonly direction = 'ltr' as const;\n\n constructor() {\n super();\n // Initialize keywords from profile + extras (single source of truth)\n this.initializeKeywordsFromProfile(koreanProfile, KOREAN_EXTRAS);\n // Set morphological normalizer for verb conjugations\n this.normalizer = new KoreanMorphologicalNormalizer();\n }\n\n tokenize(input: string): TokenStream {\n const tokens: LanguageToken[] = [];\n let pos = 0;\n\n while (pos < input.length) {\n // Skip whitespace\n if (isWhitespace(input[pos])) {\n pos++;\n continue;\n }\n\n // Try CSS selector first (ASCII-based, highest priority)\n if (isSelectorStart(input[pos])) {\n // Check for event modifier first (.once, .debounce(), etc.)\n const modifierToken = this.tryEventModifier(input, pos);\n if (modifierToken) {\n tokens.push(modifierToken);\n pos = modifierToken.position.end;\n continue;\n }\n\n const selectorToken = this.trySelector(input, pos);\n if (selectorToken) {\n tokens.push(selectorToken);\n pos = selectorToken.position.end;\n continue;\n }\n }\n\n // Try string literal\n if (isQuote(input[pos])) {\n const stringToken = this.tryString(input, pos);\n if (stringToken) {\n tokens.push(stringToken);\n pos = stringToken.position.end;\n continue;\n }\n }\n\n // Try URL (/path, ./path, http://, etc.)\n if (isUrlStart(input, pos)) {\n const urlToken = this.tryUrl(input, pos);\n if (urlToken) {\n tokens.push(urlToken);\n pos = urlToken.position.end;\n continue;\n }\n }\n\n // Try number (including Korean time units)\n if (isDigit(input[pos])) {\n const numberToken = this.extractKoreanNumber(input, pos);\n if (numberToken) {\n tokens.push(numberToken);\n pos = numberToken.position.end;\n continue;\n }\n }\n\n // Try variable reference (:varname)\n const varToken = this.tryVariableRef(input, pos);\n if (varToken) {\n tokens.push(varToken);\n pos = varToken.position.end;\n continue;\n }\n\n // Try Korean word FIRST (before particles)\n // This ensures keywords like 로그 aren't split on particle characters\n if (isKorean(input[pos])) {\n const wordToken = this.extractKoreanWord(input, pos);\n if (wordToken) {\n tokens.push(wordToken);\n pos = wordToken.position.end;\n continue;\n }\n }\n\n // Try multi-character particle (before single-character)\n const multiParticle = this.tryMultiCharParticle(input, pos, MULTI_CHAR_PARTICLES);\n if (multiParticle) {\n // Add role metadata to particle token\n const metadata = PARTICLE_ROLES.get(multiParticle.value);\n if (metadata) {\n tokens.push({\n ...multiParticle,\n metadata: {\n particleRole: metadata.role,\n particleConfidence: metadata.confidence,\n particleVariant: metadata.variant,\n },\n });\n } else {\n tokens.push(multiParticle);\n }\n pos = multiParticle.position.end;\n continue;\n }\n\n // Try single-character particle\n if (SINGLE_CHAR_PARTICLES.has(input[pos])) {\n const particle = input[pos];\n const metadata = PARTICLE_ROLES.get(particle);\n if (metadata) {\n tokens.push({\n ...createToken(particle, 'particle', createPosition(pos, pos + 1)),\n metadata: {\n particleRole: metadata.role,\n particleConfidence: metadata.confidence,\n particleVariant: metadata.variant,\n },\n });\n } else {\n tokens.push(createToken(particle, 'particle', createPosition(pos, pos + 1)));\n }\n pos++;\n continue;\n }\n\n // Try ASCII word (for mixed content)\n if (isAsciiIdentifierChar(input[pos])) {\n const asciiToken = this.extractAsciiWord(input, pos);\n if (asciiToken) {\n tokens.push(asciiToken);\n pos = asciiToken.position.end;\n continue;\n }\n }\n\n // Skip unknown character\n pos++;\n }\n\n return new TokenStreamImpl(tokens, 'ko');\n }\n\n classifyToken(token: string): TokenKind {\n if (PARTICLES.has(token)) return 'particle';\n // O(1) Map lookup instead of O(n) array search\n if (this.isKeyword(token)) return 'keyword';\n if (token.startsWith('#') || token.startsWith('.') || token.startsWith('[')) return 'selector';\n if (token.startsWith('\"') || token.startsWith(\"'\")) return 'literal';\n if (/^\\d/.test(token)) return 'literal';\n\n return 'identifier';\n }\n\n /**\n * Extract a Korean word (sequence of Hangul).\n * Prioritizes known keywords, then uses particle-based word boundaries.\n *\n * Uses morphological normalization to handle verb conjugations.\n */\n private extractKoreanWord(input: string, startPos: number): LanguageToken | null {\n // First, try to find the longest matching keyword starting at this position\n // This ensures compound words like 추가, 증가, 숨기다 are recognized whole\n const maxKeywordLen = 6; // Longest Korean keyword\n for (let len = Math.min(maxKeywordLen, input.length - startPos); len >= 2; len--) {\n const candidate = input.slice(startPos, startPos + len);\n // Check all chars are Korean\n let allKorean = true;\n for (let i = 0; i < candidate.length; i++) {\n if (!isKorean(candidate[i])) {\n allKorean = false;\n break;\n }\n }\n if (!allKorean) continue;\n\n // O(1) Map lookup instead of O(n) array search\n const keywordEntry = this.lookupKeyword(candidate);\n if (keywordEntry) {\n return createToken(\n candidate,\n 'keyword',\n createPosition(startPos, startPos + len),\n keywordEntry.normalized\n );\n }\n\n // Try morphological normalization for conjugated forms\n const morphToken = this.tryMorphKeywordMatch(candidate, startPos, startPos + len);\n if (morphToken) return morphToken;\n }\n\n // No keyword match - extract as regular word using particle boundaries\n let pos = startPos;\n let word = '';\n\n while (pos < input.length) {\n const char = input[pos];\n const nextChar = pos + 1 < input.length ? input[pos + 1] : '';\n\n // Stop at single-char particles only if:\n // 1. We have content already\n // 2. The particle is at a word boundary (followed by whitespace, end, non-Korean, or another particle)\n if (SINGLE_CHAR_PARTICLES.has(char) && word.length > 0) {\n const isWordBoundary =\n nextChar === '' ||\n isWhitespace(nextChar) ||\n !isKorean(nextChar) ||\n SINGLE_CHAR_PARTICLES.has(nextChar);\n\n if (isWordBoundary) {\n break;\n }\n // Otherwise, continue - this particle char is part of the word\n }\n\n // Check for multi-char particle (these are always at word boundaries)\n let foundMulti = false;\n for (const particle of MULTI_CHAR_PARTICLES) {\n if (input.slice(pos, pos + particle.length) === particle && word.length > 0) {\n // Only treat as particle if followed by word boundary\n const afterParticle = pos + particle.length;\n const charAfter = afterParticle < input.length ? input[afterParticle] : '';\n if (charAfter === '' || isWhitespace(charAfter) || !isKorean(charAfter)) {\n foundMulti = true;\n break;\n }\n }\n }\n if (foundMulti) break;\n\n // Continue if Korean character\n if (isKorean(char)) {\n word += char;\n pos++;\n } else {\n break;\n }\n }\n\n if (!word) return null;\n\n // O(1) Map lookup instead of O(n) array search\n const keywordEntry = this.lookupKeyword(word);\n if (keywordEntry) {\n return createToken(word, 'keyword', createPosition(startPos, pos), keywordEntry.normalized);\n }\n\n // Try morphological normalization for conjugated forms\n const morphToken = this.tryMorphKeywordMatch(word, startPos, pos);\n if (morphToken) return morphToken;\n\n // Not a keyword, return as identifier\n return createToken(word, 'identifier', createPosition(startPos, pos));\n }\n\n /**\n * Extract an ASCII word (for mixed Korean/English content).\n */\n private extractAsciiWord(input: string, startPos: number): LanguageToken | null {\n let pos = startPos;\n let word = '';\n\n while (pos < input.length && isAsciiIdentifierChar(input[pos])) {\n word += input[pos++];\n }\n\n if (!word) return null;\n\n return createToken(word, 'identifier', createPosition(startPos, pos));\n }\n\n /**\n * Extract a number, including Korean time unit suffixes.\n * Korean time units attach directly without whitespace.\n */\n private extractKoreanNumber(input: string, startPos: number): LanguageToken | null {\n return this.tryNumberWithTimeUnits(input, startPos, KOREAN_TIME_UNITS, {\n allowSign: false,\n skipWhitespace: false,\n });\n }\n}\n\n/**\n * Singleton instance.\n */\nexport const koreanTokenizer = new KoreanTokenizer();\n","/**\n * Korean Language Module\n *\n * Self-registering module for Korean language support.\n * Importing this module registers Korean tokenizer and profile.\n */\n\nimport { registerLanguage } from '../registry';\nimport { koreanTokenizer } from '../tokenizers/korean';\nimport { koreanProfile } from '../generators/profiles/korean';\n\nexport { koreanTokenizer } from '../tokenizers/korean';\nexport { koreanProfile } from '../generators/profiles/korean';\n\nregisterLanguage('ko', koreanTokenizer, koreanProfile);\n"],"mappings":";AA8EA,IAAM,aAAa,oBAAI,IAA+B;AACtD,IAAM,WAAW,oBAAI,IAA6B;AAClD,IAAM,eAAe,oBAAI,IAA+B;AAgBjD,SAAS,iBACd,MACA,WACA,SACM;AACN,aAAW,IAAI,MAAM,SAAS;AAC9B,WAAS,IAAI,MAAM,OAAO;AAE1B,eAAa,OAAO,IAAI;AAC1B;;;AC1DO,IAAM,kBAAN,MAA6C;AAAA,EAKlD,YAAY,QAAyB,UAAkB;AAFvD,SAAQ,MAAc;AAGpB,SAAK,SAAS;AACd,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,KAAK,SAAiB,GAAyB;AAC7C,UAAM,QAAQ,KAAK,MAAM;AACzB,QAAI,QAAQ,KAAK,SAAS,KAAK,OAAO,QAAQ;AAC5C,aAAO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AAiB,MAAM,iBAAiB,aAAa;","names":["normalized","normalized","isHangul","keywordEntry","morphToken"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { B as BaseTokenizer, T as TokenStream, a as TokenKind, L as LanguageProfile } from '../types-C4dcj53L.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Portuguese Tokenizer
|
|
5
|
+
*
|
|
6
|
+
* Tokenizes Portuguese hyperscript input.
|
|
7
|
+
* Portuguese is similar to Spanish:
|
|
8
|
+
* - SVO word order
|
|
9
|
+
* - Space-separated words
|
|
10
|
+
* - Prepositions
|
|
11
|
+
* - Accent marks
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
declare class PortugueseTokenizer extends BaseTokenizer {
|
|
15
|
+
readonly language = "pt";
|
|
16
|
+
readonly direction: "ltr";
|
|
17
|
+
constructor();
|
|
18
|
+
tokenize(input: string): TokenStream;
|
|
19
|
+
classifyToken(token: string): TokenKind;
|
|
20
|
+
private extractWord;
|
|
21
|
+
/**
|
|
22
|
+
* Extract a number, including Portuguese time unit suffixes.
|
|
23
|
+
*/
|
|
24
|
+
private extractNumber;
|
|
25
|
+
}
|
|
26
|
+
declare const portugueseTokenizer: PortugueseTokenizer;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Portuguese Language Profile
|
|
30
|
+
*
|
|
31
|
+
* SVO word order, prepositions, space-separated.
|
|
32
|
+
* Features rich verb conjugation with pro-drop (subject omission).
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
declare const portugueseProfile: LanguageProfile;
|
|
36
|
+
|
|
37
|
+
export { portugueseProfile, portugueseTokenizer };
|