nlptoolkit-annotatedtree 1.0.2 → 1.0.4
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 +6 -1
- package/dist/Layer/DependencyLayer.d.ts +4 -0
- package/dist/Layer/DependencyLayer.js +4 -0
- package/dist/Layer/DependencyLayer.js.map +1 -1
- package/dist/Layer/EnglishPropbankLayer.d.ts +9 -0
- package/dist/Layer/EnglishPropbankLayer.js +9 -0
- package/dist/Layer/EnglishPropbankLayer.js.map +1 -1
- package/dist/Layer/EnglishSemanticLayer.d.ts +5 -0
- package/dist/Layer/EnglishSemanticLayer.js +5 -0
- package/dist/Layer/EnglishSemanticLayer.js.map +1 -1
- package/dist/Layer/EnglishWordLayer.d.ts +4 -0
- package/dist/Layer/EnglishWordLayer.js +4 -0
- package/dist/Layer/EnglishWordLayer.js.map +1 -1
- package/dist/Layer/MetaMorphemeLayer.d.ts +19 -0
- package/dist/Layer/MetaMorphemeLayer.js +19 -0
- package/dist/Layer/MetaMorphemeLayer.js.map +1 -1
- package/dist/Layer/MetaMorphemesMovedLayer.d.ts +20 -0
- package/dist/Layer/MetaMorphemesMovedLayer.js +20 -0
- package/dist/Layer/MetaMorphemesMovedLayer.js.map +1 -1
- package/dist/Layer/MorphologicalAnalysisLayer.d.ts +32 -0
- package/dist/Layer/MorphologicalAnalysisLayer.js +32 -0
- package/dist/Layer/MorphologicalAnalysisLayer.js.map +1 -1
- package/dist/Layer/MultiWordLayer.d.ts +9 -0
- package/dist/Layer/MultiWordLayer.js +9 -0
- package/dist/Layer/MultiWordLayer.js.map +1 -1
- package/dist/Layer/NERLayer.d.ts +14 -0
- package/dist/Layer/NERLayer.js +14 -0
- package/dist/Layer/NERLayer.js.map +1 -1
- package/dist/Layer/PersianWordLayer.d.ts +4 -0
- package/dist/Layer/PersianWordLayer.js +4 -0
- package/dist/Layer/PersianWordLayer.js.map +1 -1
- package/dist/Layer/ShallowParseLayer.d.ts +11 -0
- package/dist/Layer/ShallowParseLayer.js +11 -0
- package/dist/Layer/ShallowParseLayer.js.map +1 -1
- package/dist/Layer/SingleWordLayer.d.ts +4 -0
- package/dist/Layer/SingleWordLayer.js +4 -0
- package/dist/Layer/SingleWordLayer.js.map +1 -1
- package/dist/Layer/SourceLanguageWordLayer.d.ts +4 -0
- package/dist/Layer/SourceLanguageWordLayer.js +4 -0
- package/dist/Layer/SourceLanguageWordLayer.js.map +1 -1
- package/dist/Layer/TargetLanguageWordLayer.d.ts +10 -1
- package/dist/Layer/TargetLanguageWordLayer.js +9 -0
- package/dist/Layer/TargetLanguageWordLayer.js.map +1 -1
- package/dist/Layer/TurkishPropbankLayer.d.ts +18 -0
- package/dist/Layer/TurkishPropbankLayer.js +18 -0
- package/dist/Layer/TurkishPropbankLayer.js.map +1 -1
- package/dist/Layer/TurkishSemanticLayer.d.ts +11 -0
- package/dist/Layer/TurkishSemanticLayer.js +11 -0
- package/dist/Layer/TurkishSemanticLayer.js.map +1 -1
- package/dist/Layer/TurkishWordLayer.d.ts +4 -0
- package/dist/Layer/TurkishWordLayer.js +4 -0
- package/dist/Layer/TurkishWordLayer.js.map +1 -1
- package/dist/Layer/WordLayer.d.ts +12 -0
- package/dist/Layer/WordLayer.js +12 -0
- package/dist/Layer/WordLayer.js.map +1 -1
- package/dist/LayerInfo.d.ts +188 -0
- package/dist/LayerInfo.js +229 -63
- package/dist/LayerInfo.js.map +1 -1
- package/dist/ParseNodeDrawable.d.ts +102 -0
- package/dist/ParseNodeDrawable.js +102 -0
- package/dist/ParseNodeDrawable.js.map +1 -1
- package/dist/ParseTreeDrawable.d.ts +134 -0
- package/dist/ParseTreeDrawable.js +153 -16
- package/dist/ParseTreeDrawable.js.map +1 -1
- package/dist/Processor/Condition/IsDoubleNode.d.ts +6 -0
- package/dist/Processor/Condition/IsDoubleNode.js +6 -0
- package/dist/Processor/Condition/IsDoubleNode.js.map +1 -1
- package/dist/Processor/Condition/IsDoubleNodeWithDifferentTags.d.ts +6 -0
- package/dist/Processor/Condition/IsDoubleNodeWithDifferentTags.js +6 -0
- package/dist/Processor/Condition/IsDoubleNodeWithDifferentTags.js.map +1 -1
- package/dist/Processor/Condition/IsEnglishLeafNode.d.ts +5 -0
- package/dist/Processor/Condition/IsEnglishLeafNode.js +5 -0
- package/dist/Processor/Condition/IsEnglishLeafNode.js.map +1 -1
- package/dist/Processor/Condition/IsLeafNode.d.ts +5 -0
- package/dist/Processor/Condition/IsLeafNode.js +5 -0
- package/dist/Processor/Condition/IsLeafNode.js.map +1 -1
- package/dist/Processor/Condition/IsNodeWithPredicate.d.ts +11 -0
- package/dist/Processor/Condition/IsNodeWithPredicate.js +11 -0
- package/dist/Processor/Condition/IsNodeWithPredicate.js.map +1 -1
- package/dist/Processor/Condition/IsNodeWithSymbol.d.ts +9 -0
- package/dist/Processor/Condition/IsNodeWithSymbol.js +9 -0
- package/dist/Processor/Condition/IsNodeWithSymbol.js.map +1 -1
- package/dist/Processor/Condition/IsNodeWithSynSetId.d.ts +9 -0
- package/dist/Processor/Condition/IsNodeWithSynSetId.js +9 -0
- package/dist/Processor/Condition/IsNodeWithSynSetId.js.map +1 -1
- package/dist/Processor/Condition/IsNoneNode.d.ts +5 -0
- package/dist/Processor/Condition/IsNoneNode.js +5 -0
- package/dist/Processor/Condition/IsNoneNode.js.map +1 -1
- package/dist/Processor/Condition/IsNullElement.d.ts +6 -0
- package/dist/Processor/Condition/IsNullElement.js +6 -0
- package/dist/Processor/Condition/IsNullElement.js.map +1 -1
- package/dist/Processor/Condition/IsNumber.d.ts +6 -0
- package/dist/Processor/Condition/IsNumber.js +6 -0
- package/dist/Processor/Condition/IsNumber.js.map +1 -1
- package/dist/Processor/Condition/IsPredicateVerbNode.d.ts +11 -0
- package/dist/Processor/Condition/IsPredicateVerbNode.js +11 -0
- package/dist/Processor/Condition/IsPredicateVerbNode.js.map +1 -1
- package/dist/Processor/Condition/IsProperNoun.d.ts +5 -0
- package/dist/Processor/Condition/IsProperNoun.js +5 -0
- package/dist/Processor/Condition/IsProperNoun.js.map +1 -1
- package/dist/Processor/Condition/IsPunctuationNode.d.ts +5 -0
- package/dist/Processor/Condition/IsPunctuationNode.js +5 -0
- package/dist/Processor/Condition/IsPunctuationNode.js.map +1 -1
- package/dist/Processor/Condition/IsTransferable.d.ts +5 -0
- package/dist/Processor/Condition/IsTransferable.js +5 -0
- package/dist/Processor/Condition/IsTransferable.js.map +1 -1
- package/dist/Processor/Condition/IsTurkishLeafNode.d.ts +5 -0
- package/dist/Processor/Condition/IsTurkishLeafNode.js +5 -0
- package/dist/Processor/Condition/IsTurkishLeafNode.js.map +1 -1
- package/dist/Processor/Condition/IsVPNode.d.ts +5 -0
- package/dist/Processor/Condition/IsVPNode.js +5 -0
- package/dist/Processor/Condition/IsVPNode.js.map +1 -1
- package/dist/Processor/Condition/IsVerbNode.d.ts +10 -0
- package/dist/Processor/Condition/IsVerbNode.js +10 -0
- package/dist/Processor/Condition/IsVerbNode.js.map +1 -1
- package/dist/Processor/LayerExist/ContainsLayerInformation.d.ts +9 -0
- package/dist/Processor/LayerExist/ContainsLayerInformation.js +9 -0
- package/dist/Processor/LayerExist/ContainsLayerInformation.js.map +1 -1
- package/dist/Processor/LayerExist/NotContainsLayerInformation.d.ts +9 -0
- package/dist/Processor/LayerExist/NotContainsLayerInformation.js +9 -0
- package/dist/Processor/LayerExist/NotContainsLayerInformation.js.map +1 -1
- package/dist/Processor/LayerExist/SemiContainsLayerInformation.d.ts +10 -0
- package/dist/Processor/LayerExist/SemiContainsLayerInformation.js +10 -0
- package/dist/Processor/LayerExist/SemiContainsLayerInformation.js.map +1 -1
- package/dist/Processor/LeafConverter/LeafToEnglish.d.ts +3 -0
- package/dist/Processor/LeafConverter/LeafToEnglish.js +3 -0
- package/dist/Processor/LeafConverter/LeafToEnglish.js.map +1 -1
- package/dist/Processor/LeafConverter/LeafToLanguageConverter.d.ts +7 -0
- package/dist/Processor/LeafConverter/LeafToLanguageConverter.js +7 -0
- package/dist/Processor/LeafConverter/LeafToLanguageConverter.js.map +1 -1
- package/dist/Processor/LeafConverter/LeafToPersian.d.ts +3 -0
- package/dist/Processor/LeafConverter/LeafToPersian.js +3 -0
- package/dist/Processor/LeafConverter/LeafToPersian.js.map +1 -1
- package/dist/Processor/LeafConverter/LeafToRootFormConverter.d.ts +7 -0
- package/dist/Processor/LeafConverter/LeafToRootFormConverter.js +7 -0
- package/dist/Processor/LeafConverter/LeafToRootFormConverter.js.map +1 -1
- package/dist/Processor/LeafConverter/LeafToTurkish.d.ts +3 -0
- package/dist/Processor/LeafConverter/LeafToTurkish.js +3 -0
- package/dist/Processor/LeafConverter/LeafToTurkish.js.map +1 -1
- package/dist/Processor/NodeDrawableCollector.d.ts +16 -0
- package/dist/Processor/NodeDrawableCollector.js +16 -0
- package/dist/Processor/NodeDrawableCollector.js.map +1 -1
- package/dist/Processor/TreeToStringConverter.d.ts +15 -0
- package/dist/Processor/TreeToStringConverter.js +15 -0
- package/dist/Processor/TreeToStringConverter.js.map +1 -1
- package/dist/TreeBankDrawable.d.ts +20 -0
- package/dist/TreeBankDrawable.js +20 -0
- package/dist/TreeBankDrawable.js.map +1 -1
- package/package.json +14 -12
- package/source/Layer/DependencyLayer.ts +4 -0
- package/source/Layer/EnglishPropbankLayer.ts +9 -0
- package/source/Layer/EnglishSemanticLayer.ts +5 -0
- package/source/Layer/EnglishWordLayer.ts +4 -0
- package/source/Layer/MetaMorphemeLayer.ts +19 -0
- package/source/Layer/MetaMorphemesMovedLayer.ts +20 -0
- package/source/Layer/MorphologicalAnalysisLayer.ts +32 -0
- package/source/Layer/MultiWordLayer.ts +9 -0
- package/source/Layer/NERLayer.ts +14 -0
- package/source/Layer/PersianWordLayer.ts +4 -0
- package/source/Layer/ShallowParseLayer.ts +11 -0
- package/source/Layer/SingleWordLayer.ts +4 -0
- package/source/Layer/SourceLanguageWordLayer.ts +4 -0
- package/source/Layer/TargetLanguageWordLayer.ts +10 -1
- package/source/Layer/TurkishPropbankLayer.ts +18 -0
- package/source/Layer/TurkishSemanticLayer.ts +11 -0
- package/source/Layer/TurkishWordLayer.ts +4 -0
- package/source/Layer/WordLayer.ts +12 -0
- package/source/LayerInfo.ts +333 -155
- package/source/ParseNodeDrawable.ts +102 -0
- package/source/ParseTreeDrawable.ts +158 -16
- package/source/Processor/Condition/IsDoubleNode.ts +6 -0
- package/source/Processor/Condition/IsDoubleNodeWithDifferentTags.ts +6 -0
- package/source/Processor/Condition/IsEnglishLeafNode.ts +5 -0
- package/source/Processor/Condition/IsLeafNode.ts +5 -0
- package/source/Processor/Condition/IsNodeWithPredicate.ts +11 -0
- package/source/Processor/Condition/IsNodeWithSymbol.ts +9 -0
- package/source/Processor/Condition/IsNodeWithSynSetId.ts +9 -0
- package/source/Processor/Condition/IsNoneNode.ts +5 -0
- package/source/Processor/Condition/IsNullElement.ts +6 -0
- package/source/Processor/Condition/IsNumber.ts +6 -0
- package/source/Processor/Condition/IsPredicateVerbNode.ts +11 -0
- package/source/Processor/Condition/IsProperNoun.ts +5 -0
- package/source/Processor/Condition/IsPunctuationNode.ts +5 -0
- package/source/Processor/Condition/IsTransferable.ts +5 -0
- package/source/Processor/Condition/IsTurkishLeafNode.ts +5 -0
- package/source/Processor/Condition/IsVPNode.ts +5 -0
- package/source/Processor/Condition/IsVerbNode.ts +10 -0
- package/source/Processor/LayerExist/ContainsLayerInformation.ts +9 -0
- package/source/Processor/LayerExist/NotContainsLayerInformation.ts +9 -0
- package/source/Processor/LayerExist/SemiContainsLayerInformation.ts +10 -0
- package/source/Processor/LeafConverter/LeafToEnglish.ts +3 -0
- package/source/Processor/LeafConverter/LeafToLanguageConverter.ts +7 -0
- package/source/Processor/LeafConverter/LeafToPersian.ts +3 -0
- package/source/Processor/LeafConverter/LeafToRootFormConverter.ts +7 -0
- package/source/Processor/LeafConverter/LeafToTurkish.ts +3 -0
- package/source/Processor/NodeDrawableCollector.ts +16 -0
- package/source/Processor/TreeToStringConverter.ts +15 -0
- package/source/TreeBankDrawable.ts +20 -0
|
@@ -7,25 +7,127 @@ export declare class ParseNodeDrawable extends ParseNode {
|
|
|
7
7
|
protected layers: LayerInfo;
|
|
8
8
|
protected depth: number;
|
|
9
9
|
protected inOrderTraversalIndex: number;
|
|
10
|
+
/**
|
|
11
|
+
* Constructs a ParseNodeDrawable from a single line. If the node is a leaf node, it only sets the data. Otherwise,
|
|
12
|
+
* splits the line w.r.t. spaces and parenthesis and calls itself recursively to generate its child parseNodes.
|
|
13
|
+
* @param parentOrLeftOrSymbol The parent node of this node.
|
|
14
|
+
* @param lineOrRightOrData The input line to create this parseNode.
|
|
15
|
+
* @param dataOrIsleaf True, if this node is a leaf node; false otherwise.
|
|
16
|
+
* @param depth Depth of the node.
|
|
17
|
+
*/
|
|
10
18
|
constructor(parentOrLeftOrSymbol?: any, lineOrRightOrData?: any, dataOrIsleaf?: any, depth?: number);
|
|
19
|
+
/**
|
|
20
|
+
* Accessor for layers attribute
|
|
21
|
+
* @return Layers attribute
|
|
22
|
+
*/
|
|
11
23
|
getLayerInfo(): LayerInfo;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the data. Either the node is a leaf node, in which case English word layer is returned; or the node is
|
|
26
|
+
* a nonleaf node, in which case the node tag is returned.
|
|
27
|
+
* @return English word for leaf node, constituency tag for non-leaf node.
|
|
28
|
+
*/
|
|
12
29
|
getData(): Symbol;
|
|
30
|
+
/**
|
|
31
|
+
* Clears the layers hash map.
|
|
32
|
+
*/
|
|
13
33
|
clearLayers(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Recursive method to clear a given layer.
|
|
36
|
+
* @param layerType Name of the layer to be cleared
|
|
37
|
+
*/
|
|
14
38
|
clearLayer(layerType: ViewLayerType): void;
|
|
39
|
+
/**
|
|
40
|
+
* Clears the node tag.
|
|
41
|
+
*/
|
|
15
42
|
clearData(): void;
|
|
43
|
+
/**
|
|
44
|
+
* Setter for the data attribute and also clears all layers.
|
|
45
|
+
* @param data New data field.
|
|
46
|
+
*/
|
|
16
47
|
setDataAndClearLayers(data: Symbol): void;
|
|
48
|
+
/**
|
|
49
|
+
* Mutator for the data field. If the layers is null, its sets the data field, otherwise it sets the English layer
|
|
50
|
+
* to the given value.
|
|
51
|
+
* @param data Data to be set.
|
|
52
|
+
*/
|
|
17
53
|
setData(data: Symbol): void;
|
|
54
|
+
/**
|
|
55
|
+
* Returns the layer value of the head child of this node.
|
|
56
|
+
* @param viewLayerType Layer name
|
|
57
|
+
* @return Layer value of the head child of this node.
|
|
58
|
+
*/
|
|
18
59
|
headWord(viewLayerType: ViewLayerType): string;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the layer value of a given layer.
|
|
62
|
+
* @param viewLayer Layer name
|
|
63
|
+
* @return Value of the given layer
|
|
64
|
+
*/
|
|
19
65
|
getLayerData(viewLayer?: ViewLayerType): string;
|
|
66
|
+
/**
|
|
67
|
+
* Accessor for the depth attribute
|
|
68
|
+
* @return Depth attribute
|
|
69
|
+
*/
|
|
20
70
|
getDepth(): number;
|
|
71
|
+
/**
|
|
72
|
+
* Replaces a given old child with the given new child.
|
|
73
|
+
* @param oldChild Old child to be replaced
|
|
74
|
+
* @param newChild New child which replaces old child
|
|
75
|
+
*/
|
|
21
76
|
replaceChild(oldChild: ParseNodeDrawable, newChild: ParseNodeDrawable): void;
|
|
77
|
+
/**
|
|
78
|
+
* Recursive method which updates the depth attribute
|
|
79
|
+
* @param depth Current depth to set.
|
|
80
|
+
*/
|
|
22
81
|
updateDepths(depth: number): void;
|
|
82
|
+
/**
|
|
83
|
+
* Calculates the maximum depth of the subtree rooted from this node.
|
|
84
|
+
* @return The maximum depth of the subtree rooted from this node.
|
|
85
|
+
*/
|
|
23
86
|
maxDepth(): number;
|
|
87
|
+
/**
|
|
88
|
+
* Recursive method that checks if all nodes in the subtree rooted with this node has the annotation in the given
|
|
89
|
+
* layer.
|
|
90
|
+
* @param viewLayerType Layer name
|
|
91
|
+
* @return True if all nodes in the subtree rooted with this node has the annotation in the given layer, false
|
|
92
|
+
* otherwise.
|
|
93
|
+
*/
|
|
24
94
|
layerExists(viewLayerType: ViewLayerType): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Checks if the current node is a dummy node or not. A node is a dummy node if its data contains '*', or its
|
|
97
|
+
* data is '0' and its parent is '-NONE-'.
|
|
98
|
+
* @return True if the current node is a dummy node, false otherwise.
|
|
99
|
+
*/
|
|
25
100
|
isDummyNode(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Checks if all nodes in the subtree rooted with this node has annotation with the given layer.
|
|
103
|
+
* @param viewLayerType Layer name
|
|
104
|
+
* @return True if all nodes in the subtree rooted with this node has annotation with the given layer, false
|
|
105
|
+
* otherwise.
|
|
106
|
+
*/
|
|
26
107
|
layerAll(viewLayerType: ViewLayerType): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Recursive method to convert the subtree rooted with this node to a string. All parenthesis types are converted to
|
|
110
|
+
* their regular forms.
|
|
111
|
+
* @return String version of the subtree rooted with this node.
|
|
112
|
+
*/
|
|
27
113
|
toTurkishSentence(): string;
|
|
114
|
+
/**
|
|
115
|
+
* Sets the NER layer according to the tag of the parent node and the word in the node. The word is searched in the
|
|
116
|
+
* gazetteer, if it exists, the NER info is replaced with the NER tag in the gazetter.
|
|
117
|
+
* @param gazetteer Gazetteer where we search the word
|
|
118
|
+
* @param word Word to be searched in the gazetteer
|
|
119
|
+
*/
|
|
28
120
|
checkGazetteer(gazetteer: Gazetteer, word: string): void;
|
|
121
|
+
/**
|
|
122
|
+
* Recursive method that sets the tag information of the given parse node with all descendants with respect to the
|
|
123
|
+
* morphological annotation of the current node with all descendants.
|
|
124
|
+
* @param parseNode Parse node whose tag information will be changed.
|
|
125
|
+
* @param surfaceForm If true, tag will be replaced with the surface form annotation.
|
|
126
|
+
*/
|
|
29
127
|
generateParseNode(parseNode: ParseNode, surfaceForm: boolean): void;
|
|
128
|
+
/**
|
|
129
|
+
* Recursive method to convert the subtree rooted with this node to a string.
|
|
130
|
+
* @return String version of the subtree rooted with this node.
|
|
131
|
+
*/
|
|
30
132
|
toString(): string;
|
|
31
133
|
}
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
const Symbol_1 = require("nlptoolkit-parsetree/dist/Symbol");
|
|
16
16
|
const ViewLayerType_1 = require("nlptoolkit-annotatedsentence/dist/ViewLayerType");
|
|
17
17
|
class ParseNodeDrawable extends ParseNode_1.ParseNode {
|
|
18
|
+
/**
|
|
19
|
+
* Constructs a ParseNodeDrawable from a single line. If the node is a leaf node, it only sets the data. Otherwise,
|
|
20
|
+
* splits the line w.r.t. spaces and parenthesis and calls itself recursively to generate its child parseNodes.
|
|
21
|
+
* @param parentOrLeftOrSymbol The parent node of this node.
|
|
22
|
+
* @param lineOrRightOrData The input line to create this parseNode.
|
|
23
|
+
* @param dataOrIsleaf True, if this node is a leaf node; false otherwise.
|
|
24
|
+
* @param depth Depth of the node.
|
|
25
|
+
*/
|
|
18
26
|
constructor(parentOrLeftOrSymbol, lineOrRightOrData, dataOrIsleaf, depth) {
|
|
19
27
|
super();
|
|
20
28
|
this.layers = null;
|
|
@@ -76,9 +84,18 @@
|
|
|
76
84
|
}
|
|
77
85
|
}
|
|
78
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Accessor for layers attribute
|
|
89
|
+
* @return Layers attribute
|
|
90
|
+
*/
|
|
79
91
|
getLayerInfo() {
|
|
80
92
|
return this.layers;
|
|
81
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Returns the data. Either the node is a leaf node, in which case English word layer is returned; or the node is
|
|
96
|
+
* a nonleaf node, in which case the node tag is returned.
|
|
97
|
+
* @return English word for leaf node, constituency tag for non-leaf node.
|
|
98
|
+
*/
|
|
82
99
|
getData() {
|
|
83
100
|
if (this.layers == null) {
|
|
84
101
|
return super.getData();
|
|
@@ -87,9 +104,16 @@
|
|
|
87
104
|
return new Symbol_1.Symbol(this.getLayerData(ViewLayerType_1.ViewLayerType.ENGLISH_WORD));
|
|
88
105
|
}
|
|
89
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Clears the layers hash map.
|
|
109
|
+
*/
|
|
90
110
|
clearLayers() {
|
|
91
111
|
this.layers = new LayerInfo_1.LayerInfo();
|
|
92
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Recursive method to clear a given layer.
|
|
115
|
+
* @param layerType Name of the layer to be cleared
|
|
116
|
+
*/
|
|
93
117
|
clearLayer(layerType) {
|
|
94
118
|
if (this.children.length == 0 && this.layerExists(layerType)) {
|
|
95
119
|
this.layers.removeLayer(layerType);
|
|
@@ -98,13 +122,25 @@
|
|
|
98
122
|
this.children[i].clearLayer(layerType);
|
|
99
123
|
}
|
|
100
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Clears the node tag.
|
|
127
|
+
*/
|
|
101
128
|
clearData() {
|
|
102
129
|
this.data = null;
|
|
103
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Setter for the data attribute and also clears all layers.
|
|
133
|
+
* @param data New data field.
|
|
134
|
+
*/
|
|
104
135
|
setDataAndClearLayers(data) {
|
|
105
136
|
super.setData(data);
|
|
106
137
|
this.layers = null;
|
|
107
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Mutator for the data field. If the layers is null, its sets the data field, otherwise it sets the English layer
|
|
141
|
+
* to the given value.
|
|
142
|
+
* @param data Data to be set.
|
|
143
|
+
*/
|
|
108
144
|
setData(data) {
|
|
109
145
|
if (this.layers == null) {
|
|
110
146
|
super.setData(data);
|
|
@@ -113,6 +149,11 @@
|
|
|
113
149
|
this.layers.setLayerData(ViewLayerType_1.ViewLayerType.ENGLISH_WORD, data.getName());
|
|
114
150
|
}
|
|
115
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Returns the layer value of the head child of this node.
|
|
154
|
+
* @param viewLayerType Layer name
|
|
155
|
+
* @return Layer value of the head child of this node.
|
|
156
|
+
*/
|
|
116
157
|
headWord(viewLayerType) {
|
|
117
158
|
if (this.children.length > 0) {
|
|
118
159
|
return this.headChild().headWord(viewLayerType);
|
|
@@ -121,6 +162,11 @@
|
|
|
121
162
|
return this.getLayerData(viewLayerType);
|
|
122
163
|
}
|
|
123
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns the layer value of a given layer.
|
|
167
|
+
* @param viewLayer Layer name
|
|
168
|
+
* @return Value of the given layer
|
|
169
|
+
*/
|
|
124
170
|
getLayerData(viewLayer) {
|
|
125
171
|
if (viewLayer == undefined) {
|
|
126
172
|
if (this.data != null) {
|
|
@@ -135,14 +181,27 @@
|
|
|
135
181
|
return this.layers.getLayerData(viewLayer);
|
|
136
182
|
}
|
|
137
183
|
}
|
|
184
|
+
/**
|
|
185
|
+
* Accessor for the depth attribute
|
|
186
|
+
* @return Depth attribute
|
|
187
|
+
*/
|
|
138
188
|
getDepth() {
|
|
139
189
|
return this.depth;
|
|
140
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* Replaces a given old child with the given new child.
|
|
193
|
+
* @param oldChild Old child to be replaced
|
|
194
|
+
* @param newChild New child which replaces old child
|
|
195
|
+
*/
|
|
141
196
|
replaceChild(oldChild, newChild) {
|
|
142
197
|
newChild.updateDepths(this.depth + 1);
|
|
143
198
|
newChild.parent = this;
|
|
144
199
|
this.children[this.children.indexOf(oldChild)] = newChild;
|
|
145
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Recursive method which updates the depth attribute
|
|
203
|
+
* @param depth Current depth to set.
|
|
204
|
+
*/
|
|
146
205
|
updateDepths(depth) {
|
|
147
206
|
this.depth = depth;
|
|
148
207
|
for (let aChildren of this.children) {
|
|
@@ -150,6 +209,10 @@
|
|
|
150
209
|
aChild.updateDepths(depth + 1);
|
|
151
210
|
}
|
|
152
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Calculates the maximum depth of the subtree rooted from this node.
|
|
214
|
+
* @return The maximum depth of the subtree rooted from this node.
|
|
215
|
+
*/
|
|
153
216
|
maxDepth() {
|
|
154
217
|
let depth = this.depth;
|
|
155
218
|
for (let aChildren of this.children) {
|
|
@@ -159,6 +222,13 @@
|
|
|
159
222
|
}
|
|
160
223
|
return depth;
|
|
161
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Recursive method that checks if all nodes in the subtree rooted with this node has the annotation in the given
|
|
227
|
+
* layer.
|
|
228
|
+
* @param viewLayerType Layer name
|
|
229
|
+
* @return True if all nodes in the subtree rooted with this node has the annotation in the given layer, false
|
|
230
|
+
* otherwise.
|
|
231
|
+
*/
|
|
162
232
|
layerExists(viewLayerType) {
|
|
163
233
|
if (this.children.length == 0) {
|
|
164
234
|
if (this.getLayerData(viewLayerType) != null) {
|
|
@@ -174,6 +244,11 @@
|
|
|
174
244
|
}
|
|
175
245
|
return false;
|
|
176
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Checks if the current node is a dummy node or not. A node is a dummy node if its data contains '*', or its
|
|
249
|
+
* data is '0' and its parent is '-NONE-'.
|
|
250
|
+
* @return True if the current node is a dummy node, false otherwise.
|
|
251
|
+
*/
|
|
177
252
|
isDummyNode() {
|
|
178
253
|
let data = this.getLayerData(ViewLayerType_1.ViewLayerType.ENGLISH_WORD);
|
|
179
254
|
let parentData = this.parent.getLayerData(ViewLayerType_1.ViewLayerType.ENGLISH_WORD);
|
|
@@ -188,6 +263,12 @@
|
|
|
188
263
|
return false;
|
|
189
264
|
}
|
|
190
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* Checks if all nodes in the subtree rooted with this node has annotation with the given layer.
|
|
268
|
+
* @param viewLayerType Layer name
|
|
269
|
+
* @return True if all nodes in the subtree rooted with this node has annotation with the given layer, false
|
|
270
|
+
* otherwise.
|
|
271
|
+
*/
|
|
191
272
|
layerAll(viewLayerType) {
|
|
192
273
|
if (this.children.length == 0) {
|
|
193
274
|
if (this.getLayerData(viewLayerType) == null && !this.isDummyNode()) {
|
|
@@ -203,6 +284,11 @@
|
|
|
203
284
|
}
|
|
204
285
|
return true;
|
|
205
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Recursive method to convert the subtree rooted with this node to a string. All parenthesis types are converted to
|
|
289
|
+
* their regular forms.
|
|
290
|
+
* @return String version of the subtree rooted with this node.
|
|
291
|
+
*/
|
|
206
292
|
toTurkishSentence() {
|
|
207
293
|
if (this.children.length == 0) {
|
|
208
294
|
if (this.getLayerData(ViewLayerType_1.ViewLayerType.TURKISH_WORD) != null && this.getLayerData(ViewLayerType_1.ViewLayerType.TURKISH_WORD) != "*NONE*") {
|
|
@@ -232,6 +318,12 @@
|
|
|
232
318
|
return st;
|
|
233
319
|
}
|
|
234
320
|
}
|
|
321
|
+
/**
|
|
322
|
+
* Sets the NER layer according to the tag of the parent node and the word in the node. The word is searched in the
|
|
323
|
+
* gazetteer, if it exists, the NER info is replaced with the NER tag in the gazetter.
|
|
324
|
+
* @param gazetteer Gazetteer where we search the word
|
|
325
|
+
* @param word Word to be searched in the gazetteer
|
|
326
|
+
*/
|
|
235
327
|
checkGazetteer(gazetteer, word) {
|
|
236
328
|
if (gazetteer.contains(word) && this.getParent().getData().getName() == "NNP") {
|
|
237
329
|
this.getLayerInfo().setLayerData(ViewLayerType_1.ViewLayerType.NER, gazetteer.getName());
|
|
@@ -240,6 +332,12 @@
|
|
|
240
332
|
this.getLayerInfo().setLayerData(ViewLayerType_1.ViewLayerType.NER, gazetteer.getName());
|
|
241
333
|
}
|
|
242
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Recursive method that sets the tag information of the given parse node with all descendants with respect to the
|
|
337
|
+
* morphological annotation of the current node with all descendants.
|
|
338
|
+
* @param parseNode Parse node whose tag information will be changed.
|
|
339
|
+
* @param surfaceForm If true, tag will be replaced with the surface form annotation.
|
|
340
|
+
*/
|
|
243
341
|
generateParseNode(parseNode, surfaceForm) {
|
|
244
342
|
if (this.numberOfChildren() == 0) {
|
|
245
343
|
if (surfaceForm) {
|
|
@@ -258,6 +356,10 @@
|
|
|
258
356
|
}
|
|
259
357
|
}
|
|
260
358
|
}
|
|
359
|
+
/**
|
|
360
|
+
* Recursive method to convert the subtree rooted with this node to a string.
|
|
361
|
+
* @return String version of the subtree rooted with this node.
|
|
362
|
+
*/
|
|
261
363
|
toString() {
|
|
262
364
|
if (this.children.length < 2) {
|
|
263
365
|
if (this.children.length < 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParseNodeDrawable.js","sourceRoot":"","sources":["../source/ParseNodeDrawable.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,mEAA8D;IAC9D,2CAAsC;IACtC,6DAAwD;IACxD,mFAA8E;IAG9E,MAAa,iBAAkB,SAAQ,qBAAS;QAM5C,YAAY,oBAA0B,EAAE,iBAAuB,EAAE,YAAkB,EAAE,KAAc;YAC/F,KAAK,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"ParseNodeDrawable.js","sourceRoot":"","sources":["../source/ParseNodeDrawable.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,mEAA8D;IAC9D,2CAAsC;IACtC,6DAAwD;IACxD,mFAA8E;IAG9E,MAAa,iBAAkB,SAAQ,qBAAS;QAM5C;;;;;;;WAOG;QACH,YAAY,oBAA0B,EAAE,iBAAuB,EAAE,YAAkB,EAAE,KAAc;YAC/F,KAAK,EAAE,CAAC;YAbF,WAAM,GAAc,IAAI,CAAA;YAc9B,IAAI,oBAAoB,IAAI,IAAI,IAAI,iBAAiB,IAAI,SAAS,EAAC;gBAC/D,IAAI,MAAM,GAAsB,oBAAoB,CAAA;gBACpD,IAAI,KAAK,IAAI,SAAS,EAAC;oBACnB,IAAI,IAAI,GAAW,iBAAiB,CAAA;oBACpC,IAAI,MAAM,GAAY,YAAY,CAAA;oBAClC,IAAI,gBAAgB,GAAG,CAAC,CAAC;oBACzB,IAAI,SAAS,GAAG,EAAE,CAAC;oBACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;oBACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;oBACrB,IAAI,MAAM,EAAC;wBACP,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,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 +6,159 @@ import { ViewLayerType } from "nlptoolkit-annotatedsentence/dist/ViewLayerType";
|
|
|
6
6
|
import { AnnotatedSentence } from "nlptoolkit-annotatedsentence/dist/AnnotatedSentence";
|
|
7
7
|
export declare class ParseTreeDrawable extends ParseTree {
|
|
8
8
|
private fileDescription;
|
|
9
|
+
/**
|
|
10
|
+
* Another constructor for the ParseTreeDrawable. Sets the file description and reads the tree from the file
|
|
11
|
+
* description.
|
|
12
|
+
* @param fileDescription File description that contains the path, index and extension information.
|
|
13
|
+
*/
|
|
14
|
+
constructor1(fileDescription: FileDescription): void;
|
|
15
|
+
/**
|
|
16
|
+
* Another constructor for the ParseTreeDrawable. Sets the file description and reads the tree from the file
|
|
17
|
+
* description.
|
|
18
|
+
* @param path Path of the tree
|
|
19
|
+
*/
|
|
20
|
+
constructor2(path: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Another constructor for the ParseTreeDrawable. Sets the file description and reads the tree from the file
|
|
23
|
+
* description.
|
|
24
|
+
* @param path Path of the tree
|
|
25
|
+
* @param fileDescription File description that contains the path, index and extension information.
|
|
26
|
+
*/
|
|
27
|
+
constructor3(path: string, fileDescription: FileDescription): void;
|
|
28
|
+
/**
|
|
29
|
+
* Constructor for the ParseTreeDrawable. Sets the file description and reads the tree from the file description.
|
|
30
|
+
* @param path Path of the tree
|
|
31
|
+
* @param rawFileName File name of the tree such as 0123.train.
|
|
32
|
+
*/
|
|
33
|
+
constructor4(path: string, rawFileName: string): void;
|
|
34
|
+
/**
|
|
35
|
+
* Another constructor for the ParseTreeDrawable. Sets the file description and reads the tree from the file
|
|
36
|
+
* description.
|
|
37
|
+
* @param path Path of the tree
|
|
38
|
+
* @param extension Extension of the file such as train, test or dev.
|
|
39
|
+
* @param index Index of the file such as 1235.
|
|
40
|
+
*/
|
|
41
|
+
constructor5(path: string, extension: string, index: number): void;
|
|
9
42
|
constructor(fileDescriptionOrPath?: any, fileDescriptionOrFileName?: any, index?: number);
|
|
43
|
+
/**
|
|
44
|
+
* Mutator method for the fileDescription attribute.
|
|
45
|
+
* @param fileDescription New fileDescription value.
|
|
46
|
+
*/
|
|
10
47
|
setFileDescription(fileDescription: FileDescription): void;
|
|
48
|
+
/**
|
|
49
|
+
* Accessor method for the fileDescription attribute.
|
|
50
|
+
* @return FileDescription attribute.
|
|
51
|
+
*/
|
|
11
52
|
getFileDescription(): FileDescription;
|
|
53
|
+
/**
|
|
54
|
+
* Reloads the tree from the input file.
|
|
55
|
+
*/
|
|
12
56
|
reload(): void;
|
|
57
|
+
/**
|
|
58
|
+
* Mutator for the root attribute.
|
|
59
|
+
* @param newRootNode New root node.
|
|
60
|
+
*/
|
|
13
61
|
setRoot(newRootNode: ParseNode): void;
|
|
62
|
+
/**
|
|
63
|
+
* Reads the parse tree from the given file description with path replaced with the currentPath. It sets the root
|
|
64
|
+
* node which calls ParseNodeDrawable constructor recursively.
|
|
65
|
+
* @param currentPath Path of the tree
|
|
66
|
+
*/
|
|
14
67
|
readFromFile(currentPath: string): void;
|
|
68
|
+
/**
|
|
69
|
+
* Loads the next tree according to the index of the parse tree. For example, if the current
|
|
70
|
+
* tree fileName is 0123.train, after the call of nextTree(3), the method will load 0126.train. If the next tree
|
|
71
|
+
* does not exist, nothing will happen.
|
|
72
|
+
* @param count Number of trees to go forward
|
|
73
|
+
*/
|
|
15
74
|
nextTree(count: number): void;
|
|
75
|
+
/**
|
|
76
|
+
* Loads the previous tree according to the index of the parse tree. For example, if the current
|
|
77
|
+
* tree fileName is 0123.train, after the call of previousTree(4), the method will load 0119.train. If the
|
|
78
|
+
* previous tree does not exist, nothing will happen.
|
|
79
|
+
* @param count Number of trees to go backward
|
|
80
|
+
*/
|
|
16
81
|
previousTree(count: number): void;
|
|
82
|
+
/**
|
|
83
|
+
* Calculates the maximum depth of the tree.
|
|
84
|
+
* @return The maximum depth of the tree.
|
|
85
|
+
*/
|
|
17
86
|
maxDepth(): number;
|
|
87
|
+
/**
|
|
88
|
+
* Swaps the given child node of this node with the previous sibling of that given node. If the given node is the
|
|
89
|
+
* leftmost child, it swaps with the last node.
|
|
90
|
+
* @param node Node to be swapped.
|
|
91
|
+
*/
|
|
18
92
|
moveLeft(node: ParseNode): void;
|
|
93
|
+
/**
|
|
94
|
+
* Swaps the given child node of this node with the next sibling of that given node. If the given node is the
|
|
95
|
+
* rightmost child, it swaps with the first node.
|
|
96
|
+
* @param node Node to be swapped.
|
|
97
|
+
*/
|
|
19
98
|
moveRight(node: ParseNode): void;
|
|
99
|
+
/**
|
|
100
|
+
* Divides the given node into multiple parse nodes if it contains more than one word. The parent node will be
|
|
101
|
+
* the same for the new nodes, original node is deleted from the children, the pos tags of the new parse nodes will
|
|
102
|
+
* be determined according to their morphological parses.
|
|
103
|
+
* @param parseNode Parse node to be divided
|
|
104
|
+
*/
|
|
20
105
|
divideIntoWords(parseNode: ParseNodeDrawable): void;
|
|
106
|
+
/**
|
|
107
|
+
* Moves the subtree rooted at fromNode as a child to the node toNode at position childIndex.
|
|
108
|
+
* @param fromNode Subtree root node to be moved.
|
|
109
|
+
* @param toNode Node to which a new subtree will be added.
|
|
110
|
+
* @param childIndex New child index of the toNode.
|
|
111
|
+
*/
|
|
21
112
|
moveNode(fromNode: ParseNode, toNode: ParseNode, childIndex?: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* Removed the first child of the parent node and adds the given child node as a child to that node.
|
|
115
|
+
* @param parent Parent node.
|
|
116
|
+
* @param child New child node to be added.
|
|
117
|
+
*/
|
|
22
118
|
combineWords(parent: ParseNodeDrawable, child: ParseNodeDrawable): void;
|
|
119
|
+
/**
|
|
120
|
+
* The method checks if all nodes in the tree has the annotation in the given layer.
|
|
121
|
+
* @param viewLayerType Layer name
|
|
122
|
+
* @return True if all nodes in the tree has the annotation in the given layer, false otherwise.
|
|
123
|
+
*/
|
|
23
124
|
layerExists(viewLayerType: ViewLayerType): boolean;
|
|
125
|
+
/**
|
|
126
|
+
* Checks if all nodes in the tree has annotation with the given layer.
|
|
127
|
+
* @param viewLayerType Layer name
|
|
128
|
+
* @return True if all nodes in the tree has annotation with the given layer, false otherwise.
|
|
129
|
+
*/
|
|
24
130
|
layerAll(viewLayerType: ViewLayerType): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Clears the given layer for all nodes in the tree
|
|
133
|
+
* @param layerType Layer name
|
|
134
|
+
*/
|
|
25
135
|
clearLayer(layerType: ViewLayerType): void;
|
|
136
|
+
/**
|
|
137
|
+
* Returns the leaf node that comes one after the given parse node according to the inorder traversal.
|
|
138
|
+
* @param parseNode Input parse node.
|
|
139
|
+
* @return The leaf node that comes one after the given parse node according to the inorder traversal.
|
|
140
|
+
*/
|
|
26
141
|
nextLeafNode(parseNode: ParseNodeDrawable): ParseNodeDrawable;
|
|
142
|
+
/**
|
|
143
|
+
* Returns the leaf node that comes one before the given parse node according to the inorder traversal.
|
|
144
|
+
* @param parseNode Input parse node.
|
|
145
|
+
* @return The leaf node that comes one before the given parse node according to the inorder traversal.
|
|
146
|
+
*/
|
|
27
147
|
previousLeafNode(parseNode: ParseNodeDrawable): ParseNodeDrawable;
|
|
148
|
+
/**
|
|
149
|
+
* Constructs an AnnotatedSentence object from the Turkish tree. Collects all leaf nodes, then for each leaf node
|
|
150
|
+
* converts layer info of all words at that node to AnnotatedWords. Layers are converted to the counterparts in the
|
|
151
|
+
* AnnotatedWord.
|
|
152
|
+
* @return AnnotatedSentence counterpart of the Turkish tree
|
|
153
|
+
*/
|
|
28
154
|
generateAnnotatedSentence(language?: string): AnnotatedSentence;
|
|
155
|
+
/**
|
|
156
|
+
* Recursive method that generates a new parse tree by replacing the tag information of the all parse nodes (with all
|
|
157
|
+
* its descendants) with respect to the morphological annotation of all parse nodes (with all its descendants)
|
|
158
|
+
* of the current parse tree.
|
|
159
|
+
* @param surfaceForm If true, tag will be replaced with the surface form annotation.
|
|
160
|
+
* @return A new parse tree by replacing the tag information of the all parse nodes with respect to the
|
|
161
|
+
* morphological annotation of all parse nodes of the current parse tree.
|
|
162
|
+
*/
|
|
29
163
|
generateParseTree(surfaceForm: boolean): ParseTree;
|
|
30
164
|
}
|