KoichiYasuoka
commited on
Commit
•
c4adaee
1
Parent(s):
c1fcc42
shrink
Browse files
ud.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
from transformers import TokenClassificationPipeline
|
2 |
-
from transformers.pipelines import PIPELINE_REGISTRY
|
3 |
|
4 |
class UniversalDependenciesPipeline(TokenClassificationPipeline):
|
5 |
def _forward(self,model_input):
|
@@ -31,5 +30,3 @@ class UniversalDependenciesPipeline(TokenClassificationPipeline):
|
|
31 |
q=self.model.config.id2label[p[i,h[i]]].split("|")
|
32 |
u+="\t".join([str(i),t[s:e],"_",q[0],"_","|".join(q[1:-1]),str(h[i]),q[-1],"_","_" if i<len(v) and e<v[i][0] else "SpaceAfter=No"])+"\n"
|
33 |
return u+"\n"
|
34 |
-
|
35 |
-
PIPELINE_REGISTRY.register_pipeline("universal-dependencies",pipeline_class=UniversalDependenciesPipeline)
|
|
|
1 |
from transformers import TokenClassificationPipeline
|
|
|
2 |
|
3 |
class UniversalDependenciesPipeline(TokenClassificationPipeline):
|
4 |
def _forward(self,model_input):
|
|
|
30 |
q=self.model.config.id2label[p[i,h[i]]].split("|")
|
31 |
u+="\t".join([str(i),t[s:e],"_",q[0],"_","|".join(q[1:-1]),str(h[i]),q[-1],"_","_" if i<len(v) and e<v[i][0] else "SpaceAfter=No"])+"\n"
|
32 |
return u+"\n"
|
|
|
|