summaryrefslogtreecommitdiffstats
path: root/migratetags/matchers/defaultmatcher.h
diff options
context:
space:
mode:
Diffstat (limited to 'migratetags/matchers/defaultmatcher.h')
-rw-r--r--migratetags/matchers/defaultmatcher.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/migratetags/matchers/defaultmatcher.h b/migratetags/matchers/defaultmatcher.h
index 592dbf5..b74ed38 100644
--- a/migratetags/matchers/defaultmatcher.h
+++ b/migratetags/matchers/defaultmatcher.h
@@ -6,22 +6,15 @@
class DefaultMatcher : public Matcher {
public:
+ DefaultMatcher() {
+ }
+
// Compares 2 words and tries to give a percentage assurance of a match
// TODO: could use more smarts here
//
virtual int compare(const SWBuf &s1, const SWBuf &s2) {
- SWBuf t1 = s1;
- SWBuf t2 = s2;
- UTF8GreekAccents filter;
- filter.setOptionValue("off");
-
- // remove greek accents
- filter.processText(t1);
- filter.processText(t2);
-
- // change to uppercase to match
- StringMgr::getSystemStringMgr()->upperUTF8(t1.getRawData());
- StringMgr::getSystemStringMgr()->upperUTF8(t2.getRawData());
+ SWBuf t1 = sanitizeWord(s1);
+ SWBuf t2 = sanitizeWord(s2);
int retVal = 0;
SWBuf largest = (t1.length() > t2.length()) ? t1 : t2;
@@ -38,6 +31,7 @@ virtual int compare(const SWBuf &s1, const SWBuf &s2) {
}
return (((float)matches) / largest.length()) * 100;
}
+
//
// This is where the magic happens
//
@@ -76,5 +70,10 @@ virtual void matchWords(vector<int> &targetWordTags, const vector<SWBuf> &target
}
}
}
+virtual SWBuf sanitizeWord(const SWBuf &word) {
+ SWBuf t1 = word;
+ t1.toUpper();
+ return t1;
+}
};
#endif