UNPKG

@palasimi/ipa-cluster

Version:

Cluster words with similar IPA transcriptions together

21 lines 714 B
"use strict"; // SPDX-License-Identifier: GPL-3.0-or-later // Copyright (c) 2023 Levi Gruspe Object.defineProperty(exports, "__esModule", { value: true }); exports.createCostFunction = void 0; const index_1 = require("./dsl/index"); /** * Creates cost function for IPA clustering. * May raise `ParseError`. */ function createCostFunction(code) { const querier = (0, index_1.compile)(code); return function customCost(s, t, i, j, options = {}) { const l1 = options.left || "_"; const l2 = options.right || "_"; const found = querier.query(s, t, i, j, l1, l2); return found ? 0 : 1; }; } exports.createCostFunction = createCostFunction; //# sourceMappingURL=cost.js.map