@@ -29,47 +29,45 @@ class Node(object):
2929 Class for representing non-root nodes in Universal Dependency trees.
3030
3131 """
32-
33- __slots__ = list ()
34-
35- # (A) Features following the CoNLL-U documentation:
36- __slots__ .append ('_ord' ) # Word index, integer starting at 1 for each new sentence.
37- __slots__ .append ('_form' ) # Word form or punctuation symbol.
38- __slots__ .append ('_lemma' ) # Lemma or stem of word form.
39- __slots__ .append ('_upostag' ) # Universal POS tag drawn from our revised version of the Google UPOS tags.
40- __slots__ .append ('_xpostag' ) # Language-specific part-of-speech tag; underscore if not available.
41- __slots__ .append ('_raw_feats' ) # Morphological features in their original CoNLLU format.
42- __slots__ .append ('_head' ) # Head of the current token, which is either a value of ID or zero (0).
43- __slots__ .append ('_deprel' ) # Universal Stanford dependency relation to the HEAD (root iff HEAD = 0).
44- __slots__ .append ('_raw_deps' ) # Secondary dependencies (head-deprel pairs) in their original CoNLLU format.
45- __slots__ .append ('_misc' ) # Any other annotation.
46-
47- # (B) Udapi-specific extra features:
48- __slots__ .append ('_feats' ) # Deserialized morphological features stored in a dict (feature -> value).
49- __slots__ .append ('_deps' ) # Deserialized secondary dependencies in a list od {parent, deprel} dicts.
50- __slots__ .append ('_parent' ) # Parent node.
51- __slots__ .append ('_children' ) # Ord-ordered list of child nodes.
52- __slots__ .append ('_aux' ) # Other technical attributes.
32+ __slots__ = [
33+ 'ord' , # Word index, integer starting at 1 for each new sentence.
34+ 'form' , # Word form or punctuation symbol.
35+ 'lemma' , # Lemma or stem of word form.
36+ 'upostag' , # Universal POS tag drawn from our revised version of the Google UPOS tags.
37+ 'xpostag' , # Language-specific part-of-speech tag; underscore if not available.
38+ 'head' , # Head of the current token, which is either a value of ID or zero (0).
39+ 'deprel' , # Universal Stanford dependency relation to the HEAD (root iff HEAD = 0).
40+ 'misc' , # Any other annotation.
41+
42+ '_raw_deps' , # Secondary dependencies (head-deprel pairs) in their original CoNLLU format.
43+ '_deps' , # Deserialized secondary dependencies in a list od {parent, deprel} dicts.
44+ '_raw_feats' , # Morphological features in their original CoNLLU format.
45+ '_feats' , # Deserialized morphological features stored in a dict (feature -> value).
46+ '_parent' , # Parent node.
47+ '_children' , # Ord-ordered list of child nodes.
48+ '_aux' # Other technical attributes.
49+ ]
5350
5451 def __init__ (self , data = None ):
5552 if data is None :
5653 data = dict ()
5754
5855 # Initialization of the (A) list.
59- self ._ord = 0
60- self ._form = '_'
61- self ._lemma = '_'
62- self ._upostag = '_'
63- self ._xpostag = '_'
64- self ._raw_feats = '_'
65- self ._head = '_'
66- self ._deprel = '_'
67- self ._raw_deps = '_'
68- self ._misc = '_'
56+ # setattr(self, 'ord', 0)
57+ # self.ord = 0
58+ # self.form = '_'
59+ # self.lemma = '_'
60+ # self.upostag = '_'
61+ # self.xpostag = '_'
62+ # self.head = '_'
63+ # self.deprel = '_'
64+ # self.misc = '_'
6965
7066 # Initialization of the (B) list.
71- self ._feats = None
67+ self ._raw_deps = '_'
7268 self ._deps = None
69+ self ._raw_feats = '_'
70+ self ._feats = None
7371 self ._parent = None
7472 self ._children = list ()
7573 self ._aux = dict ()
@@ -90,46 +88,6 @@ def __str__(self):
9088 parent_ord = self .parent .ord
9189 return "<%d, %s, %s, %s>" % (self .ord , self .form , parent_ord , self .deprel )
9290
93- @property
94- def ord (self ):
95- return self ._ord
96-
97- @ord .setter
98- def ord (self , value ):
99- self ._ord = int (value )
100-
101- @property
102- def form (self ):
103- return self ._form
104-
105- @form .setter
106- def form (self , value ):
107- self ._form = value
108-
109- @property
110- def lemma (self ):
111- return self ._lemma
112-
113- @lemma .setter
114- def lemma (self , value ):
115- self ._lemma = value
116-
117- @property
118- def upostag (self ):
119- return self ._upostag
120-
121- @upostag .setter
122- def upostag (self , value ):
123- self ._upostag = value
124-
125- @property
126- def xpostag (self ):
127- return self ._xpostag
128-
129- @xpostag .setter
130- def xpostag (self , value ):
131- self ._xpostag = value
132-
13391 @property
13492 def raw_feats (self ):
13593 """
@@ -161,22 +119,6 @@ def raw_feats(self, value):
161119 self ._raw_feats = str (value )
162120 self ._feats = None
163121
164- @property
165- def head (self ):
166- return self ._head
167-
168- @head .setter
169- def head (self , value ):
170- self ._head = int (value )
171-
172- @property
173- def deprel (self ):
174- return self ._deprel
175-
176- @deprel .setter
177- def deprel (self , value ):
178- self ._deprel = value
179-
180122 @property
181123 def raw_deps (self ):
182124 """
@@ -208,14 +150,6 @@ def raw_deps(self, value):
208150 self ._raw_deps = str (value )
209151 self ._deps = None
210152
211- @property
212- def misc (self ):
213- return self ._misc
214-
215- @misc .setter
216- def misc (self , value ):
217- self ._misc = value
218-
219153 @property
220154 def feats (self ):
221155 """
0 commit comments