Part of Speech for Armenian

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

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

Live Demo Open in Colab Download

How to use


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

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

pos = PerceptronModel.pretrained("pos_ud_armtdp", "hy")
  .setInputCols(["document", "token"])
  .setOutputCol("pos")

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

example = spark.createDataFrame(pd.DataFrame({'text': ["Ողջույն, John ոն Ձյուն լաբորատորիաներից: "]}))

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_armtdp", "hy")
        .setInputCols(Array("document", "token"))
        .setOutputCol("pos")

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

val result = pipeline.fit(Seq.empty["Ողջույն, John ոն Ձյուն լաբորատորիաներից: "].toDS.toDF("text")).transform(data)


import nlu
text = [""Ողջույն, John ոն Ձյուն լաբորատորիաներից: ""]
token_df = nlu.load('hy.pos').predict(text)
token_df
    

Results

              token    pos
                          
0           Ողջույն   INTJ
1                 ,  PUNCT
2              John    ADJ
3                ոն   NOUN
4             Ձյուն   NOUN
5  լաբորատորիաներից   NOUN
6                 :  PUNCT

Model Information

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