Description
Pretrained BertForSequenceClassification model, adapted from Hugging Face and curated to provide scalability and production-readiness using Spark NLP. bert_MultiClass_TextClassification is a English model originally trained by palakagl.
Predicted Entities
alarm_remove, transport_query, email_addcontact, general_praise, general_dontcare, takeaway_query, email_query, transport_traffic, iot_wemo_off, weather_query, iot_hue_lightchange, calendar_query, iot_wemo_on, email_sendemail, general_negate, qa_currency, general_joke, alarm_query, alarm_set, general_repeat, datetime_convert, transport_taxi, lists_query, general_quirky, recommendation_movies, calendar_remove, qa_factoid, iot_hue_lighton, iot_hue_lightup, audio_volume_up, social_query, general_explain, general_confirm, news_query, qa_definition, iot_coffee, play_audiobook, qa_maths, lists_createoradd, play_podcasts, music_query, recommendation_locations, play_music, calendar_set, email_querycontact, general_affirm, recommendation_events, play_radio, audio_volume_down, social_post, general_commandstop, iot_hue_lightdim, transport_ticket, cooking_recipe, iot_hue_lightoff, audio_volume_mute, lists_remove, music_settings, iot_cleaning, takeaway_order, music_likeness, qa_stock, datetime_query, play_game
How to use
documentAssembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")
tokenizer = Tokenizer() \
.setInputCols("document") \
.setOutputCol("token")
sequenceClassifier = BertForSequenceClassification.pretrained("bert_sequence_classifier_multiclass_textclassification","en") \
.setInputCols(["document", "token"]) \
.setOutputCol("class")
pipeline = Pipeline(stages=[documentAssembler, tokenizer, sequenceClassifier])
data = spark.createDataFrame([["PUT YOUR STRING HERE"]]).toDF("text")
result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val tokenizer = new Tokenizer()
.setInputCols("document")
.setOutputCol("token")
val sequenceClassifier = BertForSequenceClassification.pretrained("bert_sequence_classifier_multiclass_textclassification","en")
.setInputCols(Array("document", "token"))
.setOutputCol("ner")
val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, sequenceClassifier))
val data = Seq("PUT YOUR STRING HERE").toDS.toDF("text")
val result = pipeline.fit(data).transform(data)
Model Information
| Model Name: | bert_sequence_classifier_multiclass_textclassification |
| Compatibility: | Spark NLP 4.3.1+ |
| License: | Open Source |
| Edition: | Official |
| Input Labels: | [document, token] |
| Output Labels: | [ner] |
| Language: | en |
| Size: | 410.2 MB |
| Case sensitive: | true |
| Max sentence length: | 128 |
References
- https://huggingface.co/palakagl/bert_MultiClass_TextClassification