Description
This model is trained on Common Crawl and Wikipedia using fastText. It is trained using CBOW with position-weights, in dimension 300, with character n-grams of length 5, a window of size 5 and 10 negatives.
The model gives 300 dimensional vector outputs per token. The output vectors map words into a meaningful space where the distance between the vectors is related to semantic similarity of words.
These embeddings can be used in multiple tasks like semantic word similarity, named entity recognition, sentiment analysis, and classification.
How to use
Use as part of a pipeline after tokenization.
embeddings = WordEmbeddingsModel.pretrained("hebrew_cc_300d", "he") \
.setInputCols(["document", "token"]) \
.setOutputCol("embeddings")
nlp_pipeline = Pipeline(stages=[document_assembler, sentence_detector, tokenizer, embeddings])
pipeline_model = nlp_pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))
result = pipeline_model.transform(spark.createDataFrame([['כמו גם התקפות והאשמות נגד בראון']], ["text"]))
val embeddings = WordEmbeddingsModel.pretrained("hebrew_cc_300d", "he")
.setInputCols(Array("document", "token"))
.setOutputCol("embeddings")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, embeddings))
val data = Seq("כמו גם התקפות והאשמות נגד בראון").toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu
text = ["כמו גם התקפות והאשמות נגד בראון"]
hebrevec_df = nlu.load('he.embed.cbow_300d').predict(text, output_level="token")
hebrevec_df
Results
The model gives 300 dimensional Word2Vec feature vector outputs per token.
| he_embed_cbow_300d_embeddings | token
|----------------------------------------------------|-------
| [0.01140000019222498, 0.005900000222027302, 0.... כמו
| [-0.06199999898672104, 0.04879999905824661, 0.... גם
| [0.041600000113248825, 0.045099999755620956, 0... התקפות
| [0.01489999983459711, 0.024800000712275505, -0... והאשמות
| [-0.049800001084804535, 0.05260000005364418, -... נגד
| [0.01209999993443489, -0.012600000016391277, -... בראון
Model Information
Model Name: | hebrew_cc_300d |
Type: | embeddings |
Compatibility: | Spark NLP 2.7.0+ |
License: | Open Source |
Edition: | Official |
Input Labels: | [document, token] |
Output Labels: | [word_embeddings] |
Language: | he |
Case sensitive: | false |
Dimension: | 300 |
Data Source
This model is imported from https://fasttext.cc/docs/en/crawl-vectors.html