Description
A Part of Speech classifier predicts a grammatical label for every token in the input text. Implemented with a averaged perceptron architecture
.
Predicted Entities
- PROPN
- PUNCT
- NOUN
- ADP
- ADJ
- DET
- AUX
- VERB
- PRON
- CCONJ
- NUM
- ADV
- INTJ
- SCONJ
- X
- SYM
- PART
Live Demo Open in Colab Download Copy S3 URICopied!
How to use
document_assembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")
sentence_detector = SentenceDetector() \
.setInputCols(["document"]) \
.setOutputCol("sentence")
pos = PerceptronModel.pretrained("pos_ud_isdt", "it") \
.setInputCols(["document", "token"]) \
.setOutputCol("pos")
pipeline = Pipeline(stages=[
document_assembler,
sentence_detector,
posTagger
])
example = spark.createDataFrame([['Ciao da John Snow Labs! ']], ["text"])
result = pipeline.fit(example).transform(example)
Results
token pos
0 Ciao VERB
1 da ADP
2 John PROPN
3 Snow PROPN
4 Labs PROPN
5 ! PUNCT
Model Information
Model Name: | pos_ud_isdt |
Compatibility: | Spark NLP 3.0.0+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [document, token] |
Output Labels: | [pos] |
Language: | it |