wink-embeddings-small-en-50d
Version:
Small English 50-dimensional word-embedding dataset compatible with wink-nlp.
20 lines (19 loc) • 800 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.embeddings = void 0;
const embeddings_json_1 = __importDefault(require("./embeddings.json"));
// ---------- runtime codec ----------
function toEmbeddings(data) {
for (const [word, vector] of Object.entries(data)) {
if (vector.length !== 50) {
throw new Error(`Vector for word "${word}" has length ${vector.length}; expected 50.`);
}
}
// Cast via unknown so the compiler accepts the transformation after validation.
return data;
}
exports.embeddings = toEmbeddings(embeddings_json_1.default);
exports.default = exports.embeddings;