You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class sent2vec.vectorizer.Vectorizer(pretrained_weights='distilbert-base-uncased', ensemble_method='average')
34
+
```
35
35
36
36
### **Parameters**
37
37
38
-
-**pretrained_weights**: str, *default*='distilbert-base-uncased' - If the string does not include an extension .txt, .gz or .bin, then Bert vectorizer is loaded using the specified weights. *Example: pass 'distilbert-base-multilingual-cased' to load Bert base multilingual model.* <br/> To load word2vec vectorizer pass a valid path to the weights file (.txt, .gz or .bin). *Example: pass 'glove-wiki-gigaword-300.gz' to load the Wiki vectors (when saved in the same folder you are running the code).*
39
-
-**ensemble_method**: str, *default*='average' - How word vectors are computed into sentece vectors.
38
+
-`pretrained_weights`: str, *default*='distilbert-base-uncased' - How word embeddings are computed. => You can pass other BERT models into this parameter such as base multilingual model, i.e., `distilbert-base-multilingual-cased`. Basically, the vectorizer uses the BERT vectorizer with specified weights unless you pass a file path with extensions `.txt`, `.gz` or `.bin` to this parameter. In that case, the Gensim library will load the provided word2ved model (pretrained weights). For example, you can pass `glove-wiki-gigaword-300.gz` to load the Wiki vectors (when saved in the same folder you are running the code).
39
+
-`ensemble_method`: str, *default*='average' - How word vectors are aggregated into sentece vectors.
Note: The default vectorizer for the BERT model is `distilbert-base-uncased` but it's possible to pass the argument `pretrained_weights` to chose another BERT model. For example, you can use the code below to load the base multilingual model.
83
79
84
-
If you want to use a word2vec approach instead, you must pass a valid path to the model weights. Under the hood the sentences will be splitted into lists of words using the `sent2words` method from the `Splitter` class. It is possible to customize the list of stop-words by adding or removing to/from the default list. Two additional arguments (both lists) must be passed when the vectorizer's method .run is called: `remove_stop_words` and `add_stop_words`.
If you want to use a Word2Vec approach instead, you must pass a valid path to the model weights. Under the hood, the sentences will be split into lists of words using the `sent2words` method from the `Splitter` class. It is possible to customize the list of stop-words by adding or removing to/from the default list. Two additional arguments (both lists) must be passed when the vectorizer's method .run is called: `remove_stop_words` and `add_stop_words`.
85
85
86
-
NOTE: When you extract the most important words in sentences, by default `Vectorizer`computes the sentence embeddings using the average of vectors corresponding to the remaining words.
86
+
NOTE: The default method to computes the sentence embeddings after extracting list of vectors is average of vectors corresponding to the remaining words.
0 commit comments