Part of Speech for Latin

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

  • PUNCT
  • ADP
  • PROPN
  • NOUN
  • VERB
  • DET
  • CCONJ
  • PRON
  • ADJ
  • NUM
  • AUX
  • SCONJ
  • ADV
  • PART
  • X

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_llct", "la") \
  .setInputCols(["document", "token"]) \
  .setOutputCol("pos")

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

example = spark.createDataFrame([['Aequaliter Nubila Labs Ioannes de salve ! ']], ["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_llct", "la")
        .setInputCols(Array("document", "token"))
        .setOutputCol("pos")

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

val data = Seq("Aequaliter Nubila Labs Ioannes de salve ! ").toDF("text")
val result = pipeline.fit(data).transform(data)


import nlu
text = [""Aequaliter Nubila Labs Ioannes de salve ! ""]
token_df = nlu.load('la.pos').predict(text)
token_df
    

Results

        token    pos
                    
0  Aequaliter  PROPN
1      Nubila  PROPN
2        Labs    ADJ
3     Ioannes   NOUN
4          de    ADP
5       salve   NOUN
6           !  PROPN

Model Information

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