UNPKG

taipa

Version:

Taiwanese morphological parsing library

36 lines 1.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mutateFinalOfPrecedingWord = exports.mutateFinalConsonantOfPrecedingSyllable = exports.mutateInitialOfFollowingSyllable = void 0; const lexeme_1 = require("../change/lexeme"); const analyzer_1 = require("../change/analyzer"); const metaplasm_1 = require("../change/metaplasm"); const metaplasm_2 = require("../metaplasm"); const phraseme_1 = require("./phraseme"); function getNoMutation(word) { const mrphs = (0, analyzer_1.morphAnalyzeChanging)(word); const lx = new lexeme_1.TonalMutationLexeme(mrphs, new metaplasm_2.TonalZeroMutationMetaplasm()); return lx; } /** Mutates the initial of the following syllable. */ function mutateInitialOfFollowingSyllable(word) { const ms = (0, analyzer_1.morphAnalyzeChanging)(word); const lx = new lexeme_1.TonalMutationLexeme(ms, new metaplasm_1.ConsonantMutation()); return lx; } exports.mutateInitialOfFollowingSyllable = mutateInitialOfFollowingSyllable; /** Mutates the final of the preceding syllable. */ function mutateFinalConsonantOfPrecedingSyllable(word) { const mrphs = (0, analyzer_1.morphAnalyzeChanging)(word); const lx = new lexeme_1.TonalMutationLexeme(mrphs, new metaplasm_1.FinalConsonantMutationInternal()); return lx; } exports.mutateFinalConsonantOfPrecedingSyllable = mutateFinalConsonantOfPrecedingSyllable; /** Mutates the final of the preceding word. */ function mutateFinalOfPrecedingWord(preceding, following) { const lxPreceding = getNoMutation(preceding); const lxFollowing = getNoMutation(following); const phmk = new phraseme_1.TonalMutationPhrasemeMaker(); return phmk.makePhraseme(lxPreceding, lxFollowing, new metaplasm_1.FinalConsonantMutationExternal()); } exports.mutateFinalOfPrecedingWord = mutateFinalOfPrecedingWord; //# sourceMappingURL=mutator.js.map