buildKeywordsFromDictionary function presentation exported ✓ 100.0%
Last updated: 2026-02-24T21:07:57.551Z
Location
Metrics
LOC: 21
Complexity: 4
Params: 0
Coverage: 100.0% (9/9 lines, 4x executed)
Signature
buildKeywordsFromDictionary(): : Record<FieldType, string[]>
Summary
Generates a Record<FieldType, string[]> keyword map directly from the field dictionary. This can replace / supplement the static FIELD_TYPE_KEYWORDS in tensorflow-generator.ts.
Source Code
export function buildKeywordsFromDictionary(): Record<FieldType, string[]> {
const result = {} as Record<FieldType, string[]>;
for (const entry of FIELD_DICTIONARY) {
const keywords: string[] = [];
// Derive keywords from tags (tags are the classification hints)
if (entry.tags.length > 0) {
keywords.push(...entry.tags);
}
// Derive keywords from entry type itself (e.g. "cpf" → ["cpf"])
if (!keywords.includes(entry.type)) {
keywords.push(entry.type);
}
result[entry.type] = [...new Set(keywords)]; // dedupe
}
return result;
}
Dependencies (Outgoing)
| Target | Type |
|---|---|
| FieldType | uses |
| FIELD_DICTIONARY | uses |
| flattenStructuredSignals | uses |
| getTrainingDistribution | uses |
| TrainingSample | uses |
| augmentShuffle | uses |
| augmentDrop | uses |
| augmentTypo | uses |
| checkDatasetHealth | uses |
| AccuracyThresholds | uses |
| DatasetHealthReport | uses |
| classifyField | uses |
| FormField | uses |
| fromFlatSignals | uses |
Impact (Incoming)
| Source | Type |
|---|---|
| EvalMisclassified | uses |
| FIELD_DICTIONARY | uses |