KoichiYasuoka commited on
Commit
84b67ad
1 Parent(s): c85e093

人称接辞

Browse files
Files changed (1) hide show
  1. ud.py +8 -1
ud.py CHANGED
@@ -51,7 +51,14 @@ class UniversalDependenciesPipeline(TokenClassificationPipeline):
51
  f=-1
52
  if i+1<len(v) and e>v[i+1][0]:
53
  w[-1]=z[c[-1]] if c[-1] in z else "ッ"
54
- l=("".join(w).replace(" ","") if max(w)<"z" else c).replace("sh","s").replace("ch","c").replace("au","aw").replace("iu","iw").replace("eu","ew").replace("ou","ow").replace("ai","ay").replace("ui","uy").replace("ei","ey").replace("oi","oy") if g else "_"
 
 
 
 
 
 
 
55
  u=x+"\t".join([str(i+1),"".join(w),l,q[i][0],"|".join(q[i][1:-1]),"_",str(0 if h[i]==i else h[i]+1),q[i][-1],"_","_" if i+1<len(v) and e<v[i+1][0] else "SpaceAfter=No"])+"\n"+u
56
  return "# text = "+t+"\n"+u
57
  def chu_liu_edmonds(self,matrix):
 
51
  f=-1
52
  if i+1<len(v) and e>v[i+1][0]:
53
  w[-1]=z[c[-1]] if c[-1] in z else "ッ"
54
+ if g:
55
+ l="".join(w).replace(" ","") if max(w)<"z" else c
56
+ l=l.replace("sh","s").replace("ch","c").replace("au","aw").replace("iu","iw").replace("eu","ew").replace("ou","ow").replace("ai","ay").replace("ui","uy").replace("ei","ey").replace("oi","oy")
57
+ if q[i][1]=="人称接辞":
58
+ if l.find("=")<0:
59
+ l="="+l if i>h[i] else l+"="
60
+ else:
61
+ l="_"
62
  u=x+"\t".join([str(i+1),"".join(w),l,q[i][0],"|".join(q[i][1:-1]),"_",str(0 if h[i]==i else h[i]+1),q[i][-1],"_","_" if i+1<len(v) and e<v[i+1][0] else "SpaceAfter=No"])+"\n"+u
63
  return "# text = "+t+"\n"+u
64
  def chu_liu_edmonds(self,matrix):