Description
This model annotates the part of speech of tokens in a text. The parts of speech annotated include PRON (pronoun), CCONJ (coordinating conjunction), and 15 others. The part of speech model is useful for extracting the grammatical structure of a piece of text automatically.
How to use
...
pos = PerceptronModel.pretrained("pos_ud_szeged", "hu") \
.setInputCols(["document", "token"]) \
.setOutputCol("pos")
nlp_pipeline = Pipeline(stages=[document_assembler, sentence_detector, tokenizer, pos])
light_pipeline = LightPipeline(nlp_pipeline.fit(spark.createDataFrame([['']]).toDF("text")))
results = light_pipeline.fullAnnotate("Az északi király kivételével John Snow angol orvos, vezető szerepet játszik az érzéstelenítés és az orvosi higiénia fejlesztésében.")
...
val pos = PerceptronModel.pretrained("pos_ud_szeged", "hu")
.setInputCols(Array("document", "token"))
.setOutputCol("pos")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, pos))
val result = pipeline.fit(Seq.empty["Az északi király kivételével John Snow angol orvos, vezető szerepet játszik az érzéstelenítés és az orvosi higiénia fejlesztésében."].toDS.toDF("text")).transform(data)
Results
[Row(annotatorType='pos', begin=0, end=1, result='DET', metadata={'word': 'Az'}),
Row(annotatorType='pos', begin=3, end=8, result='ADJ', metadata={'word': 'északi'}),
Row(annotatorType='pos', begin=10, end=15, result='NOUN', metadata={'word': 'király'}),
Row(annotatorType='pos', begin=17, end=27, result='NOUN', metadata={'word': 'kivételével'}),
Row(annotatorType='pos', begin=29, end=32, result='PROPN', metadata={'word': 'John'}),
...]
Model Information
Model Name: | pos_ud_szeged |
Type: | pos |
Compatibility: | Spark NLP 2.5.0+ |
Edition: | Official |
Input labels: | [token] |
Output labels: | [pos] |
Language: | hu |
Case sensitive: | false |
License: | Open Source |
Data Source
The model is imported from https://universaldependencies.org
PREVIOUSHungarian Lemmatizer
NEXTGreek Lemmatizer