KoichiYasuoka commited on
Commit
9cb4947
1 Parent(s): 2fd10da
Files changed (2) hide show
  1. README.md +1 -1
  2. ud.py +1 -1
README.md CHANGED
@@ -51,7 +51,7 @@ class UDgoeswith(object):
51
  m[i,0],m[i,i],p[i,0]=m[i,i],numpy.nan,p[i,i]
52
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
53
  if [0 for i in h if i==0]!=[0]:
54
- m[:,0]+=numpy.where(m[:,0]<numpy.nanmax(m[:,0]),numpy.nan,0)
55
  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)]
56
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
57
  u="# text = "+text+"\n"
 
51
  m[i,0],m[i,i],p[i,0]=m[i,i],numpy.nan,p[i,i]
52
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
53
  if [0 for i in h if i==0]!=[0]:
54
+ m[:,0]+=numpy.where(m[:,0]==numpy.nanmax(m[[i for i,j in enumerate(h) if j==0],0]),0,numpy.nan)
55
  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)]
56
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
57
  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
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
33
  v=[(s,e) for s,e in model_output["offset_mapping"][0].tolist() if s<e]
 
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
  h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
33
  v=[(s,e) for s,e in model_output["offset_mapping"][0].tolist() if s<e]