Description
Pretrained BertForTokenClassification model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. IDRISI-LMR-HD-TB-partition
is a English model originally trained by rsuwaileh
.
Predicted Entities
L-ST
, CTRY
, L-HPOI
, CNTY
, U-OTHR
, L-ISL
, OTHR
, U-HPOI
, L-CNTY
, CITY
, L-CTRY
, L-DIST
, U-STAT
, CONT
, NBHD
, L-NBHD
, L-STAT
, U-ST
, L-CITY
, NPOI
, ST
, ISL
, U-NBHD
, STAT
, L-NPOI
, HPOI
, U-CNTY
, L-OTHR
, U-ISL
, U-CTRY
, L-CONT
, U-CONT
, U-NPOI
, U-DIST
, U-CITY
, DIST
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_IDRISI_LMR_HD_TB_partition","en") \
.setInputCols(["sentence", "token"]) \
.setOutputCol("ner")
pipeline = Pipeline(stages=[documentAssembler, sentenceDetector, tokenizer, tokenClassifier])
data = spark.createDataFrame([["PUT YOUR STRING HERE"]]).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_IDRISI_LMR_HD_TB_partition","en")
.setInputCols(Array("sentence", "token"))
.setOutputCol("ner")
val pipeline = new Pipeline().setStages(Array(documentAssembler,sentenceDetector, tokenizer, tokenClassifier))
val data = Seq("PUT YOUR STRING HERE").toDF("text")
val result = pipeline.fit(data).transform(data)
Model Information
Model Name: | bert_ner_IDRISI_LMR_HD_TB_partition |
Compatibility: | Spark NLP 4.0.0+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [document, token] |
Output Labels: | [ner] |
Language: | en |
Size: | 1.2 GB |
Case sensitive: | true |
Max sentence length: | 128 |
References
- https://huggingface.co/rsuwaileh/IDRISI-LMR-HD-TB-partition
- https://github.com/rsuwaileh/IDRISI
- https://github.com/rsuwaileh/TLLMR4CM/
- https://github.com/rsuwaileh/IDRISI/tree/main/data/LMR/EN/gold-random-bilou/hurricane_dorian_2019