@shobyde/boaz 0.0.0-stage → 0.8.2
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 +422 -2
- package/dist/build/codes.d.ts +16 -0
- package/dist/build/codes.d.ts.map +1 -0
- package/dist/build/codes.js +72 -0
- package/dist/build/codes.js.map +1 -0
- package/dist/build/extract.d.ts +45 -0
- package/dist/build/extract.d.ts.map +1 -0
- package/dist/build/extract.js +484 -0
- package/dist/build/extract.js.map +1 -0
- package/dist/build/glob.d.ts +11 -0
- package/dist/build/glob.d.ts.map +1 -0
- package/dist/build/glob.js +88 -0
- package/dist/build/glob.js.map +1 -0
- package/dist/build/index.d.ts +7 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +4 -0
- package/dist/build/index.js.map +1 -0
- package/dist/build/probes.d.ts +41 -0
- package/dist/build/probes.d.ts.map +1 -0
- package/dist/build/probes.js +134 -0
- package/dist/build/probes.js.map +1 -0
- package/dist/build/report.d.ts +11 -0
- package/dist/build/report.d.ts.map +1 -0
- package/dist/build/report.js +39 -0
- package/dist/build/report.js.map +1 -0
- package/dist/cli/audit.d.ts +15 -0
- package/dist/cli/audit.d.ts.map +1 -0
- package/dist/cli/audit.js +68 -0
- package/dist/cli/audit.js.map +1 -0
- package/dist/cli/bench.d.ts +7 -0
- package/dist/cli/bench.d.ts.map +1 -0
- package/dist/cli/bench.js +147 -0
- package/dist/cli/bench.js.map +1 -0
- package/dist/cli/harness.d.ts +45 -0
- package/dist/cli/harness.d.ts.map +1 -0
- package/dist/cli/harness.js +90 -0
- package/dist/cli/harness.js.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +404 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/probes.d.ts +20 -0
- package/dist/cli/probes.d.ts.map +1 -0
- package/dist/cli/probes.js +27 -0
- package/dist/cli/probes.js.map +1 -0
- package/dist/cli/skill-template.d.ts +2 -0
- package/dist/cli/skill-template.d.ts.map +1 -0
- package/dist/cli/skill-template.js +254 -0
- package/dist/cli/skill-template.js.map +1 -0
- package/dist/core/actions.d.ts +67 -0
- package/dist/core/actions.d.ts.map +1 -0
- package/dist/core/actions.js +357 -0
- package/dist/core/actions.js.map +1 -0
- package/dist/core/define.d.ts +25 -0
- package/dist/core/define.d.ts.map +1 -0
- package/dist/core/define.js +76 -0
- package/dist/core/define.js.map +1 -0
- package/dist/core/execute.d.ts +75 -0
- package/dist/core/execute.d.ts.map +1 -0
- package/dist/core/execute.js +145 -0
- package/dist/core/execute.js.map +1 -0
- package/dist/core/index.d.ts +35 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +20 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/lemmas.d.ts +32 -0
- package/dist/core/lemmas.d.ts.map +1 -0
- package/dist/core/lemmas.js +80 -0
- package/dist/core/lemmas.js.map +1 -0
- package/dist/core/lexical-engine.d.ts +18 -0
- package/dist/core/lexical-engine.d.ts.map +1 -0
- package/dist/core/lexical-engine.js +296 -0
- package/dist/core/lexical-engine.js.map +1 -0
- package/dist/core/loop.d.ts +51 -0
- package/dist/core/loop.d.ts.map +1 -0
- package/dist/core/loop.js +432 -0
- package/dist/core/loop.js.map +1 -0
- package/dist/core/mcp.d.ts +119 -0
- package/dist/core/mcp.d.ts.map +1 -0
- package/dist/core/mcp.js +253 -0
- package/dist/core/mcp.js.map +1 -0
- package/dist/core/memory.d.ts +106 -0
- package/dist/core/memory.d.ts.map +1 -0
- package/dist/core/memory.js +185 -0
- package/dist/core/memory.js.map +1 -0
- package/dist/core/plan.d.ts +83 -0
- package/dist/core/plan.d.ts.map +1 -0
- package/dist/core/plan.js +258 -0
- package/dist/core/plan.js.map +1 -0
- package/dist/core/preferences.d.ts +54 -0
- package/dist/core/preferences.d.ts.map +1 -0
- package/dist/core/preferences.js +83 -0
- package/dist/core/preferences.js.map +1 -0
- package/dist/core/prompt.d.ts +23 -0
- package/dist/core/prompt.d.ts.map +1 -0
- package/dist/core/prompt.js +76 -0
- package/dist/core/prompt.js.map +1 -0
- package/dist/core/question.d.ts +96 -0
- package/dist/core/question.d.ts.map +1 -0
- package/dist/core/question.js +501 -0
- package/dist/core/question.js.map +1 -0
- package/dist/core/registry.d.ts +33 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +72 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/retriever.d.ts +48 -0
- package/dist/core/retriever.d.ts.map +1 -0
- package/dist/core/retriever.js +123 -0
- package/dist/core/retriever.js.map +1 -0
- package/dist/core/schema.d.ts +27 -0
- package/dist/core/schema.d.ts.map +1 -0
- package/dist/core/schema.js +231 -0
- package/dist/core/schema.js.map +1 -0
- package/dist/core/skill.d.ts +105 -0
- package/dist/core/skill.d.ts.map +1 -0
- package/dist/core/skill.js +205 -0
- package/dist/core/skill.js.map +1 -0
- package/dist/core/summarise.d.ts +52 -0
- package/dist/core/summarise.d.ts.map +1 -0
- package/dist/core/summarise.js +146 -0
- package/dist/core/summarise.js.map +1 -0
- package/dist/core/tools.d.ts +21 -0
- package/dist/core/tools.d.ts.map +1 -0
- package/dist/core/tools.js +120 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/core/types.d.ts +199 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +5 -0
- package/dist/core/types.js.map +1 -0
- package/dist/dom/index.d.ts +22 -0
- package/dist/dom/index.d.ts.map +1 -0
- package/dist/dom/index.js +94 -0
- package/dist/dom/index.js.map +1 -0
- package/dist/extract/index.d.ts +36 -0
- package/dist/extract/index.d.ts.map +1 -0
- package/dist/extract/index.js +86 -0
- package/dist/extract/index.js.map +1 -0
- package/dist/react/index.d.ts +52 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +131 -0
- package/dist/react/index.js.map +1 -0
- package/dist/rules/engine.d.ts +152 -0
- package/dist/rules/engine.d.ts.map +1 -0
- package/dist/rules/engine.js +364 -0
- package/dist/rules/engine.js.map +1 -0
- package/dist/rules/facts.d.ts +63 -0
- package/dist/rules/facts.d.ts.map +1 -0
- package/dist/rules/facts.js +115 -0
- package/dist/rules/facts.js.map +1 -0
- package/dist/rules/index.d.ts +10 -0
- package/dist/rules/index.d.ts.map +1 -0
- package/dist/rules/index.js +5 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/knowledge.d.ts +78 -0
- package/dist/rules/knowledge.d.ts.map +1 -0
- package/dist/rules/knowledge.js +254 -0
- package/dist/rules/knowledge.js.map +1 -0
- package/dist/vite/index.d.ts +26 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +112 -0
- package/dist/vite/index.js.map +1 -0
- package/package.json +108 -4
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shape of a question, decided without a model.
|
|
3
|
+
*
|
|
4
|
+
* A visitor's sentence carries two things a router needs: what kind of answer
|
|
5
|
+
* would satisfy it (a name, a place, a date, a count, a comparison) and which
|
|
6
|
+
* entities it is about. Both are recoverable from the interrogative frame plus
|
|
7
|
+
* the app's own vocabulary, which is why this lives next to the retriever
|
|
8
|
+
* rather than in a host app.
|
|
9
|
+
*
|
|
10
|
+
* It classifies the question, never the request. "Take me to the archive" is a
|
|
11
|
+
* navigation command and stays one: controller verbs are decided by the engine,
|
|
12
|
+
* and a caller must not let `type` override that.
|
|
13
|
+
*/
|
|
14
|
+
export type QuestionType = 'who' | 'what' | 'where' | 'when' | 'how-many' | 'which' | 'why' | 'compare' | 'unknown';
|
|
15
|
+
export interface QuestionSlots {
|
|
16
|
+
/** The entity the question is about, canonicalised against `subjects`. */
|
|
17
|
+
subject: string | null;
|
|
18
|
+
/** What is being asked about that subject: stack, writing, contact, date… */
|
|
19
|
+
attribute: string | null;
|
|
20
|
+
/** Every declared subject the query names, in order of appearance. */
|
|
21
|
+
entities: string[];
|
|
22
|
+
/** How two or more named things are joined, or null when there is nothing to join. */
|
|
23
|
+
combine: Combine | null;
|
|
24
|
+
/** Recency qualifier, when the question names one. */
|
|
25
|
+
newest: 'newest' | 'oldest' | null;
|
|
26
|
+
/** True when the question points back at something instead of naming it. */
|
|
27
|
+
referenced: boolean;
|
|
28
|
+
/** The subject a pointer resolves to, or null when it points nowhere. */
|
|
29
|
+
reference: Reference | null;
|
|
30
|
+
/**
|
|
31
|
+
* Subjects named inside a negation scope: "python but not readback" excludes
|
|
32
|
+
* Readback. A negated subject is never also an entity, because the visitor is
|
|
33
|
+
* asking about everything else.
|
|
34
|
+
*/
|
|
35
|
+
exclude: string[];
|
|
36
|
+
/** Content words no subject or attribute accounted for. */
|
|
37
|
+
mentions: string[];
|
|
38
|
+
}
|
|
39
|
+
/** How a visitor pointed back at something instead of naming it. */
|
|
40
|
+
export interface Reference {
|
|
41
|
+
kind: 'ordinal' | 'pronoun' | 'partial';
|
|
42
|
+
/** The declared subject the pointer resolves to. */
|
|
43
|
+
value: string;
|
|
44
|
+
/** The words that pointed, kept for a trace line. */
|
|
45
|
+
cue: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* How a question combines the things it names. "which projects use python and
|
|
49
|
+
* sqlite" wants the projects with both; "python or rust" wants either. The
|
|
50
|
+
* distinction lives in the words between the two names, which is why it is
|
|
51
|
+
* extracted here and not left to the app's keyword list.
|
|
52
|
+
*/
|
|
53
|
+
export interface Combine {
|
|
54
|
+
/** `all` = every named value must hold, `any` = one is enough. */
|
|
55
|
+
op: 'all' | 'any';
|
|
56
|
+
/** The two names the connective joins, in the order they were said. */
|
|
57
|
+
between: [string, string];
|
|
58
|
+
/** The word that decided it, for a trace line. */
|
|
59
|
+
cue: string;
|
|
60
|
+
}
|
|
61
|
+
/** What the previous turn left behind, for a pointer to resolve against. */
|
|
62
|
+
export interface ReferenceContext {
|
|
63
|
+
/** Subjects in the order the previous answer listed them, for ordinals. */
|
|
64
|
+
items?: string[];
|
|
65
|
+
/** The subject the previous turn was about, for pronouns. */
|
|
66
|
+
subject?: string | null;
|
|
67
|
+
}
|
|
68
|
+
export interface QuestionAnalysis {
|
|
69
|
+
type: QuestionType;
|
|
70
|
+
/** Share of the winning frame's evidence, capped at 1. Ties lower this. */
|
|
71
|
+
confidence: number;
|
|
72
|
+
/** The runner-up when it is close enough that the label is a judgement call. */
|
|
73
|
+
contested: QuestionType | null;
|
|
74
|
+
questionShaped: boolean;
|
|
75
|
+
slots: QuestionSlots;
|
|
76
|
+
/** Which cue patterns fired, for a trace line. */
|
|
77
|
+
cues: string[];
|
|
78
|
+
}
|
|
79
|
+
export interface AnalyzeOptions {
|
|
80
|
+
/**
|
|
81
|
+
* Values the app can name: project names, technologies, sections, declared
|
|
82
|
+
* constants. Matched through `tokenize()` so "SQLite" and "sqlite" agree.
|
|
83
|
+
*/
|
|
84
|
+
subjects?: string[];
|
|
85
|
+
/** Attribute words per app, merged over the defaults. */
|
|
86
|
+
attributes?: Record<string, string[]>;
|
|
87
|
+
/** The previous turn's subject and listing, so a pointer can resolve. */
|
|
88
|
+
context?: ReferenceContext;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Classifies a question and fills the slots a router can act on.
|
|
92
|
+
*
|
|
93
|
+
* Deterministic: same string and context, same analysis, no state between calls.
|
|
94
|
+
*/
|
|
95
|
+
export declare function analyzeQuestion(query: string, options?: AnalyzeOptions): QuestionAnalysis;
|
|
96
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../src/core/question.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,GACpB,KAAK,GACL,MAAM,GACN,OAAO,GACP,MAAM,GACN,UAAU,GACV,OAAO,GACP,KAAK,GACL,SAAS,GACT,SAAS,CAAC;AAEd,MAAM,WAAW,aAAa;IAC5B,0EAA0E;IAC1E,OAAO,EAAE,MAAM,GAAG,IAA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AE,aAAa,CAAC;IACrB,kDAAkD;IAClD,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACtC,yEAAyE;IACzE,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B;AAmaD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,gBAAgB,CAoH7F"}
|
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
import { tokenize } from './retriever.js';
|
|
2
|
+
import { canonicalTerm, DOMAIN_SYNONYMS, LEMMAS } from './lemmas.js';
|
|
3
|
+
/**
|
|
4
|
+
* Ordered by precedence, which is also the tie-break. `compare` sits first
|
|
5
|
+
* because "what's the difference between A and B" is a comparison before it is
|
|
6
|
+
* a `what`, and `how-many` before `when` because "how many posts did he write in
|
|
7
|
+
* 2024" asks for a count, not a date.
|
|
8
|
+
*/
|
|
9
|
+
const CUES = [
|
|
10
|
+
{
|
|
11
|
+
type: 'compare',
|
|
12
|
+
weight: 3,
|
|
13
|
+
label: 'compare',
|
|
14
|
+
patterns: [
|
|
15
|
+
/^compare\b/,
|
|
16
|
+
/\bcompar(?:e|ed|ing) (?:to|with|against)\b/,
|
|
17
|
+
/\bcompare\b.{1,60}\b(?:and|to|with)\b/,
|
|
18
|
+
/\b(?:the )?difference(?:s)? between\b/,
|
|
19
|
+
/\bhow (?:does|do|did) .{0,48}?(?:compare|differ)\b/,
|
|
20
|
+
/\bwhat(?:'s| is| are) (?:the )?difference\b/,
|
|
21
|
+
/\bvs\.?\b/,
|
|
22
|
+
/\bversus\b/,
|
|
23
|
+
/\bwhich is (?:better|faster|newer|older)\b/,
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'how-many',
|
|
28
|
+
weight: 3,
|
|
29
|
+
label: 'how-many',
|
|
30
|
+
patterns: [
|
|
31
|
+
/\bhow (?:many|much)\b/,
|
|
32
|
+
/\bnumber of\b/,
|
|
33
|
+
/\bcount (?:the|all|every|of)\b/,
|
|
34
|
+
/^count\b/,
|
|
35
|
+
/\btotal (?:number|count)\b/,
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 'why',
|
|
40
|
+
weight: 3,
|
|
41
|
+
label: 'why',
|
|
42
|
+
patterns: [/\bwhy\b/, /\breason(?:s)? (?:for|why|behind)\b/, /\bwhat(?:'s| is| was) the reason\b/],
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'where',
|
|
46
|
+
weight: 2,
|
|
47
|
+
label: 'where',
|
|
48
|
+
patterns: [/\bwhere\b/, /\bin (?:which|what) (?:part|section|page)\b/],
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: 'when',
|
|
52
|
+
weight: 2,
|
|
53
|
+
label: 'when',
|
|
54
|
+
patterns: [
|
|
55
|
+
/\bwhen\b/,
|
|
56
|
+
/\bwhat (?:year|date|month|time)\b/,
|
|
57
|
+
/\bhow long (?:ago|since|did)\b/,
|
|
58
|
+
/\bhow (?:recent|old)\b/,
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
type: 'who',
|
|
63
|
+
weight: 2.5,
|
|
64
|
+
label: 'who',
|
|
65
|
+
patterns: [/\bwho\b/, /\bwhose\b/, /\bwhom\b/],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'which',
|
|
69
|
+
weight: 2,
|
|
70
|
+
label: 'which',
|
|
71
|
+
patterns: [/\bwhich\b/],
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'what',
|
|
75
|
+
weight: 1.5,
|
|
76
|
+
label: 'what',
|
|
77
|
+
patterns: [
|
|
78
|
+
/\bwhat\b/,
|
|
79
|
+
/\btell me (?:about|what|how)\b/,
|
|
80
|
+
/\bdescribe\b/,
|
|
81
|
+
/\bexplain\b/,
|
|
82
|
+
/\bsummar(?:y|ise|ize)\b/,
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
const DEFAULT_ATTRIBUTES = {
|
|
87
|
+
stack: ['stack', 'tech', 'technology', 'technologies', 'language', 'languages', 'framework', 'use', 'uses', 'using'],
|
|
88
|
+
writing: ['post', 'posts', 'write', 'writes', 'written', 'wrote', 'blog', 'article', 'articles', 'essay'],
|
|
89
|
+
contact: ['email', 'contact', 'reach', 'message', 'mail', 'linkedin'],
|
|
90
|
+
count: ['count', 'number', 'total', 'many'],
|
|
91
|
+
date: ['date', 'released', 'release', 'published', 'year', 'when'],
|
|
92
|
+
location: ['based', 'live', 'lives', 'location', 'located', 'where'],
|
|
93
|
+
identity: ['name', 'role', 'job', 'who', 'headline'],
|
|
94
|
+
reason: ['reason', 'motivation', 'why'],
|
|
95
|
+
projects: ['project', 'projects', 'work', 'card', 'cards'],
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* When a question names both a container and a property ("which projects use
|
|
99
|
+
* python"), the property is the question. Priority breaks count ties.
|
|
100
|
+
*/
|
|
101
|
+
const ATTRIBUTE_PRIORITY = {
|
|
102
|
+
stack: 5,
|
|
103
|
+
count: 4,
|
|
104
|
+
contact: 4,
|
|
105
|
+
writing: 3,
|
|
106
|
+
identity: 3,
|
|
107
|
+
date: 2,
|
|
108
|
+
location: 2,
|
|
109
|
+
reason: 2,
|
|
110
|
+
projects: 1,
|
|
111
|
+
};
|
|
112
|
+
/** Words that only frame the question; they say nothing about its subject. */
|
|
113
|
+
const FRAME_WORDS = new Set([
|
|
114
|
+
'who', 'what', 'where', 'when', 'why', 'which', 'whose', 'whom',
|
|
115
|
+
'how', 'many', 'much', 'tell', 'about', 'describe', 'explain', 'summar',
|
|
116
|
+
'there', 'here', 'any', 'all', 'some', 'one', 'ones', 'thing', 'things',
|
|
117
|
+
'between', 'difference', 'differences', 'compare', 'compared', 'versus', 'vs',
|
|
118
|
+
'newest', 'latest', 'recent', 'oldest', 'earliest', 'first', 'last',
|
|
119
|
+
]);
|
|
120
|
+
const PRONOUNS = new Set([
|
|
121
|
+
'he', 'him', 'his', 'she', 'her', 'hers', 'it', 'its', 'they', 'them', 'their',
|
|
122
|
+
'that', 'this', 'those', 'these', 'theirs', 'ours', 'yours',
|
|
123
|
+
]);
|
|
124
|
+
/**
|
|
125
|
+
* Cues that put what follows them out of scope. Longest alternation first so
|
|
126
|
+
* "anything but" is not read as a bare clause break.
|
|
127
|
+
*/
|
|
128
|
+
const NEGATION_CUE = /\b(?:anything but|other than|apart from|excluding|excludes?|except|besides|without|not)\b/g;
|
|
129
|
+
/** Words that turn "not" into an idiom ("not sure", "not to like") rather than an exclusion. */
|
|
130
|
+
const NEGATION_IDIOMS = new Set([
|
|
131
|
+
'sure', 'bad', 'only', 'just', 'much', 'really', 'necessarily', 'quite', 'even', 'to', 'so', 'yet', 'at', 'all',
|
|
132
|
+
]);
|
|
133
|
+
/**
|
|
134
|
+
* Where an exclusion stops. A sentence end or "but" always closes it; a comma
|
|
135
|
+
* closes it only when what follows starts a new question or a command, so
|
|
136
|
+
* "not readback, take me to the blog" excludes one thing and still navigates.
|
|
137
|
+
*/
|
|
138
|
+
const NEGATION_BREAK = /[.;?!]|\bbut\b|,\s*(?:who|what|where|when|why|which|how|take|open|show|go|give|tell|and then)\b/;
|
|
139
|
+
/** The text inside each negation scope, in order of appearance. */
|
|
140
|
+
function negationScopes(text) {
|
|
141
|
+
const scopes = [];
|
|
142
|
+
NEGATION_CUE.lastIndex = 0;
|
|
143
|
+
let match;
|
|
144
|
+
while ((match = NEGATION_CUE.exec(text)) !== null) {
|
|
145
|
+
const rest = text.slice(match.index + match[0].length);
|
|
146
|
+
const nextWord = (rest.trimStart().match(/^[a-z']+/) ?? [''])[0];
|
|
147
|
+
if (NEGATION_IDIOMS.has(nextWord))
|
|
148
|
+
continue;
|
|
149
|
+
// "why not python" is a suggestion, not an exclusion.
|
|
150
|
+
if (/\bwhy\s*$/.test(text.slice(0, match.index)))
|
|
151
|
+
continue;
|
|
152
|
+
const stop = rest.search(NEGATION_BREAK);
|
|
153
|
+
scopes.push(stop < 0 ? rest : rest.slice(0, stop));
|
|
154
|
+
}
|
|
155
|
+
return scopes;
|
|
156
|
+
}
|
|
157
|
+
function allDigits(token) {
|
|
158
|
+
return /^[0-9]+$/.test(token);
|
|
159
|
+
}
|
|
160
|
+
/** Subject tokens with digits dropped, so "Python 3.10+" matches "python". */
|
|
161
|
+
function subjectTokens(value) {
|
|
162
|
+
return tokenize(value).filter((token) => !allDigits(token));
|
|
163
|
+
}
|
|
164
|
+
function matchIndex(needle, haystack) {
|
|
165
|
+
if (needle.length === 0)
|
|
166
|
+
return -1;
|
|
167
|
+
for (let start = 0; start < haystack.length; start += 1) {
|
|
168
|
+
if (haystack[start] !== needle[0])
|
|
169
|
+
continue;
|
|
170
|
+
let at = 0;
|
|
171
|
+
for (let i = start; i < haystack.length && at < needle.length; i += 1) {
|
|
172
|
+
if (haystack[i] === needle[at])
|
|
173
|
+
at += 1;
|
|
174
|
+
}
|
|
175
|
+
if (at === needle.length)
|
|
176
|
+
return start;
|
|
177
|
+
}
|
|
178
|
+
return -1;
|
|
179
|
+
}
|
|
180
|
+
function attributeIndex(extra) {
|
|
181
|
+
const merged = { ...DEFAULT_ATTRIBUTES };
|
|
182
|
+
for (const [name, words] of Object.entries(extra ?? {})) {
|
|
183
|
+
merged[name] = [...(merged[name] ?? []), ...words];
|
|
184
|
+
}
|
|
185
|
+
const index = new Map();
|
|
186
|
+
for (const [name, words] of Object.entries(merged)) {
|
|
187
|
+
for (const word of words) {
|
|
188
|
+
for (const token of tokenize(word)) {
|
|
189
|
+
if (!index.has(token))
|
|
190
|
+
index.set(token, name);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// A bundled synonym only ever points at an attribute the app already
|
|
195
|
+
// declares, so "toolset" reads as stack only where stack is one of the
|
|
196
|
+
// attributes in play. It is also what keeps the word out of `mentions`, which
|
|
197
|
+
// would otherwise report "toolset" as something no fact accounted for.
|
|
198
|
+
for (const [from, to] of [...Object.entries(DOMAIN_SYNONYMS), ...Object.entries(LEMMAS)]) {
|
|
199
|
+
if (index.has(from))
|
|
200
|
+
continue;
|
|
201
|
+
// `to` is either an attribute name ("stack") or a word inside one.
|
|
202
|
+
const name = merged[to] ? to : (index.get(to) ?? index.get(canonicalTerm(to)));
|
|
203
|
+
if (name)
|
|
204
|
+
index.set(from, name);
|
|
205
|
+
}
|
|
206
|
+
return index;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Ordinal words that point at a position in the previous answer's list. The
|
|
210
|
+
* spelled-out number is the common form; digits show up as "number 2".
|
|
211
|
+
*/
|
|
212
|
+
const ORDINALS = {
|
|
213
|
+
first: 0,
|
|
214
|
+
'1st': 0,
|
|
215
|
+
one: 0,
|
|
216
|
+
second: 1,
|
|
217
|
+
'2nd': 1,
|
|
218
|
+
two: 1,
|
|
219
|
+
third: 2,
|
|
220
|
+
'3rd': 2,
|
|
221
|
+
three: 2,
|
|
222
|
+
fourth: 3,
|
|
223
|
+
'4th': 3,
|
|
224
|
+
four: 3,
|
|
225
|
+
fifth: 4,
|
|
226
|
+
'5th': 4,
|
|
227
|
+
five: 4,
|
|
228
|
+
};
|
|
229
|
+
/** A bare ordinal word counts only when it names a list item. */
|
|
230
|
+
const ORDINAL_NOUN = '(?:one|project|item|entry|card|result|option|thing)';
|
|
231
|
+
/**
|
|
232
|
+
* Singular pointers that can stand for a project. Personal pronouns (he, his,
|
|
233
|
+
* they) are excluded on purpose: on this site they refer to the person, and
|
|
234
|
+
* resolving "his stack" to the last project mentioned was the first wrong
|
|
235
|
+
* answer this slot produced.
|
|
236
|
+
*/
|
|
237
|
+
const OBJECT_PRONOUNS = new Set(['it', 'its', "it's", 'that', 'this', 'those', 'these']);
|
|
238
|
+
/** A query that opens with one of these is a command, so a partial name is not a pointer. */
|
|
239
|
+
const CONTROLLER_OPEN = /^(?:show|open|go|take|read|expand|copy|download|print|visit|browse|scroll|jump|navigate|see|filter|sort)\b/;
|
|
240
|
+
/**
|
|
241
|
+
* Words that join two names conjunctively ("python and sqlite" wants both) and
|
|
242
|
+
* disjunctively ("python or rust" wants either). Read only in the gap between
|
|
243
|
+
* the two names, nearest first: a connective elsewhere in the sentence joins
|
|
244
|
+
* something else, and "neither A nor B" is an exclusion, so `nor` is absent on
|
|
245
|
+
* purpose rather than quietly read as `or`.
|
|
246
|
+
*/
|
|
247
|
+
const ALL_CUES = new Set(['and', 'plus', 'both', 'with', 'also', 'along', 'well', 'as']);
|
|
248
|
+
const ANY_CUES = new Set(['or', 'either', 'versus', 'vs']);
|
|
249
|
+
/**
|
|
250
|
+
* Where a subject name starts inside a token list, trying the camel-split form
|
|
251
|
+
* and the joined spelling the visitor actually types ("TypeScript" vs
|
|
252
|
+
* "typescript"). Every caller that matches a name against text goes through
|
|
253
|
+
* this, so the slot, the span and the exclusion scope cannot disagree.
|
|
254
|
+
*/
|
|
255
|
+
function subjectAt(subject, haystack) {
|
|
256
|
+
// Both sides go through the bundled lemma table before comparison, so "js"
|
|
257
|
+
// reaches JavaScript and "postgres" reaches PostgreSQL without either name
|
|
258
|
+
// having to be spelled out in the app's manifest.
|
|
259
|
+
const tokens = subjectTokens(subject).map(canonicalTerm);
|
|
260
|
+
const words = haystack.map(canonicalTerm);
|
|
261
|
+
const at = matchIndex(tokens, words);
|
|
262
|
+
if (at >= 0)
|
|
263
|
+
return at;
|
|
264
|
+
const joined = tokenize(subject.toLowerCase().replace(/[^a-z0-9]+/g, '')).map(canonicalTerm);
|
|
265
|
+
if (joined.length === 0 || joined.join(' ') === tokens.join(' '))
|
|
266
|
+
return -1;
|
|
267
|
+
return matchIndex(joined, words);
|
|
268
|
+
}
|
|
269
|
+
/** Word index range of a subject name inside the query's plain words. */
|
|
270
|
+
function subjectSpan(subject, words) {
|
|
271
|
+
const forms = [subjectTokens(subject), tokenize(subject.toLowerCase().replace(/[^a-z0-9]+/g, ''))]
|
|
272
|
+
.filter((form) => form.length > 0)
|
|
273
|
+
.filter((form, i, all) => all.findIndex((other) => other.join(' ') === form.join(' ')) === i);
|
|
274
|
+
for (const needle of forms) {
|
|
275
|
+
for (let start = 0; start < words.length; start += 1) {
|
|
276
|
+
let at = 0;
|
|
277
|
+
let i = start;
|
|
278
|
+
for (; i < words.length && at < needle.length; i += 1) {
|
|
279
|
+
if (allDigits(words[i]))
|
|
280
|
+
continue;
|
|
281
|
+
if (words[i] !== needle[at])
|
|
282
|
+
break;
|
|
283
|
+
at += 1;
|
|
284
|
+
}
|
|
285
|
+
if (at === needle.length)
|
|
286
|
+
return { start, end: i - 1 };
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Decides whether two named things are joined by "and" or "or", from the words
|
|
293
|
+
* between them. Two names with no connective get null: "python sqlite" is a
|
|
294
|
+
* half-written list, and answering it as either a union or an intersection
|
|
295
|
+
* would be a guess.
|
|
296
|
+
*/
|
|
297
|
+
function resolveCombine(text, entities) {
|
|
298
|
+
if (entities.length < 2)
|
|
299
|
+
return null;
|
|
300
|
+
const words = plainWords(text);
|
|
301
|
+
const spans = entities
|
|
302
|
+
.map((subject) => ({ subject, span: subjectSpan(subject, words) }))
|
|
303
|
+
.filter((entry) => entry.span !== null)
|
|
304
|
+
.sort((a, b) => a.span.start - b.span.start);
|
|
305
|
+
if (spans.length < 2)
|
|
306
|
+
return null;
|
|
307
|
+
const [first, second] = [spans[0], spans[1]];
|
|
308
|
+
if (second.span.start <= first.span.end)
|
|
309
|
+
return null;
|
|
310
|
+
const gap = words.slice(first.span.end + 1, second.span.start);
|
|
311
|
+
for (let i = gap.length - 1; i >= 0; i -= 1) {
|
|
312
|
+
const word = gap[i];
|
|
313
|
+
if (ANY_CUES.has(word))
|
|
314
|
+
return { op: 'any', between: [first.subject, second.subject], cue: word };
|
|
315
|
+
if (ALL_CUES.has(word))
|
|
316
|
+
return { op: 'all', between: [first.subject, second.subject], cue: word };
|
|
317
|
+
}
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
/** The plain words of a query, used for prefix matching against subject names. */
|
|
321
|
+
function plainWords(query) {
|
|
322
|
+
return query
|
|
323
|
+
.toLowerCase()
|
|
324
|
+
.replace(/[^a-z0-9' ]+/g, ' ')
|
|
325
|
+
.split(/\s+/)
|
|
326
|
+
.filter(Boolean);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Resolves a pointer to a declared subject, or returns null.
|
|
330
|
+
*
|
|
331
|
+
* Three cues, in the order a reader would try them: an ordinal position in the
|
|
332
|
+
* list the last answer produced, a singular pronoun standing in for the last
|
|
333
|
+
* subject, then a truncated name ("ground" for Groundglass). Each needs the
|
|
334
|
+
* context that makes it meaningful, and returns null without it, which is the
|
|
335
|
+
* honest answer: "the second one" with no list behind it points nowhere.
|
|
336
|
+
*/
|
|
337
|
+
function resolveReference(text, query, subjects, named, attributes, context) {
|
|
338
|
+
// A question that names what it is about still points elsewhere with a
|
|
339
|
+
// pronoun: "does it use sqlite" names SQLite and points at the project.
|
|
340
|
+
const items = context?.items ?? [];
|
|
341
|
+
const previous = context?.subject ?? null;
|
|
342
|
+
const ordinalNoun = new RegExp(`\\b(?:the\\s+)?(${Object.keys(ORDINALS).join('|')})\\s+${ORDINAL_NOUN}\\b`);
|
|
343
|
+
const ordinalNumber = new RegExp(`\\bnumber\\s+(${Object.keys(ORDINALS).join('|')})\\b`);
|
|
344
|
+
const lastNoun = new RegExp(`\\b(?:the\\s+)?last\\s+${ORDINAL_NOUN}\\b`);
|
|
345
|
+
const ordinalMatch = text.match(ordinalNoun) ?? text.match(ordinalNumber);
|
|
346
|
+
if (ordinalMatch) {
|
|
347
|
+
// "the second one" only means something after a list.
|
|
348
|
+
if (items.length === 0)
|
|
349
|
+
return null;
|
|
350
|
+
const index = ORDINALS[ordinalMatch[1]];
|
|
351
|
+
if (index === undefined || index >= items.length)
|
|
352
|
+
return null;
|
|
353
|
+
return { kind: 'ordinal', value: items[index], cue: ordinalMatch[0].trim() };
|
|
354
|
+
}
|
|
355
|
+
const lastMatch = text.match(lastNoun);
|
|
356
|
+
if (lastMatch) {
|
|
357
|
+
if (items.length === 0)
|
|
358
|
+
return null;
|
|
359
|
+
return { kind: 'ordinal', value: items[items.length - 1], cue: lastMatch[0].trim() };
|
|
360
|
+
}
|
|
361
|
+
const words = plainWords(text);
|
|
362
|
+
const pronounAt = words.findIndex((word) => OBJECT_PRONOUNS.has(word));
|
|
363
|
+
// "the one that uses sqlite" is a description, not a pointer: the demonstrative
|
|
364
|
+
// is a relative pronoun introducing a filter, so no antecedent answers it.
|
|
365
|
+
const RELATIVE_VERBS = new Set([
|
|
366
|
+
'is', 'are', 'was', 'were', 'has', 'have', 'had', 'does', 'do', 'did',
|
|
367
|
+
'use', 'uses', 'used', 'link', 'links', 'links', 'costs', 'cost', 'supports',
|
|
368
|
+
'runs', 'run', 'ships', 'ship', 'works', 'work', 'needs', 'need',
|
|
369
|
+
]);
|
|
370
|
+
const relative = pronounAt >= 0 &&
|
|
371
|
+
['that', 'this', 'those', 'these'].includes(words[pronounAt]) &&
|
|
372
|
+
RELATIVE_VERBS.has(words[pronounAt + 1] ?? '');
|
|
373
|
+
const pronoun = pronounAt >= 0 && !relative ? words[pronounAt] : null;
|
|
374
|
+
if (pronoun && previous) {
|
|
375
|
+
return { kind: 'pronoun', value: previous, cue: pronoun };
|
|
376
|
+
}
|
|
377
|
+
// A partial name is the last resort, and only for a question that named no
|
|
378
|
+
// subject: "read the newest post" opens with a command and must reach the
|
|
379
|
+
// read action, not the Readback project that shares its first four letters.
|
|
380
|
+
if (named.length > 0 || CONTROLLER_OPEN.test(text.trim()))
|
|
381
|
+
return null;
|
|
382
|
+
const frame = new Set([...FRAME_WORDS, ...PRONOUNS]);
|
|
383
|
+
for (const subject of subjects) {
|
|
384
|
+
for (const token of subjectTokens(subject)) {
|
|
385
|
+
if (token.length < 4 || allDigits(token))
|
|
386
|
+
continue;
|
|
387
|
+
const hit = words.find((word) => word.length >= 4 &&
|
|
388
|
+
word !== token &&
|
|
389
|
+
token.startsWith(word) &&
|
|
390
|
+
!frame.has(word) &&
|
|
391
|
+
!attributes.has(word));
|
|
392
|
+
if (hit)
|
|
393
|
+
return { kind: 'partial', value: subject, cue: hit };
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Classifies a question and fills the slots a router can act on.
|
|
400
|
+
*
|
|
401
|
+
* Deterministic: same string and context, same analysis, no state between calls.
|
|
402
|
+
*/
|
|
403
|
+
export function analyzeQuestion(query, options = {}) {
|
|
404
|
+
const text = query.toLowerCase();
|
|
405
|
+
const queryTokens = tokenize(query);
|
|
406
|
+
const cues = [];
|
|
407
|
+
const scores = new Map();
|
|
408
|
+
for (const cue of CUES) {
|
|
409
|
+
let score = 0;
|
|
410
|
+
for (const pattern of cue.patterns) {
|
|
411
|
+
if (pattern.test(text)) {
|
|
412
|
+
score += cue.weight;
|
|
413
|
+
cues.push(cue.label);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
if (score > 0)
|
|
417
|
+
scores.set(cue.type, score);
|
|
418
|
+
}
|
|
419
|
+
const ranked = [...scores.entries()].sort((a, b) => b[1] - a[1]);
|
|
420
|
+
const type = ranked.length > 0 ? ranked[0][0] : 'unknown';
|
|
421
|
+
const topScore = ranked.length > 0 ? ranked[0][1] : 0;
|
|
422
|
+
const second = ranked.length > 1 ? ranked[1] : null;
|
|
423
|
+
const contested = second && topScore - second[1] < 1 ? second[0] : null;
|
|
424
|
+
// Entity slots: longest declared subject wins a shared span, then the rest in
|
|
425
|
+
// the order the visitor named them, so `subject` is what they asked about first.
|
|
426
|
+
const subjects = [...(options.subjects ?? [])].sort((a, b) => subjectTokens(b).length - subjectTokens(a).length);
|
|
427
|
+
const matched = [];
|
|
428
|
+
for (const subject of subjects) {
|
|
429
|
+
const at = subjectAt(subject, queryTokens);
|
|
430
|
+
if (at < 0)
|
|
431
|
+
continue;
|
|
432
|
+
if (matched.some((entry) => entry.subject === subject))
|
|
433
|
+
continue;
|
|
434
|
+
matched.push({ subject, at });
|
|
435
|
+
}
|
|
436
|
+
matched.sort((a, b) => a.at - b.at);
|
|
437
|
+
// A subject inside a negation scope is what the visitor ruled out, not what
|
|
438
|
+
// they asked about: "which projects use python but not readback" has one
|
|
439
|
+
// entity and one exclusion.
|
|
440
|
+
const scopes = negationScopes(text);
|
|
441
|
+
const exclude = matched
|
|
442
|
+
.filter((entry) => scopes.some((scope) => subjectAt(entry.subject, tokenize(scope)) >= 0))
|
|
443
|
+
.map((entry) => entry.subject);
|
|
444
|
+
const entities = matched.map((entry) => entry.subject).filter((subject) => !exclude.includes(subject));
|
|
445
|
+
// Two things the visitor named are joined by whatever sits between them:
|
|
446
|
+
// "python and sqlite" is an intersection, "python or rust" a union.
|
|
447
|
+
const combine = resolveCombine(text, entities);
|
|
448
|
+
// Mentions stay keyed on everything the visitor named, including the ones they
|
|
449
|
+
// excluded: "not Django" is still a word the answer should acknowledge.
|
|
450
|
+
const entityTokens = new Set(matched.flatMap((entry) => subjectTokens(entry.subject)));
|
|
451
|
+
const attributes = attributeIndex(options.attributes);
|
|
452
|
+
const attributeHits = new Map();
|
|
453
|
+
for (const token of queryTokens) {
|
|
454
|
+
const attribute = attributes.get(token);
|
|
455
|
+
if (!attribute)
|
|
456
|
+
continue;
|
|
457
|
+
attributeHits.set(attribute, (attributeHits.get(attribute) ?? 0) + 1);
|
|
458
|
+
}
|
|
459
|
+
// "written in" asks which language, not about the writing: the token form
|
|
460
|
+
// scored as `writing` and outranked nothing, so the phrase is read first.
|
|
461
|
+
// "shipped in", "built on" and "powered by" are the same shape, and they are
|
|
462
|
+
// how visitors describe a finished stack without ever saying "stack".
|
|
463
|
+
const stackPhrase = /\b(?:written|built|coded|implemented|made|shipped|powered|runs|running) (?:in|with|on|by)\b/.test(text);
|
|
464
|
+
const winner = [...attributeHits.entries()].sort((a, b) => b[1] - a[1] || (ATTRIBUTE_PRIORITY[b[0]] ?? 0) - (ATTRIBUTE_PRIORITY[a[0]] ?? 0))[0]?.[0] ?? null;
|
|
465
|
+
const attribute = stackPhrase && (!winner || winner === 'writing' || winner === 'projects') ? 'stack' : winner;
|
|
466
|
+
const referenced = /\b(?:he|him|his|she|her|it|its|they|them|their|that|those)\b/.test(text) &&
|
|
467
|
+
entities.length === 0;
|
|
468
|
+
const newest = /\b(?:newest|latest|most recent)\b/.test(text)
|
|
469
|
+
? 'newest'
|
|
470
|
+
: /\b(?:oldest|earliest|first ever)\b/.test(text)
|
|
471
|
+
? 'oldest'
|
|
472
|
+
: null;
|
|
473
|
+
const mentions = [
|
|
474
|
+
...new Set(queryTokens.filter((token) => !entityTokens.has(token) &&
|
|
475
|
+
!attributes.has(token) &&
|
|
476
|
+
!FRAME_WORDS.has(token) &&
|
|
477
|
+
!PRONOUNS.has(token))),
|
|
478
|
+
];
|
|
479
|
+
const resolved = resolveReference(text, query, subjects, entities, attributes, options.context);
|
|
480
|
+
const subject = entities[0] ?? resolved?.value ?? null;
|
|
481
|
+
const confidence = topScore === 0 ? 0 : Math.min(1, topScore / 3);
|
|
482
|
+
return {
|
|
483
|
+
type,
|
|
484
|
+
confidence,
|
|
485
|
+
contested,
|
|
486
|
+
questionShaped: type !== 'unknown' || /\?\s*$/.test(query),
|
|
487
|
+
slots: {
|
|
488
|
+
subject,
|
|
489
|
+
attribute,
|
|
490
|
+
entities,
|
|
491
|
+
combine,
|
|
492
|
+
newest,
|
|
493
|
+
referenced: referenced || resolved !== null,
|
|
494
|
+
reference: resolved,
|
|
495
|
+
exclude,
|
|
496
|
+
mentions,
|
|
497
|
+
},
|
|
498
|
+
cues: [...new Set([...cues, ...(resolved ? [`reference:${resolved.kind}`] : [])])],
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
//# sourceMappingURL=question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.js","sourceRoot":"","sources":["../../src/core/question.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAmHrE;;;;;GAKG;AACH,MAAM,IAAI,GAAU;IAClB;QACE,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE;YACR,YAAY;YACZ,4CAA4C;YAC5C,uCAAuC;YACvC,uCAAuC;YACvC,oDAAoD;YACpD,6CAA6C;YAC7C,WAAW;YACX,YAAY;YACZ,4CAA4C;SAC7C;KACF;IACD;QACE,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE;YACR,uBAAuB;YACvB,eAAe;YACf,gCAAgC;YAChC,UAAU;YACV,4BAA4B;SAC7B;KACF;IACD;QACE,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,CAAC,SAAS,EAAE,qCAAqC,EAAE,oCAAoC,CAAC;KACnG;IACD;QACE,IAAI,EAAE,OAAO;QACb,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,OAAO;QACd,QAAQ,EAAE,CAAC,WAAW,EAAE,6CAA6C,CAAC;KACvE;IACD;QACE,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE;YACR,UAAU;YACV,mCAAmC;YACnC,gCAAgC;YAChC,wBAAwB;SACzB;KACF;IACD;QACE,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,GA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