Skip to content

Commit

Permalink
Add word ngram parameter to fasttext (#1432)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsonntag authored and menshikh-iv committed Jun 22, 2017
1 parent 968ac32 commit dfb66f1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gensim/models/wrappers/fasttext.py
Expand Up @@ -146,7 +146,7 @@ def initialize_word_vectors(self):

@classmethod
def train(cls, ft_path, corpus_file, output_file=None, model='cbow', size=100, alpha=0.025, window=5, min_count=5,
loss='ns', sample=1e-3, negative=5, iter=5, min_n=3, max_n=6, sorted_vocab=1, threads=12):
word_ngrams=1, loss='ns', sample=1e-3, negative=5, iter=5, min_n=3, max_n=6, sorted_vocab=1, threads=12):
"""
`ft_path` is the path to the FastText executable, e.g. `/home/kofola/fastText/fasttext`.
Expand All @@ -164,6 +164,8 @@ def train(cls, ft_path, corpus_file, output_file=None, model='cbow', size=100, a
`min_count` = ignore all words with total occurrences lower than this.
`word_ngram` = max length of word ngram
`loss` = defines training objective. Allowed values are `hs` (hierarchical softmax),
`ns` (negative sampling) and `softmax`. Defaults to `ns`
Expand Down Expand Up @@ -197,6 +199,7 @@ def train(cls, ft_path, corpus_file, output_file=None, model='cbow', size=100, a
'ws': window,
'epoch': iter,
'minCount': min_count,
'wordNgrams': word_ngrams,
'neg': negative,
'loss': loss,
'minn': min_n,
Expand Down

0 comments on commit dfb66f1

Please sign in to comment.