From 4f33c33b5492e1cc391c13bee8aa9265784706c9 Mon Sep 17 00:00:00 2001 From: "Troy A. Griffitts" Date: Sun, 16 Apr 2023 13:48:43 +0000 Subject: added ability to use -tei as target git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@555 07627401-56e2-0310-80f4-f8cd0041bdcd --- migratetags/matchers/gntmatcher.h | 12 ++++++++---- migratetags/migratetags.cpp | 6 +++--- 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 &targetWordTags, const vector &targetWords, const vector &fromWords, vector 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 &targetWordTags, const vector &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 &targetWordTags, const vector &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"; -- cgit