Part of Speech for Spanish (Venezuela)

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.

Open in Colab Download

How to use


pos = PerceptronModel.pretrained("pos_ud_tal", "sv") \
    .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("Förutom att vara kungen i norr är John Snow en engelsk läkare och en ledare inom utveckling av anestesi och medicinsk hygien.")

val pos = PerceptronModel.pretrained("pos_ud_tal", "sv")
    .setInputCols(Array("document", "token"))
    .setOutputCol("pos")

Results

[Row(annotatorType='pos', begin=0, end=6, result='ADP', metadata={'word': 'Förutom'}, embeddings=[]),
Row(annotatorType='pos', begin=8, end=10, result='PART', metadata={'word': 'att'}, embeddings=[]),
Row(annotatorType='pos', begin=12, end=15, result='AUX', metadata={'word': 'vara'}, embeddings=[]),
Row(annotatorType='pos', begin=17, end=22, result='NOUN', metadata={'word': 'kungen'}, embeddings=[]),
Row(annotatorType='pos', begin=24, end=24, result='ADP', metadata={'word': 'i'}, embeddings=[]),
...]

Model Information

Model Name: pos_ud_tal
Type: pos
Compatibility: Spark NLP 2.5.0+
Edition: Official
Input labels: [token]
Output labels: [pos]
Language: sv
Case sensitive: false
License: Open Source

Data Source

The model is imported from https://universaldependencies.org