nlptoolkit-universaldependencyparser 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/Parser/TransitionBasedParser/Agenda.js +52 -60
  2. package/dist/Parser/TransitionBasedParser/Agenda.js.map +1 -1
  3. package/dist/Parser/TransitionBasedParser/ArcEagerInstanceGenerator.js +56 -66
  4. package/dist/Parser/TransitionBasedParser/ArcEagerInstanceGenerator.js.map +1 -1
  5. package/dist/Parser/TransitionBasedParser/ArcEagerOracle.js +25 -35
  6. package/dist/Parser/TransitionBasedParser/ArcEagerOracle.js.map +1 -1
  7. package/dist/Parser/TransitionBasedParser/ArcEagerTransitionParser.js +89 -99
  8. package/dist/Parser/TransitionBasedParser/ArcEagerTransitionParser.js.map +1 -1
  9. package/dist/Parser/TransitionBasedParser/ArcStandardOracle.js +23 -33
  10. package/dist/Parser/TransitionBasedParser/ArcStandardOracle.js.map +1 -1
  11. package/dist/Parser/TransitionBasedParser/ArcStandardTransitionParser.js +97 -107
  12. package/dist/Parser/TransitionBasedParser/ArcStandardTransitionParser.js.map +1 -1
  13. package/dist/Parser/TransitionBasedParser/Candidate.js +15 -23
  14. package/dist/Parser/TransitionBasedParser/Candidate.js.map +1 -1
  15. package/dist/Parser/TransitionBasedParser/Command.js +10 -20
  16. package/dist/Parser/TransitionBasedParser/Command.js.map +1 -1
  17. package/dist/Parser/TransitionBasedParser/Decision.js +13 -22
  18. package/dist/Parser/TransitionBasedParser/Decision.js.map +1 -1
  19. package/dist/Parser/TransitionBasedParser/InstanceGenerator.js +63 -73
  20. package/dist/Parser/TransitionBasedParser/InstanceGenerator.js.map +1 -1
  21. package/dist/Parser/TransitionBasedParser/Oracle.js +92 -100
  22. package/dist/Parser/TransitionBasedParser/Oracle.js.map +1 -1
  23. package/dist/Parser/TransitionBasedParser/RandomOracle.js +32 -42
  24. package/dist/Parser/TransitionBasedParser/RandomOracle.js.map +1 -1
  25. package/dist/Parser/TransitionBasedParser/RandomScoringOracle.js +9 -19
  26. package/dist/Parser/TransitionBasedParser/RandomScoringOracle.js.map +1 -1
  27. package/dist/Parser/TransitionBasedParser/ScoringOracle.js +6 -16
  28. package/dist/Parser/TransitionBasedParser/ScoringOracle.js.map +1 -1
  29. package/dist/Parser/TransitionBasedParser/SimpleInstanceGenerator.js +45 -55
  30. package/dist/Parser/TransitionBasedParser/SimpleInstanceGenerator.js.map +1 -1
  31. package/dist/Parser/TransitionBasedParser/StackRelation.js +18 -26
  32. package/dist/Parser/TransitionBasedParser/StackRelation.js.map +1 -1
  33. package/dist/Parser/TransitionBasedParser/StackWord.js +28 -36
  34. package/dist/Parser/TransitionBasedParser/StackWord.js.map +1 -1
  35. package/dist/Parser/TransitionBasedParser/State.js +136 -143
  36. package/dist/Parser/TransitionBasedParser/State.js.map +1 -1
  37. package/dist/Parser/TransitionBasedParser/TransitionParser.js +137 -147
  38. package/dist/Parser/TransitionBasedParser/TransitionParser.js.map +1 -1
  39. package/dist/Parser/TransitionBasedParser/TransitionSystem.js +8 -18
  40. package/dist/Parser/TransitionBasedParser/TransitionSystem.js.map +1 -1
  41. package/dist/index.js +22 -32
  42. package/dist/index.js.map +1 -1
  43. package/package.json +7 -6
  44. package/tsconfig.json +4 -3
  45. package/source/tsconfig.json +0 -13
