@voctiv/agent-runtime 0.2.2 → 0.4.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/README.md +45 -20
- package/dist/barge-in/barge-in-module.d.ts +0 -1
- package/dist/barge-in/barge-in-module.js +0 -1
- package/dist/barge-in/barge-in-service.d.ts +1 -1
- package/dist/barge-in/barge-in-service.js +33 -2
- package/dist/barge-in/barge-in-strategy.d.ts +11 -9
- package/dist/barge-in/barge-in-strategy.js +39 -23
- package/dist/barge-in/echo-cancellation.d.ts +0 -1
- package/dist/barge-in/echo-cancellation.js +0 -1
- package/dist/barge-in/echo.d.ts +0 -1
- package/dist/barge-in/echo.js +0 -1
- package/dist/barge-in/lexicon.d.ts +0 -1
- package/dist/barge-in/lexicon.js +0 -1
- package/dist/barge-in/speech-ledger.d.ts +0 -2
- package/dist/barge-in/speech-ledger.js +3 -4
- package/dist/barge-in/word-classifier.d.ts +0 -1
- package/dist/barge-in/word-classifier.js +0 -1
- package/dist/call/asr-usage.d.ts +53 -0
- package/dist/call/asr-usage.js +42 -0
- package/dist/call/async.d.ts +2 -0
- package/dist/call/async.js +14 -0
- package/dist/call/env.d.ts +88 -0
- package/dist/call/env.js +294 -0
- package/dist/call/extraction/core.d.ts +99 -0
- package/dist/call/extraction/core.js +259 -0
- package/dist/call/extraction/defaults.d.ts +10 -0
- package/dist/call/extraction/defaults.js +25 -0
- package/dist/call/extraction/index.d.ts +7 -0
- package/dist/call/extraction/index.js +24 -0
- package/dist/call/extraction/orchestrator.d.ts +144 -0
- package/dist/call/extraction/orchestrator.js +309 -0
- package/dist/call/failed-leg.d.ts +43 -0
- package/dist/call/failed-leg.js +77 -0
- package/dist/call/http.d.ts +94 -0
- package/dist/call/http.js +145 -0
- package/dist/call/ledger.d.ts +18 -0
- package/dist/call/ledger.js +80 -0
- package/dist/call/llm-tap.d.ts +7 -0
- package/dist/call/llm-tap.js +41 -0
- package/dist/call/logging.d.ts +16 -0
- package/dist/call/logging.js +92 -0
- package/dist/call/outbound.d.ts +144 -0
- package/dist/call/outbound.js +404 -0
- package/dist/call/output.d.ts +108 -0
- package/dist/call/output.js +77 -0
- package/dist/call/plan.d.ts +119 -0
- package/dist/call/plan.js +2 -0
- package/dist/call/recall.d.ts +115 -0
- package/dist/call/recall.js +312 -0
- package/dist/call/records.d.ts +9 -0
- package/dist/call/records.js +71 -0
- package/dist/call/report.d.ts +65 -0
- package/dist/call/report.js +263 -0
- package/dist/call/sanitize.d.ts +16 -0
- package/dist/call/sanitize.js +72 -0
- package/dist/call/sip.d.ts +111 -0
- package/dist/call/sip.js +212 -0
- package/dist/call/voicemail.d.ts +159 -0
- package/dist/call/voicemail.js +246 -0
- package/dist/core/call-disposables.d.ts +2 -2
- package/dist/core/call-disposables.js +8 -3
- package/dist/core/call-ended-budget.d.ts +11 -0
- package/dist/core/call-ended-budget.js +31 -0
- package/dist/core/container.d.ts +1 -3
- package/dist/core/container.js +9 -49
- package/dist/core/create-agent-script.d.ts +6 -1
- package/dist/core/create-agent-script.js +161 -28
- package/dist/core/decorators.d.ts +0 -1
- package/dist/core/decorators.js +0 -1
- package/dist/core/define-module.d.ts +0 -1
- package/dist/core/define-module.js +0 -1
- package/dist/core/dump-policy.d.ts +0 -1
- package/dist/core/dump-policy.js +0 -1
- package/dist/core/hooks.d.ts +15 -4
- package/dist/core/hooks.js +0 -1
- package/dist/core/media-bootstrap.d.ts +19 -4
- package/dist/core/media-bootstrap.js +53 -13
- package/dist/core/open-timeout.d.ts +12 -0
- package/dist/core/open-timeout.js +48 -0
- package/dist/core/provide-media.d.ts +0 -8
- package/dist/core/provide-media.js +1 -22
- package/dist/core/runtime-events.d.ts +28 -0
- package/dist/{llm/llm-module.js → core/runtime-events.js} +19 -16
- package/dist/core/tokens.d.ts +0 -10
- package/dist/core/tokens.js +0 -1
- package/dist/core/types.d.ts +0 -1
- package/dist/core/types.js +0 -1
- package/dist/core/version.d.ts +2 -3
- package/dist/core/version.js +2 -3
- package/dist/dialog/dialog-definition.d.ts +0 -5
- package/dist/dialog/dialog-definition.js +1 -6
- package/dist/dialog/dialog-ports.d.ts +3 -1
- package/dist/dialog/dialog-ports.js +10 -2
- package/dist/dialog/online-call-host.d.ts +26 -4
- package/dist/dialog/online-call-host.js +94 -12
- package/dist/dialog/online-call-module.d.ts +5 -11
- package/dist/dialog/online-call-module.js +4 -36
- package/dist/dialog/turn-metrics.d.ts +46 -0
- package/dist/dialog/turn-metrics.js +141 -0
- package/dist/dialog-events/active-media.d.ts +50 -2
- package/dist/dialog-events/active-media.js +146 -34
- package/dist/dialog-events/event-source.d.ts +0 -1
- package/dist/dialog-events/event-source.js +0 -1
- package/dist/dialog-events/virtual-finals-module.d.ts +0 -1
- package/dist/dialog-events/virtual-finals-module.js +0 -1
- package/dist/dialog-events/virtual-finals.d.ts +2 -1
- package/dist/dialog-events/virtual-finals.js +1 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.js +8 -26
- package/dist/lifecycle/lifecycle.d.ts +25 -3
- package/dist/lifecycle/lifecycle.js +92 -14
- package/dist/result/result-store.d.ts +0 -1
- package/dist/result/result-store.js +0 -1
- package/dist/templates/authoring.d.ts +222 -0
- package/dist/templates/authoring.js +2 -0
- package/dist/templates/builder/agent.d.ts +34 -0
- package/dist/templates/builder/agent.js +87 -0
- package/dist/templates/builder/blocks.d.ts +54 -0
- package/dist/templates/builder/blocks.js +92 -0
- package/dist/templates/builder/data-check.d.ts +2 -0
- package/dist/templates/builder/data-check.js +61 -0
- package/dist/templates/builder/draft.d.ts +73 -0
- package/dist/templates/builder/draft.js +142 -0
- package/dist/templates/builder/index.d.ts +8 -0
- package/dist/templates/builder/index.js +55 -0
- package/dist/templates/builder/presets.d.ts +34 -0
- package/dist/templates/builder/presets.js +45 -0
- package/dist/templates/builder/spec-of.d.ts +13 -0
- package/dist/templates/builder/spec-of.js +18 -0
- package/dist/templates/builder/steps.d.ts +25 -0
- package/dist/templates/builder/steps.js +27 -0
- package/dist/templates/business/adapter.d.ts +12 -0
- package/dist/templates/business/adapter.js +980 -0
- package/dist/templates/business/agent-integrations.d.ts +24 -0
- package/dist/templates/business/agent-integrations.js +233 -0
- package/dist/templates/business/extraction-rules-transcript.d.ts +158 -0
- package/dist/templates/business/extraction-rules-transcript.js +405 -0
- package/dist/templates/business/extraction-rules.d.ts +107 -0
- package/dist/templates/business/extraction-rules.js +267 -0
- package/dist/templates/business/index.d.ts +6 -0
- package/dist/{result → templates/business}/index.js +8 -2
- package/dist/templates/business/input.d.ts +56 -0
- package/dist/templates/business/input.js +299 -0
- package/dist/templates/business/integration-data.d.ts +87 -0
- package/dist/templates/business/integration-data.js +312 -0
- package/dist/templates/business/integrations.d.ts +76 -0
- package/dist/templates/business/integrations.js +535 -0
- package/dist/templates/business/legs-policy.d.ts +43 -0
- package/dist/templates/business/legs-policy.js +268 -0
- package/dist/templates/business/report-label.d.ts +7 -0
- package/dist/templates/business/report-label.js +29 -0
- package/dist/templates/business/report.d.ts +67 -0
- package/dist/templates/business/report.js +284 -0
- package/dist/templates/business/result-catalog.d.ts +142 -0
- package/dist/templates/business/result-catalog.js +208 -0
- package/dist/templates/business/result-rules.d.ts +105 -0
- package/dist/templates/business/result-rules.js +167 -0
- package/dist/templates/business/results.d.ts +73 -0
- package/dist/templates/business/results.js +183 -0
- package/dist/templates/business/rule-env.d.ts +18 -0
- package/dist/templates/business/rule-env.js +38 -0
- package/dist/templates/business/sources.d.ts +76 -0
- package/dist/templates/business/sources.js +239 -0
- package/dist/templates/business/test-presets.d.ts +10 -0
- package/dist/templates/business/test-presets.js +68 -0
- package/dist/templates/catalog-match/block.d.ts +32 -0
- package/dist/templates/catalog-match/block.js +95 -0
- package/dist/templates/catalog-match/catalog.d.ts +77 -0
- package/dist/templates/catalog-match/catalog.js +222 -0
- package/dist/templates/catalog-match/recognizer.d.ts +44 -0
- package/dist/templates/catalog-match/recognizer.js +206 -0
- package/dist/templates/catalog-match/reconcile.d.ts +4 -0
- package/dist/templates/catalog-match/reconcile.js +39 -0
- package/dist/templates/catalog-match/request.d.ts +57 -0
- package/dist/templates/catalog-match/request.js +139 -0
- package/dist/templates/catalog-match/types.d.ts +197 -0
- package/dist/templates/catalog-match/types.js +2 -0
- package/dist/templates/catalog-match/verify.d.ts +76 -0
- package/dist/templates/catalog-match/verify.js +220 -0
- package/dist/templates/decision-model/index.d.ts +52 -0
- package/dist/templates/decision-model/index.js +68 -0
- package/dist/templates/engine/asr-picks.d.ts +11 -0
- package/dist/templates/engine/asr-picks.js +44 -0
- package/dist/templates/engine/call.d.ts +104 -0
- package/dist/templates/engine/call.js +322 -0
- package/dist/templates/engine/config.d.ts +447 -0
- package/dist/templates/engine/config.js +493 -0
- package/dist/templates/engine/define.d.ts +1 -0
- package/dist/templates/engine/define.js +9 -0
- package/dist/templates/engine/dialog.d.ts +253 -0
- package/dist/templates/engine/dialog.js +167 -0
- package/dist/templates/engine/echo-numbers.d.ts +7 -0
- package/dist/templates/engine/echo-numbers.js +19 -0
- package/dist/templates/engine/expand.d.ts +6 -0
- package/dist/templates/engine/expand.js +125 -0
- package/dist/templates/engine/filters.d.ts +81 -0
- package/dist/templates/engine/filters.js +654 -0
- package/dist/templates/engine/hook-state.d.ts +18 -0
- package/dist/templates/engine/hook-state.js +100 -0
- package/dist/templates/engine/hooks.d.ts +51 -0
- package/dist/templates/engine/hooks.js +310 -0
- package/dist/templates/engine/index.d.ts +13 -0
- package/dist/templates/engine/index.js +30 -0
- package/dist/templates/engine/language-vars.d.ts +6 -0
- package/dist/templates/engine/language-vars.js +40 -0
- package/dist/templates/engine/language.d.ts +32 -0
- package/dist/templates/engine/language.js +155 -0
- package/dist/templates/engine/lookup.d.ts +20 -0
- package/dist/templates/engine/lookup.js +52 -0
- package/dist/templates/engine/match.d.ts +48 -0
- package/dist/templates/engine/match.js +253 -0
- package/dist/templates/engine/media.d.ts +428 -0
- package/dist/templates/engine/media.js +1240 -0
- package/dist/templates/engine/script.d.ts +11 -0
- package/dist/templates/engine/script.js +69 -0
- package/dist/templates/engine/turns/actions.d.ts +5 -0
- package/dist/templates/engine/turns/actions.js +128 -0
- package/dist/templates/engine/turns/carry.d.ts +15 -0
- package/dist/templates/engine/turns/carry.js +74 -0
- package/dist/templates/engine/turns/choices-offers.d.ts +21 -0
- package/dist/templates/engine/turns/choices-offers.js +143 -0
- package/dist/templates/engine/turns/choices.d.ts +22 -0
- package/dist/templates/engine/turns/choices.js +141 -0
- package/dist/templates/engine/turns/closing-guard.d.ts +73 -0
- package/dist/templates/engine/turns/closing-guard.js +162 -0
- package/dist/templates/engine/turns/closing.d.ts +10 -0
- package/dist/templates/engine/turns/closing.js +82 -0
- package/dist/templates/engine/turns/compile-forms.d.ts +24 -0
- package/dist/templates/engine/turns/compile-forms.js +68 -0
- package/dist/templates/engine/turns/context.d.ts +96 -0
- package/dist/templates/engine/turns/context.js +158 -0
- package/dist/templates/engine/turns/events.d.ts +409 -0
- package/dist/templates/engine/turns/events.js +5 -0
- package/dist/templates/engine/turns/hook-forms.d.ts +62 -0
- package/dist/templates/engine/turns/hook-forms.js +79 -0
- package/dist/templates/engine/turns/ladders.d.ts +42 -0
- package/dist/templates/engine/turns/ladders.js +119 -0
- package/dist/templates/engine/turns/language.d.ts +8 -0
- package/dist/templates/engine/turns/language.js +121 -0
- package/dist/templates/engine/turns/notes-dates.d.ts +9 -0
- package/dist/templates/engine/turns/notes-dates.js +42 -0
- package/dist/templates/engine/turns/notes-detect.d.ts +13 -0
- package/dist/templates/engine/turns/notes-detect.js +36 -0
- package/dist/templates/engine/turns/notes.d.ts +27 -0
- package/dist/templates/engine/turns/notes.js +176 -0
- package/dist/templates/engine/turns/opening.d.ts +34 -0
- package/dist/templates/engine/turns/opening.js +306 -0
- package/dist/templates/engine/turns/overtalk.d.ts +21 -0
- package/dist/templates/engine/turns/overtalk.js +247 -0
- package/dist/templates/engine/turns/pending.d.ts +9 -0
- package/dist/templates/engine/turns/pending.js +88 -0
- package/dist/templates/engine/turns/reply-rules.d.ts +184 -0
- package/dist/templates/engine/turns/reply-rules.js +335 -0
- package/dist/templates/engine/turns/rules.d.ts +20 -0
- package/dist/templates/engine/turns/rules.js +144 -0
- package/dist/templates/engine/turns/silence.d.ts +7 -0
- package/dist/templates/engine/turns/silence.js +127 -0
- package/dist/templates/engine/turns/state-spec.d.ts +305 -0
- package/dist/templates/engine/turns/state-spec.js +2 -0
- package/dist/templates/engine/turns/state.d.ts +38 -0
- package/dist/templates/engine/turns/state.js +101 -0
- package/dist/templates/engine/turns/tracking.d.ts +50 -0
- package/dist/templates/engine/turns/tracking.js +184 -0
- package/dist/templates/engine/turns/transfer.d.ts +19 -0
- package/dist/templates/engine/turns/transfer.js +93 -0
- package/dist/templates/engine/turns/turn.d.ts +17 -0
- package/dist/templates/engine/turns/turn.js +363 -0
- package/dist/templates/engine/turns/voicemail.d.ts +8 -0
- package/dist/templates/engine/turns/voicemail.js +101 -0
- package/dist/templates/engine/variants.d.ts +36 -0
- package/dist/templates/engine/variants.js +159 -0
- package/dist/templates/engine/voice-dialog.d.ts +24 -0
- package/dist/templates/engine/voice-dialog.js +157 -0
- package/dist/templates/engine/voice.d.ts +174 -0
- package/dist/templates/engine/voice.js +1337 -0
- package/dist/templates/expr/caller-after.d.ts +20 -0
- package/dist/templates/expr/caller-after.js +53 -0
- package/dist/templates/expr/check.d.ts +19 -0
- package/dist/templates/expr/check.js +314 -0
- package/dist/templates/expr/compiled.d.ts +8 -0
- package/dist/templates/expr/compiled.js +8 -0
- package/dist/templates/expr/context.d.ts +28 -0
- package/dist/templates/expr/context.js +55 -0
- package/dist/templates/expr/day-table.d.ts +4 -0
- package/dist/templates/expr/day-table.js +80 -0
- package/dist/templates/expr/evaluate.d.ts +26 -0
- package/dist/templates/expr/evaluate.js +885 -0
- package/dist/templates/expr/facts.d.ts +7 -0
- package/dist/templates/expr/facts.js +81 -0
- package/dist/templates/expr/index.d.ts +4 -0
- package/dist/templates/expr/index.js +11 -0
- package/dist/templates/expr/line-tally.d.ts +64 -0
- package/dist/templates/expr/line-tally.js +88 -0
- package/dist/templates/expr/matchers-state.d.ts +23 -0
- package/dist/templates/expr/matchers-state.js +37 -0
- package/dist/templates/expr/matchers.d.ts +12 -0
- package/dist/templates/expr/matchers.js +99 -0
- package/dist/templates/expr/readers.d.ts +14 -0
- package/dist/templates/expr/readers.js +351 -0
- package/dist/templates/expr/slots.d.ts +14 -0
- package/dist/templates/expr/slots.js +678 -0
- package/dist/templates/expr/template.d.ts +12 -0
- package/dist/templates/expr/template.js +76 -0
- package/dist/templates/expr/test-call.d.ts +8 -0
- package/dist/templates/expr/test-call.js +32 -0
- package/dist/templates/expr/transcript.d.ts +36 -0
- package/dist/templates/expr/transcript.js +394 -0
- package/dist/templates/expr/types.d.ts +1011 -0
- package/dist/templates/expr/types.js +2 -0
- package/dist/templates/expr/values.d.ts +42 -0
- package/dist/templates/expr/values.js +166 -0
- package/dist/templates/expr/voice-ops.d.ts +26 -0
- package/dist/templates/expr/voice-ops.js +85 -0
- package/dist/templates/helpers/decision.d.ts +55 -0
- package/dist/templates/helpers/decision.js +83 -0
- package/dist/templates/helpers/fuzzy.d.ts +9 -0
- package/dist/templates/helpers/fuzzy.js +44 -0
- package/dist/templates/helpers/index.d.ts +6 -0
- package/dist/templates/helpers/index.js +35 -0
- package/dist/templates/index.d.ts +9 -0
- package/dist/templates/index.js +68 -0
- package/dist/templates/integration-forms.d.ts +252 -0
- package/dist/templates/integration-forms.js +2 -0
- package/dist/templates/knowledge/block.d.ts +44 -0
- package/dist/templates/knowledge/block.js +199 -0
- package/dist/templates/knowledge/dense.d.ts +87 -0
- package/dist/templates/knowledge/dense.js +158 -0
- package/dist/templates/knowledge/flow.d.ts +328 -0
- package/dist/templates/knowledge/flow.js +509 -0
- package/dist/templates/knowledge/retriever.d.ts +75 -0
- package/dist/templates/knowledge/retriever.js +204 -0
- package/dist/templates/knowledge/service.d.ts +77 -0
- package/dist/templates/knowledge/service.js +316 -0
- package/dist/templates/knowledge/text.d.ts +31 -0
- package/dist/templates/knowledge/text.js +66 -0
- package/dist/templates/knowledge/types.d.ts +120 -0
- package/dist/templates/knowledge/types.js +2 -0
- package/dist/templates/locale.d.ts +259 -0
- package/dist/templates/locale.js +4 -0
- package/dist/templates/locales/en-lexicons.d.ts +9 -0
- package/dist/templates/locales/en-lexicons.js +101 -0
- package/dist/templates/locales/en.d.ts +132 -0
- package/dist/templates/locales/en.js +261 -0
- package/dist/templates/locales/es.d.ts +65 -0
- package/dist/templates/locales/es.js +208 -0
- package/dist/templates/locales/hi.d.ts +47 -0
- package/dist/templates/locales/hi.js +235 -0
- package/dist/templates/locales/id.d.ts +43 -0
- package/dist/templates/locales/id.js +127 -0
- package/dist/templates/locales/index.d.ts +34 -0
- package/dist/templates/locales/index.js +112 -0
- package/dist/templates/locales/kk-lexicons.d.ts +22 -0
- package/dist/templates/locales/kk-lexicons.js +89 -0
- package/dist/templates/locales/kk.d.ts +140 -0
- package/dist/templates/locales/kk.js +306 -0
- package/dist/templates/locales/kn.d.ts +29 -0
- package/dist/templates/locales/kn.js +22 -0
- package/dist/templates/locales/listen-only.d.ts +15 -0
- package/dist/templates/locales/listen-only.js +27 -0
- package/dist/templates/locales/ms-lexicons.d.ts +13 -0
- package/dist/templates/locales/ms-lexicons.js +113 -0
- package/dist/templates/locales/ms.d.ts +76 -0
- package/dist/templates/locales/ms.js +179 -0
- package/dist/templates/locales/parse.d.ts +86 -0
- package/dist/templates/locales/parse.js +461 -0
- package/dist/templates/locales/ru-lexicons.d.ts +27 -0
- package/dist/templates/locales/ru-lexicons.js +127 -0
- package/dist/templates/locales/ru-stem.d.ts +2 -0
- package/dist/templates/locales/ru-stem.js +53 -0
- package/dist/templates/locales/ru.d.ts +143 -0
- package/dist/templates/locales/ru.js +387 -0
- package/dist/templates/locales/shared.d.ts +122 -0
- package/dist/templates/locales/shared.js +318 -0
- package/dist/templates/locales/ta.d.ts +29 -0
- package/dist/templates/locales/ta.js +22 -0
- package/dist/templates/locales/te.d.ts +29 -0
- package/dist/templates/locales/te.js +22 -0
- package/dist/templates/locales/tl-lexicons.d.ts +2 -0
- package/dist/templates/locales/tl-lexicons.js +230 -0
- package/dist/templates/locales/tl.d.ts +59 -0
- package/dist/templates/locales/tl.js +82 -0
- package/dist/templates/locales/vi.d.ts +59 -0
- package/dist/templates/locales/vi.js +160 -0
- package/dist/templates/locales/word-regex.d.ts +13 -0
- package/dist/templates/locales/word-regex.js +43 -0
- package/dist/templates/locales/words-kk.d.ts +2 -0
- package/dist/templates/locales/words-kk.js +23 -0
- package/dist/templates/locales/words-ru.d.ts +4 -0
- package/dist/templates/locales/words-ru.js +92 -0
- package/dist/templates/spec.d.ts +2856 -0
- package/dist/templates/spec.js +2 -0
- package/dist/testing/fake-channel.d.ts +0 -1
- package/dist/testing/fake-channel.js +0 -1
- package/dist/testing/index.d.ts +24 -1
- package/dist/testing/index.js +117 -2
- package/dist/voice/call-voice.d.ts +581 -0
- package/dist/voice/call-voice.js +1399 -0
- package/dist/voice/intent-interrupt.d.ts +32 -0
- package/dist/voice/intent-interrupt.js +91 -0
- package/dist/voice/self-echo.d.ts +28 -0
- package/dist/voice/self-echo.js +135 -0
- package/dist/voice/sentence-tag.d.ts +5 -0
- package/dist/voice/sentence-tag.js +42 -0
- package/dist/voice/speech-leak.d.ts +74 -0
- package/dist/voice/speech-leak.js +216 -0
- package/dist/voice/transfer.d.ts +90 -0
- package/dist/voice/transfer.js +331 -0
- package/dist/voice/turn-timing.d.ts +293 -0
- package/dist/voice/turn-timing.js +567 -0
- package/docs/README.md +3 -6
- package/docs/framework/README.md +6 -10
- package/docs/framework/architecture.md +2 -2
- package/docs/framework/container-and-di.md +1 -2
- package/docs/framework/invariants.md +6 -6
- package/docs/framework/package-layout.md +16 -23
- package/docs/framework/testing.md +8 -6
- package/package.json +10 -54
- package/skill/SKILL.md +213 -0
- package/skill/references/agent-file.md +230 -0
- package/skill/references/blocks.md +246 -0
- package/skill/references/builder.md +163 -0
- package/skill/references/business.md +659 -0
- package/skill/references/conversation.md +586 -0
- package/skill/references/core.md +89 -0
- package/skill/references/examples.md +73 -0
- package/skill/references/expressions.md +342 -0
- package/skill/references/format.md +114 -0
- package/skill/references/locales.md +149 -0
- package/skill/references/migration.md +133 -0
- package/skill/references/new-agent.md +81 -0
- package/skill/references/porting.md +109 -0
- package/templates/agent/README.md +50 -0
- package/templates/agent/package.json +24 -0
- package/templates/agent/src/agent.spec.ts +51 -0
- package/templates/agent/src/agent.ts +268 -0
- package/templates/agent/src/entities.ts +44 -0
- package/templates/agent/src/prompt.sqrl +21 -0
- package/templates/agent/src/variants/fixed-opening.ts +144 -0
- package/templates/agent/tsconfig.build.json +4 -0
- package/templates/agent/tsconfig.json +18 -0
- package/dist/asr/index.d.ts +0 -3
- package/dist/asr/index.d.ts.map +0 -1
- package/dist/asr/index.js +0 -6
- package/dist/asr/index.js.map +0 -1
- package/dist/barge-in/barge-in-module.d.ts.map +0 -1
- package/dist/barge-in/barge-in-module.js.map +0 -1
- package/dist/barge-in/barge-in-service.d.ts.map +0 -1
- package/dist/barge-in/barge-in-service.js.map +0 -1
- package/dist/barge-in/barge-in-strategy.d.ts.map +0 -1
- package/dist/barge-in/barge-in-strategy.js.map +0 -1
- package/dist/barge-in/echo-cancellation.d.ts.map +0 -1
- package/dist/barge-in/echo-cancellation.js.map +0 -1
- package/dist/barge-in/echo.d.ts.map +0 -1
- package/dist/barge-in/echo.js.map +0 -1
- package/dist/barge-in/index.d.ts +0 -13
- package/dist/barge-in/index.d.ts.map +0 -1
- package/dist/barge-in/index.js +0 -28
- package/dist/barge-in/index.js.map +0 -1
- package/dist/barge-in/lexicon.d.ts.map +0 -1
- package/dist/barge-in/lexicon.js.map +0 -1
- package/dist/barge-in/lexicons/en.d.ts +0 -2
- package/dist/barge-in/lexicons/en.d.ts.map +0 -1
- package/dist/barge-in/lexicons/en.js +0 -36
- package/dist/barge-in/lexicons/en.js.map +0 -1
- package/dist/barge-in/lexicons/id.d.ts +0 -2
- package/dist/barge-in/lexicons/id.d.ts.map +0 -1
- package/dist/barge-in/lexicons/id.js +0 -39
- package/dist/barge-in/lexicons/id.js.map +0 -1
- package/dist/barge-in/lexicons/index.d.ts +0 -10
- package/dist/barge-in/lexicons/index.d.ts.map +0 -1
- package/dist/barge-in/lexicons/index.js +0 -11
- package/dist/barge-in/lexicons/index.js.map +0 -1
- package/dist/barge-in/lexicons/ru.d.ts +0 -2
- package/dist/barge-in/lexicons/ru.d.ts.map +0 -1
- package/dist/barge-in/lexicons/ru.js +0 -39
- package/dist/barge-in/lexicons/ru.js.map +0 -1
- package/dist/barge-in/speech-ledger.d.ts.map +0 -1
- package/dist/barge-in/speech-ledger.js.map +0 -1
- package/dist/barge-in/word-classifier.d.ts.map +0 -1
- package/dist/barge-in/word-classifier.js.map +0 -1
- package/dist/bridge/bridge.d.ts +0 -28
- package/dist/bridge/bridge.d.ts.map +0 -1
- package/dist/bridge/bridge.js +0 -117
- package/dist/bridge/bridge.js.map +0 -1
- package/dist/bridge/index.d.ts +0 -3
- package/dist/bridge/index.d.ts.map +0 -1
- package/dist/bridge/index.js +0 -8
- package/dist/bridge/index.js.map +0 -1
- package/dist/core/call-disposables.d.ts.map +0 -1
- package/dist/core/call-disposables.js.map +0 -1
- package/dist/core/container.d.ts.map +0 -1
- package/dist/core/container.js.map +0 -1
- package/dist/core/create-agent-script.d.ts.map +0 -1
- package/dist/core/create-agent-script.js.map +0 -1
- package/dist/core/decorators.d.ts.map +0 -1
- package/dist/core/decorators.js.map +0 -1
- package/dist/core/define-module.d.ts.map +0 -1
- package/dist/core/define-module.js.map +0 -1
- package/dist/core/dump-policy.d.ts.map +0 -1
- package/dist/core/dump-policy.js.map +0 -1
- package/dist/core/hooks.d.ts.map +0 -1
- package/dist/core/hooks.js.map +0 -1
- package/dist/core/index.d.ts +0 -16
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -36
- package/dist/core/index.js.map +0 -1
- package/dist/core/media-bootstrap.d.ts.map +0 -1
- package/dist/core/media-bootstrap.js.map +0 -1
- package/dist/core/provide-media.d.ts.map +0 -1
- package/dist/core/provide-media.js.map +0 -1
- package/dist/core/tokens.d.ts.map +0 -1
- package/dist/core/tokens.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js.map +0 -1
- package/dist/core/version.d.ts.map +0 -1
- package/dist/core/version.js.map +0 -1
- package/dist/dialog/basic-ports.d.ts +0 -54
- package/dist/dialog/basic-ports.d.ts.map +0 -1
- package/dist/dialog/basic-ports.js +0 -206
- package/dist/dialog/basic-ports.js.map +0 -1
- package/dist/dialog/define-dialog.d.ts +0 -21
- package/dist/dialog/define-dialog.d.ts.map +0 -1
- package/dist/dialog/define-dialog.js +0 -21
- package/dist/dialog/define-dialog.js.map +0 -1
- package/dist/dialog/dialog-definition.d.ts.map +0 -1
- package/dist/dialog/dialog-definition.js.map +0 -1
- package/dist/dialog/dialog-ports.d.ts.map +0 -1
- package/dist/dialog/dialog-ports.js.map +0 -1
- package/dist/dialog/index.d.ts +0 -7
- package/dist/dialog/index.d.ts.map +0 -1
- package/dist/dialog/index.js +0 -23
- package/dist/dialog/index.js.map +0 -1
- package/dist/dialog/online-call-host.d.ts.map +0 -1
- package/dist/dialog/online-call-host.js.map +0 -1
- package/dist/dialog/online-call-module.d.ts.map +0 -1
- package/dist/dialog/online-call-module.js.map +0 -1
- package/dist/dialog-events/active-media.d.ts.map +0 -1
- package/dist/dialog-events/active-media.js.map +0 -1
- package/dist/dialog-events/event-source.d.ts.map +0 -1
- package/dist/dialog-events/event-source.js.map +0 -1
- package/dist/dialog-events/index.d.ts +0 -8
- package/dist/dialog-events/index.d.ts.map +0 -1
- package/dist/dialog-events/index.js +0 -24
- package/dist/dialog-events/index.js.map +0 -1
- package/dist/dialog-events/max-listen-source.d.ts +0 -27
- package/dist/dialog-events/max-listen-source.d.ts.map +0 -1
- package/dist/dialog-events/max-listen-source.js +0 -98
- package/dist/dialog-events/max-listen-source.js.map +0 -1
- package/dist/dialog-events/overtalk-source.d.ts +0 -61
- package/dist/dialog-events/overtalk-source.d.ts.map +0 -1
- package/dist/dialog-events/overtalk-source.js +0 -232
- package/dist/dialog-events/overtalk-source.js.map +0 -1
- package/dist/dialog-events/silence-source.d.ts +0 -32
- package/dist/dialog-events/silence-source.d.ts.map +0 -1
- package/dist/dialog-events/silence-source.js +0 -128
- package/dist/dialog-events/silence-source.js.map +0 -1
- package/dist/dialog-events/virtual-finals-module.d.ts.map +0 -1
- package/dist/dialog-events/virtual-finals-module.js.map +0 -1
- package/dist/dialog-events/virtual-finals.d.ts.map +0 -1
- package/dist/dialog-events/virtual-finals.js.map +0 -1
- package/dist/dtmf/dtmf.d.ts +0 -27
- package/dist/dtmf/dtmf.d.ts.map +0 -1
- package/dist/dtmf/dtmf.js +0 -87
- package/dist/dtmf/dtmf.js.map +0 -1
- package/dist/dtmf/index.d.ts +0 -3
- package/dist/dtmf/index.d.ts.map +0 -1
- package/dist/dtmf/index.js +0 -8
- package/dist/dtmf/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lifecycle/index.d.ts +0 -3
- package/dist/lifecycle/index.d.ts.map +0 -1
- package/dist/lifecycle/index.js +0 -9
- package/dist/lifecycle/index.js.map +0 -1
- package/dist/lifecycle/lifecycle.d.ts.map +0 -1
- package/dist/lifecycle/lifecycle.js.map +0 -1
- package/dist/llm/index.d.ts +0 -7
- package/dist/llm/index.d.ts.map +0 -1
- package/dist/llm/index.js +0 -18
- package/dist/llm/index.js.map +0 -1
- package/dist/llm/llm-markers-module.d.ts +0 -15
- package/dist/llm/llm-markers-module.d.ts.map +0 -1
- package/dist/llm/llm-markers-module.js +0 -48
- package/dist/llm/llm-markers-module.js.map +0 -1
- package/dist/llm/llm-markers.d.ts +0 -36
- package/dist/llm/llm-markers.d.ts.map +0 -1
- package/dist/llm/llm-markers.js +0 -210
- package/dist/llm/llm-markers.js.map +0 -1
- package/dist/llm/llm-module.d.ts +0 -20
- package/dist/llm/llm-module.d.ts.map +0 -1
- package/dist/llm/llm-module.js.map +0 -1
- package/dist/match/index.d.ts +0 -3
- package/dist/match/index.d.ts.map +0 -1
- package/dist/match/index.js +0 -10
- package/dist/match/index.js.map +0 -1
- package/dist/match/match.d.ts +0 -33
- package/dist/match/match.d.ts.map +0 -1
- package/dist/match/match.js +0 -85
- package/dist/match/match.js.map +0 -1
- package/dist/outbound/index.d.ts +0 -3
- package/dist/outbound/index.d.ts.map +0 -1
- package/dist/outbound/index.js +0 -8
- package/dist/outbound/index.js.map +0 -1
- package/dist/outbound/outbound.d.ts +0 -40
- package/dist/outbound/outbound.d.ts.map +0 -1
- package/dist/outbound/outbound.js +0 -84
- package/dist/outbound/outbound.js.map +0 -1
- package/dist/result/index.d.ts +0 -2
- package/dist/result/index.d.ts.map +0 -1
- package/dist/result/index.js.map +0 -1
- package/dist/result/result-store.d.ts.map +0 -1
- package/dist/result/result-store.js.map +0 -1
- package/dist/testing/fake-channel.d.ts.map +0 -1
- package/dist/testing/fake-channel.js.map +0 -1
- package/dist/testing/index.d.ts.map +0 -1
- package/dist/testing/index.js.map +0 -1
- package/docs/agents/README.md +0 -41
- package/docs/agents/barge-in.md +0 -67
- package/docs/agents/dialog.md +0 -98
- package/docs/agents/getting-started.md +0 -142
- package/docs/agents/imports.md +0 -40
- package/docs/agents/media-and-ports.md +0 -82
- package/docs/agents/modules.md +0 -83
- package/docs/agents/phases.md +0 -83
- package/docs/framework/extending.md +0 -59
- package/docs/framework/idn-parity.md +0 -18
- package/examples/minimal-agent/README.md +0 -7
- package/examples/minimal-agent/agent.ts +0 -94
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Tagalog / Taglish word patterns of the `tl` pack: what Philippine callers and carriers say, copied word for word from
|
|
3
|
+
// the agents that first needed them (golden tests in `__golden__/` compare each with its original). English words
|
|
4
|
+
// are part of them: callers mix both languages in one line.
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TL_PATTERNS = void 0;
|
|
7
|
+
/** Fillers that may stand around a caller question («Ay hello, saan po ito?»). */
|
|
8
|
+
const QUESTION_FILLER = String.raw `(?:ah|ay|eh|oh|uh|um|hello|hindi|teka|sandali|ma'?am|sir|po)`;
|
|
9
|
+
/** Regular expressions of the `tl` pack by lexicon name. */
|
|
10
|
+
exports.TL_PATTERNS = {
|
|
11
|
+
/** «Wait / stop / say that again» said over the agent, English and Tagalog. */
|
|
12
|
+
interrupt: [
|
|
13
|
+
/\bwait\b/i,
|
|
14
|
+
/\bhold on\b/i,
|
|
15
|
+
/\bhold up\b/i,
|
|
16
|
+
/\bhang on\b/i,
|
|
17
|
+
/\bstop\b/i,
|
|
18
|
+
/\bone (?:moment|sec(?:ond)?)\b/i,
|
|
19
|
+
/\bjust a (?:moment|sec(?:ond)?|minute)\b/i,
|
|
20
|
+
/\bexcuse me\b/i,
|
|
21
|
+
/\brepeat\b/i,
|
|
22
|
+
/\bsandali\b/i,
|
|
23
|
+
/\bsaglit\b/i,
|
|
24
|
+
/\bteka\b/i,
|
|
25
|
+
/\b(?:mag)?hintay\b/i,
|
|
26
|
+
/\b(?:mag-?)?antay\b/i,
|
|
27
|
+
/\b(?:hu)?wag muna\b/i,
|
|
28
|
+
/\btigil\b/i,
|
|
29
|
+
/\bulitin\b/i,
|
|
30
|
+
/\bpaki-?ulit\b/i,
|
|
31
|
+
/\bano (?:po )?ulit\b/i,
|
|
32
|
+
],
|
|
33
|
+
/** Only «wait / stop» said over the agent, English and Tagalog (no «repeat»). */
|
|
34
|
+
interruptWait: [
|
|
35
|
+
/\bwait\b/i,
|
|
36
|
+
/\bhold on\b/i,
|
|
37
|
+
/\bhang on\b/i,
|
|
38
|
+
/\bstop\b/i,
|
|
39
|
+
/\bone (?:moment|sec(?:ond)?)\b/i,
|
|
40
|
+
/\bexcuse me\b/i,
|
|
41
|
+
/\bsandali\b/i,
|
|
42
|
+
/\bsaglit\b/i,
|
|
43
|
+
/\bteka\b/i,
|
|
44
|
+
/\bhintay\b/i,
|
|
45
|
+
],
|
|
46
|
+
/** A line of fillers only («Hm.», «Ah.», «Speech.» — the recognizer's word for noise). */
|
|
47
|
+
filler: [/^(?:[\s.,!?]*(?:[mh]+|u+h+m*|u+m+h*|er+|uhm+|huh+|hah+|a+h+|e+h+|o+h+|a+y+|speech))+[\s.,!?]*$/i],
|
|
48
|
+
/** A line made only of digits and digit words (English and Tagalog), said one by one. */
|
|
49
|
+
digits: [/^[\s.,-]*(?:(?:\d+|zero|nought|oh|o|one|two|three|four|five|six|seven|eight|nine|sero|isa|dalawa|tatlo|apat|lima|anim|pito|walo|siyam)[\s.,-]*)+$/i],
|
|
50
|
+
/** As `digits`, with «sampu» (ten). */
|
|
51
|
+
numberDictation: [/^[\s.,-]*(?:(?:\d+|zero|nought|oh|o|one|two|three|four|five|six|seven|eight|nine|sero|isa|dalawa|tatlo|apat|lima|anim|pito|walo|siyam|sampu)[\s.,-]*)+$/i],
|
|
52
|
+
/** A contentless «hello? hello po?» prod, tested on the normalized line with spaces removed. */
|
|
53
|
+
liveness: [/^(?:hello|helo|hallo|halo|hi|hey|uy|oy|hoy)+(?:po)?$/i],
|
|
54
|
+
/** A yes word. */
|
|
55
|
+
yes: [/\b(?:opo|oo|yes|yeah|yep|yup|sige|okay|oke|ok)\b/i],
|
|
56
|
+
/** A whole line that is only a yes and fillers. */
|
|
57
|
+
onlyYes: [/^\s*(?:(?:opo|oo|yes|yeah|yep|yup|sige|okay|oke|ok|po|ah|eh|oh|uh|um|ma'?am|sir)[\s.,!?]*)+$/i],
|
|
58
|
+
/** A yes or «that's right» in a reply to a summary. */
|
|
59
|
+
yesRight: [/\b(?:opo|oo|yes|yeah|yep|sige|okay|oke|ok|tama|ayos|sure)\b/i],
|
|
60
|
+
/** A no or «that's wrong» in a reply to a summary. */
|
|
61
|
+
no: [/\b(?:hindi|di|no|not|mali|ayaw|ayoko|wag|huwag)\b/i],
|
|
62
|
+
/** «Wala» — nothing is wrong (after «what is not right?»). */
|
|
63
|
+
nothingWrong: [/\bwala\b/i],
|
|
64
|
+
/** A whole line that is only «oo». */
|
|
65
|
+
onlyOo: [/^\s*(?:oo[\s.,!?]*)+$/i],
|
|
66
|
+
/** A whole line that is only «oo po». */
|
|
67
|
+
onlyOoPo: [/^\s*(?:oo[\s.,!?]*)+po[\s.,!?]*$/i],
|
|
68
|
+
/** A word agreeing to pay. */
|
|
69
|
+
agree: [/\b(?:opo|oo|yes|yeah|yep|yup|sige|okay|oke|ok|sure|kaya|pwede|puwede|babayaran|magbabayad)\b/i],
|
|
70
|
+
/** A whole line that only agrees to pay. */
|
|
71
|
+
onlyAgree: [/^\s*(?:(?:opo|oo|yes|yeah|yep|yup|sige|okay|oke|ok|sure|kaya|pwede|puwede|babayaran|magbabayad|ko|ako|na|lang|naman|po|ah|eh|oh|uh|um|ma'?am|sir)[\s.,!?]*)+$/i],
|
|
72
|
+
/** An affirmative word (a bare «oo» is not one: noise is written so). */
|
|
73
|
+
affirmative: [/\b(?:opo|oo\s+nga|yes|yeah|yep|yun|iyon|sige|tama|okay|oke|ok)\b/i],
|
|
74
|
+
/** A whole line of affirmative words and fillers. */
|
|
75
|
+
onlyAffirmative: [/^(?:\s*(?:opo|oo\s+nga|yes|yeah|yep|yun|iyon|sige|tama|okay|oke|ok|po|na|lang|yan|iyan|ah|oh|eh|uh|um|hmm?|ay|ma'?am|sir)\b[\s.,!?]*)+$/i],
|
|
76
|
+
/** A whole line that is only a farewell word («Bye.», «Ah bye po»). */
|
|
77
|
+
onlyBye: [/^\s*(?:(?:ah|oh|uh|eh|ay)[\s.,!?]+)?(?:bye|babay)(?:[\s.,!?]+(?:bye|babay))*(?:[\s.,!?]+po)?[\s.,!?]*$/i],
|
|
78
|
+
/** A bare «Saan po?». */
|
|
79
|
+
onlyWhere: [/^\s*saan(?:\s+po)?[\s.,!?]*$/i],
|
|
80
|
+
/** A whole line asking who is calling, where the call is from or what it is about (Tagalog and English). */
|
|
81
|
+
askWhoCalls: [
|
|
82
|
+
new RegExp(String.raw `^\s*(?:${QUESTION_FILLER}[\s.,!?]+)*` +
|
|
83
|
+
String.raw `(?:saan(?: po)?(?: ba)?(?: (?:ito|to|'to|iyan|yan|yun|iyon|kayo|kayo galing|galing(?: ito| to| 'to)?|po ito|po kayo))?` +
|
|
84
|
+
String.raw `|taga[- ]?saan(?: po)? kayo` +
|
|
85
|
+
String.raw `|sino(?: po)?(?: ba)? (?:ito|to|'to|sila|kayo|yan|iyan)` +
|
|
86
|
+
String.raw `|ano(?: nga)?(?: po)?(?: ba)? (?:ito|to|'to|itong ano|iyan|yan)` +
|
|
87
|
+
String.raw `|(?:para|tungkol) saan(?: po)?(?: ba)? (?:ito|to|'to|yan|iyan)` +
|
|
88
|
+
String.raw `|who(?: is|'s) (?:this|calling)` +
|
|
89
|
+
String.raw `|where (?:are you calling from|are you from|is this from|is this call from)` +
|
|
90
|
+
String.raw `|what is this(?: about| for| call)?)` +
|
|
91
|
+
String.raw `(?:[\s.,!?]+${QUESTION_FILLER})*[\s.,!?]*$`, 'i'),
|
|
92
|
+
],
|
|
93
|
+
/** Words for today, later today, tonight. */
|
|
94
|
+
today: [/\b(?:today|mamaya|tonight)\b/i],
|
|
95
|
+
/** Question words (when, what, why, how much, how). */
|
|
96
|
+
questionWord: [/\b(?:kailan|ano|bakit|magkano|paano|when|what)\b/i],
|
|
97
|
+
/** A curse or an insult, Tagalog or English. */
|
|
98
|
+
profanity: [
|
|
99
|
+
new RegExp(String.raw `\b(?:` +
|
|
100
|
+
[
|
|
101
|
+
String.raw `putang ?ina`,
|
|
102
|
+
String.raw `tang ?ina`,
|
|
103
|
+
String.raw `tangna`,
|
|
104
|
+
String.raw `king ?ina`,
|
|
105
|
+
String.raw `puta`,
|
|
106
|
+
String.raw `pota`,
|
|
107
|
+
String.raw `punyeta`,
|
|
108
|
+
String.raw `gago`,
|
|
109
|
+
String.raw `gaga`,
|
|
110
|
+
String.raw `ulol`,
|
|
111
|
+
String.raw `ulul`,
|
|
112
|
+
String.raw `tarantado`,
|
|
113
|
+
String.raw `tarantada`,
|
|
114
|
+
String.raw `bobo`,
|
|
115
|
+
String.raw `tanga`,
|
|
116
|
+
String.raw `inutil`,
|
|
117
|
+
String.raw `leche`,
|
|
118
|
+
String.raw `lintik`,
|
|
119
|
+
String.raw `hayop ka`,
|
|
120
|
+
String.raw `walang ?hiya`,
|
|
121
|
+
String.raw `bu?wisit`,
|
|
122
|
+
String.raw `kupal`,
|
|
123
|
+
String.raw `hinayupak`,
|
|
124
|
+
String.raw `pakyu`,
|
|
125
|
+
String.raw `fuck\w*`,
|
|
126
|
+
String.raw `shit`,
|
|
127
|
+
String.raw `bullshit`,
|
|
128
|
+
String.raw `asshole`,
|
|
129
|
+
String.raw `bitch`,
|
|
130
|
+
String.raw `stupid`,
|
|
131
|
+
String.raw `idiot`,
|
|
132
|
+
String.raw `loko ka`,
|
|
133
|
+
String.raw `baliw ka`,
|
|
134
|
+
String.raw `sira ?ulo`,
|
|
135
|
+
].join('|') +
|
|
136
|
+
String.raw `)\b`, 'i'),
|
|
137
|
+
],
|
|
138
|
+
/** Someone already called about it / we already talked. */
|
|
139
|
+
alreadyCalled: [
|
|
140
|
+
new RegExp(String.raw `\b(?:` +
|
|
141
|
+
[
|
|
142
|
+
String.raw `may tumawag na`,
|
|
143
|
+
String.raw `tumawag (?:na (?:po )?(?:kayo|ka|sila)|(?:kayo|ka|sila) na)`,
|
|
144
|
+
String.raw `tinawagan (?:na (?:po )?|(?:ninyo|n'?yo|nila) na (?:po )?)(?:ako|kami)`,
|
|
145
|
+
String.raw `ka(?:ka|ta)tawag (?:pa )?lang`,
|
|
146
|
+
String.raw `nag[- ]?usap na (?:po )?(?:kami|tayo)`,
|
|
147
|
+
String.raw `nakausap ko na`,
|
|
148
|
+
String.raw `kausap ko na`,
|
|
149
|
+
String.raw `may (?:na)?kausap na (?:po )?ako(?:ng)?`,
|
|
150
|
+
String.raw `already called`,
|
|
151
|
+
String.raw `called (?:me|us) (?:already|earlier|kanina)`,
|
|
152
|
+
]
|
|
153
|
+
.join('|')
|
|
154
|
+
.replace(/ /g, String.raw `\s+`) +
|
|
155
|
+
String.raw `)\b`, 'i'),
|
|
156
|
+
],
|
|
157
|
+
/** The payment is already made. */
|
|
158
|
+
saysPaid: [/\b(?:bayad na|nagbayad|nakabayad|binayaran|nabayaran|paid)\b/i],
|
|
159
|
+
/** A request to stop the calls (the word alone). */
|
|
160
|
+
stop: [/\b(?:huwag|wag|stop|don'?t|do not)\b/i],
|
|
161
|
+
/** A no or a cannot in a line. */
|
|
162
|
+
noOrCannot: [/\b(?:hindi|di|wala|walang|ayaw|ayoko|no|not|never|can'?t|cannot|won'?t)\b/i],
|
|
163
|
+
/** Carrier voicemail and IVR prompts of Philippine carriers (English, as they speak it) and their recognizer forms. */
|
|
164
|
+
voicemail: [
|
|
165
|
+
/(\s|^)voicemail(\s|$)/i,
|
|
166
|
+
/(\s|^)voice(\s|)mail(\s|$)/i,
|
|
167
|
+
/(\s|^)(voice|leave\sa|audio)(\sshort)?\smessage/i,
|
|
168
|
+
/mail(\s|ing\s)box(\s|$)/i,
|
|
169
|
+
/(\s|^)voice\smail(\s|$)/i,
|
|
170
|
+
/(\s|^)not\savailable\sat\sthe\smoment(\s|$)/i,
|
|
171
|
+
/(?=.*((not\s|un)available))(?=.*(message|record|subscriber))/i,
|
|
172
|
+
/(?=.*((not\s|un)available))(?=.*subscriber)/i,
|
|
173
|
+
/(\s|^)(can\s?t|can\s?not)\sbe\sreached/i,
|
|
174
|
+
/(?=.*(cannot))(?=.*completed)/i,
|
|
175
|
+
/(\s|^)no\slonger\sin\sservice(\s|$)/i,
|
|
176
|
+
/(\s|^)not\sin\sservice(\s|$)/i,
|
|
177
|
+
/(?=.*number)(?=.*trying\sto\sreach)/i,
|
|
178
|
+
/(\s|^)number.{3,8}calling/i,
|
|
179
|
+
/(\s|^)(record|leave)\s(the|your)\smessage/i,
|
|
180
|
+
/(\s|^)leave.{1,7}(name|number|message)/i,
|
|
181
|
+
/(\s|^)leave\b.{0,20}\bmessage(\s|$)/i,
|
|
182
|
+
/(\s|^)send(\s|\sme\s)a?\s(message|text)/i,
|
|
183
|
+
/(\s|^)please\srecord\syour\smessage(\s|$)/i,
|
|
184
|
+
/(\s|^)(have\sfinished\srecording)(\s|$)/i,
|
|
185
|
+
/(\s|^)finished\srecording(\s|$)/i,
|
|
186
|
+
/(\s|^)(finished|finish)\s(recording|recalling)(\s|$)/i,
|
|
187
|
+
/(\s|^)recording\syou\smight\shelp(\s|$)/i,
|
|
188
|
+
/(?=.*\bpress\b)(?=.*\bto\b)/i,
|
|
189
|
+
/press\s(0|zero|1|one|2|two|3|three|4|four|5|five|6|six|7|seven|8|eight|9|nine)/i,
|
|
190
|
+
/press\s(1|0|2|3|4|5|6|7|8|9)/i,
|
|
191
|
+
/(\s|^)welcome\sto/i,
|
|
192
|
+
/(?=.*(mail|voice|after))(?=.*(service|assistant|tone))/i,
|
|
193
|
+
/(\s|^)at\sthe\stone(\s|$)/i,
|
|
194
|
+
/(\s|^)after\sthe\s(tone|beep)(\s|$)/i,
|
|
195
|
+
/(\s|^)switched\soff(\s|$)/i,
|
|
196
|
+
/(\s|^)switched\soff\sor\sout\sof\scoverage(\s|$)/i,
|
|
197
|
+
/(\s|^)not\sallowed\sto\suse(\s|$)/i,
|
|
198
|
+
/(\s|^)(number\syou\shave\sdialed\sis\snow\san\sattended)(\s|$)/i,
|
|
199
|
+
/(\s|^)(forward\srequest)(\s|$)/i,
|
|
200
|
+
/(\s|^)(forwarded|forward)\b.*(voicemail|voice\smail)(\s|$)/i,
|
|
201
|
+
/(\s|^)has\sbeen\sforwarded(\s|$)/i,
|
|
202
|
+
/(\s|^)(may|my)\s(hangop|hangup|hang\sup|high\sup|hay\sup|hand\sup)(\s|$)/i,
|
|
203
|
+
/(\s|^)may\shang\sup(\s|$)/i,
|
|
204
|
+
/(\s|^)(my)\s(hand\sup)(\s|$)/i,
|
|
205
|
+
/(\s|^)(have)\s(finished)(\s|$)/i,
|
|
206
|
+
/(\s|^)(reach)\b.*(unavailable)(\s|$)/i,
|
|
207
|
+
],
|
|
208
|
+
/** Full carrier prompts of Philippine carriers in English and Tagalog: a live caller's short reply never matches. */
|
|
209
|
+
carrierVoicemail: [
|
|
210
|
+
/\b(number|subscriber)\s+(you\s+(have\s+)?(dialed|called|are\s+calling))\b/i,
|
|
211
|
+
/\b(cannot|can\s*not|could\s+not)\s+be\s+(reached|completed)\b/i,
|
|
212
|
+
/\b(unattended|out\s+of\s+(the\s+)?coverage(\s+area)?)\b/i,
|
|
213
|
+
/\b(switched\s+off|not\s+in\s+service)\b/i,
|
|
214
|
+
/\bplease\s+try\s+(your\s+call\s+)?(again\s+)?later\b/i,
|
|
215
|
+
/\bleave\s+(a|your)\s+(message|voice\s*mail)\b/i,
|
|
216
|
+
/\bafter\s+the\s+(tone|beep)\b/i,
|
|
217
|
+
/\bvoice\s*mail\b/i,
|
|
218
|
+
/\bmailbox\b/i,
|
|
219
|
+
/\bthe\s+person\s+you\s+are\s+calling\b/i,
|
|
220
|
+
/\bpress\s+(one|two|zero|\d)\b/i,
|
|
221
|
+
/\bang\s+(numero|subscriber)\s+(na\s+)?(iyong|inyong|yong)\s+(tinawagan|tinatawagan|dinial)\b/i,
|
|
222
|
+
/\b(hindi|di)\s+(ma[\s-]?)?(contact|kontak|tawagan|maabot)\b/i,
|
|
223
|
+
/\b(nakapatay|naka[\s-]?off)\b.*\b(labas|saklaw|coverage)\b/i,
|
|
224
|
+
/\bnasa\s+labas\s+(ng\s+)?(saklaw|sakop|coverage)\b/i,
|
|
225
|
+
/\bmag[\s-]?iwan\s+(ng\s+)?(mensahe|message)\b/i,
|
|
226
|
+
/\bpagkatapos\s+(ng|ng\s+tunog\s+ng)\s+(beep|tono|tunog)\b/i,
|
|
227
|
+
/\b(subukan|subukang)\s+(muling\s+)?tumawag\s+(muli\s+)?(mamaya|sa\s+ibang\s+pagkakataon)\b/i,
|
|
228
|
+
/\bkasalukuyang\s+(abala|nakapatay|hindi\s+available)\b/i,
|
|
229
|
+
],
|
|
230
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { NameOptions } from '../locale';
|
|
2
|
+
import { enDate, type EnAmountOptions } from './en';
|
|
3
|
+
export declare const TL_MONTHS: readonly ["Enero", "Pebrero", "Marso", "Abril", "Mayo", "Hunyo", "Hulyo", "Agosto", "Setyembre", "Oktubre", "Nobyembre", "Disyembre"];
|
|
4
|
+
/** Weekday names, Sunday first (index = `Date#getUTCDay()`). */
|
|
5
|
+
export declare const TL_WEEKDAYS: readonly ["Linggo", "Lunes", "Martes", "Miyerkules", "Huwebes", "Biyernes", "Sabado"];
|
|
6
|
+
/**
|
|
7
|
+
* Spellings a speech engine writes for each weekday, Sunday first. Sunday is empty on purpose: «linggo» is also the
|
|
8
|
+
* word for "week".
|
|
9
|
+
*/
|
|
10
|
+
export declare const TL_WEEKDAY_HEARD: readonly (readonly string[])[];
|
|
11
|
+
/** English number words and English + Tagalog day words. */
|
|
12
|
+
export declare const tlParse: import("../locale").LocaleParse;
|
|
13
|
+
export declare const tlFormat: {
|
|
14
|
+
number: (n: number, opts?: import("./en").EnNumberOptions | undefined) => string;
|
|
15
|
+
/** English words, default currency PHP: «five thousand two hundred fifty pesos and fifty centavos». */
|
|
16
|
+
amount: (n: number | string, currency?: string | undefined, opts?: EnAmountOptions) => string;
|
|
17
|
+
/** English dates («sixth of July»), as callers say them. */
|
|
18
|
+
date: typeof enDate;
|
|
19
|
+
ordinal: (n: number) => string;
|
|
20
|
+
/** «one day» / «five days» in English words, as `en`. */
|
|
21
|
+
count: (n: number, forms: readonly string[], opts?: import("./en").EnNumberOptions | undefined) => string;
|
|
22
|
+
months: readonly ["Enero", "Pebrero", "Marso", "Abril", "Mayo", "Hunyo", "Hulyo", "Agosto", "Setyembre", "Oktubre", "Nobyembre", "Disyembre"];
|
|
23
|
+
weekdays: readonly ["Linggo", "Lunes", "Martes", "Miyerkules", "Huwebes", "Biyernes", "Sabado"];
|
|
24
|
+
/** URL-decoded, punctuation removed (`opts.punctuation: 'space'`: a space), each word capitalized. */
|
|
25
|
+
name: (raw: string, _kase?: string, opts?: NameOptions) => string;
|
|
26
|
+
};
|
|
27
|
+
export declare const tl: {
|
|
28
|
+
code: "tl";
|
|
29
|
+
script: "latin";
|
|
30
|
+
extends: "en";
|
|
31
|
+
lexicons: {
|
|
32
|
+
yes: never[];
|
|
33
|
+
no: never[];
|
|
34
|
+
backchannel: never[];
|
|
35
|
+
interrupt: never[];
|
|
36
|
+
greeting: never[];
|
|
37
|
+
notHeard: never[];
|
|
38
|
+
repeat: never[];
|
|
39
|
+
wait: never[];
|
|
40
|
+
voicemail: never[];
|
|
41
|
+
goodbye: never[];
|
|
42
|
+
};
|
|
43
|
+
patterns: Readonly<Record<string, readonly RegExp[]>>;
|
|
44
|
+
format: {
|
|
45
|
+
number: (n: number, opts?: import("./en").EnNumberOptions | undefined) => string;
|
|
46
|
+
/** English words, default currency PHP: «five thousand two hundred fifty pesos and fifty centavos». */
|
|
47
|
+
amount: (n: number | string, currency?: string | undefined, opts?: EnAmountOptions) => string;
|
|
48
|
+
/** English dates («sixth of July»), as callers say them. */
|
|
49
|
+
date: typeof enDate;
|
|
50
|
+
ordinal: (n: number) => string;
|
|
51
|
+
/** «one day» / «five days» in English words, as `en`. */
|
|
52
|
+
count: (n: number, forms: readonly string[], opts?: import("./en").EnNumberOptions | undefined) => string;
|
|
53
|
+
months: readonly ["Enero", "Pebrero", "Marso", "Abril", "Mayo", "Hunyo", "Hulyo", "Agosto", "Setyembre", "Oktubre", "Nobyembre", "Disyembre"];
|
|
54
|
+
weekdays: readonly ["Linggo", "Lunes", "Martes", "Miyerkules", "Huwebes", "Biyernes", "Sabado"];
|
|
55
|
+
/** URL-decoded, punctuation removed (`opts.punctuation: 'space'`: a space), each word capitalized. */
|
|
56
|
+
name: (raw: string, _kase?: string, opts?: NameOptions) => string;
|
|
57
|
+
};
|
|
58
|
+
parse: import("../locale").LocaleParse;
|
|
59
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tl = exports.tlFormat = exports.tlParse = exports.TL_WEEKDAY_HEARD = exports.TL_WEEKDAYS = exports.TL_MONTHS = void 0;
|
|
4
|
+
const en_1 = require("./en");
|
|
5
|
+
const parse_1 = require("./parse");
|
|
6
|
+
const shared_1 = require("./shared");
|
|
7
|
+
const tl_lexicons_1 = require("./tl-lexicons");
|
|
8
|
+
exports.TL_MONTHS = [
|
|
9
|
+
'Enero', 'Pebrero', 'Marso', 'Abril', 'Mayo', 'Hunyo', 'Hulyo', 'Agosto', 'Setyembre', 'Oktubre', 'Nobyembre',
|
|
10
|
+
'Disyembre',
|
|
11
|
+
];
|
|
12
|
+
/** Weekday names, Sunday first (index = `Date#getUTCDay()`). */
|
|
13
|
+
exports.TL_WEEKDAYS = ['Linggo', 'Lunes', 'Martes', 'Miyerkules', 'Huwebes', 'Biyernes', 'Sabado'];
|
|
14
|
+
/**
|
|
15
|
+
* Spellings a speech engine writes for each weekday, Sunday first. Sunday is empty on purpose: «linggo» is also the
|
|
16
|
+
* word for "week".
|
|
17
|
+
*/
|
|
18
|
+
exports.TL_WEEKDAY_HEARD = [
|
|
19
|
+
[],
|
|
20
|
+
['lunes'],
|
|
21
|
+
['martes'],
|
|
22
|
+
['miyerkules', 'miyerkoles'],
|
|
23
|
+
['huwebes'],
|
|
24
|
+
['biyernes', 'byernes'],
|
|
25
|
+
['sabado'],
|
|
26
|
+
];
|
|
27
|
+
/** Day words Taglish callers add to the English ones. */
|
|
28
|
+
const TL_MONTH_WORDS = [
|
|
29
|
+
// «mayo» is left out: the speech engine writes a common wallet name with it.
|
|
30
|
+
['enero'], ['pebrero'], ['marso'], ['abril'], [], ['hunyo'], ['hulyo'], ['agosto'], ['setyembre', 'septiyembre'],
|
|
31
|
+
['oktubre'], ['nobyembre'], ['disyembre'],
|
|
32
|
+
];
|
|
33
|
+
const TL_DATE_LISTS = {
|
|
34
|
+
months: en_1.EN_DATE_LISTS.months.map((ws, i) => [...ws, ...TL_MONTH_WORDS[i]]),
|
|
35
|
+
// «tower ko» is how the speech engine writes «tomorrow» on Taglish calls.
|
|
36
|
+
relative: [['makalawa', 2], ...en_1.EN_DATE_LISTS.relative, ['bukas', 1], ['tower ko', 1], ['ngayon', 0]],
|
|
37
|
+
weekdays: en_1.EN_DATE_LISTS.weekdays.map((ws, i) => [...ws, ...exports.TL_WEEKDAY_HEARD[i]]),
|
|
38
|
+
nextBefore: en_1.EN_DATE_LISTS.nextBefore,
|
|
39
|
+
dayLead: [...en_1.EN_DATE_LISTS.dayLead, 'sa', 'hanggang', 'bago', 'mga', 'pag'],
|
|
40
|
+
ordinalLead: en_1.EN_DATE_LISTS.ordinalLead,
|
|
41
|
+
monthLink: [...en_1.EN_DATE_LISTS.monthLink, 'ng'],
|
|
42
|
+
dayLink: en_1.EN_DATE_LISTS.dayLink,
|
|
43
|
+
notDayAfter: [...en_1.EN_DATE_LISTS.notDayAfter, 'ng', 'pesos', 'peso', 'araw', 'buwan', 'taon'],
|
|
44
|
+
filler: [...en_1.EN_DATE_LISTS.filler, 'po', 'opo', 'oo', 'sa', 'mga', 'siguro', 'lang', 'na', 'ma'],
|
|
45
|
+
vagueOrdinals: en_1.EN_DATE_LISTS.vagueOrdinals,
|
|
46
|
+
};
|
|
47
|
+
/** English number words and English + Tagalog day words. */
|
|
48
|
+
exports.tlParse = (0, parse_1.makeParse)(en_1.EN_NUMBER_WORDS, (0, en_1.enDateWords)(TL_DATE_LISTS));
|
|
49
|
+
exports.tlFormat = {
|
|
50
|
+
number: en_1.enFormat.number,
|
|
51
|
+
/** English words, default currency PHP: «five thousand two hundred fifty pesos and fifty centavos». */
|
|
52
|
+
amount: (n, currency = 'PHP', opts) => (0, en_1.enAmount)(n, currency, opts),
|
|
53
|
+
/** English dates («sixth of July»), as callers say them. */
|
|
54
|
+
date: en_1.enDate,
|
|
55
|
+
ordinal: en_1.enFormat.ordinal,
|
|
56
|
+
/** «one day» / «five days» in English words, as `en`. */
|
|
57
|
+
count: en_1.enFormat.count,
|
|
58
|
+
months: exports.TL_MONTHS,
|
|
59
|
+
weekdays: exports.TL_WEEKDAYS,
|
|
60
|
+
/** URL-decoded, punctuation removed (`opts.punctuation: 'space'`: a space), each word capitalized. */
|
|
61
|
+
name: (raw, _kase, opts) => (0, shared_1.cleanName)(raw, opts),
|
|
62
|
+
};
|
|
63
|
+
exports.tl = {
|
|
64
|
+
code: 'tl',
|
|
65
|
+
script: 'latin',
|
|
66
|
+
extends: 'en',
|
|
67
|
+
lexicons: {
|
|
68
|
+
yes: [],
|
|
69
|
+
no: [],
|
|
70
|
+
backchannel: [],
|
|
71
|
+
interrupt: [],
|
|
72
|
+
greeting: [],
|
|
73
|
+
notHeard: [],
|
|
74
|
+
repeat: [],
|
|
75
|
+
wait: [],
|
|
76
|
+
voicemail: [],
|
|
77
|
+
goodbye: [],
|
|
78
|
+
},
|
|
79
|
+
patterns: tl_lexicons_1.TL_PATTERNS,
|
|
80
|
+
format: exports.tlFormat,
|
|
81
|
+
parse: exports.tlParse,
|
|
82
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { DateInput } from '../locale';
|
|
2
|
+
import { type NumberWords } from './parse';
|
|
3
|
+
/** A digit string read as an integer: `"1500000"` → «một triệu năm trăm nghìn». `''` for anything but digits. */
|
|
4
|
+
export declare function viIntegerToWords(raw: string): string;
|
|
5
|
+
/** Digits read one by one: `"0905"` → «không chín không năm». Non-digits are skipped. */
|
|
6
|
+
export declare function viDigits(s: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* `"1234.5"` → «một nghìn hai trăm ba mươi tư phẩy năm»: the decimal digits are read one by one after «phẩy», trailing
|
|
9
|
+
* zeros dropped. No currency word unless one is given (`'VND'` → «đồng»).
|
|
10
|
+
*/
|
|
11
|
+
export declare function viAmount(value: number | string, currency?: string): string;
|
|
12
|
+
export declare const VI_MONTHS: readonly ["tháng một", "tháng hai", "tháng ba", "tháng tư", "tháng năm", "tháng sáu", "tháng bảy", "tháng tám", "tháng chín", "tháng mười", "tháng mười một", "tháng mười hai"];
|
|
13
|
+
/** Weekday names, Sunday first (index = `Date#getUTCDay()`). */
|
|
14
|
+
export declare const VI_WEEKDAYS: readonly ["chủ nhật", "thứ hai", "thứ ba", "thứ tư", "thứ năm", "thứ sáu", "thứ bảy"];
|
|
15
|
+
/** «ngày chín tháng tám». Every style reads the same. */
|
|
16
|
+
export declare function viDate(d: DateInput, _style?: 'short' | 'long' | 'dayMonth'): string;
|
|
17
|
+
export declare const viFormat: {
|
|
18
|
+
/** Whole number in words; the fraction is dropped; `''` for negative or non-finite input. */
|
|
19
|
+
number: (n: number) => string;
|
|
20
|
+
amount: typeof viAmount;
|
|
21
|
+
date: typeof viDate;
|
|
22
|
+
months: readonly ["tháng một", "tháng hai", "tháng ba", "tháng tư", "tháng năm", "tháng sáu", "tháng bảy", "tháng tám", "tháng chín", "tháng mười", "tháng mười một", "tháng mười hai"];
|
|
23
|
+
weekdays: readonly ["chủ nhật", "thứ hai", "thứ ba", "thứ tư", "thứ năm", "thứ sáu", "thứ bảy"];
|
|
24
|
+
digits: typeof viDigits;
|
|
25
|
+
};
|
|
26
|
+
export declare const VI_NUMBER_WORDS: NumberWords;
|
|
27
|
+
export declare const viParse: import("../locale").LocaleParse;
|
|
28
|
+
export declare const vi: {
|
|
29
|
+
code: "vi";
|
|
30
|
+
script: "latin";
|
|
31
|
+
lexicons: {
|
|
32
|
+
yes: never[];
|
|
33
|
+
no: never[];
|
|
34
|
+
backchannel: never[];
|
|
35
|
+
interrupt: never[];
|
|
36
|
+
greeting: never[];
|
|
37
|
+
notHeard: never[];
|
|
38
|
+
repeat: never[];
|
|
39
|
+
wait: never[];
|
|
40
|
+
voicemail: never[];
|
|
41
|
+
goodbye: never[];
|
|
42
|
+
/** Today, tomorrow, the day after, as a prompt names them (index = days from today; other spellings in brackets). */
|
|
43
|
+
relativeDays: string[];
|
|
44
|
+
};
|
|
45
|
+
patterns: {
|
|
46
|
+
/** A contentless «a lô? nói đi» prod, tested on the normalized line with spaces removed. */
|
|
47
|
+
liveness: RegExp[];
|
|
48
|
+
};
|
|
49
|
+
format: {
|
|
50
|
+
/** Whole number in words; the fraction is dropped; `''` for negative or non-finite input. */
|
|
51
|
+
number: (n: number) => string;
|
|
52
|
+
amount: typeof viAmount;
|
|
53
|
+
date: typeof viDate;
|
|
54
|
+
months: readonly ["tháng một", "tháng hai", "tháng ba", "tháng tư", "tháng năm", "tháng sáu", "tháng bảy", "tháng tám", "tháng chín", "tháng mười", "tháng mười một", "tháng mười hai"];
|
|
55
|
+
weekdays: readonly ["chủ nhật", "thứ hai", "thứ ba", "thứ tư", "thứ năm", "thứ sáu", "thứ bảy"];
|
|
56
|
+
digits: typeof viDigits;
|
|
57
|
+
};
|
|
58
|
+
parse: import("../locale").LocaleParse;
|
|
59
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vi = exports.viParse = exports.VI_NUMBER_WORDS = exports.viFormat = exports.viDate = exports.VI_WEEKDAYS = exports.VI_MONTHS = exports.viAmount = exports.viDigits = exports.viIntegerToWords = void 0;
|
|
4
|
+
const parse_1 = require("./parse");
|
|
5
|
+
const shared_1 = require("./shared");
|
|
6
|
+
const VI_DIGITS = ['không', 'một', 'hai', 'ba', 'bốn', 'năm', 'sáu', 'bảy', 'tám', 'chín'];
|
|
7
|
+
/** Ones place after a tens word: «mốt»/«lăm» replace «một»/«năm». */
|
|
8
|
+
const VI_UNITS = ['', ' mốt', ' hai', ' ba', ' bốn', ' lăm', ' sáu', ' bảy', ' tám', ' chín'];
|
|
9
|
+
const VI_TENS = [
|
|
10
|
+
'linh', 'mười', 'hai mươi', 'ba mươi', 'bốn mươi', 'năm mươi', 'sáu mươi', 'bảy mươi', 'tám mươi', 'chín mươi',
|
|
11
|
+
];
|
|
12
|
+
const VI_HUNDREDS = VI_DIGITS.map((d) => `${d} trăm`);
|
|
13
|
+
/** Scale words by 3-digit group from the right. */
|
|
14
|
+
const VI_SCALES = ['', ' nghìn', ' triệu', ' tỉ', ' nghìn tỉ', ' triệu tỉ', ' tỉ tỉ'];
|
|
15
|
+
/** One 1-3 digit group, as written (a leading group may be shorter than three digits). */
|
|
16
|
+
function viGroup(group) {
|
|
17
|
+
const n = Number(group);
|
|
18
|
+
if (group.length === 1)
|
|
19
|
+
return VI_DIGITS[n];
|
|
20
|
+
if (n === 11)
|
|
21
|
+
return 'mười một';
|
|
22
|
+
if (group.length === 2)
|
|
23
|
+
return VI_TENS[Math.floor(n / 10)] + VI_UNITS[n % 10];
|
|
24
|
+
if (group === '000')
|
|
25
|
+
return '';
|
|
26
|
+
const hundreds = VI_HUNDREDS[Math.floor(n / 100)];
|
|
27
|
+
const tens = Math.floor(n / 10) % 10;
|
|
28
|
+
if (tens === 0) {
|
|
29
|
+
if (n % 10 === 0)
|
|
30
|
+
return hundreds;
|
|
31
|
+
return `${hundreds} ${VI_TENS[0]} ${VI_DIGITS[n % 10]}`;
|
|
32
|
+
}
|
|
33
|
+
return `${hundreds} ${VI_TENS[tens]}${VI_UNITS[n % 10]}`;
|
|
34
|
+
}
|
|
35
|
+
/** A digit string read as an integer: `"1500000"` → «một triệu năm trăm nghìn». `''` for anything but digits. */
|
|
36
|
+
function viIntegerToWords(raw) {
|
|
37
|
+
if (!raw || !/^\d+$/.test(raw))
|
|
38
|
+
return '';
|
|
39
|
+
const digits = raw.replace(/^0+/, '');
|
|
40
|
+
if (!digits)
|
|
41
|
+
return VI_DIGITS[0];
|
|
42
|
+
const groups = [];
|
|
43
|
+
for (let i = digits.length; i > 0; i -= 3)
|
|
44
|
+
groups.push(digits.slice(Math.max(i - 3, 0), i));
|
|
45
|
+
const parts = [];
|
|
46
|
+
groups.forEach((g, idx) => {
|
|
47
|
+
const word = viGroup(g);
|
|
48
|
+
if (word)
|
|
49
|
+
parts.push(word + VI_SCALES[idx]);
|
|
50
|
+
});
|
|
51
|
+
return parts.reverse().join(' ').trim();
|
|
52
|
+
}
|
|
53
|
+
exports.viIntegerToWords = viIntegerToWords;
|
|
54
|
+
/** Digits read one by one: `"0905"` → «không chín không năm». Non-digits are skipped. */
|
|
55
|
+
function viDigits(s) {
|
|
56
|
+
return s
|
|
57
|
+
.replace(/\D/g, '')
|
|
58
|
+
.split('')
|
|
59
|
+
.map((d) => VI_DIGITS[Number(d)])
|
|
60
|
+
.join(' ');
|
|
61
|
+
}
|
|
62
|
+
exports.viDigits = viDigits;
|
|
63
|
+
const VI_CURRENCY = { VND: 'đồng' };
|
|
64
|
+
/**
|
|
65
|
+
* `"1234.5"` → «một nghìn hai trăm ba mươi tư phẩy năm»: the decimal digits are read one by one after «phẩy», trailing
|
|
66
|
+
* zeros dropped. No currency word unless one is given (`'VND'` → «đồng»).
|
|
67
|
+
*/
|
|
68
|
+
function viAmount(value, currency) {
|
|
69
|
+
const [intPart = '0', fracPart = ''] = String(value).split('.');
|
|
70
|
+
const intRead = viIntegerToWords(intPart || '0');
|
|
71
|
+
const frac = fracPart.replace(/0+$/, '');
|
|
72
|
+
const text = frac ? `${intRead} phẩy ${viDigits(frac)}` : intRead;
|
|
73
|
+
const unit = currency ? VI_CURRENCY[currency] ?? currency : '';
|
|
74
|
+
return unit ? `${text} ${unit}` : text;
|
|
75
|
+
}
|
|
76
|
+
exports.viAmount = viAmount;
|
|
77
|
+
const VI_DAY_WORDS = [
|
|
78
|
+
'không', 'một', 'hai', 'ba', 'bốn', 'năm', 'sáu', 'bảy', 'tám', 'chín', 'mười', 'mười một', 'mười hai', 'mười ba',
|
|
79
|
+
'mười bốn', 'mười lăm', 'mười sáu', 'mười bảy', 'mười tám', 'mười chín', 'hai mươi', 'hai mươi mốt', 'hai mươi hai',
|
|
80
|
+
'hai mươi ba', 'hai mươi bốn', 'hai mươi lăm', 'hai mươi sáu', 'hai mươi bảy', 'hai mươi tám', 'hai mươi chín',
|
|
81
|
+
'ba mươi', 'ba mươi mốt',
|
|
82
|
+
];
|
|
83
|
+
exports.VI_MONTHS = [
|
|
84
|
+
'tháng một', 'tháng hai', 'tháng ba', 'tháng tư', 'tháng năm', 'tháng sáu', 'tháng bảy', 'tháng tám', 'tháng chín',
|
|
85
|
+
'tháng mười', 'tháng mười một', 'tháng mười hai',
|
|
86
|
+
];
|
|
87
|
+
/** Weekday names, Sunday first (index = `Date#getUTCDay()`). */
|
|
88
|
+
exports.VI_WEEKDAYS = ['chủ nhật', 'thứ hai', 'thứ ba', 'thứ tư', 'thứ năm', 'thứ sáu', 'thứ bảy'];
|
|
89
|
+
/** «ngày chín tháng tám». Every style reads the same. */
|
|
90
|
+
function viDate(d, _style) {
|
|
91
|
+
const p = (0, shared_1.partsOf)(d);
|
|
92
|
+
return `ngày ${VI_DAY_WORDS[p.day] ?? String(p.day)} ${exports.VI_MONTHS[p.month - 1] ?? `tháng ${p.month}`}`;
|
|
93
|
+
}
|
|
94
|
+
exports.viDate = viDate;
|
|
95
|
+
exports.viFormat = {
|
|
96
|
+
/** Whole number in words; the fraction is dropped; `''` for negative or non-finite input. */
|
|
97
|
+
number: (n) => (Number.isFinite(n) && n >= 0 ? viIntegerToWords(String(Math.trunc(n))) : ''),
|
|
98
|
+
amount: viAmount,
|
|
99
|
+
date: viDate,
|
|
100
|
+
months: exports.VI_MONTHS,
|
|
101
|
+
weekdays: exports.VI_WEEKDAYS,
|
|
102
|
+
digits: viDigits,
|
|
103
|
+
};
|
|
104
|
+
// ── reading back ────────────────────────────────────────────────────────────────────────────────
|
|
105
|
+
exports.VI_NUMBER_WORDS = {
|
|
106
|
+
values: new Map([
|
|
107
|
+
...VI_DIGITS.map((w, i) => [w, i]), ['mốt', 1], ['tư', 4], ['lăm', 5], ['nhăm', 5], ['bẩy', 7], ['mười', 10],
|
|
108
|
+
]),
|
|
109
|
+
multipliers: new Map([['mươi', 10], ['trăm', 100]]),
|
|
110
|
+
scales: new Map([['nghìn', 1000], ['ngàn', 1000], ['triệu', 1_000_000], ['tỉ', 1_000_000_000], ['tỷ', 1_000_000_000]]),
|
|
111
|
+
joiners: new Set(['linh', 'lẻ']),
|
|
112
|
+
tenPlusUnit: true,
|
|
113
|
+
group: '.',
|
|
114
|
+
decimal: ',',
|
|
115
|
+
};
|
|
116
|
+
/** «tháng» with the month number in words or figures; «tháng giêng» and «tháng chạp» for January and December. */
|
|
117
|
+
const VI_MONTH_PHRASES = new Map([
|
|
118
|
+
...exports.VI_MONTHS.map((m, i) => [m, i + 1]),
|
|
119
|
+
...Array.from({ length: 12 }, (_, i) => [`tháng ${i + 1}`, i + 1]),
|
|
120
|
+
['tháng giêng', 1], ['tháng bốn', 4], ['tháng chạp', 12],
|
|
121
|
+
]);
|
|
122
|
+
exports.viParse = (0, parse_1.makeParse)(exports.VI_NUMBER_WORDS, {
|
|
123
|
+
numbers: exports.VI_NUMBER_WORDS,
|
|
124
|
+
months: VI_MONTH_PHRASES,
|
|
125
|
+
relative: new Map([
|
|
126
|
+
['hôm nay', 0], ['bữa nay', 0], ['ngày mai', 1], ['mai', 1], ['ngày mốt', 2], ['mốt', 2], ['ngày kia', 2],
|
|
127
|
+
]),
|
|
128
|
+
weekdays: new Map([
|
|
129
|
+
...exports.VI_WEEKDAYS.map((d, i) => [d, i]), ['thứ bẩy', 6],
|
|
130
|
+
...Array.from({ length: 6 }, (_, i) => [`thứ ${i + 2}`, i + 1]),
|
|
131
|
+
]),
|
|
132
|
+
nextAfter: new Set(['tuần sau', 'tuần tới', 'tới']),
|
|
133
|
+
dayLead: new Set(['ngày', 'mùng', 'mồng', 'trước', 'đến']),
|
|
134
|
+
notDayAfter: new Set(['giờ', 'tiếng', 'phút', 'đồng', 'ngày', 'tuần', 'tháng', 'năm', 'lần', 'phần']),
|
|
135
|
+
filler: new Set(['dạ', 'vâng', 'ạ', 'ừ', 'khoảng', 'chắc', 'ngày', 'mùng', 'mồng']),
|
|
136
|
+
});
|
|
137
|
+
exports.vi = {
|
|
138
|
+
code: 'vi',
|
|
139
|
+
script: 'latin',
|
|
140
|
+
lexicons: {
|
|
141
|
+
yes: [],
|
|
142
|
+
no: [],
|
|
143
|
+
backchannel: [],
|
|
144
|
+
interrupt: [],
|
|
145
|
+
greeting: [],
|
|
146
|
+
notHeard: [],
|
|
147
|
+
repeat: [],
|
|
148
|
+
wait: [],
|
|
149
|
+
voicemail: [],
|
|
150
|
+
goodbye: [],
|
|
151
|
+
/** Today, tomorrow, the day after, as a prompt names them (index = days from today; other spellings in brackets). */
|
|
152
|
+
relativeDays: ['hôm nay', 'ngày mai (mai)', 'ngày mốt (mốt, ngày kia)'],
|
|
153
|
+
},
|
|
154
|
+
patterns: {
|
|
155
|
+
/** A contentless «a lô? nói đi» prod, tested on the normalized line with spaces removed. */
|
|
156
|
+
liveness: [/^(?:a?l[ôo]|hê\s?lô|hello|halo|nói\s?đi|nghe|máy|đi|ơi|dạ|à|ạ|hả)+$/iu],
|
|
157
|
+
},
|
|
158
|
+
format: exports.viFormat,
|
|
159
|
+
parse: exports.viParse,
|
|
160
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** One pattern: any of `parts` starting a word (no letter right before it). Case-insensitive, Unicode. */
|
|
2
|
+
export declare function wordStarts(...parts: string[]): RegExp;
|
|
3
|
+
/** One pattern: any of `parts` as a whole word (no letter right before or after it). Case-insensitive, Unicode. */
|
|
4
|
+
export declare function wholeWordsOf(...parts: string[]): RegExp;
|
|
5
|
+
/** `text` with the characters a pattern reads as syntax escaped (safe in a Unicode pattern too). */
|
|
6
|
+
export declare function escapeRegExp(text: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* The first place `text` names `word` as a whole word: no letter or digit right before or after it (in any script),
|
|
9
|
+
* its spaces matching any run of spaces; with `notFollowedBy` (a sticky pattern), not followed by it there.
|
|
10
|
+
*/
|
|
11
|
+
export declare function findWholeWord(word: string, text: string, notFollowedBy?: RegExp | null): RegExpExecArray | null;
|
|
12
|
+
/** A pattern's source as a sticky pattern (no other flags), for `findWholeWord`'s `notFollowedBy`. */
|
|
13
|
+
export declare function stickyOf(re: RegExp): RegExp;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Builders of word patterns for the packs (language-free): alternatives that start a word, or whole words.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.stickyOf = exports.findWholeWord = exports.escapeRegExp = exports.wholeWordsOf = exports.wordStarts = void 0;
|
|
5
|
+
/** One pattern: any of `parts` starting a word (no letter right before it). Case-insensitive, Unicode. */
|
|
6
|
+
function wordStarts(...parts) {
|
|
7
|
+
return new RegExp(parts.map((p) => `(?<!\\p{L})${p}`).join('|'), 'iu');
|
|
8
|
+
}
|
|
9
|
+
exports.wordStarts = wordStarts;
|
|
10
|
+
/** One pattern: any of `parts` as a whole word (no letter right before or after it). Case-insensitive, Unicode. */
|
|
11
|
+
function wholeWordsOf(...parts) {
|
|
12
|
+
return new RegExp(parts.map((p) => `(?<!\\p{L})${p}(?!\\p{L})`).join('|'), 'iu');
|
|
13
|
+
}
|
|
14
|
+
exports.wholeWordsOf = wholeWordsOf;
|
|
15
|
+
/** `text` with the characters a pattern reads as syntax escaped (safe in a Unicode pattern too). */
|
|
16
|
+
function escapeRegExp(text) {
|
|
17
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
18
|
+
}
|
|
19
|
+
exports.escapeRegExp = escapeRegExp;
|
|
20
|
+
/**
|
|
21
|
+
* The first place `text` names `word` as a whole word: no letter or digit right before or after it (in any script),
|
|
22
|
+
* its spaces matching any run of spaces; with `notFollowedBy` (a sticky pattern), not followed by it there.
|
|
23
|
+
*/
|
|
24
|
+
function findWholeWord(word, text, notFollowedBy) {
|
|
25
|
+
const re = new RegExp(`(?<![\\p{L}\\p{N}])${escapeRegExp(word).replace(/ /g, '\\s+')}(?![\\p{L}\\p{N}])`, 'gu');
|
|
26
|
+
for (let m = re.exec(text); m != null; m = re.exec(text)) {
|
|
27
|
+
const end = m.index + m[0].length;
|
|
28
|
+
if (m[0] === '')
|
|
29
|
+
re.lastIndex++;
|
|
30
|
+
if (!notFollowedBy)
|
|
31
|
+
return m;
|
|
32
|
+
notFollowedBy.lastIndex = end;
|
|
33
|
+
if (!notFollowedBy.test(text))
|
|
34
|
+
return m;
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
exports.findWholeWord = findWholeWord;
|
|
39
|
+
/** A pattern's source as a sticky pattern (no other flags), for `findWholeWord`'s `notFollowedBy`. */
|
|
40
|
+
function stickyOf(re) {
|
|
41
|
+
return new RegExp(re.source, 'y');
|
|
42
|
+
}
|
|
43
|
+
exports.stickyOf = stickyOf;
|