summaryrefslogtreecommitdiff
path: root/extractor/phrase_location.cc
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-02-19 21:23:48 +0000
committerPaul Baltescu <pauldb89@gmail.com>2013-02-19 21:23:48 +0000
commit54a1c0e2bde259e3acc9c0a8ec8da3c7704e80ca (patch)
tree6171a6a2e904d00b86ea108b2ef1d572c2d36d87 /extractor/phrase_location.cc
parent63b30ed9c8510da8c8e2f6a456576424fddacc0e (diff)
Timing every part of the extractor.
Diffstat (limited to 'extractor/phrase_location.cc')
-rw-r--r--extractor/phrase_location.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/extractor/phrase_location.cc b/extractor/phrase_location.cc
index 62f1e714..b0bfed80 100644
--- a/extractor/phrase_location.cc
+++ b/extractor/phrase_location.cc
@@ -5,15 +5,19 @@ PhraseLocation::PhraseLocation(int sa_low, int sa_high) :
PhraseLocation::PhraseLocation(const vector<int>& matchings,
int num_subpatterns) :
- sa_high(0), sa_low(0),
+ sa_low(0), sa_high(0),
matchings(make_shared<vector<int> >(matchings)),
num_subpatterns(num_subpatterns) {}
-bool PhraseLocation::IsEmpty() {
+bool PhraseLocation::IsEmpty() const {
+ return GetSize() == 0;
+}
+
+int PhraseLocation::GetSize() const {
if (num_subpatterns > 0) {
- return matchings->size() == 0;
+ return matchings->size();
} else {
- return sa_low >= sa_high;
+ return sa_high - sa_low;
}
}