Skip to content

Commit

Permalink
getDictionary api for FastText
Browse files Browse the repository at this point in the history
Summary: Enable users to get const pointer to Dictionary.

Reviewed By: stephenroller, EdouardGrave

Differential Revision: D5826941

fbshipit-source-id: 66442d7c6428c79aa74fbbce270aba3feccd34fa
  • Loading branch information
cpuhrsch authored and facebook-github-bot committed Sep 16, 2017
1 parent 1f69d86 commit 7e5c955
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/fasttext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,10 @@ void FastText::sentenceVectors() {
}
}

std::shared_ptr<const Dictionary> FastText::getDictionary() const {
return dict_;
}

void FastText::ngramVectors(std::string word) {
std::vector<int32_t> ngrams;
std::vector<std::string> substrings;
Expand Down
1 change: 1 addition & 0 deletions src/fasttext.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class FastText {
FastText();

void getVector(Vector&, const std::string&) const;
std::shared_ptr<const Dictionary> getDictionary() const;
void saveVectors();
void saveOutput();
void saveModel();
Expand Down

0 comments on commit 7e5c955

Please sign in to comment.