summaryrefslogtreecommitdiff
path: root/extractor/matchings_finder.h
blob: 451f4a4ca6dd906ce9868db299117ef8a7922399 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef _MATCHINGS_FINDER_H_
#define _MATCHINGS_FINDER_H_

#include <memory>
#include <string>

using namespace std;

namespace extractor {

class PhraseLocation;
class SuffixArray;

/**
 * Class wrapping the suffix array lookup for a contiguous phrase.
 */
class MatchingsFinder {
 public:
  MatchingsFinder(shared_ptr<SuffixArray> suffix_array);

  virtual ~MatchingsFinder();

  // Uses the suffix array to search only for the last word of the phrase
  // starting from the range in which the prefix of the phrase occurs.
  virtual PhraseLocation Find(PhraseLocation& location, const string& word,
                              int offset);

 protected:
  MatchingsFinder();

 private:
  shared_ptr<SuffixArray> suffix_array;
};

} // namespace extractor

#endif