@@ -1 +1 @@
1
- {"version":3,"file":"InstanceGenerator.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/InstanceGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;IAKA,wIAEwF;IACxF,gHAA2G;IAG3G,MAAsB,iBAAiB;QAWnC;;;;;WAKG;QACK,0BAA0B,CAAC,IAAqC,EACrC,UAA4B,EAC5B,WAAmB;YAClD,IAAI,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAA;YAC/C,IAAI,cAAc,GAAG,yEAAmC,CAAC,cAAc,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC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BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QAC1D,IAAI,CAAC,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAA;QAC3D,IAAI,CAAC,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;QAC1D,IAAI,CAAC,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,CAAC,CAAA;QAC5D,IAAI,CAAC,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA;QAC7D,IAAI,CAAC,0BAA0B,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAA;IAC/D,CAAC;CACJ;AAzED,8CAyEC"}
@@ -1,116 +1,108 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Oracle = void 0;
4
+ const Candidate_1 = require("./Candidate");
5
+ const UniversalDependencyRelation_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyRelation");
6
+ const UniversalDependencyType_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyType");
7
+ const Command_1 = require("./Command");
8
+ class Oracle {
9
+ commandModel;
10
+ windowSize;
11
+ /**
12
+ * Constructs an Oracle with the given model and window size.
13
+ * @param model the model used for making predictions
14
+ * @param windowSize the size of the window used in parsing
15
+ */
16
+ constructor(model, windowSize) {
17
+ this.commandModel = model;
18
+ this.windowSize = windowSize;
5
19
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./Candidate", "nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyRelation", "nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyType", "./Command"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Oracle = void 0;
13
- const Candidate_1 = require("./Candidate");
14
- const UniversalDependencyRelation_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyRelation");
15
- const UniversalDependencyType_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyType");
16
- const Command_1 = require("./Command");
17
- class Oracle {
18
- /**
19
- * Constructs an Oracle with the given model and window size.
20
- * @param model the model used for making predictions
21
- * @param windowSize the size of the window used in parsing
22
- */
23
- constructor(model, windowSize) {
24
- this.commandModel = model;
25
- this.windowSize = windowSize;
26
- }
27
- /**
28
- * Finds the best valid parsing action for the ARC_EAGER transition system based on probabilities.
29
- * Ensures the action is applicable given the current state.
30
- * @param probabilities a map of actions to their associated probabilities
31
- * @param state the current parsing state
32
- * @return the best action as a string, or an empty string if no valid action is found
33
- */
34
- findBestValidEagerClassInfo(probabilities, state) {
35
- let bestValue = 0.0;
36
- let best = "";
37
- for (let key in probabilities) {
38
- if (probabilities.get(key) > bestValue) {
39
- if (key == "SHIFT" || key == "RIGHTARC") {
40
- if (state.wordListSize() > 0) {
20
+ /**
21
+ * Finds the best valid parsing action for the ARC_EAGER transition system based on probabilities.
22
+ * Ensures the action is applicable given the current state.
23
+ * @param probabilities a map of actions to their associated probabilities
24
+ * @param state the current parsing state
25
+ * @return the best action as a string, or an empty string if no valid action is found
26
+ */
27
+ findBestValidEagerClassInfo(probabilities, state) {
28
+ let bestValue = 0.0;
29
+ let best = "";
30
+ for (let key in probabilities) {
31
+ if (probabilities.get(key) > bestValue) {
32
+ if (key == "SHIFT" || key == "RIGHTARC") {
33
+ if (state.wordListSize() > 0) {
34
+ best = key;
35
+ bestValue = probabilities.get(key);
36
+ }
37
+ }
38
+ else {
39
+ if (state.stackSize() > 1) {
40
+ if (!(key == "REDUCE" && state.getPeek().getRelation() == null)) {
41
41
  best = key;
42
42
  bestValue = probabilities.get(key);
43
43
  }
44
44
  }
45
- else {
46
- if (state.stackSize() > 1) {
47
- if (!(key == "REDUCE" && state.getPeek().getRelation() == null)) {
48
- best = key;
49
- bestValue = probabilities.get(key);
50
- }
51
- }
52
- }
53
45
  }
54
46
  }
55
- return best;
56
47
  }
57
- /**
58
- * Finds the best valid parsing action for the ARC_STANDARD transition system based on probabilities.
59
- * Ensures the action is applicable given the current state.
60
- * @param probabilities a map of actions to their associated probabilities
61
- * @param state the current parsing state
62
- * @return the best action as a string, or an empty string if no valid action is found
63
- */
64
- findBestValidStandardClassInfo(probabilities, state) {
65
- let bestValue = 0.0;
66
- let best = "";
67
- for (let key in probabilities) {
68
- if (probabilities.get(key) > bestValue) {
69
- if (key == "SHIFT") {
70
- if (state.wordListSize() > 0) {
71
- best = key;
72
- bestValue = probabilities.get(key);
73
- }
48
+ return best;
49
+ }
50
+ /**
51
+ * Finds the best valid parsing action for the ARC_STANDARD transition system based on probabilities.
52
+ * Ensures the action is applicable given the current state.
53
+ * @param probabilities a map of actions to their associated probabilities
54
+ * @param state the current parsing state
55
+ * @return the best action as a string, or an empty string if no valid action is found
56
+ */
57
+ findBestValidStandardClassInfo(probabilities, state) {
58
+ let bestValue = 0.0;
59
+ let best = "";
60
+ for (let key in probabilities) {
61
+ if (probabilities.get(key) > bestValue) {
62
+ if (key == "SHIFT") {
63
+ if (state.wordListSize() > 0) {
64
+ best = key;
65
+ bestValue = probabilities.get(key);
74
66
  }
75
- else {
76
- if (state.stackSize() > 1) {
77
- best = key;
78
- bestValue = probabilities.get(key);
79
- }
67
+ }
68
+ else {
69
+ if (state.stackSize() > 1) {
70
+ best = key;
71
+ bestValue = probabilities.get(key);
80
72
  }
81
73
  }
82
74
  }
83
- return best;
84
75
  }
85
- /**
86
- * Converts a string representation of the best action into a {@link Candidate} object.
87
- * @param best the best action represented as a string, possibly with a dependency type in parentheses
88
- * @return a {@link Candidate} object representing the action, or null if the action is unknown
89
- */
90
- getDecisionCandidate(best) {
91
- let command, type;
92
- if (best.includes("(")) {
93
- command = best.substring(0, best.indexOf('('));
94
- let relation = best.substring(best.indexOf('(') + 1, best.indexOf(')'));
95
- type = UniversalDependencyRelation_1.UniversalDependencyRelation.getDependencyTag(relation);
96
- }
97
- else {
98
- command = best;
99
- type = UniversalDependencyType_1.UniversalDependencyType.DEP;
100
- }
101
- switch (command) {
102
- case "SHIFT":
103
- return new Candidate_1.Candidate(Command_1.Command.SHIFT, type);
104
- case "REDUCE":
105
- return new Candidate_1.Candidate(Command_1.Command.REDUCE, type);
106
- case "LEFTARC":
107
- return new Candidate_1.Candidate(Command_1.Command.LEFTARC, type);
108
- case "RIGHTARC":
109
- return new Candidate_1.Candidate(Command_1.Command.RIGHTARC, type);
110
- }
111
- return null;
76
+ return best;
77
+ }
78
+ /**
79
+ * Converts a string representation of the best action into a {@link Candidate} object.
80
+ * @param best the best action represented as a string, possibly with a dependency type in parentheses
81
+ * @return a {@link Candidate} object representing the action, or null if the action is unknown
82
+ */
83
+ getDecisionCandidate(best) {
84
+ let command, type;
85
+ if (best.includes("(")) {
86
+ command = best.substring(0, best.indexOf('('));
87
+ let relation = best.substring(best.indexOf('(') + 1, best.indexOf(')'));
88
+ type = UniversalDependencyRelation_1.UniversalDependencyRelation.getDependencyTag(relation);
89
+ }
90
+ else {
91
+ command = best;
92
+ type = UniversalDependencyType_1.UniversalDependencyType.DEP;
93
+ }
94
+ switch (command) {
95
+ case "SHIFT":
96
+ return new Candidate_1.Candidate(Command_1.Command.SHIFT, type);
97
+ case "REDUCE":
98
+ return new Candidate_1.Candidate(Command_1.Command.REDUCE, type);
99
+ case "LEFTARC":
100
+ return new Candidate_1.Candidate(Command_1.Command.LEFTARC, type);
101
+ case "RIGHTARC":
102
+ return new Candidate_1.Candidate(Command_1.Command.RIGHTARC, type);
112
103
  }
104
+ return null;
113
105
  }
114
- exports.Oracle = Oracle;
115
- });
106
+ }
107
+ exports.Oracle = Oracle;
116
108
  //# sourceMappingURL=Oracle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Oracle.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/Oracle.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GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;YACvE,IAAI,GAAG,yDAA2B,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;QACjE,CAAC;aAAM,CAAC;YACJ,OAAO,GAAG,IAAI,CAAA;YACd,IAAI,GAAG,iDAAuB,CAAC,GAAG,CAAA;QACtC,CAAC;QACD,QAAQ,OAAO,EAAC,CAAC;YACb,KAAK,OAAO;gBACR,OAAO,IAAI,qBAAS,CAAC,iBAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YAC7C,KAAK,QAAQ;gBACT,OAAO,IAAI,qBAAS,CAAC,iBAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YAC9C,KAAK,SAAS;gBACV,OAAO,IAAI,qBAAS,CAAC,iBAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;YAC/C,KAAK,UAAU;gBACX,OAAO,IAAI,qBAAS,CAAC,iBAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;QACpD,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC;CACJ;AAnHD,wBAmHC"}
@@ -1,46 +1,36 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RandomOracle = void 0;
4
+ const Oracle_1 = require("./Oracle");
5
+ const Decision_1 = require("./Decision");
6
+ const UniversalDependencyType_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyType");
7
+ const UniversalDependencyRelation_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyRelation");
8
+ const Command_1 = require("./Command");
9
+ class RandomOracle extends Oracle_1.Oracle {
10
+ constructor(model, windowSize) {
11
+ super(model, windowSize);
5
12
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./Oracle", "./Decision", "nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyType", "nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyRelation", "./Command"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RandomOracle = void 0;
13
- const Oracle_1 = require("./Oracle");
14
- const Decision_1 = require("./Decision");
15
- const UniversalDependencyType_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyType");
16
- const UniversalDependencyRelation_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyRelation");
17
- const Command_1 = require("./Command");
18
- class RandomOracle extends Oracle_1.Oracle {
19
- constructor(model, windowSize) {
20
- super(model, windowSize);
21
- }
22
- /**
23
- * Makes a random decision based on a uniform distribution over possible actions.
24
- * @param state The current state of the parser.
25
- * @return A Decision object representing the randomly chosen action.
26
- */
27
- makeDecision(state) {
28
- let command = Math.floor(Math.random() * 3);
29
- let relation = Math.floor(Math.random() * 58);
30
- switch (command) {
31
- case 0:
32
- return new Decision_1.Decision(Command_1.Command.LEFTARC, UniversalDependencyRelation_1.UniversalDependencyRelation.universalDependencyTags[relation], 0);
33
- case 1:
34
- return new Decision_1.Decision(Command_1.Command.RIGHTARC, UniversalDependencyRelation_1.UniversalDependencyRelation.universalDependencyTags[relation], 0);
35
- case 2:
36
- return new Decision_1.Decision(Command_1.Command.SHIFT, UniversalDependencyType_1.UniversalDependencyType.DEP, 0);
37
- }
38
- return null;
39
- }
40
- scoreDecisions(state, transitionSystem) {
41
- return null;
13
+ /**
14
+ * Makes a random decision based on a uniform distribution over possible actions.
15
+ * @param state The current state of the parser.
16
+ * @return A Decision object representing the randomly chosen action.
17
+ */
18
+ makeDecision(state) {
19
+ let command = Math.floor(Math.random() * 3);
20
+ let relation = Math.floor(Math.random() * 58);
21
+ switch (command) {
22
+ case 0:
23
+ return new Decision_1.Decision(Command_1.Command.LEFTARC, UniversalDependencyRelation_1.UniversalDependencyRelation.universalDependencyTags[relation], 0);
24
+ case 1:
25
+ return new Decision_1.Decision(Command_1.Command.RIGHTARC, UniversalDependencyRelation_1.UniversalDependencyRelation.universalDependencyTags[relation], 0);
26
+ case 2:
27
+ return new Decision_1.Decision(Command_1.Command.SHIFT, UniversalDependencyType_1.UniversalDependencyType.DEP, 0);
42
28
  }
29
+ return null;
30
+ }
31
+ scoreDecisions(state, transitionSystem) {
32
+ return null;
43
33
  }
44
- exports.RandomOracle = RandomOracle;
45
- });
34
+ }
35
+ exports.RandomOracle = RandomOracle;
46
36
  //# sourceMappingURL=RandomOracle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RandomOracle.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/RandomOracle.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,qCAAgC;IAEhC,yCAAoC;IAEpC,gHAA2G;IAC3G,wHAAmH;IACnH,uCAAkC;IAGlC,MAAa,YAAa,SAAQ,eAAM;QAEpC,YAAY,KAAY,EAAE,UAAkB;YACxC,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;QAC5B,CAAC;QAED;;;;WAIG;QACI,YAAY,CAAC,KAAY;YAC5B,IAAI,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;YAC3C,IAAI,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAA;YAC7C,QAAQ,OAAO,EAAC;gBACZ,KAAK,CAAC;oBACF,OAAO,IAAI,mBAAQ,CAAC,iBAAO,CAAC,OAAO,EAAE,yDAA2B,CAAC,uBAAuB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;gBAC1G,KAAK,CAAC;oBACF,OAAO,IAAI,mBAAQ,CAAC,iBAAO,CAAC,QAAQ,EAAE,yDAA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AC,KAAK,EAAE,iDAAuB,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QAC1E,CAAC;QACD,OAAO,IAAI,CAAA;IACf,CAAC;IAES,cAAc,CAAC,KAAY,EAAE,gBAAkC;QACrE,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ;AA7BD,oCA6BC"}
@@ -1,21 +1,11 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RandomScoringOracle = void 0;
4
+ const ScoringOracle_1 = require("./ScoringOracle");
5
+ class RandomScoringOracle extends ScoringOracle_1.ScoringOracle {
6
+ score(state) {
7
+ return Math.random();
5
8
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./ScoringOracle"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RandomScoringOracle = void 0;
13
- const ScoringOracle_1 = require("./ScoringOracle");
14
- class RandomScoringOracle extends ScoringOracle_1.ScoringOracle {
15
- score(state) {
16
- return Math.random();
17
- }
18
- }
19
- exports.RandomScoringOracle = RandomScoringOracle;
20
- });
9
+ }
10
+ exports.RandomScoringOracle = RandomScoringOracle;
21
11
  //# sourceMappingURL=RandomScoringOracle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RandomScoringOracle.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/RandomScoringOracle.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,mDAA8C;IAG9C,MAAa,mBAAoB,SAAQ,6BAAa;QAElD,KAAK,CAAC,KAAY;YACd,OAAO,IAAI,CAAC,MAAM,EAAE,CAAA;QACxB,CAAC;KAEJ;IAND,kDAMC"}
1
+ {"version":3,"file":"RandomScoringOracle.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/RandomScoringOracle.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAG9C,MAAa,mBAAoB,SAAQ,6BAAa;IAElD,KAAK,CAAC,KAAY;QACd,OAAO,IAAI,CAAC,MAAM,EAAE,CAAA;IACxB,CAAC;CAEJ;AAND,kDAMC"}
@@ -1,17 +1,7 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ScoringOracle = void 0;
13
- class ScoringOracle {
14
- }
15
- exports.ScoringOracle = ScoringOracle;
16
- });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScoringOracle = void 0;
4
+ class ScoringOracle {
5
+ }
6
+ exports.ScoringOracle = ScoringOracle;
17
7
  //# sourceMappingURL=ScoringOracle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ScoringOracle.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/ScoringOracle.ts"],"names":[],"mappings":";;;;;;;;;;;;IAEA,MAAsB,aAAa;KAElC;IAFD,sCAEC"}
1
+ {"version":3,"file":"ScoringOracle.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/ScoringOracle.ts"],"names":[],"mappings":";;;AAEA,MAAsB,aAAa;CAElC;AAFD,sCAEC"}
@@ -1,67 +1,57 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SimpleInstanceGenerator = void 0;
4
+ const InstanceGenerator_1 = require("./InstanceGenerator");
5
+ const Instance_1 = require("nlptoolkit-classification/dist/Instance/Instance");
6
+ const DiscreteIndexedAttribute_1 = require("nlptoolkit-classification/dist/Attribute/DiscreteIndexedAttribute");
7
+ const UniversalDependencyTreeBankFeatures_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyTreeBankFeatures");
8
+ class SimpleInstanceGenerator extends InstanceGenerator_1.InstanceGenerator {
9
+ constructor() {
10
+ super();
5
11
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./InstanceGenerator", "nlptoolkit-classification/dist/Instance/Instance", "nlptoolkit-classification/dist/Attribute/DiscreteIndexedAttribute", "nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyTreeBankFeatures"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SimpleInstanceGenerator = void 0;
13
- const InstanceGenerator_1 = require("./InstanceGenerator");
14
- const Instance_1 = require("nlptoolkit-classification/dist/Instance/Instance");
15
- const DiscreteIndexedAttribute_1 = require("nlptoolkit-classification/dist/Attribute/DiscreteIndexedAttribute");
16
- const UniversalDependencyTreeBankFeatures_1 = require("nlptoolkit-dependencyparser/dist/Universal/UniversalDependencyTreeBankFeatures");
17
- class SimpleInstanceGenerator extends InstanceGenerator_1.InstanceGenerator {
18
- constructor() {
19
- super();
20
- }
21
- /**
22
- * Generates an instance based on the state, window size, and command.
23
- * @param state The current state of the parser, which includes the stack and word list.
24
- * @param windowSize The size of the window used for feature extraction.
25
- * @param command The command to be associated with the generated instance.
26
- * @return The generated {@link Instance} object with attributes based on the state and command.
27
- */
28
- generate(state, windowSize, command) {
29
- let instance = new Instance_1.Instance(command);
30
- let attributes = new Array();
31
- for (let i = 0; i < windowSize; i++) {
32
- let word = state.getStackWord(i);
33
- if (word == null) {
34
- attributes.push(new DiscreteIndexedAttribute_1.DiscreteIndexedAttribute("null", 0, 18));
12
+ /**
13
+ * Generates an instance based on the state, window size, and command.
14
+ * @param state The current state of the parser, which includes the stack and word list.
15
+ * @param windowSize The size of the window used for feature extraction.
16
+ * @param command The command to be associated with the generated instance.
17
+ * @return The generated {@link Instance} object with attributes based on the state and command.
18
+ */
19
+ generate(state, windowSize, command) {
20
+ let instance = new Instance_1.Instance(command);
21
+ let attributes = new Array();
22
+ for (let i = 0; i < windowSize; i++) {
23
+ let word = state.getStackWord(i);
24
+ if (word == null) {
25
+ attributes.push(new DiscreteIndexedAttribute_1.DiscreteIndexedAttribute("null", 0, 18));
26
+ this.addEmptyAttributes(attributes);
27
+ }
28
+ else {
29
+ if (word.getName() == "root") {
30
+ attributes.push(new DiscreteIndexedAttribute_1.DiscreteIndexedAttribute("root", 0, 18));
35
31
  this.addEmptyAttributes(attributes);
36
32
  }
37
33
  else {
38
- if (word.getName() == "root") {
39
- attributes.push(new DiscreteIndexedAttribute_1.DiscreteIndexedAttribute("root", 0, 18));
40
- this.addEmptyAttributes(attributes);
41
- }
42
- else {
43
- attributes.push(new DiscreteIndexedAttribute_1.DiscreteIndexedAttribute(word.getUpos().toString(), UniversalDependencyTreeBankFeatures_1.UniversalDependencyTreeBankFeatures.posIndex(word.getUpos().toString()) + 1, 18));
44
- this.addFeatureAttributes(word, attributes);
45
- }
46
- }
47
- }
48
- for (let i = 0; i < windowSize; i++) {
49
- let word = state.getWordListWord(i);
50
- if (word != null) {
51
34
  attributes.push(new DiscreteIndexedAttribute_1.DiscreteIndexedAttribute(word.getUpos().toString(), UniversalDependencyTreeBankFeatures_1.UniversalDependencyTreeBankFeatures.posIndex(word.getUpos().toString()) + 1, 18));
52
35
  this.addFeatureAttributes(word, attributes);
53
36
  }
54
- else {
55
- attributes.push(new DiscreteIndexedAttribute_1.DiscreteIndexedAttribute("root", 0, 18));
56
- this.addEmptyAttributes(attributes);
57
- }
58
37
  }
59
- for (let attribute of attributes) {
60
- instance.addAttribute(attribute);
38
+ }
39
+ for (let i = 0; i < windowSize; i++) {
40
+ let word = state.getWordListWord(i);
41
+ if (word != null) {
42
+ attributes.push(new DiscreteIndexedAttribute_1.DiscreteIndexedAttribute(word.getUpos().toString(), UniversalDependencyTreeBankFeatures_1.UniversalDependencyTreeBankFeatures.posIndex(word.getUpos().toString()) + 1, 18));
43
+ this.addFeatureAttributes(word, attributes);
44
+ }
45
+ else {
46
+ attributes.push(new DiscreteIndexedAttribute_1.DiscreteIndexedAttribute("root", 0, 18));
47
+ this.addEmptyAttributes(attributes);
61
48
  }
62
- return instance;
63
49
  }
50
+ for (let attribute of attributes) {
51
+ instance.addAttribute(attribute);
52
+ }
53
+ return instance;
64
54
  }
65
- exports.SimpleInstanceGenerator = SimpleInstanceGenerator;
66
- });
55
+ }
56
+ exports.SimpleInstanceGenerator = SimpleInstanceGenerator;
67
57
  //# sourceMappingURL=SimpleInstanceGenerator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SimpleInstanceGenerator.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/SimpleInstanceGenerator.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,2DAAsD;IAEtD,+EAA0E;IAC1E,gHAA2G;IAC3G,wIAEwF;IAGxF,MAAa,uBAAwB,SAAQ,qCAAiB;QAE1D;YACI,KAAK,EAAE,CAAC;QACZ,CAAC;QAED;;;;;;WAMG;QACH,QAAQ,CAAC,KAAY,EAAE,UAAkB,EAAE,OAAe;YACtD,IAAI,QAAQ,GAAG,IAAI,mBAAQ,CAAC,OAAO,CAAC,CAAA;YACpC,IAAI,UAAU,GAAG,IAAI,KAAK,EAAa,CAAA;YACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;gBACjC,IAAI,IAAI,GAAG,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;gBACjC,IAAI,IAAI,IAAI,IAAI,EAAE;oBACd,UAAU,CAAC,IAAI,CAAC,IAAI,mDAAwB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;oBAC5D,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;iBACtC;qBAAM;oBACH,IAAI,IAAI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EAAE,yEAAmC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;oBACzJ,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;gBAC/C,CAAC;YACL,CAAC;QACL,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE,CAAC;YAClC,IAAI,IAAI,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;YACnC,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;gBACf,UAAU,CAAC,IAAI,CAAC,IAAI,mDAAwB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,yEAAmC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;gBACzJ,IAAI,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;YAC/C,CAAC;iBAAM,CAAC;gBACJ,UAAU,CAAC,IAAI,CAAC,IAAI,mDAAwB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;gBAC5D,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAA;YACvC,CAAC;QACL,CAAC;QACD,KAAK,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;YAC/B,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC,CAAA;QACpC,CAAC;QACD,OAAO,QAAQ,CAAA;IACnB,CAAC;CAEJ;AA/CD,0DA+CC"}
@@ -1,30 +1,22 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StackRelation = void 0;
4
+ class StackRelation {
5
+ word;
6
+ relation;
7
+ constructor(word, relation) {
8
+ this.word = word;
9
+ this.relation = relation;
5
10
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
11
+ clone() {
12
+ return new StackRelation(this.word.clone(), this.relation);
8
13
  }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.StackRelation = void 0;
13
- class StackRelation {
14
- constructor(word, relation) {
15
- this.word = word;
16
- this.relation = relation;
17
- }
18
- clone() {
19
- return new StackRelation(this.word.clone(), this.relation);
20
- }
21
- getWord() {
22
- return this.word;
23
- }
24
- getRelation() {
25
- return this.relation;
26
- }
14
+ getWord() {
15
+ return this.word;
27
16
  }
28
- exports.StackRelation = StackRelation;
29
- });
17
+ getRelation() {
18
+ return this.relation;
19
+ }
20
+ }
21
+ exports.StackRelation = StackRelation;
30
22
  //# sourceMappingURL=StackRelation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StackRelation.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/StackRelation.ts"],"names":[],"mappings":";;;;;;;;;;;;IAKA,MAAa,aAAa;QAKtB,YAAY,IAAqC,EAAE,QAAqC;YACpF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;YAChB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QAC5B,CAAC;QAED,KAAK;YACD,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;QAC9D,CAAC;QAED,OAAO;YACH,OAAO,IAAI,CAAC,IAAI,CAAA;QACpB,CAAC;QAED,WAAW;YACP,OAAO,IAAI,CAAC,QAAQ,CAAA;QACxB,CAAC;KACJ;IArBD,sCAqBC"}
1
+ {"version":3,"file":"StackRelation.js","sourceRoot":"","sources":["../../../source/Parser/TransitionBasedParser/StackRelation.ts"],"names":[],"mappings":";;;AAKA,MAAa,aAAa;IAEL,IAAI,CAAiC;IACrC,QAAQ,CAA6B;IAEtD,YAAY,IAAqC,EAAE,QAAqC;QACpF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC5B,CAAC;IAED,KAAK;QACD,OAAO,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,IAAI,CAAA;IACpB,CAAC;IAED,WAAW;QACP,OAAO,IAAI,CAAC,QAAQ,CAAA;IACxB,CAAC;CACJ;AArBD,sCAqBC"}