vesper-wizard 2.3.0 → 2.3.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/README.md +37 -322
- package/package.json +34 -100
- package/vesper-mcp-config.json +6 -0
- package/{scripts/wizard.js → wizard.js} +34 -10
- package/LICENSE +0 -21
- package/build/cache/cdn.js +0 -34
- package/build/cache/service.js +0 -63
- package/build/cleaning/cleaner.js +0 -81
- package/build/cleaning/evaluator.js +0 -89
- package/build/cleaning/executor.js +0 -62
- package/build/cleaning/exporter.js +0 -87
- package/build/cleaning/planner.js +0 -127
- package/build/cleaning/rules.js +0 -57
- package/build/cleaning/types.js +0 -1
- package/build/cloud/adapters/local.js +0 -37
- package/build/cloud/adapters/s3.js +0 -24
- package/build/cloud/adapters/supabase.js +0 -49
- package/build/cloud/storage-manager.js +0 -26
- package/build/cloud/types.js +0 -1
- package/build/compliance/service.js +0 -73
- package/build/compliance/store.js +0 -80
- package/build/compliance/types.js +0 -1
- package/build/config/config-manager.js +0 -221
- package/build/config/secure-keys.js +0 -51
- package/build/config/user-config.js +0 -48
- package/build/data/processing-worker.js +0 -23
- package/build/data/streaming.js +0 -38
- package/build/data/worker-pool.js +0 -39
- package/build/export/exporter.js +0 -82
- package/build/export/packager.js +0 -100
- package/build/export/types.js +0 -1
- package/build/fusion/aligner.js +0 -56
- package/build/fusion/deduplicator.js +0 -69
- package/build/fusion/engine.js +0 -69
- package/build/fusion/harmonizer.js +0 -39
- package/build/fusion/orchestrator.js +0 -86
- package/build/fusion/types.js +0 -1
- package/build/gateway/unified-dataset-gateway.js +0 -410
- package/build/index.js +0 -3068
- package/build/ingestion/hf-downloader.js +0 -171
- package/build/ingestion/ingestor.js +0 -271
- package/build/ingestion/kaggle-downloader.js +0 -102
- package/build/install/install-service.js +0 -46
- package/build/jobs/manager.js +0 -136
- package/build/jobs/queue.js +0 -59
- package/build/jobs/types.js +0 -1
- package/build/lib/supabase.js +0 -3
- package/build/metadata/dataworld-source.js +0 -89
- package/build/metadata/domain.js +0 -147
- package/build/metadata/github-scraper.js +0 -47
- package/build/metadata/institutional-scrapers.js +0 -49
- package/build/metadata/kaggle-scraper.js +0 -182
- package/build/metadata/kaggle-source.js +0 -70
- package/build/metadata/license.js +0 -68
- package/build/metadata/monitoring-service.js +0 -107
- package/build/metadata/monitoring-store.js +0 -78
- package/build/metadata/monitoring-types.js +0 -1
- package/build/metadata/openml-source.js +0 -87
- package/build/metadata/quality.js +0 -48
- package/build/metadata/rate-limiter.js +0 -128
- package/build/metadata/scraper.js +0 -448
- package/build/metadata/store.js +0 -340
- package/build/metadata/types.js +0 -1
- package/build/metadata/uci-scraper.js +0 -49
- package/build/monitoring/observability.js +0 -76
- package/build/preparation/target-detector.js +0 -75
- package/build/python/__pycache__/config.cpython-312.pyc +0 -0
- package/build/python/asset_downloader_engine.py +0 -94
- package/build/python/cleaner.py +0 -226
- package/build/python/config.py +0 -263
- package/build/python/convert_engine.py +0 -92
- package/build/python/dataworld_engine.py +0 -208
- package/build/python/export_engine.py +0 -288
- package/build/python/framework_adapters.py +0 -100
- package/build/python/fusion_engine.py +0 -368
- package/build/python/github_adapter.py +0 -106
- package/build/python/hf_fallback.py +0 -298
- package/build/python/image_engine.py +0 -86
- package/build/python/kaggle_engine.py +0 -295
- package/build/python/media_engine.py +0 -133
- package/build/python/nasa_adapter.py +0 -82
- package/build/python/normalize_engine.py +0 -83
- package/build/python/openml_engine.py +0 -146
- package/build/python/quality_engine.py +0 -267
- package/build/python/row_count.py +0 -54
- package/build/python/splitter_engine.py +0 -283
- package/build/python/target_engine.py +0 -154
- package/build/python/test_framework_adapters.py +0 -61
- package/build/python/test_fusion_engine.py +0 -89
- package/build/python/uci_adapter.py +0 -94
- package/build/python/vesper/__init__.py +0 -1
- package/build/python/vesper/__pycache__/__init__.cpython-312.pyc +0 -0
- package/build/python/vesper/core/__init__.py +0 -1
- package/build/python/vesper/core/__pycache__/__init__.cpython-312.pyc +0 -0
- package/build/python/vesper/core/__pycache__/asset_downloader.cpython-312.pyc +0 -0
- package/build/python/vesper/core/__pycache__/download_recipe.cpython-312.pyc +0 -0
- package/build/python/vesper/core/asset_downloader.py +0 -679
- package/build/python/vesper/core/download_recipe.py +0 -104
- package/build/python/worldbank_adapter.py +0 -99
- package/build/quality/analyzer.js +0 -93
- package/build/quality/image-analyzer.js +0 -114
- package/build/quality/media-analyzer.js +0 -115
- package/build/quality/quality-orchestrator.js +0 -162
- package/build/quality/types.js +0 -1
- package/build/scripts/build-index.js +0 -54
- package/build/scripts/check-db.js +0 -73
- package/build/scripts/check-jobs.js +0 -24
- package/build/scripts/check-naruto.js +0 -17
- package/build/scripts/cleanup-kaggle.js +0 -41
- package/build/scripts/demo-full-pipeline.js +0 -62
- package/build/scripts/demo-ui.js +0 -58
- package/build/scripts/e2e-demo.js +0 -72
- package/build/scripts/massive-scrape.js +0 -103
- package/build/scripts/ops-dashboard.js +0 -33
- package/build/scripts/repro-bug.js +0 -37
- package/build/scripts/repro-export-bug.js +0 -56
- package/build/scripts/scrape-metadata.js +0 -100
- package/build/scripts/search-cli.js +0 -26
- package/build/scripts/test-bias.js +0 -45
- package/build/scripts/test-caching.js +0 -51
- package/build/scripts/test-cleaning.js +0 -76
- package/build/scripts/test-cloud-storage.js +0 -48
- package/build/scripts/test-compliance.js +0 -58
- package/build/scripts/test-conversion.js +0 -64
- package/build/scripts/test-custom-rules.js +0 -58
- package/build/scripts/test-db-opt.js +0 -63
- package/build/scripts/test-export-custom.js +0 -33
- package/build/scripts/test-exporter.js +0 -53
- package/build/scripts/test-fusion.js +0 -61
- package/build/scripts/test-github.js +0 -27
- package/build/scripts/test-group-split.js +0 -52
- package/build/scripts/test-hf-download.js +0 -29
- package/build/scripts/test-holdout-manager.js +0 -61
- package/build/scripts/test-hybrid-search.js +0 -41
- package/build/scripts/test-image-analysis.js +0 -50
- package/build/scripts/test-ingestion-infra.js +0 -39
- package/build/scripts/test-install.js +0 -40
- package/build/scripts/test-institutional.js +0 -26
- package/build/scripts/test-integrity.js +0 -41
- package/build/scripts/test-jit.js +0 -42
- package/build/scripts/test-job-queue.js +0 -62
- package/build/scripts/test-kaggle-download.js +0 -34
- package/build/scripts/test-large-data.js +0 -50
- package/build/scripts/test-mcp-v5.js +0 -74
- package/build/scripts/test-media-analysis.js +0 -61
- package/build/scripts/test-monitoring.js +0 -91
- package/build/scripts/test-observability.js +0 -106
- package/build/scripts/test-packager.js +0 -55
- package/build/scripts/test-pipeline.js +0 -50
- package/build/scripts/test-planning.js +0 -64
- package/build/scripts/test-privacy.js +0 -38
- package/build/scripts/test-production-sync.js +0 -36
- package/build/scripts/test-quality.js +0 -43
- package/build/scripts/test-robust-ingestion.js +0 -41
- package/build/scripts/test-schema.js +0 -45
- package/build/scripts/test-split-validation.js +0 -40
- package/build/scripts/test-splitter.js +0 -93
- package/build/scripts/test-target-detector.js +0 -29
- package/build/scripts/test-uci.js +0 -27
- package/build/scripts/test-unified-quality.js +0 -86
- package/build/scripts/test-write.js +0 -14
- package/build/scripts/verify-integration.js +0 -57
- package/build/scripts/verify-priority.js +0 -33
- package/build/search/embedder.js +0 -34
- package/build/search/engine.js +0 -190
- package/build/search/jit-orchestrator.js +0 -262
- package/build/search/query-intent.js +0 -509
- package/build/search/vector-store.js +0 -123
- package/build/splitting/splitter.js +0 -82
- package/build/splitting/types.js +0 -1
- package/build/tools/formatter.js +0 -251
- package/build/utils/downloader.js +0 -52
- package/build/utils/python-runtime.js +0 -130
- package/build/utils/selector.js +0 -69
- package/mcp-config-template.json +0 -18
- package/scripts/postinstall.cjs +0 -170
- package/scripts/preindex_registry.cjs +0 -157
- package/scripts/refresh-index.cjs +0 -87
- package/scripts/wizard.cjs +0 -601
- package/src/python/__pycache__/config.cpython-312.pyc +0 -0
- package/src/python/__pycache__/export_engine.cpython-312.pyc +0 -0
- package/src/python/__pycache__/framework_adapters.cpython-312.pyc +0 -0
- package/src/python/__pycache__/fusion_engine.cpython-312.pyc +0 -0
- package/src/python/__pycache__/kaggle_engine.cpython-312.pyc +0 -0
- package/src/python/asset_downloader_engine.py +0 -94
- package/src/python/cleaner.py +0 -226
- package/src/python/config.py +0 -263
- package/src/python/convert_engine.py +0 -92
- package/src/python/dataworld_engine.py +0 -208
- package/src/python/export_engine.py +0 -288
- package/src/python/framework_adapters.py +0 -100
- package/src/python/fusion_engine.py +0 -368
- package/src/python/github_adapter.py +0 -106
- package/src/python/hf_fallback.py +0 -298
- package/src/python/image_engine.py +0 -86
- package/src/python/kaggle_engine.py +0 -295
- package/src/python/media_engine.py +0 -133
- package/src/python/nasa_adapter.py +0 -82
- package/src/python/normalize_engine.py +0 -83
- package/src/python/openml_engine.py +0 -146
- package/src/python/quality_engine.py +0 -267
- package/src/python/row_count.py +0 -54
- package/src/python/splitter_engine.py +0 -283
- package/src/python/target_engine.py +0 -154
- package/src/python/test_framework_adapters.py +0 -61
- package/src/python/test_fusion_engine.py +0 -89
- package/src/python/uci_adapter.py +0 -94
- package/src/python/vesper/__init__.py +0 -1
- package/src/python/vesper/core/__init__.py +0 -1
- package/src/python/vesper/core/asset_downloader.py +0 -679
- package/src/python/vesper/core/download_recipe.py +0 -104
- package/src/python/worldbank_adapter.py +0 -99
- package/wizard.cjs +0 -3
|
@@ -1,509 +0,0 @@
|
|
|
1
|
-
import { classifyDomain } from "../metadata/domain.js";
|
|
2
|
-
const STOP_WORDS = new Set([
|
|
3
|
-
"a", "an", "the", "and", "or", "but", "in", "on", "at", "to", "for",
|
|
4
|
-
"of", "with", "by", "from", "as", "is", "was", "are", "were", "been",
|
|
5
|
-
"be", "have", "has", "had", "do", "does", "did", "will", "would",
|
|
6
|
-
"could", "should", "may", "might", "must", "shall", "can", "need",
|
|
7
|
-
"about", "into", "through", "during", "before", "after", "above",
|
|
8
|
-
"below", "between", "under", "again", "further", "then", "once",
|
|
9
|
-
"here", "there", "when", "where", "why", "how", "all", "each",
|
|
10
|
-
"few", "more", "most", "other", "some", "such", "no", "nor", "not",
|
|
11
|
-
"only", "own", "same", "so", "than", "too", "very", "just", "also",
|
|
12
|
-
"dataset", "datasets", "data", "find", "search", "looking", "need", "want",
|
|
13
|
-
"give", "show", "me", "please"
|
|
14
|
-
]);
|
|
15
|
-
const LANGUAGE_ALIASES = {
|
|
16
|
-
english: ["english", "en", "eng"],
|
|
17
|
-
spanish: ["spanish", "es", "spa"],
|
|
18
|
-
french: ["french", "fr", "fra"],
|
|
19
|
-
german: ["german", "de", "deu"],
|
|
20
|
-
portuguese: ["portuguese", "pt", "por"],
|
|
21
|
-
chinese: ["chinese", "zh", "cmn"],
|
|
22
|
-
japanese: ["japanese", "ja", "jpn"],
|
|
23
|
-
korean: ["korean", "ko", "kor"],
|
|
24
|
-
arabic: ["arabic", "ar", "ara"],
|
|
25
|
-
russian: ["russian", "ru", "rus"],
|
|
26
|
-
hindi: ["hindi", "hi", "hin"],
|
|
27
|
-
multilingual: ["multilingual", "bilingual", "cross-lingual", "crosslingual"],
|
|
28
|
-
};
|
|
29
|
-
const TASK_PATTERNS = [
|
|
30
|
-
{ task: "translation", patterns: [/\btranslation\b/i, /\bmachine translation\b/i, /\bparallel corpus\b/i] },
|
|
31
|
-
{ task: "question-answering", patterns: [/\bquestion answering\b/i, /\bqa\b/i, /\bq&a\b/i] },
|
|
32
|
-
{ task: "summarization", patterns: [/\bsummarization\b/i, /\bsummary\b/i, /\btl;dr\b/i] },
|
|
33
|
-
{ task: "sentiment-analysis", patterns: [/\bsentiment\b/i, /\bsentiment analysis\b/i] },
|
|
34
|
-
{ task: "text-classification", patterns: [/\bclassification\b/i, /\bclassifier\b/i, /\btext classification\b/i] },
|
|
35
|
-
{ task: "token-classification", patterns: [/\bner\b/i, /\bnamed entity\b/i, /\btoken classification\b/i] },
|
|
36
|
-
{ task: "text-generation", patterns: [/\btext generation\b/i, /\bgenerative\b/i, /\binstruction\b/i, /\bchat\b/i] },
|
|
37
|
-
{ task: "image-classification", patterns: [/\bimage classification\b/i] },
|
|
38
|
-
{ task: "object-detection", patterns: [/\bobject detection\b/i, /\bdetection\b/i] },
|
|
39
|
-
];
|
|
40
|
-
const intentCache = new Map();
|
|
41
|
-
export async function analyzeDatasetQuery(query, requirements) {
|
|
42
|
-
const cacheKey = `${query || ""}::${requirements || ""}`;
|
|
43
|
-
const cached = intentCache.get(cacheKey);
|
|
44
|
-
if (cached) {
|
|
45
|
-
return cached;
|
|
46
|
-
}
|
|
47
|
-
const task = (async () => {
|
|
48
|
-
const heuristic = buildHeuristicIntent(query, requirements);
|
|
49
|
-
const llmIntent = await tryLlmIntent(heuristic, requirements);
|
|
50
|
-
return llmIntent ? mergeIntent(heuristic, llmIntent) : heuristic;
|
|
51
|
-
})();
|
|
52
|
-
intentCache.set(cacheKey, task);
|
|
53
|
-
return task;
|
|
54
|
-
}
|
|
55
|
-
export function scoreDatasetAgainstIntent(dataset, intent) {
|
|
56
|
-
if (!intent)
|
|
57
|
-
return 0;
|
|
58
|
-
const text = [
|
|
59
|
-
dataset.name,
|
|
60
|
-
dataset.description,
|
|
61
|
-
dataset.task,
|
|
62
|
-
dataset.domain || "",
|
|
63
|
-
dataset.tags.join(" "),
|
|
64
|
-
dataset.languages.join(" "),
|
|
65
|
-
].join(" ").toLowerCase();
|
|
66
|
-
let score = 0;
|
|
67
|
-
if (intent.language) {
|
|
68
|
-
const aliases = getLanguageAliases(intent.language);
|
|
69
|
-
const datasetLanguages = dataset.languages.map(normalizeToken);
|
|
70
|
-
const languageMatch = aliases.some(alias => datasetLanguages.includes(alias) || text.includes(alias));
|
|
71
|
-
const isMultilingualIntent = intent.language === "multilingual";
|
|
72
|
-
if (languageMatch) {
|
|
73
|
-
// Check if the dataset is monolingual in the requested language vs multilingual
|
|
74
|
-
const nonRequestedLanguages = datasetLanguages.filter(lang => !aliases.includes(lang) && lang !== "" && lang !== "unknown");
|
|
75
|
-
if (nonRequestedLanguages.length === 0 || isMultilingualIntent) {
|
|
76
|
-
// Purely the requested language (or user wants multilingual) → full boost
|
|
77
|
-
score += 0.55;
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
// Bilingual/multilingual dataset that CONTAINS the language but isn't exclusive
|
|
81
|
-
// Penalize proportionally to how many other languages are present
|
|
82
|
-
const ratio = nonRequestedLanguages.length / Math.max(datasetLanguages.length, 1);
|
|
83
|
-
score += 0.1 - (ratio * 0.4); // ranges from +0.1 (mostly target lang) to -0.3 (mostly other langs)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if (dataset.languages.length > 0) {
|
|
87
|
-
score -= 0.65;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
score -= 0.1;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (intent.task) {
|
|
94
|
-
if (matchesTask(dataset, intent.task, text)) {
|
|
95
|
-
score += 0.35;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
score -= 0.3;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (intent.domain && intent.domain !== "general" && intent.domain !== "unknown") {
|
|
102
|
-
const datasetDomain = String(dataset.domain || "").toLowerCase();
|
|
103
|
-
if (datasetDomain === intent.domain || text.includes(intent.domain)) {
|
|
104
|
-
score += 0.25;
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
score -= 0.2;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (intent.minRows && intent.minRows > 0) {
|
|
111
|
-
const totalExamples = Number(dataset.total_examples || 0);
|
|
112
|
-
if (totalExamples > 0) {
|
|
113
|
-
const ratio = totalExamples / intent.minRows;
|
|
114
|
-
if (ratio >= 1) {
|
|
115
|
-
score += Math.min(0.45, 0.18 + (Math.log10(ratio + 1) * 0.15));
|
|
116
|
-
}
|
|
117
|
-
else if (ratio < 0.05) {
|
|
118
|
-
score -= 1.2;
|
|
119
|
-
}
|
|
120
|
-
else if (ratio < 0.25) {
|
|
121
|
-
score -= 0.8;
|
|
122
|
-
}
|
|
123
|
-
else if (ratio < 0.5) {
|
|
124
|
-
score -= 0.45;
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
score -= 0.15;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
score -= 0.08;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (intent.positiveTerms.length > 0) {
|
|
135
|
-
const matches = intent.positiveTerms.filter(term => text.includes(term)).length;
|
|
136
|
-
score += Math.min(0.25, matches * 0.06);
|
|
137
|
-
}
|
|
138
|
-
if (intent.negativeTerms.some(term => text.includes(term))) {
|
|
139
|
-
score -= 0.7;
|
|
140
|
-
}
|
|
141
|
-
return Math.round(score * 100) / 100;
|
|
142
|
-
}
|
|
143
|
-
export function buildIntentSearchQuery(intent) {
|
|
144
|
-
return intent.searchQuery;
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Build HuggingFace-compatible filter tags from the parsed intent.
|
|
148
|
-
* Returns e.g. ["language:en", "task_ids:text-classification"].
|
|
149
|
-
*/
|
|
150
|
-
export function buildHuggingFaceFilterTags(intent) {
|
|
151
|
-
const tags = [];
|
|
152
|
-
if (intent.language && intent.language !== "multilingual") {
|
|
153
|
-
const langCode = LANGUAGE_TO_CODE[intent.language];
|
|
154
|
-
if (langCode)
|
|
155
|
-
tags.push(`language:${langCode}`);
|
|
156
|
-
}
|
|
157
|
-
if (intent.task) {
|
|
158
|
-
tags.push(`task_ids:${intent.task}`);
|
|
159
|
-
}
|
|
160
|
-
return tags;
|
|
161
|
-
}
|
|
162
|
-
const LANGUAGE_TO_CODE = {
|
|
163
|
-
english: "en",
|
|
164
|
-
spanish: "es",
|
|
165
|
-
french: "fr",
|
|
166
|
-
german: "de",
|
|
167
|
-
portuguese: "pt",
|
|
168
|
-
chinese: "zh",
|
|
169
|
-
japanese: "ja",
|
|
170
|
-
korean: "ko",
|
|
171
|
-
arabic: "ar",
|
|
172
|
-
russian: "ru",
|
|
173
|
-
hindi: "hi",
|
|
174
|
-
};
|
|
175
|
-
const BILINGUAL_INDICATORS = [
|
|
176
|
-
"translation", "parallel", "bilingual", "multilingual",
|
|
177
|
-
"cross-lingual", "crosslingual", "machine-translation",
|
|
178
|
-
"aligned", "comparable corpus",
|
|
179
|
-
];
|
|
180
|
-
/**
|
|
181
|
-
* Hard-exclude a dataset when the user requests a single specific language
|
|
182
|
-
* and the dataset is bilingual, multilingual, or tagged with other languages.
|
|
183
|
-
* Returns true if the dataset should be EXCLUDED from results.
|
|
184
|
-
*/
|
|
185
|
-
export function shouldExcludeByLanguage(dataset, intent) {
|
|
186
|
-
if (!intent?.language || intent.language === "multilingual")
|
|
187
|
-
return false;
|
|
188
|
-
const aliases = getLanguageAliases(intent.language);
|
|
189
|
-
const datasetLanguages = dataset.languages.map(normalizeToken).filter(l => l && l !== "unknown");
|
|
190
|
-
// If the dataset has language tags and ANY of them are NOT the requested language, exclude
|
|
191
|
-
if (datasetLanguages.length > 0) {
|
|
192
|
-
const hasRequestedLang = aliases.some(a => datasetLanguages.includes(a));
|
|
193
|
-
const hasOtherLangs = datasetLanguages.some(lang => !aliases.includes(lang));
|
|
194
|
-
if (hasOtherLangs)
|
|
195
|
-
return true; // bilingual/multilingual → exclude
|
|
196
|
-
if (!hasRequestedLang)
|
|
197
|
-
return true; // wrong language entirely
|
|
198
|
-
}
|
|
199
|
-
// Check name, description, and tags for bilingual indicators or other language names
|
|
200
|
-
const text = [
|
|
201
|
-
dataset.name,
|
|
202
|
-
dataset.description,
|
|
203
|
-
dataset.tags.join(" "),
|
|
204
|
-
].join(" ").toLowerCase();
|
|
205
|
-
// Check for bilingual/translation keywords
|
|
206
|
-
if (BILINGUAL_INDICATORS.some(indicator => text.includes(indicator))) {
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
// Check if the text mentions other specific languages by name
|
|
210
|
-
const otherLanguageNames = Object.keys(LANGUAGE_ALIASES).filter(lang => lang !== intent.language && lang !== "multilingual");
|
|
211
|
-
for (const otherLang of otherLanguageNames) {
|
|
212
|
-
const otherAliases = LANGUAGE_ALIASES[otherLang];
|
|
213
|
-
// Only check the full language name (not 2-letter codes which could appear in regular text)
|
|
214
|
-
if (otherAliases && otherAliases[0] && text.includes(otherAliases[0])) {
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
function buildHeuristicIntent(query, requirements) {
|
|
221
|
-
const originalQuery = `${query || ""} ${requirements || ""}`.trim();
|
|
222
|
-
const normalizedQuery = originalQuery.toLowerCase();
|
|
223
|
-
const negativeTerms = [...normalizedQuery.matchAll(/(?:^|\s)-([\w-]{2,})/g)].map(match => normalizeToken(match[1]));
|
|
224
|
-
const positiveTerms = tokenize(normalizedQuery)
|
|
225
|
-
.filter(token => !negativeTerms.includes(token))
|
|
226
|
-
.slice(0, 8);
|
|
227
|
-
const task = detectTask(normalizedQuery);
|
|
228
|
-
const language = detectLanguage(normalizedQuery);
|
|
229
|
-
const domain = classifyDomain(normalizedQuery, [], normalizedQuery, task);
|
|
230
|
-
const minRows = extractRequestedRows(normalizedQuery);
|
|
231
|
-
const searchTerms = [
|
|
232
|
-
language,
|
|
233
|
-
task,
|
|
234
|
-
domain !== "general" && domain !== "unknown" ? domain : undefined,
|
|
235
|
-
...positiveTerms,
|
|
236
|
-
].filter((value, index, self) => !!value && self.indexOf(value) === index);
|
|
237
|
-
return {
|
|
238
|
-
originalQuery,
|
|
239
|
-
normalizedQuery,
|
|
240
|
-
searchQuery: searchTerms.slice(0, 6).join(" ") || normalizedQuery,
|
|
241
|
-
positiveTerms,
|
|
242
|
-
negativeTerms,
|
|
243
|
-
language,
|
|
244
|
-
task: task || undefined,
|
|
245
|
-
domain,
|
|
246
|
-
minRows,
|
|
247
|
-
llmBacked: false,
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
function mergeIntent(base, llmIntent) {
|
|
251
|
-
const language = llmIntent.language ? normalizeToken(llmIntent.language) : base.language;
|
|
252
|
-
const task = llmIntent.task ? normalizeToken(llmIntent.task) : base.task;
|
|
253
|
-
const domain = llmIntent.domain ? normalizeToken(llmIntent.domain) : base.domain;
|
|
254
|
-
const minRows = typeof llmIntent.minRows === "number" && Number.isFinite(llmIntent.minRows)
|
|
255
|
-
? llmIntent.minRows
|
|
256
|
-
: base.minRows;
|
|
257
|
-
const positiveTerms = Array.from(new Set([...(llmIntent.positiveTerms || []), ...base.positiveTerms].map(normalizeToken))).filter(Boolean);
|
|
258
|
-
const negativeTerms = Array.from(new Set([...(llmIntent.negativeTerms || []), ...base.negativeTerms].map(normalizeToken))).filter(Boolean);
|
|
259
|
-
const merged = {
|
|
260
|
-
...base,
|
|
261
|
-
language,
|
|
262
|
-
task,
|
|
263
|
-
domain,
|
|
264
|
-
minRows,
|
|
265
|
-
positiveTerms,
|
|
266
|
-
negativeTerms,
|
|
267
|
-
llmBacked: true,
|
|
268
|
-
};
|
|
269
|
-
merged.searchQuery = [
|
|
270
|
-
merged.language,
|
|
271
|
-
merged.task,
|
|
272
|
-
merged.domain !== "general" && merged.domain !== "unknown" ? merged.domain : undefined,
|
|
273
|
-
...merged.positiveTerms,
|
|
274
|
-
].filter((value, index, self) => !!value && self.indexOf(value) === index).slice(0, 6).join(" ") || merged.normalizedQuery;
|
|
275
|
-
return merged;
|
|
276
|
-
}
|
|
277
|
-
async function tryLlmIntent(base, requirements) {
|
|
278
|
-
const openAiKey = process.env.OPENAI_API_KEY;
|
|
279
|
-
if (openAiKey) {
|
|
280
|
-
return await callOpenAiIntent(base, requirements).catch(() => undefined);
|
|
281
|
-
}
|
|
282
|
-
const geminiKey = process.env.GEMINI_API_KEY || process.env.GOOGLE_API_KEY;
|
|
283
|
-
if (geminiKey) {
|
|
284
|
-
return await callGeminiIntent(base, requirements, geminiKey).catch(() => undefined);
|
|
285
|
-
}
|
|
286
|
-
return undefined;
|
|
287
|
-
}
|
|
288
|
-
async function callOpenAiIntent(base, requirements) {
|
|
289
|
-
const controller = new AbortController();
|
|
290
|
-
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
291
|
-
try {
|
|
292
|
-
const response = await fetch("https://api.openai.com/v1/chat/completions", {
|
|
293
|
-
method: "POST",
|
|
294
|
-
headers: {
|
|
295
|
-
"Content-Type": "application/json",
|
|
296
|
-
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
|
|
297
|
-
},
|
|
298
|
-
body: JSON.stringify({
|
|
299
|
-
model: process.env.OPENAI_MODEL || "gpt-4o-mini",
|
|
300
|
-
temperature: 0,
|
|
301
|
-
response_format: { type: "json_object" },
|
|
302
|
-
messages: [
|
|
303
|
-
{
|
|
304
|
-
role: "system",
|
|
305
|
-
content: "Extract dataset search intent as JSON with keys: language, task, domain, minRows, positiveTerms, negativeTerms. Use null for unknowns.",
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
role: "user",
|
|
309
|
-
content: JSON.stringify({ query: base.originalQuery, requirements: requirements || null, heuristic: base }),
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
}),
|
|
313
|
-
signal: controller.signal,
|
|
314
|
-
});
|
|
315
|
-
if (!response.ok) {
|
|
316
|
-
return undefined;
|
|
317
|
-
}
|
|
318
|
-
const body = await response.json();
|
|
319
|
-
const content = body?.choices?.[0]?.message?.content;
|
|
320
|
-
return parseIntentPayload(content);
|
|
321
|
-
}
|
|
322
|
-
finally {
|
|
323
|
-
clearTimeout(timeout);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
async function callGeminiIntent(base, requirements, apiKey) {
|
|
327
|
-
const controller = new AbortController();
|
|
328
|
-
const timeout = setTimeout(() => controller.abort(), 5000);
|
|
329
|
-
try {
|
|
330
|
-
const model = process.env.GEMINI_MODEL || "gemini-1.5-flash";
|
|
331
|
-
const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/${model}:generateContent?key=${encodeURIComponent(apiKey)}`, {
|
|
332
|
-
method: "POST",
|
|
333
|
-
headers: {
|
|
334
|
-
"Content-Type": "application/json",
|
|
335
|
-
},
|
|
336
|
-
body: JSON.stringify({
|
|
337
|
-
generationConfig: {
|
|
338
|
-
temperature: 0,
|
|
339
|
-
responseMimeType: "application/json",
|
|
340
|
-
},
|
|
341
|
-
contents: [{
|
|
342
|
-
role: "user",
|
|
343
|
-
parts: [{
|
|
344
|
-
text: `Extract dataset search intent as JSON with keys language, task, domain, minRows, positiveTerms, negativeTerms. Query payload: ${JSON.stringify({ query: base.originalQuery, requirements: requirements || null, heuristic: base })}`,
|
|
345
|
-
}],
|
|
346
|
-
}],
|
|
347
|
-
}),
|
|
348
|
-
signal: controller.signal,
|
|
349
|
-
});
|
|
350
|
-
if (!response.ok) {
|
|
351
|
-
return undefined;
|
|
352
|
-
}
|
|
353
|
-
const body = await response.json();
|
|
354
|
-
const content = body?.candidates?.[0]?.content?.parts?.[0]?.text;
|
|
355
|
-
return parseIntentPayload(content);
|
|
356
|
-
}
|
|
357
|
-
finally {
|
|
358
|
-
clearTimeout(timeout);
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
function parseIntentPayload(content) {
|
|
362
|
-
if (typeof content !== "string" || !content.trim()) {
|
|
363
|
-
return undefined;
|
|
364
|
-
}
|
|
365
|
-
const jsonText = extractJsonObject(content);
|
|
366
|
-
if (!jsonText) {
|
|
367
|
-
return undefined;
|
|
368
|
-
}
|
|
369
|
-
try {
|
|
370
|
-
const parsed = JSON.parse(jsonText);
|
|
371
|
-
return {
|
|
372
|
-
language: typeof parsed.language === "string" ? parsed.language : undefined,
|
|
373
|
-
task: typeof parsed.task === "string" ? parsed.task : undefined,
|
|
374
|
-
domain: typeof parsed.domain === "string" ? parsed.domain : undefined,
|
|
375
|
-
minRows: typeof parsed.minRows === "number"
|
|
376
|
-
? parsed.minRows
|
|
377
|
-
: typeof parsed.min_rows === "number"
|
|
378
|
-
? parsed.min_rows
|
|
379
|
-
: undefined,
|
|
380
|
-
positiveTerms: Array.isArray(parsed.positiveTerms)
|
|
381
|
-
? parsed.positiveTerms.filter((item) => typeof item === "string")
|
|
382
|
-
: Array.isArray(parsed.positive_terms)
|
|
383
|
-
? parsed.positive_terms.filter((item) => typeof item === "string")
|
|
384
|
-
: undefined,
|
|
385
|
-
negativeTerms: Array.isArray(parsed.negativeTerms)
|
|
386
|
-
? parsed.negativeTerms.filter((item) => typeof item === "string")
|
|
387
|
-
: Array.isArray(parsed.negative_terms)
|
|
388
|
-
? parsed.negative_terms.filter((item) => typeof item === "string")
|
|
389
|
-
: undefined,
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
catch {
|
|
393
|
-
return undefined;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
function extractJsonObject(text) {
|
|
397
|
-
const trimmed = text.trim();
|
|
398
|
-
if (trimmed.startsWith("{") && trimmed.endsWith("}")) {
|
|
399
|
-
return trimmed;
|
|
400
|
-
}
|
|
401
|
-
const start = trimmed.indexOf("{");
|
|
402
|
-
const end = trimmed.lastIndexOf("}");
|
|
403
|
-
if (start >= 0 && end > start) {
|
|
404
|
-
return trimmed.slice(start, end + 1);
|
|
405
|
-
}
|
|
406
|
-
return undefined;
|
|
407
|
-
}
|
|
408
|
-
function detectLanguage(text) {
|
|
409
|
-
for (const [language, aliases] of Object.entries(LANGUAGE_ALIASES)) {
|
|
410
|
-
if (aliases.some(alias => new RegExp(`(^|[^a-z])${escapeRegex(alias)}([^a-z]|$)`, "i").test(text))) {
|
|
411
|
-
return language;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
return undefined;
|
|
415
|
-
}
|
|
416
|
-
function detectTask(text) {
|
|
417
|
-
const match = TASK_PATTERNS.find(entry => entry.patterns.some(pattern => pattern.test(text)));
|
|
418
|
-
return match?.task;
|
|
419
|
-
}
|
|
420
|
-
function tokenize(text) {
|
|
421
|
-
return Array.from(new Set(text
|
|
422
|
-
.replace(/[^\w\s-]/g, " ")
|
|
423
|
-
.split(/\s+/)
|
|
424
|
-
.map(normalizeToken)
|
|
425
|
-
.filter(token => token.length > 2 && !STOP_WORDS.has(token) && !/^\d+$/.test(token))));
|
|
426
|
-
}
|
|
427
|
-
function normalizeToken(value) {
|
|
428
|
-
return value.toLowerCase().replace(/^[^a-z0-9]+|[^a-z0-9-]+$/g, "").trim();
|
|
429
|
-
}
|
|
430
|
-
function extractRequestedRows(text) {
|
|
431
|
-
// Match "1 million", "2.5 billion", "500 thousand" etc.
|
|
432
|
-
const wordMultipliers = {
|
|
433
|
-
thousand: 1_000, million: 1_000_000, billion: 1_000_000_000,
|
|
434
|
-
mil: 1_000_000, bil: 1_000_000_000,
|
|
435
|
-
};
|
|
436
|
-
const wordPattern = new RegExp(`(\\d+(?:\\.\\d+)?)\\s*(${Object.keys(wordMultipliers).join("|")})\\b`, "i");
|
|
437
|
-
const wordMatch = text.match(wordPattern);
|
|
438
|
-
if (wordMatch) {
|
|
439
|
-
const base = Number(wordMatch[1]);
|
|
440
|
-
const multiplier = wordMultipliers[wordMatch[2].toLowerCase()];
|
|
441
|
-
const value = Math.round(base * multiplier);
|
|
442
|
-
if (Number.isFinite(value) && value > 0)
|
|
443
|
-
return value;
|
|
444
|
-
}
|
|
445
|
-
const explicit = text.match(/(\d[\d,\s]{1,12})\s*(samples?|rows?|records?)/i);
|
|
446
|
-
if (explicit) {
|
|
447
|
-
const value = Number(explicit[1].replace(/[\s,]/g, ""));
|
|
448
|
-
if (Number.isFinite(value) && value > 0) {
|
|
449
|
-
return value;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
const humanSized = text.match(/(\d+(?:\.\d+)?)\s*([kmb])\s*(samples?|rows?|records?)/i);
|
|
453
|
-
if (humanSized) {
|
|
454
|
-
const base = Number(humanSized[1]);
|
|
455
|
-
const suffix = humanSized[2].toLowerCase();
|
|
456
|
-
const multiplier = suffix === "k" ? 1_000 : suffix === "m" ? 1_000_000 : 1_000_000_000;
|
|
457
|
-
const value = Math.round(base * multiplier);
|
|
458
|
-
if (Number.isFinite(value) && value > 0) {
|
|
459
|
-
return value;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
const commaNumbers = [...text.matchAll(/\b\d{1,3}(?:,\d{3})+\b/g)]
|
|
463
|
-
.map(match => Number(match[0].replace(/,/g, "")))
|
|
464
|
-
.filter(value => Number.isFinite(value) && value > 0);
|
|
465
|
-
if (commaNumbers.length > 0) {
|
|
466
|
-
return Math.max(...commaNumbers);
|
|
467
|
-
}
|
|
468
|
-
const humanSizedAnywhere = [...text.matchAll(/\b(\d+(?:\.\d+)?)\s*([kmb])\b/gi)]
|
|
469
|
-
.map(match => {
|
|
470
|
-
const base = Number(match[1]);
|
|
471
|
-
const suffix = match[2].toLowerCase();
|
|
472
|
-
const multiplier = suffix === "k" ? 1_000 : suffix === "m" ? 1_000_000 : 1_000_000_000;
|
|
473
|
-
return Math.round(base * multiplier);
|
|
474
|
-
})
|
|
475
|
-
.filter(value => Number.isFinite(value) && value > 0);
|
|
476
|
-
if (humanSizedAnywhere.length > 0) {
|
|
477
|
-
return Math.max(...humanSizedAnywhere);
|
|
478
|
-
}
|
|
479
|
-
const allNumbers = [...text.matchAll(/\b\d{4,9}\b/g)]
|
|
480
|
-
.map(match => Number(match[0]))
|
|
481
|
-
.filter(value => Number.isFinite(value) && value > 0);
|
|
482
|
-
if (allNumbers.length > 0) {
|
|
483
|
-
return Math.max(...allNumbers);
|
|
484
|
-
}
|
|
485
|
-
return undefined;
|
|
486
|
-
}
|
|
487
|
-
function matchesTask(dataset, task, text) {
|
|
488
|
-
const normalizedTask = normalizeToken(task);
|
|
489
|
-
const aliases = {
|
|
490
|
-
"question-answering": ["question-answering", "qa", "question answering"],
|
|
491
|
-
"text-classification": ["text-classification", "classification", "text classification"],
|
|
492
|
-
"token-classification": ["token-classification", "ner", "named entity"],
|
|
493
|
-
"sentiment-analysis": ["sentiment-analysis", "sentiment"],
|
|
494
|
-
translation: ["translation", "machine-translation", "parallel corpus"],
|
|
495
|
-
summarization: ["summarization", "summary"],
|
|
496
|
-
"text-generation": ["text-generation", "generation", "chat", "instruction"],
|
|
497
|
-
"image-classification": ["image-classification", "image classification"],
|
|
498
|
-
"object-detection": ["object-detection", "object detection"],
|
|
499
|
-
};
|
|
500
|
-
const variants = aliases[normalizedTask] || [normalizedTask];
|
|
501
|
-
return variants.some(variant => normalizeToken(dataset.task).includes(variant) || text.includes(variant));
|
|
502
|
-
}
|
|
503
|
-
function getLanguageAliases(language) {
|
|
504
|
-
const normalized = normalizeToken(language);
|
|
505
|
-
return (LANGUAGE_ALIASES[normalized] || [normalized]).map(normalizeToken);
|
|
506
|
-
}
|
|
507
|
-
function escapeRegex(value) {
|
|
508
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
509
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
export class VectorStore {
|
|
4
|
-
idToVector = new Map();
|
|
5
|
-
filePath;
|
|
6
|
-
binPath;
|
|
7
|
-
constructor(filePath) {
|
|
8
|
-
this.filePath = filePath;
|
|
9
|
-
this.binPath = filePath.replace(".json", ".bin");
|
|
10
|
-
this.load();
|
|
11
|
-
}
|
|
12
|
-
load() {
|
|
13
|
-
if (fs.existsSync(this.filePath) && fs.existsSync(this.binPath)) {
|
|
14
|
-
try {
|
|
15
|
-
const metadata = JSON.parse(fs.readFileSync(this.filePath, "utf-8"));
|
|
16
|
-
const buffer = fs.readFileSync(this.binPath);
|
|
17
|
-
const ids = metadata.ids;
|
|
18
|
-
const dim = metadata.dimension;
|
|
19
|
-
for (let i = 0; i < ids.length; i++) {
|
|
20
|
-
const start = i * dim * 4;
|
|
21
|
-
const vector = new Float32Array(buffer.buffer, buffer.byteOffset + start, dim);
|
|
22
|
-
this.idToVector.set(ids[i], new Float32Array(vector)); // Copy to ensure independence
|
|
23
|
-
}
|
|
24
|
-
console.error(`Loaded ${this.idToVector.size} vectors from binary store`);
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
console.error("Failed to load vector store:", err);
|
|
28
|
-
this.idToVector.clear();
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else if (fs.existsSync(this.filePath)) {
|
|
32
|
-
// Migration from old JSON format
|
|
33
|
-
try {
|
|
34
|
-
const data = JSON.parse(fs.readFileSync(this.filePath, "utf-8"));
|
|
35
|
-
if (Array.isArray(data)) {
|
|
36
|
-
for (const entry of data) {
|
|
37
|
-
this.idToVector.set(entry.id, new Float32Array(entry.vector));
|
|
38
|
-
}
|
|
39
|
-
console.error(`Migrated ${this.idToVector.size} vectors from legacy JSON`);
|
|
40
|
-
this.save(); // Convert to binary immediately
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
console.error("Migration failed:", err);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
save() {
|
|
49
|
-
const dir = path.dirname(this.filePath);
|
|
50
|
-
if (!fs.existsSync(dir)) {
|
|
51
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
52
|
-
}
|
|
53
|
-
const ids = Array.from(this.idToVector.keys());
|
|
54
|
-
if (ids.length === 0)
|
|
55
|
-
return;
|
|
56
|
-
const dim = this.idToVector.get(ids[0]).length;
|
|
57
|
-
const buffer = Buffer.alloc(ids.length * dim * 4);
|
|
58
|
-
for (let i = 0; i < ids.length; i++) {
|
|
59
|
-
const vector = this.idToVector.get(ids[i]);
|
|
60
|
-
const byteOffset = i * dim * 4;
|
|
61
|
-
for (let j = 0; j < dim; j++) {
|
|
62
|
-
buffer.writeFloatLE(vector[j], byteOffset + j * 4);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
fs.writeFileSync(this.binPath, buffer);
|
|
66
|
-
fs.writeFileSync(this.filePath, JSON.stringify({
|
|
67
|
-
ids,
|
|
68
|
-
dimension: dim,
|
|
69
|
-
count: ids.length,
|
|
70
|
-
updatedAt: new Date().toISOString()
|
|
71
|
-
}, null, 2));
|
|
72
|
-
console.error(`Saved ${ids.length} vectors to binary store (${this.binPath})`);
|
|
73
|
-
}
|
|
74
|
-
add(id, vector) {
|
|
75
|
-
this.idToVector.set(id, vector instanceof Float32Array ? vector : new Float32Array(vector));
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Delete a vector by ID
|
|
79
|
-
*/
|
|
80
|
-
delete(id) {
|
|
81
|
-
return this.idToVector.delete(id);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Delete multiple vectors by IDs
|
|
85
|
-
*/
|
|
86
|
-
deleteMany(ids) {
|
|
87
|
-
let count = 0;
|
|
88
|
-
for (const id of ids) {
|
|
89
|
-
if (this.idToVector.delete(id)) {
|
|
90
|
-
count++;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return count;
|
|
94
|
-
}
|
|
95
|
-
search(queryVector, limit = 10) {
|
|
96
|
-
const q = queryVector instanceof Float32Array ? queryVector : new Float32Array(queryVector);
|
|
97
|
-
const results = [];
|
|
98
|
-
for (const [id, v] of this.idToVector.entries()) {
|
|
99
|
-
results.push({
|
|
100
|
-
id,
|
|
101
|
-
score: this.cosineSimilarity(q, v)
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
return results
|
|
105
|
-
.sort((a, b) => b.score - a.score)
|
|
106
|
-
.slice(0, limit);
|
|
107
|
-
}
|
|
108
|
-
cosineSimilarity(v1, v2) {
|
|
109
|
-
let dotProduct = 0;
|
|
110
|
-
let normA = 0;
|
|
111
|
-
let normB = 0;
|
|
112
|
-
for (let i = 0; i < v1.length; i++) {
|
|
113
|
-
dotProduct += v1[i] * v2[i];
|
|
114
|
-
normA += v1[i] * v1[i];
|
|
115
|
-
normB += v2[i] * v2[i];
|
|
116
|
-
}
|
|
117
|
-
const magnitude = Math.sqrt(normA) * Math.sqrt(normB);
|
|
118
|
-
return magnitude === 0 ? 0 : dotProduct / magnitude;
|
|
119
|
-
}
|
|
120
|
-
getAllIds() {
|
|
121
|
-
return Array.from(this.idToVector.keys());
|
|
122
|
-
}
|
|
123
|
-
}
|