KoichiYasuoka
commited on
Commit
•
7b9ed0e
1
Parent(s):
c071152
improvement for duplicated roots
Browse files
README.md
CHANGED
@@ -46,6 +46,7 @@ class UDgoeswith(object):
|
|
46 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
47 |
if [0 for i in h if i==0]!=[0]:
|
48 |
m[:,0]+=numpy.where(m[:,0]<numpy.nanmax(m[:,0]),numpy.nan,0)
|
|
|
49 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
50 |
u="# text = "+text+"\n"
|
51 |
v=[(s,e) for s,e in w["offset_mapping"] if s<e]
|
|
|
46 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
47 |
if [0 for i in h if i==0]!=[0]:
|
48 |
m[:,0]+=numpy.where(m[:,0]<numpy.nanmax(m[:,0]),numpy.nan,0)
|
49 |
+
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)]
|
50 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
51 |
u="# text = "+text+"\n"
|
52 |
v=[(s,e) for s,e in w["offset_mapping"] if s<e]
|
ud.py
CHANGED
@@ -22,6 +22,7 @@ class UniversalDependenciesPipeline(TokenClassificationPipeline):
|
|
22 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
23 |
if [0 for i in h if i==0]!=[0]:
|
24 |
m[:,0]+=numpy.where(m[:,0]<numpy.nanmax(m[:,0]),numpy.nan,0)
|
|
|
25 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
26 |
v=[(s,e) for s,e in model_output["offset_mapping"][0].tolist() if s<e]
|
27 |
q=[self.model.config.id2label[p[i,j]].split("|") for i,j in enumerate(h)]
|
|
|
22 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
23 |
if [0 for i in h if i==0]!=[0]:
|
24 |
m[:,0]+=numpy.where(m[:,0]<numpy.nanmax(m[:,0]),numpy.nan,0)
|
25 |
+
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)]
|
26 |
h=ufal.chu_liu_edmonds.chu_liu_edmonds(m)[0]
|
27 |
v=[(s,e) for s,e in model_output["offset_mapping"][0].tolist() if s<e]
|
28 |
q=[self.model.config.id2label[p[i,j]].split("|") for i,j in enumerate(h)]
|