这是用于印地语-英语混合代码数据的预训练模型,使用自 LinCE 。
该模型是针对以下存储库进行训练的。
https://github.com/sagorbrur/codeswitch
要安装codeswitch:
pip install codeswitch
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")
from codeswitch.codeswitch import POS pos = POS('hin-eng') text = "" # your mixed sentence result = pos.tag(text) print(result)