英文

codeswitch-hineng-pos-lince

这是用于印地语-英语混合代码数据的预训练模型,使用自 LinCE

该模型是针对以下存储库进行训练的。

https://github.com/sagorbrur/codeswitch

要安装codeswitch:

pip install codeswitch

印地语-英语混合数据的词性标注

  • 方法-1
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline

tokenizer = AutoTokenizer.from_pretrained("sagorsarker/codeswitch-hineng-pos-lince")

model = AutoModelForTokenClassification.from_pretrained("sagorsarker/codeswitch-hineng-pos-lince")
pos_model = pipeline('ner', model=model, tokenizer=tokenizer)

pos_model("put any hindi english code-mixed sentence")
  • 方法-2
from codeswitch.codeswitch import POS
pos = POS('hin-eng')
text = "" # your mixed sentence 
result = pos.tag(text)
print(result)