Part of Speech for Finnish

Description

A Part of Speech classifier predicts a grammatical label for every token in the input text. Implemented with an averaged perceptron architecture.

Predicted Entities

  • NOUN
  • ADJ
  • VERB
  • ADV
  • CCONJ
  • PUNCT
  • SCONJ
  • PRON
  • PROPN
  • AUX
  • ADP
  • NUM
  • X
  • SYM
  • INTJ

Live Demo Open in Colab Download Copy S3 URI

How to use


document_assembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")

sentence_detector = SentenceDetector() \
.setInputCols(["document"]) \
.setOutputCol("sentence")

pos = PerceptronModel.pretrained("pos_ud_tdt", "fi") \
.setInputCols(["document", "token"]) \
.setOutputCol("pos")

pipeline = Pipeline(stages=[
document_assembler,
sentence_detector,
posTagger
])

example = spark.createDataFrame([['Hei John Snow Labs! ']], ["text"])

result = pipeline.fit(example).transform(example)



val document_assembler = DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")

val sentence_detector = SentenceDetector()
.setInputCols("document")
.setOutputCol("sentence")

val pos = PerceptronModel.pretrained("pos_ud_tdt", "fi")
.setInputCols(Array("document", "token"))
.setOutputCol("pos")

val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, pos))

val data = Seq("Hei John Snow Labs! ").toDF("text")
val result = pipeline.fit(data).transform(data)


import nlu
text = [""Hei John Snow Labs! ""]
token_df = nlu.load('fi.pos').predict(text)
token_df

Results

token    pos

0   Hei   INTJ
1  John  PROPN
2  Snow  PROPN
3  Labs  PROPN
4     !  PUNCT

Model Information

Model Name: pos_ud_tdt
Compatibility: Spark NLP 3.0.0+
License: Open Source
Edition: Official
Input Labels: [document, token]
Output Labels: [pos]
Language: fi