taipa
Version:
Taiwanese morphological parsing library
43 lines • 2.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.uninsertFromFollowingWord = exports.uninsertFromFollowingSyllable = void 0;
const unit_1 = require("../unit");
const tonalres_1 = require("../tonal/tonalres");
const lexeme_1 = require("../change/lexeme");
const morpheme_1 = require("../unchange/morpheme");
const metaplasm_1 = require("../change/metaplasm");
const phraseme_1 = require("../change/phraseme");
const analyzer_1 = require("./analyzer");
const metaplasm_2 = require("../metaplasm");
function getNoUninsertion(word) {
const mrphs = (0, analyzer_1.morphAnalyzeUnchanging)(word);
const lx = new lexeme_1.TonalUninsertionLexeme(mrphs, new metaplasm_2.TonalZeroUninsertionMetaplasm());
return lx;
}
/**
* Uninserts an initial m, n, or ng from syllable ~ay if the preceding syllable has a final m, n, or ng.
* @param word A word whose second syllable is may, nay, ngay, ma, na, nga, maf, naf, or ngaf. The word has at least 2 syllables for the second one to be uninserted an initial.
*/
function uninsertFromFollowingSyllable(word) {
const mm = new morpheme_1.TonalSoundUnchangingMorphemeMaker();
const gm = new unit_1.GraphemeMaker(tonalres_1.lowerLettersTonal);
const gs = gm.makeGraphemes(word);
const ms = mm.makeMorphemes(gs);
// TODO: add initial g. b? l?
const lx = new lexeme_1.TonalUninsertionLexeme(ms, new metaplasm_1.Uninsertion());
return lx;
}
exports.uninsertFromFollowingSyllable = uninsertFromFollowingSyllable;
/**
* Uninsert an initial from the enclitic.
* @param preceding The preceding word
* @param following The following word. The enclitic.
*/
function uninsertFromFollowingWord(preceding, following) {
const lxPreceding = getNoUninsertion(preceding);
const lxFollowing = getNoUninsertion(following);
const phmk = new phraseme_1.TonalUninsertionPhrasemeMaker();
return phmk.makePhraseme(lxPreceding, lxFollowing, new metaplasm_1.UninsertionFromEnclitic());
}
exports.uninsertFromFollowingWord = uninsertFromFollowingWord;
//# sourceMappingURL=uninserter.js.map