KoichiYasuoka
commited on
Commit
·
f5e6263
1
Parent(s):
d554a77
bug fix
Browse files
ud.py
CHANGED
@@ -67,7 +67,6 @@ class UniversalDependenciesPipeline(TokenClassificationPipeline):
|
|
67 |
u+="\t".join([str(i+1),t[s:e],"_",q[i][0],"_","_" if len(q[i])<3 else "|".join(q[i][1:-1]),str(0 if h[i]==i else h[i]+1),"root" if q[i][-1]=="root" else q[i][-1][0:-2],"_","_" if i+1<len(v) and e<v[i+1][0] else "SpaceAfter=No"])+"\n"
|
68 |
return u+"\n"
|
69 |
def chu_liu_edmonds(self,matrix):
|
70 |
-
import numpy
|
71 |
h=numpy.nanargmax(matrix,axis=0)
|
72 |
x=[-1 if i==j else j for i,j in enumerate(h)]
|
73 |
for b in [lambda x,i,j:-1 if i not in x else x[i],lambda x,i,j:-1 if j<0 else x[j]]:
|
|
|
67 |
u+="\t".join([str(i+1),t[s:e],"_",q[i][0],"_","_" if len(q[i])<3 else "|".join(q[i][1:-1]),str(0 if h[i]==i else h[i]+1),"root" if q[i][-1]=="root" else q[i][-1][0:-2],"_","_" if i+1<len(v) and e<v[i+1][0] else "SpaceAfter=No"])+"\n"
|
68 |
return u+"\n"
|
69 |
def chu_liu_edmonds(self,matrix):
|
|
|
70 |
h=numpy.nanargmax(matrix,axis=0)
|
71 |
x=[-1 if i==j else j for i,j in enumerate(h)]
|
72 |
for b in [lambda x,i,j:-1 if i not in x else x[i],lambda x,i,j:-1 if j<0 else x[j]]:
|