summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTroy A. Griffitts <scribe@crosswire.org>2023-04-16 13:48:43 +0000
committerTroy A. Griffitts <scribe@crosswire.org>2023-04-16 13:48:43 +0000
commit4f33c33b5492e1cc391c13bee8aa9265784706c9 (patch)
tree185552c49cd7fa59cdf2f68379c5448f3f4065e5
parent2add4f87ae8a5c77122e472c53b430a64e931a48 (diff)
downloadsword-tools-4f33c33b5492e1cc391c13bee8aa9265784706c9.tar.gz
added ability to use -tei <filename> as target
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@555 07627401-56e2-0310-80f4-f8cd0041bdcd
-rw-r--r--migratetags/matchers/gntmatcher.h12
-rw-r--r--migratetags/migratetags.cpp6
2 files changed, 11 insertions, 7 deletions
diff --git a/migratetags/matchers/gntmatcher.h b/migratetags/matchers/gntmatcher.h
index aa8f296..adce7ef 100644
--- a/migratetags/matchers/gntmatcher.h
+++ b/migratetags/matchers/gntmatcher.h
@@ -48,6 +48,10 @@ virtual int compare(const SWBuf &s1, const SWBuf &s2) {
virtual void matchWords(vector<int> &targetWordTags, const vector<SWBuf> &targetWords, const vector<SWBuf> &fromWords, vector<int> fromWordTags) {
+ // percentage of word match
+ // Set very high to output every word which doesn't match exactly.
+ const int WORD_MATCH_PERCENT = 99;
+
// initialize our results to all -1 so we can pop around and set
// words as we find them, and know which ones we haven't yet set
for (int i = 0; i < targetWords.size(); i++) targetWordTags.push_back(-1);
@@ -63,9 +67,9 @@ virtual void matchWords(vector<int> &targetWordTags, const vector<SWBuf> &target
SWBuf w2 = fromWords[j];
int match = compare(w1, w2);
- // if we have a better than 75% match of sequencial characters
+ // if we have a better than n% match of sequencial characters
// then we'll say we have a match
- if (match > 99) {
+ if (match > WORD_MATCH_PERCENT) {
targetWordTags[i] = fromWordTags[j];
fromWordTags[j] = -1;
break;
@@ -88,9 +92,9 @@ virtual void matchWords(vector<int> &targetWordTags, const vector<SWBuf> &target
SWBuf w2 = fromWords[j];
int match = compare(w1, w2);
- // if we have a better than 75% match of sequencial characters
+ // if we have a better than n% match of sequencial characters
// then we'll say we have a match
- if (match > 99) {
+ if (match > WORD_MATCH_PERCENT) {
targetWordTags[i] = fromWordTags[j];
fromWordTags[j] = -1;
break;
diff --git a/migratetags/migratetags.cpp b/migratetags/migratetags.cpp
index 22f73d2..d1b284a 100644
--- a/migratetags/migratetags.cpp
+++ b/migratetags/migratetags.cpp
@@ -16,9 +16,9 @@ using namespace std;
#include "matchers/matcher.h"
// select your matcher here
-//#include "matchers/gntmatcher.h"
-#include "matchers/defaultmatcher.h"
-Matcher *matcher = new DefaultMatcher();
+#include "matchers/gntmatcher.h"
+//#include "matchers/defaultmatcher.h"
+Matcher *matcher = new GNTMatcher();
// hard code your from and to modules here or pass them on the command line with -
SWBuf strongsSourceModuleName = "WHNU";