Word2Vec Embeddings in Urdu (300d)

Description

Word Embeddings lookup annotator that maps tokens to vectors.

Download

How to use

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

tokenizer = Tokenizer() \
.setInputCols("document") \
.setOutputCol("token")

embeddings = WordEmbeddingsModel.pretrained("w2v_cc_300d","ur") \
.setInputCols(["document", "token"]) \
.setOutputCol("embeddings")

pipeline = Pipeline(stages=[documentAssembler, tokenizer, embeddings])

data = spark.createDataFrame([["مجھے سپارک این ایل پی سے محبت ہے"]]).toDF("text")

result = pipeline.fit(data).transform(data)
val documentAssembler = new DocumentAssembler() 
.setInputCol("text") 
.setOutputCol("document")

val tokenizer = new Tokenizer() 
.setInputCols(Array("document"))
.setOutputCol("token")

val embeddings = WordEmbeddingsModel.pretrained("w2v_cc_300d","ur") 
.setInputCols(Array("document", "token")) 
.setOutputCol("embeddings")

val pipeline = new Pipeline().setStages(Array(documentAssembler, tokenizer, embeddings))

val data = Seq("مجھے سپارک این ایل پی سے محبت ہے").toDF("text")

val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("ur.embed.w2v_cc_300d").predict("""مجھے سپارک این ایل پی سے محبت ہے""")

Model Information

Model Name: w2v_cc_300d
Type: embeddings
Compatibility: Spark NLP 3.4.1+
License: Open Source
Edition: Official
Input Labels: [document, token]
Output Labels: [embeddings]
Language: ur
Size: 672.4 MB
Case sensitive: false
Dimension: 300