KoichiYasuoka commited on
Commit
b3aca41
1 Parent(s): 83960e8
Files changed (2) hide show
  1. README.md +1 -1
  2. ud.py +1 -1
README.md CHANGED
@@ -53,7 +53,7 @@ class UDgoeswith(object):
53
  m[i,0],m[i,i],p[i,0]=m[i,i],numpy.nan,p[i,i]
54
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
55
  if [0 for i in h if i==0]!=[0]:
56
- m[:,0]+=numpy.where(m[:,0]<numpy.nanmax(m[:,0]),numpy.nan,0)
57
  m[[i for i,j in enumerate(h) if j==0]]+=[0 if i==0 or j==0 else numpy.nan for i,j in enumerate(h)]
58
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
59
  u="# text = "+text+"\n"
 
53
  m[i,0],m[i,i],p[i,0]=m[i,i],numpy.nan,p[i,i]
54
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
55
  if [0 for i in h if i==0]!=[0]:
56
+ m[:,0]+=numpy.where(m[:,0]==numpy.nanmax(m[[i for i,j in enumerate(h) if j==0],0]),0,numpy.nan)
57
  m[[i for i,j in enumerate(h) if j==0]]+=[0 if i==0 or j==0 else numpy.nan for i,j in enumerate(h)]
58
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
59
  u="# text = "+text+"\n"
ud.py CHANGED
@@ -27,7 +27,7 @@ class UniversalDependenciesPipeline(TokenClassificationPipeline):
27
  m[i,0],m[i,i],p[i,0]=m[i,i],numpy.nan,p[i,i]
28
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
29
  if [0 for i in h if i==0]!=[0]:
30
- m[:,0]+=numpy.where(m[:,0]<numpy.nanmax(m[:,0]),numpy.nan,0)
31
  m[[i for i,j in enumerate(h) if j==0]]+=[0 if i==0 or j==0 else numpy.nan for i,j in enumerate(h)]
32
  m[[i for i,j in enumerate(h) if j==0],:]+=[0 if i==0 or j==0 else numpy.nan for i,j in enumerate(h)]
33
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
 
27
  m[i,0],m[i,i],p[i,0]=m[i,i],numpy.nan,p[i,i]
28
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
29
  if [0 for i in h if i==0]!=[0]:
30
+ m[:,0]+=numpy.where(m[:,0]==numpy.nanmax(m[[i for i,j in enumerate(h) if j==0],0]),0,numpy.nan)
31
  m[[i for i,j in enumerate(h) if j==0]]+=[0 if i==0 or j==0 else numpy.nan for i,j in enumerate(h)]
32
  m[[i for i,j in enumerate(h) if j==0],:]+=[0 if i==0 or j==0 else numpy.nan for i,j in enumerate(h)]
33
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]