Part of Speech for Basque

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_bdt", "eu") \
    .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("Iparraldeko erregea izateaz gain, mediku ingelesa eta anestesia eta higiene medikoa garatzen duen liderra da John Snow.")

val pos = PerceptronModel.pretrained("pos_ud_bdt", "eu")
    .setInputCols(Array("document", "token"))
    .setOutputCol("pos")

Results

[Row(annotatorType='pos', begin=0, end=10, result='NOUN', metadata={'word': 'Iparraldeko'}, embeddings=[]),
Row(annotatorType='pos', begin=12, end=18, result='NOUN', metadata={'word': 'erregea'}, embeddings=[]),
Row(annotatorType='pos', begin=20, end=26, result='VERB', metadata={'word': 'izateaz'}, embeddings=[]),
Row(annotatorType='pos', begin=28, end=31, result='NOUN', metadata={'word': 'gain'}, embeddings=[]),
Row(annotatorType='pos', begin=32, end=32, result='PUNCT', metadata={'word': ','}, embeddings=[]),
...]

Model Information

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

Data Source

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