Vietnamese Lemmatizer


This is a dictionary-based lemmatizer that assigns all forms and inflections of a word to a single root. This enables the pipeline to treat the past and present tense of a verb, for example, as the same word instead of two completely different words.

Live Demo Open in Colab Download

How to use

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

tokenizer = Tokenizer()\
    .setInputCols(["document"]) \

lemmatizer = LemmatizerModel.pretrained("lemma", "vi") \
        .setInputCols(["token"]) \

pipeline = Pipeline(stages=[document_assembler, tokenizer, lemmatizer])

example = spark.createDataFrame(pd.DataFrame({'text': ["Tất cả đều hồi hộp ."]]}))

results =
val document_assembler = DocumentAssembler()

val tokenizer = Tokenizer()

val lemmatizer = LemmatizerModel.pretrained("lemma", "vi")

val pipeline = new Pipeline().setStages(Array(document_assembler, tokenizer, lemmatizer))
val result =["Tất cả đều hồi hộp ."].toDS.toDF("text")).transform(data)

import nlu

text = ["Tất cả đều hồi hộp ."]
lemma_df = nlu.load('vi.lemma').predict(text, output_level = "document")


|  Tất|
|   cả|
|  đều|
|  hồi|
|  hộp|
|    .|

Model Information

Model Name: lemma
Compatibility: Spark NLP 3.0.0+
License: Open Source
Edition: Official
Input Labels: [token]
Output Labels: [lemma]
Language: vi

Data Source

The model was trained on the Universal Dependencies version 2.7.


Precision=0.96, Recall=0.89, F1-score=0.93