UNPKG

taipa

Version:

Taiwanese morphological parsing library

35 lines 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.kanaLemmatizationAnalyzer = exports.graphAnalyzeKana = void 0; const unit_1 = require("../unit"); const morpheme_1 = require("./morpheme"); const kanares_1 = require("./kanares"); const metaplasm_1 = require("../metaplasm"); /** * Analyzes a string into graphemes. Graphemic analysis. * @param str A string */ function graphAnalyzeKana(str) { const gm = new unit_1.GraphemeMaker(kanares_1.lowerLettersKana); return gm.makeGraphemes(str); } exports.graphAnalyzeKana = graphAnalyzeKana; /** Analyzes a string into morphemes. */ exports.kanaLemmatizationAnalyzer = { /** * Analyzes a string or graphemes into morphemes. Morphological analysis. * @param x A string or graphemes */ morphAnalyze(x) { let graphemes = []; if (typeof x == 'object') { graphemes = x; } else if (typeof x == 'string') { graphemes = graphAnalyzeKana(x); } const mm = new morpheme_1.KanaStandaloneMorphemeMaker(new metaplasm_1.KanaCombiningMetaplasm()); return mm.makeMorphemes(graphemes); }, }; //# sourceMappingURL=analyzer.js.map