joint representation form
This commit is contained in:
parent
401698409e
commit
87712128be
7
wani.py
7
wani.py
|
@ -850,7 +850,7 @@ class Writer:
|
|||
|
||||
def from_word(self, word):
|
||||
if word is None:
|
||||
return "" * self.length()
|
||||
return [""] * self.length()
|
||||
elif self.all:
|
||||
return [word.id, word.text, word.lemma, word.msd]
|
||||
else:
|
||||
|
@ -879,17 +879,22 @@ class Writer:
|
|||
rows = []
|
||||
for m, reason, cid in matches:
|
||||
to_write = []
|
||||
representation = ""
|
||||
|
||||
for idx, comp in enumerate(components):
|
||||
idx = str(idx + 1)
|
||||
word = m[idx] if idx in m else None
|
||||
to_write.extend(self.from_word(word))
|
||||
representation += " " + to_write[-1]
|
||||
|
||||
# make them equal size
|
||||
to_write.extend([""] * (MAX_NUM_COMPONENTS * self.length() - len(to_write)))
|
||||
to_write = [structure_id] + to_write + [colocation_ids.to_id(cid)]
|
||||
|
||||
if not self.all:
|
||||
representation = re.sub(' +', ' ', representation)
|
||||
to_write.append(representation.strip())
|
||||
|
||||
if colocation_ids.should_write(cid):
|
||||
to_write.append(colocation_ids.num(cid))
|
||||
colocation_ids.set_written(cid)
|
||||
|
|
Loading…
Reference in New Issue
Block a user