Dutch Named Entity Recognition (from Davlan)

Description

Pretrained Named Entity Recognition model, uploaded to Hugging Face, adapted and imported into Spark NLP. bert-base-multilingual-cased-ner-hrl is a Dutch model orginally trained by Davlan.

Predicted Entities

LOC, DATE, PER, ORG

Download Copy S3 URI

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_multilingual_cased_ner_hrl","nl") \
    .setInputCols(["sentence", "token"]) \
    .setOutputCol("ner")

pipeline = Pipeline(stages=[documentAssembler, sentenceDetector, tokenizer, tokenClassifier])

data = spark.createDataFrame([["Ik hou van Spark 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_multilingual_cased_ner_hrl","nl") 
    .setInputCols(Array("sentence", "token")) 
    .setOutputCol("ner")

val pipeline = new Pipeline().setStages(Array(documentAssembler,sentenceDetector, tokenizer, tokenClassifier))

val data = Seq("Ik hou van Spark NLP").toDF("text")

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("nl.ner.bert.cased_multilingual_base").predict("""Ik hou van Spark NLP""")

Model Information

Model Name: bert_ner_bert_base_multilingual_cased_ner_hrl
Compatibility: Spark NLP 3.4.2+
License: Open Source
Edition: Official
Input Labels: [document, token]
Output Labels: [ner]
Language: nl
Size: 665.6 MB
Case sensitive: true
Max sentence length: 128

References

  • https://huggingface.co/Davlan/bert-base-multilingual-cased-ner-hrl
  • https://camel.abudhabi.nyu.edu/anercorp/
  • https://www.clips.uantwerpen.be/conll2003/ner/
  • https://www.clips.uantwerpen.be/conll2003/ner/
  • https://www.clips.uantwerpen.be/conll2002/ner/
  • https://github.com/EuropeanaNewspapers/ner-corpora/tree/master/enp_FR.bnf.bio
  • https://ontotext.fbk.eu/icab.html
  • https://github.com/LUMII-AILab/FullStack/tree/master/NamedEntities
  • https://www.clips.uantwerpen.be/conll2002/ner/
  • https://github.com/davidsbatista/NER-datasets/tree/master/Portuguese