Description
Pretrained Named Entity Recognition model, uploaded to Hugging Face, adapted and imported into Spark NLP. bert-base-parsbert-armanner-uncased is a Persian model orginally trained by HooshvareLab.
Predicted Entities
fac, pers, pro, event, org, loc
How to use
documentAssembler = DocumentAssembler() \
        .setInputCol("text") \
        .setOutputCol("document")
sentenceDetector = SentenceDetectorDLModel.pretrained("sentence_detector_dl", "xx")\
       .setInputCols(["document"])\
       .setOutputCol("sentence")
tokenizer = Tokenizer() \
    .setInputCols("sentence") \
    .setOutputCol("token")
tokenClassifier = BertForTokenClassification.pretrained("bert_ner_bert_base_parsbert_armanner_uncased","fa") \
    .setInputCols(["sentence", "token"]) \
    .setOutputCol("ner")
pipeline = Pipeline(stages=[documentAssembler, sentenceDetector, tokenizer, tokenClassifier])
data = spark.createDataFrame([["من عاشق جرقه nlp هستم"]]).toDF("text")
result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler() 
          .setInputCol("text") 
          .setOutputCol("document")
val sentenceDetector = SentenceDetectorDLModel.pretrained("sentence_detector_dl", "xx")
       .setInputCols(Array("document"))
       .setOutputCol("sentence")
val tokenizer = new Tokenizer() 
    .setInputCols(Array("sentence"))
    .setOutputCol("token")
val tokenClassifier = BertForTokenClassification.pretrained("bert_ner_bert_base_parsbert_armanner_uncased","fa") 
    .setInputCols(Array("sentence", "token")) 
    .setOutputCol("ner")
val pipeline = new Pipeline().setStages(Array(documentAssembler,sentenceDetector, tokenizer, tokenClassifier))
val data = Seq("من عاشق جرقه nlp هستم").toDF("text")
val result = pipeline.fit(data).transform(data)
Model Information
| Model Name: | bert_ner_bert_base_parsbert_armanner_uncased | 
| Compatibility: | Spark NLP 3.4.2+ | 
| License: | Open Source | 
| Edition: | Official | 
| Input Labels: | [document, token] | 
| Output Labels: | [ner] | 
| Language: | fa | 
| Size: | 607.0 MB | 
| Case sensitive: | true | 
| Max sentence length: | 128 | 
References
- https://huggingface.co/HooshvareLab/bert-base-parsbert-armanner-uncased
- https://arxiv.org/abs/2005.12515
- https://github.com/HaniehP/PersianNER
- https://github.com/hooshvare/parsbert-ner/blob/master/persian-ner-pipeline.ipynb
- https://colab.research.google.com/github/hooshvare/parsbert-ner/blob/master/persian-ner-pipeline.ipynb
- https://arxiv.org/abs/2005.12515
- https://tensorflow.org/tfrc
- https://hooshvare.com
- https://www.linkedin.com/in/m3hrdadfi/
- https://twitter.com/m3hrdadfi
- https://github.com/m3hrdadfi
- https://www.linkedin.com/in/mohammad-gharachorloo/
- https://twitter.com/MGharachorloo
- https://github.com/baarsaam
- https://www.linkedin.com/in/marziehphi/
- https://twitter.com/marziehphi
- https://github.com/marziehphi
- https://www.linkedin.com/in/mohammad-manthouri-aka-mansouri-07030766/
- https://twitter.com/mmanthouri
- https://github.com/mmanthouri
- https://hooshvare.com/
- https://www.linkedin.com/company/hooshvare
- https://twitter.com/hooshvare
- https://github.com/hooshvare
- https://www.instagram.com/hooshvare/
- https://www.linkedin.com/in/sara-tabrizi-64548b79/
- https://www.behance.net/saratabrizi
- https://www.instagram.com/sara_b_tabrizi/