taipa
Version:
Taiwanese morphological parsing library
52 lines • 1.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Configuration = exports.LeftArc = exports.RightArc = exports.Shift = exports.Transition = void 0;
class Transition {
}
exports.Transition = Transition;
class Shift extends Transition {
do(c) {
let s = c.queue.shift();
if (s != undefined) {
c.stack.push(s);
}
return c;
}
}
exports.Shift = Shift;
class RightArc extends Transition {
do(c) {
c.stack.pop();
return c;
}
}
exports.RightArc = RightArc;
class LeftArc extends Transition {
do(c) {
const top = c.stack.pop();
c.stack.pop();
if (top)
c.stack.push(top);
return c;
}
}
exports.LeftArc = LeftArc;
class Configuration {
queue = new Array();
stack = new Array();
relations = new Array();
getGraph() {
return this.relations;
}
isTerminalConfiguration() {
if (this.queue.length > 0) {
return false;
}
if (this.stack.length == 1 && this.queue.length == 0) {
return true;
}
return false;
}
}
exports.Configuration = Configuration;
//# sourceMappingURL=configuration.js.map