Dynamically calculated max num components
This commit is contained in:
parent
c0a22a4ef3
commit
d30f8c1980
7
wani.py
7
wani.py
|
@ -20,7 +20,7 @@ except ImportError:
|
||||||
tqdm = lambda x: x
|
tqdm = lambda x: x
|
||||||
|
|
||||||
|
|
||||||
MAX_NUM_COMPONENTS = 5
|
MAX_NUM_COMPONENTS = -1
|
||||||
|
|
||||||
CODES = {
|
CODES = {
|
||||||
"Noun": "N",
|
"Noun": "N",
|
||||||
|
@ -782,12 +782,17 @@ def load_structures(filename):
|
||||||
return build_structures(et), get_lemma_features(et)
|
return build_structures(et), get_lemma_features(et)
|
||||||
|
|
||||||
def build_structures(et):
|
def build_structures(et):
|
||||||
|
global MAX_NUM_COMPONENTS
|
||||||
|
|
||||||
structures = []
|
structures = []
|
||||||
for structure in et.iter('syntactic_structure'):
|
for structure in et.iter('syntactic_structure'):
|
||||||
to_append = SyntacticStructure.from_xml(structure)
|
to_append = SyntacticStructure.from_xml(structure)
|
||||||
if to_append is None:
|
if to_append is None:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
structures.append(to_append)
|
structures.append(to_append)
|
||||||
|
MAX_NUM_COMPONENTS = max(MAX_NUM_COMPONENTS, len(to_append.components))
|
||||||
|
|
||||||
return structures
|
return structures
|
||||||
|
|
||||||
def get_lemma_features(et):
|
def get_lemma_features(et):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user