Part of Speech for English (pos_anc)

Description

Part of Speech trained for English trained Pos Anc dataset. Predicts the following tags :

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

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

example = spark.createDataFrame([['Hello from 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_anc", "en")
.setInputCols(Array("document", "token"))
.setOutputCol("pos")

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

val data = Seq("Hello from John Snow Labs!").toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu
text = ["Hello from John Snow Labs!"]
pos_df = nlu.load('en.pos.anc').predict(text, output_level = "token")
pos_df

Results

+----------+----------+
|token_result|pos_result|
+----------+----------+
|Hello     |UH        |
|from      |IN        |
|John      |NNP       |
|Snow      |NNP       |
|Labs      |NNP       |
|!         |.         |
+----------+----------+

Model Information

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