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_gdt", "el") \
.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("Εκτός από το ότι είναι ο βασιλιάς του Βορρά, ο John Snow είναι Άγγλος γιατρός και ηγέτης στην ανάπτυξη της αναισθησίας και της ιατρικής υγιεινής.")
...
val pos = PerceptronModel.pretrained("pos_ud_gdt", "el")
.setInputCols(Array("document", "token"))
.setOutputCol("pos")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, pos))
val result = pipeline.fit(Seq.empty["Εκτός από το ότι είναι ο βασιλιάς του Βορρά, ο John Snow είναι Άγγλος γιατρός και ηγέτης στην ανάπτυξη της αναισθησίας και της ιατρικής υγιεινής."].toDS.toDF("text")).transform(data)
Results
[Row(annotatorType='pos', begin=0, end=4, result='ADV', metadata={'word': 'Εκτός'}),
Row(annotatorType='pos', begin=6, end=8, result='ADP', metadata={'word': 'από'}),
Row(annotatorType='pos', begin=10, end=11, result='DET', metadata={'word': 'το'}),
Row(annotatorType='pos', begin=13, end=15, result='SCONJ', metadata={'word': 'ότι'}),
Row(annotatorType='pos', begin=17, end=21, result='AUX', metadata={'word': 'είναι'}),
...]
Model Information
Model Name: | pos_ud_gdt |
Type: | pos |
Compatibility: | Spark NLP 2.5.0+ |
Edition: | Official |
Input labels: | [token] |
Output labels: | [pos] |
Language: | el |
Case sensitive: | false |
License: | Open Source |
Data Source
The model is imported from https://universaldependencies.org
PREVIOUSGreek Lemmatizer