diff options
author | Paul Baltescu <pauldb89@gmail.com> | 2013-11-25 18:19:13 +0000 |
---|---|---|
committer | Paul Baltescu <pauldb89@gmail.com> | 2013-11-25 18:19:13 +0000 |
commit | bd6fef61505b19989cc327620632e8e7efda2e6e (patch) | |
tree | 40d01e5319d1b00ea199812bda62349adbfb73bc /extractor/suffix_array.cc | |
parent | 9834df1efceb27b140f18f47e711d3fff6c7ecb8 (diff) |
Reduce unordered_map calls.
Diffstat (limited to 'extractor/suffix_array.cc')
-rw-r--r-- | extractor/suffix_array.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/extractor/suffix_array.cc b/extractor/suffix_array.cc index ac230d13..4a514b12 100644 --- a/extractor/suffix_array.cc +++ b/extractor/suffix_array.cc @@ -187,12 +187,12 @@ shared_ptr<DataArray> SuffixArray::GetData() const { PhraseLocation SuffixArray::Lookup(int low, int high, const string& word, int offset) const { - if (!data_array->HasWord(word)) { + int word_id = data_array->GetWordId(word); + if (word_id == -1) { // Return empty phrase location. return PhraseLocation(0, 0); } - int word_id = data_array->GetWordId(word); if (offset == 0) { return PhraseLocation(word_start[word_id], word_start[word_id + 1]); } |