nlptoolkit-framenet 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.
- package/README.md +1 -1
- package/dist/Frame.d.ts +35 -0
- package/dist/Frame.js +35 -0
- package/dist/Frame.js.map +1 -1
- package/dist/FrameElement.d.ts +8 -1
- package/dist/FrameElement.js +9 -0
- package/dist/FrameElement.js.map +1 -1
- package/dist/FrameElementList.d.ts +54 -0
- package/dist/FrameElementList.js +135 -0
- package/dist/FrameElementList.js.map +1 -0
- package/dist/FrameNet.d.ts +24 -1
- package/dist/FrameNet.js +23 -0
- package/dist/FrameNet.js.map +1 -1
- package/framenet.xml +21556 -4613
- package/index.js +2 -1
- package/package.json +1 -1
- package/source/Frame.ts +35 -0
- package/source/FrameElement.ts +11 -1
- package/source/FrameElementList.ts +131 -0
- package/source/FrameNet.ts +24 -1
- package/tests/FrameNetTest.ts +4 -4
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Video Lectures
|
|
|
25
25
|
For Developers
|
|
26
26
|
============
|
|
27
27
|
You can also see either [Python](https://github.com/starlangsoftware/TurkishFrameNet-Py), [Java](https://github.com/starlangsoftware/TurkishFrameNet),
|
|
28
|
-
[C++](https://github.com/starlangsoftware/TurkishFrameNet-CPP), [C#](https://github.com/starlangsoftware/TurkishFrameNet-CS),
|
|
28
|
+
[C++](https://github.com/starlangsoftware/TurkishFrameNet-CPP), [C](https://github.com/starlangsoftware/TurkishFrameNet-C), [C#](https://github.com/starlangsoftware/TurkishFrameNet-CS), [Php](https://github.com/starlangsoftware/TurkishFrameNet-Php),
|
|
29
29
|
[Cython](https://github.com/starlangsoftware/TurkishFrameNet-Cy), or [Swift](https://github.com/starlangsoftware/TurkishFrameNet-Swift) repository.
|
|
30
30
|
|
|
31
31
|
## Requirements
|
package/dist/Frame.d.ts
CHANGED
|
@@ -8,12 +8,47 @@ export declare class Frame {
|
|
|
8
8
|
* @param name Name of the frame
|
|
9
9
|
*/
|
|
10
10
|
constructor(name: string);
|
|
11
|
+
/**
|
|
12
|
+
* Adds a new lexical unit to the current frame
|
|
13
|
+
* @param lexicalUnit Lexical unit to be added
|
|
14
|
+
*/
|
|
11
15
|
addLexicalUnit(lexicalUnit: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Adds a new frame element to the current frame
|
|
18
|
+
* @param frameElement Frame element to be added
|
|
19
|
+
*/
|
|
12
20
|
addFrameElement(frameElement: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if the given lexical unit exists in the current frame
|
|
23
|
+
* @param lexicalUnit Lexical unit to be searched.
|
|
24
|
+
* @return True if the lexical unit exists, false otherwise.
|
|
25
|
+
*/
|
|
13
26
|
lexicalUnitExists(lexicalUnit: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Accessor for a given index in the lexicalUnit array.
|
|
29
|
+
* @param index Index of the lexical unit
|
|
30
|
+
* @return The lexical unit at position index in the lexicalUnit array
|
|
31
|
+
*/
|
|
14
32
|
getLexicalUnit(index: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* Accessor for a given index in the frameElements array.
|
|
35
|
+
* @param index Index of the frame element
|
|
36
|
+
* @return The frame element at position index in the frameElements array
|
|
37
|
+
*/
|
|
15
38
|
getFrameElement(index: number): string;
|
|
39
|
+
/**
|
|
40
|
+
* Returns number of lexical units in the current frame
|
|
41
|
+
* @return Number of lexical units in the current frame
|
|
42
|
+
*/
|
|
16
43
|
lexicalUnitSize(): number;
|
|
44
|
+
/**
|
|
45
|
+
* Returns number of frame elements in the current frame
|
|
46
|
+
* @return Number of frame elements in the current frame
|
|
47
|
+
*/
|
|
17
48
|
frameElementSize(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Accessor for the name of the frame
|
|
51
|
+
* @return Name of the frame
|
|
52
|
+
*/
|
|
18
53
|
getName(): string;
|
|
19
54
|
}
|
package/dist/Frame.js
CHANGED
|
@@ -21,27 +21,62 @@
|
|
|
21
21
|
this.lexicalUnits = [];
|
|
22
22
|
this.frameElements = [];
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Adds a new lexical unit to the current frame
|
|
26
|
+
* @param lexicalUnit Lexical unit to be added
|
|
27
|
+
*/
|
|
24
28
|
addLexicalUnit(lexicalUnit) {
|
|
25
29
|
this.lexicalUnits.push(lexicalUnit);
|
|
26
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Adds a new frame element to the current frame
|
|
33
|
+
* @param frameElement Frame element to be added
|
|
34
|
+
*/
|
|
27
35
|
addFrameElement(frameElement) {
|
|
28
36
|
this.frameElements.push(frameElement);
|
|
29
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Checks if the given lexical unit exists in the current frame
|
|
40
|
+
* @param lexicalUnit Lexical unit to be searched.
|
|
41
|
+
* @return True if the lexical unit exists, false otherwise.
|
|
42
|
+
*/
|
|
30
43
|
lexicalUnitExists(lexicalUnit) {
|
|
31
44
|
return this.lexicalUnits.includes(lexicalUnit);
|
|
32
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Accessor for a given index in the lexicalUnit array.
|
|
48
|
+
* @param index Index of the lexical unit
|
|
49
|
+
* @return The lexical unit at position index in the lexicalUnit array
|
|
50
|
+
*/
|
|
33
51
|
getLexicalUnit(index) {
|
|
34
52
|
return this.lexicalUnits[index];
|
|
35
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Accessor for a given index in the frameElements array.
|
|
56
|
+
* @param index Index of the frame element
|
|
57
|
+
* @return The frame element at position index in the frameElements array
|
|
58
|
+
*/
|
|
36
59
|
getFrameElement(index) {
|
|
37
60
|
return this.frameElements[index];
|
|
38
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Returns number of lexical units in the current frame
|
|
64
|
+
* @return Number of lexical units in the current frame
|
|
65
|
+
*/
|
|
39
66
|
lexicalUnitSize() {
|
|
40
67
|
return this.lexicalUnits.length;
|
|
41
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Returns number of frame elements in the current frame
|
|
71
|
+
* @return Number of frame elements in the current frame
|
|
72
|
+
*/
|
|
42
73
|
frameElementSize() {
|
|
43
74
|
return this.frameElements.length;
|
|
44
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Accessor for the name of the frame
|
|
78
|
+
* @return Name of the frame
|
|
79
|
+
*/
|
|
45
80
|
getName() {
|
|
46
81
|
return this.name;
|
|
47
82
|
}
|
package/dist/Frame.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Frame.js","sourceRoot":"","sources":["../source/Frame.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,MAAa,KAAK;QAMd;;;;WAIG;QACH,YAAY,IAAY;YACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;YAChB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAA;YACtB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;QAC3B,CAAC;QAED,cAAc,CAAC,WAAmB;YAC9B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACvC,CAAC;QAED,eAAe,CAAC,YAAoB;YAChC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACzC,CAAC;QAED,iBAAiB,CAAC,WAAmB;YACjC,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;QAClD,CAAC;QAED,cAAc,CAAC,KAAa;YACxB,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;QACnC,CAAC;QAED,eAAe,CAAC,KAAa;YACzB,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QACpC,CAAC;QAED,eAAe;YACX,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAA;QACnC,CAAC;QAED,gBAAgB;YACZ,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAA;QACpC,CAAC;QAED,OAAO;YACH,OAAO,IAAI,CAAC,IAAI,CAAA;QACpB,CAAC;KACJ;
|
|
1
|
+
{"version":3,"file":"Frame.js","sourceRoot":"","sources":["../source/Frame.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,MAAa,KAAK;QAMd;;;;WAIG;QACH,YAAY,IAAY;YACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;YAChB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAA;YACtB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAA;QAC3B,CAAC;QAED;;;WAGG;QACH,cAAc,CAAC,WAAmB;YAC9B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;QACvC,CAAC;QAED;;;WAGG;QACH,eAAe,CAAC,YAAoB;YAChC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;QACzC,CAAC;QAED;;;;WAIG;QACH,iBAAiB,CAAC,WAAmB;YACjC,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;QAClD,CAAC;QAED;;;;WAIG;QACH,cAAc,CAAC,KAAa;YACxB,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;QACnC,CAAC;QAED;;;;WAIG;QACH,eAAe,CAAC,KAAa;YACzB,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QACpC,CAAC;QAED;;;WAGG;QACH,eAAe;YACX,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAA;QACnC,CAAC;QAED;;;WAGG;QACH,gBAAgB;YACZ,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAA;QACpC,CAAC;QAED;;;WAGG;QACH,OAAO;YACH,OAAO,IAAI,CAAC,IAAI,CAAA;QACpB,CAAC;KACJ;IAnFD,sBAmFC"}
|
package/dist/FrameElement.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare class FrameElement {
|
|
2
2
|
private readonly frameElementType;
|
|
3
3
|
private readonly frame;
|
|
4
|
-
private
|
|
4
|
+
private id;
|
|
5
5
|
/**
|
|
6
6
|
* A constructor of {@link FrameElement} class which takes frameElement string which is in the form of frameElementType$id
|
|
7
7
|
* and parses this string into frameElementType and id. If the frameElement string does not contain '$' then the
|
|
@@ -30,6 +30,13 @@ export declare class FrameElement {
|
|
|
30
30
|
* @return id.
|
|
31
31
|
*/
|
|
32
32
|
getId(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Mutator for id.
|
|
35
|
+
*
|
|
36
|
+
* @param id New id.
|
|
37
|
+
* @return id.
|
|
38
|
+
*/
|
|
39
|
+
setId(id: string): void;
|
|
33
40
|
/**
|
|
34
41
|
* toString converts an {@link FrameElement} to a string. If the frameElementType is "NONE" returns only "NONE", otherwise
|
|
35
42
|
* it returns argument string which is in the form of frameElementType$id
|
package/dist/FrameElement.js
CHANGED
|
@@ -61,6 +61,15 @@
|
|
|
61
61
|
getId() {
|
|
62
62
|
return this.id;
|
|
63
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Mutator for id.
|
|
66
|
+
*
|
|
67
|
+
* @param id New id.
|
|
68
|
+
* @return id.
|
|
69
|
+
*/
|
|
70
|
+
setId(id) {
|
|
71
|
+
this.id = id;
|
|
72
|
+
}
|
|
64
73
|
/**
|
|
65
74
|
* toString converts an {@link FrameElement} to a string. If the frameElementType is "NONE" returns only "NONE", otherwise
|
|
66
75
|
* it returns argument string which is in the form of frameElementType$id
|
package/dist/FrameElement.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameElement.js","sourceRoot":"","sources":["../source/FrameElement.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,MAAa,YAAY;QAMrB;;;;;;;;WAQG;QACH,YAAY,YAAoB,EAAE,KAAc,EAAE,EAAW;YACzD,IAAI,KAAK,IAAI,SAAS,EAAC;gBACnB,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC;oBAC3B,IAAI,CAAC,gBAAg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G,IAAI,CAAC,KAAK,GAAG,GAAG,GAAG,IAAI,CAAC,EAAE,CAAC;aACnE;QACL,CAAC;KACJ;IAjFD,oCAiFC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare class FrameElementList {
|
|
2
|
+
private readonly _frameElements;
|
|
3
|
+
/**
|
|
4
|
+
* Constructor of frame element list from a string. The frame elements for a word is a concatenated list of
|
|
5
|
+
* frame element separated via '#' character.
|
|
6
|
+
* @param frameElementList String consisting of frame elements separated with '#' character.
|
|
7
|
+
*/
|
|
8
|
+
constructor(frameElementList: string);
|
|
9
|
+
/**
|
|
10
|
+
* Overloaded toString method to convert a frame element list to a string. Concatenates the string forms of all
|
|
11
|
+
* frame element with '#' character.
|
|
12
|
+
* @return String form of the frame element list.
|
|
13
|
+
*/
|
|
14
|
+
toString(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Replaces id's of predicates, which have previousId as synset id, with currentId.
|
|
17
|
+
* @param previousId Previous id of the synset.
|
|
18
|
+
* @param currentId Replacement id.
|
|
19
|
+
*/
|
|
20
|
+
updateConnectedId(previousId: string, currentId: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Adds a predicate argument to the frame element list of this word.
|
|
23
|
+
* @param predicateId Synset id of this predicate.
|
|
24
|
+
*/
|
|
25
|
+
addPredicate(predicateId: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Removes the predicate with the given predicate id.
|
|
28
|
+
*/
|
|
29
|
+
removePredicate(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if one of the frame elements is a predicate.
|
|
32
|
+
* @return True, if one of the frame elements is predicate; false otherwise.
|
|
33
|
+
*/
|
|
34
|
+
containsPredicate(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Checks if one of the frame element is a predicate with the given id.
|
|
37
|
+
* @param predicateId Synset id to check.
|
|
38
|
+
* @return True, if one of the frame element is predicate; false otherwise.
|
|
39
|
+
*/
|
|
40
|
+
containsPredicateWithId(predicateId: string): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Returns the frame elements as an array list of strings.
|
|
43
|
+
* @return Frame elements as an array list of strings.
|
|
44
|
+
*/
|
|
45
|
+
getFrameElements(): Array<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Checks if the given argument with the given type and id exists or not.
|
|
48
|
+
* @param frameElementType Type of the frame element to search for.
|
|
49
|
+
* @param frame frame Name of the frame to search for
|
|
50
|
+
* @param id Id of the frame element to search for.
|
|
51
|
+
* @return True if the frame element exists, false otherwise.
|
|
52
|
+
*/
|
|
53
|
+
containsFrameElement(frameElementType: string, frame: string, id: string): boolean;
|
|
54
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
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", "./FrameElement"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.FrameElementList = void 0;
|
|
13
|
+
const FrameElement_1 = require("./FrameElement");
|
|
14
|
+
class FrameElementList {
|
|
15
|
+
/**
|
|
16
|
+
* Constructor of frame element list from a string. The frame elements for a word is a concatenated list of
|
|
17
|
+
* frame element separated via '#' character.
|
|
18
|
+
* @param frameElementList String consisting of frame elements separated with '#' character.
|
|
19
|
+
*/
|
|
20
|
+
constructor(frameElementList) {
|
|
21
|
+
this._frameElements = [];
|
|
22
|
+
let items = frameElementList.split("#");
|
|
23
|
+
for (let item of items) {
|
|
24
|
+
this._frameElements.push(new FrameElement_1.FrameElement(item));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Overloaded toString method to convert a frame element list to a string. Concatenates the string forms of all
|
|
29
|
+
* frame element with '#' character.
|
|
30
|
+
* @return String form of the frame element list.
|
|
31
|
+
*/
|
|
32
|
+
toString() {
|
|
33
|
+
if (this._frameElements.length == 0) {
|
|
34
|
+
return "NONE";
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
let result = this._frameElements[0].toString();
|
|
38
|
+
for (let i = 1; i < this._frameElements.length; i++) {
|
|
39
|
+
result += "#" + this._frameElements[i].toString();
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Replaces id's of predicates, which have previousId as synset id, with currentId.
|
|
46
|
+
* @param previousId Previous id of the synset.
|
|
47
|
+
* @param currentId Replacement id.
|
|
48
|
+
*/
|
|
49
|
+
updateConnectedId(previousId, currentId) {
|
|
50
|
+
for (let frameElement of this._frameElements) {
|
|
51
|
+
if (frameElement.getId() == previousId) {
|
|
52
|
+
frameElement.setId(currentId);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Adds a predicate argument to the frame element list of this word.
|
|
58
|
+
* @param predicateId Synset id of this predicate.
|
|
59
|
+
*/
|
|
60
|
+
addPredicate(predicateId) {
|
|
61
|
+
if (this._frameElements.length != 0 && this._frameElements[0].getFrameElementType() == "NONE") {
|
|
62
|
+
this._frameElements.shift();
|
|
63
|
+
}
|
|
64
|
+
this._frameElements.push(new FrameElement_1.FrameElement("PREDICATE", "NONE", predicateId));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Removes the predicate with the given predicate id.
|
|
68
|
+
*/
|
|
69
|
+
removePredicate() {
|
|
70
|
+
let i = 0;
|
|
71
|
+
for (let frameElement of this._frameElements) {
|
|
72
|
+
if (frameElement.getFrameElementType() == "PREDICATE") {
|
|
73
|
+
this._frameElements.splice(i, 1);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
i++;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Checks if one of the frame elements is a predicate.
|
|
81
|
+
* @return True, if one of the frame elements is predicate; false otherwise.
|
|
82
|
+
*/
|
|
83
|
+
containsPredicate() {
|
|
84
|
+
for (let frameElement of this._frameElements) {
|
|
85
|
+
if (frameElement.getFrameElementType() == "PREDICATE") {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Checks if one of the frame element is a predicate with the given id.
|
|
93
|
+
* @param predicateId Synset id to check.
|
|
94
|
+
* @return True, if one of the frame element is predicate; false otherwise.
|
|
95
|
+
*/
|
|
96
|
+
containsPredicateWithId(predicateId) {
|
|
97
|
+
for (let frameElement of this._frameElements) {
|
|
98
|
+
if (frameElement.getFrameElementType() == "PREDICATE" && frameElement.getId() == predicateId) {
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Returns the frame elements as an array list of strings.
|
|
106
|
+
* @return Frame elements as an array list of strings.
|
|
107
|
+
*/
|
|
108
|
+
getFrameElements() {
|
|
109
|
+
let result = [];
|
|
110
|
+
for (let frameElement of this._frameElements) {
|
|
111
|
+
result.push(frameElement.toString());
|
|
112
|
+
}
|
|
113
|
+
return result;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Checks if the given argument with the given type and id exists or not.
|
|
117
|
+
* @param frameElementType Type of the frame element to search for.
|
|
118
|
+
* @param frame frame Name of the frame to search for
|
|
119
|
+
* @param id Id of the frame element to search for.
|
|
120
|
+
* @return True if the frame element exists, false otherwise.
|
|
121
|
+
*/
|
|
122
|
+
containsFrameElement(frameElementType, frame, id) {
|
|
123
|
+
for (let frameElement of this._frameElements) {
|
|
124
|
+
if (frameElement.getFrameElementType() == frameElementType &&
|
|
125
|
+
frameElement.getFrame() == frame &&
|
|
126
|
+
frameElement.getId() == id) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
exports.FrameElementList = FrameElementList;
|
|
134
|
+
});
|
|
135
|
+
//# sourceMappingURL=FrameElementList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FrameElementList.js","sourceRoot":"","sources":["../source/FrameElementList.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,iDAA4C;IAE5C,MAAa,gBAAgB;QAIzB;;;;WAIG;QACH,YAAY,gBAAwB;YAChC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAA;YACxB,IAAI,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACxC,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE;gBACpB,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,IAAI,CAAC,CAAC,CAAC;aACpD;QACL,CAAC;QAED;;;;WAIG;QACH,QAAQ;YACJ,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,IAAI,CAAC,EAAC;gBAChC,OAAO,MAAM,CAAA;aAChB;iBAAM;gBACH,IAAI,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;gBAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAC;oBAChD,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAA;iBACpD;gBACD,OAAO,MAAM,CAAC;aACjB;QACL,CAAC;QAED;;;;WAIG;QACH,iBAAiB,CAAC,UAAkB,EAAE,SAAiB;YACnD,KAAK,IAAI,YAAY,IAAI,IAAI,CAAC,cAAc,EAAE;gBAC1C,IAAI,YAAY,CAAC,KAAK,EAAE,I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GG;QACH,gBAAgB;YACZ,IAAI,MAAM,GAAG,EAAE,CAAA;YACf,KAAK,IAAI,YAAY,IAAI,IAAI,CAAC,cAAc,EAAE;gBAC1C,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;aACxC;YACD,OAAO,MAAM,CAAC;QAClB,CAAC;QAED;;;;;;WAMG;QACH,oBAAoB,CAAC,gBAAwB,EAAE,KAAa,EAAE,EAAU;YACpE,KAAK,IAAI,YAAY,IAAI,IAAI,CAAC,cAAc,EAAE;gBAC1C,IAAI,YAAY,CAAC,mBAAmB,EAAE,IAAI,gBAAgB;oBACtD,YAAY,CAAC,QAAQ,EAAE,IAAI,KAAK;oBAChC,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAC;oBAC3B,OAAO,IAAI,CAAC;iBACf;aACJ;YACD,OAAO,KAAK,CAAC;QACjB,CAAC;KACJ;IAhID,4CAgIC"}
|
package/dist/FrameNet.d.ts
CHANGED
|
@@ -1,9 +1,32 @@
|
|
|
1
1
|
import { Frame } from "./Frame";
|
|
2
2
|
export declare class FrameNet {
|
|
3
|
-
private frames;
|
|
3
|
+
private readonly frames;
|
|
4
|
+
/**
|
|
5
|
+
* A constructor of {@link FrameNet} class which reads all frame files inside the files2.txt file. For each
|
|
6
|
+
* filename inside that file, the constructor creates a FrameNet.Frame and puts in inside the frames {@link ArrayList}.
|
|
7
|
+
*/
|
|
4
8
|
constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Checks if the given lexical unit exists in any frame in the frame set.
|
|
11
|
+
* @param synSetId Id of the lexical unit
|
|
12
|
+
* @return True if any frame contains the given lexical unit, false otherwise.
|
|
13
|
+
*/
|
|
5
14
|
lexicalUnitExists(synSetId: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Returns an array of frames that contain the given lexical unit in their lexical units
|
|
17
|
+
* @param synSetId Id of the lexical unit.
|
|
18
|
+
* @return An array of frames that contains the given lexical unit.
|
|
19
|
+
*/
|
|
6
20
|
getFrames(synSetId: string): Array<Frame>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns number of frames in the frame set.
|
|
23
|
+
* @return Number of frames in the frame set.
|
|
24
|
+
*/
|
|
7
25
|
size(): number;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the element at the specified position in the frame list.
|
|
28
|
+
* @param index index of the element to return
|
|
29
|
+
* @return The element at the specified position in the frame list.
|
|
30
|
+
*/
|
|
8
31
|
getFrame(index: number): Frame;
|
|
9
32
|
}
|
package/dist/FrameNet.js
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
const Frame_1 = require("./Frame");
|
|
14
14
|
const XmlDocument_1 = require("nlptoolkit-xmlparser/dist/XmlDocument");
|
|
15
15
|
class FrameNet {
|
|
16
|
+
/**
|
|
17
|
+
* A constructor of {@link FrameNet} class which reads all frame files inside the files2.txt file. For each
|
|
18
|
+
* filename inside that file, the constructor creates a FrameNet.Frame and puts in inside the frames {@link ArrayList}.
|
|
19
|
+
*/
|
|
16
20
|
constructor() {
|
|
17
21
|
let xmlDocument;
|
|
18
22
|
xmlDocument = new XmlDocument_1.XmlDocument("framenet.xml");
|
|
@@ -38,6 +42,11 @@
|
|
|
38
42
|
frameNode = frameNode.getNextSibling();
|
|
39
43
|
}
|
|
40
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Checks if the given lexical unit exists in any frame in the frame set.
|
|
47
|
+
* @param synSetId Id of the lexical unit
|
|
48
|
+
* @return True if any frame contains the given lexical unit, false otherwise.
|
|
49
|
+
*/
|
|
41
50
|
lexicalUnitExists(synSetId) {
|
|
42
51
|
for (let frame of this.frames) {
|
|
43
52
|
if (frame.lexicalUnitExists(synSetId)) {
|
|
@@ -46,6 +55,11 @@
|
|
|
46
55
|
}
|
|
47
56
|
return false;
|
|
48
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Returns an array of frames that contain the given lexical unit in their lexical units
|
|
60
|
+
* @param synSetId Id of the lexical unit.
|
|
61
|
+
* @return An array of frames that contains the given lexical unit.
|
|
62
|
+
*/
|
|
49
63
|
getFrames(synSetId) {
|
|
50
64
|
var result = [];
|
|
51
65
|
for (let frame of this.frames) {
|
|
@@ -55,9 +69,18 @@
|
|
|
55
69
|
}
|
|
56
70
|
return result;
|
|
57
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Returns number of frames in the frame set.
|
|
74
|
+
* @return Number of frames in the frame set.
|
|
75
|
+
*/
|
|
58
76
|
size() {
|
|
59
77
|
return this.frames.length;
|
|
60
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Returns the element at the specified position in the frame list.
|
|
81
|
+
* @param index index of the element to return
|
|
82
|
+
* @return The element at the specified position in the frame list.
|
|
83
|
+
*/
|
|
61
84
|
getFrame(index) {
|
|
62
85
|
return this.frames[index];
|
|
63
86
|
}
|
package/dist/FrameNet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FrameNet.js","sourceRoot":"","sources":["../source/FrameNet.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,mCAA8B;IAC9B,uEAAkE;IAElE,MAAa,QAAQ;QAIjB;YACI,IAAI,WAAwB,CAAC;YAC7B,WAAW,GAAG,IAAI,yBAAW,CAAC,cAAc,CAAC,CAAA;YAC7C,WAAW,CAAC,KAAK,EAAE,CAAA;YACnB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;YAChB,IAAI,QAAQ,GAAG,WAAW,CAAC,aAAa,EAAE,CAAA;YAC1C,IAAI,SAAS,GAAG,QAAQ,CAAC,aAAa,EAAE,CAAA;YACxC,OAAO,SAAS,IAAI,SAAS,EAAC;gBAC1B,IAAI,YAAY,GAAG,IAAI,aAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAA;gBACjE,IAAI,YAAY,GAAG,SAAS,CAAC,aAAa,EAAE,CAAA;gBAC5C,IAAI,WAAW,GAAG,YAAY,CAAC,aAAa,EAAE,CAAA;gBAC9C,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