Skip to content

Commit 8b147c9

Browse files
committed
Minor changes
1 parent 76f5e78 commit 8b147c9

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

lib/import/AECD.js

+29
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,31 @@ function updateEntry(dbEntry, aecdEntry) {
2929
return dbEntry;
3030
}
3131

32+
/**
33+
* A class representing an ALTLab database entry.
34+
*/
35+
class DatabaseEntry {
36+
37+
/**
38+
* Create a new database entry from an AECD entry.
39+
* @param {Object} aecdEntry
40+
*/
41+
constructor(aecdEntry) {
42+
43+
this.dataSources ??= {};
44+
this.dataSources.AECD = aecdEntry;
45+
46+
this.head = Object.assign({}, aecdEntry.head);
47+
this.lemma = Object.assign({}, aecdEntry.lemma);
48+
this.pos = aecdEntry.pos;
49+
50+
aecdEntry.matched = true;
51+
52+
return this;
53+
}
54+
55+
}
56+
3257
/**
3358
* Imports the AECD entries into the ALTLab database.
3459
* @param {String} aecdPath
@@ -132,6 +157,10 @@ export default async function importAECD(aecdPath, dbPath, fstPath, { report } =
132157

133158
}
134159

160+
for (const mdEntry of unmatched) {
161+
dbIndex.add(new DatabaseEntry(mdEntry))
162+
}
163+
135164
importSpinner.succeed(`AECD entries imported.`);
136165

137166
const writeSpinner = createSpinner(`Writing entries to database file.`).start();

0 commit comments

Comments
 (0)