[sword-svn] r555 - in trunk/migratetags: . matchers

scribe at crosswire.org scribe at crosswire.org
Sun Apr 16 09:48:43 EDT 2023


Author: scribe
Date: 2023-04-16 09:48:43 -0400 (Sun, 16 Apr 2023)
New Revision: 555

Modified:
   trunk/migratetags/matchers/gntmatcher.h
   trunk/migratetags/migratetags.cpp
Log:
added ability to use -tei <filename> as target


Modified: trunk/migratetags/matchers/gntmatcher.h
===================================================================
--- trunk/migratetags/matchers/gntmatcher.h	2023-04-13 08:31:02 UTC (rev 554)
+++ trunk/migratetags/matchers/gntmatcher.h	2023-04-16 13:48:43 UTC (rev 555)
@@ -48,6 +48,10 @@
 
 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 @@
 
 			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 @@
 
 					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;

Modified: trunk/migratetags/migratetags.cpp
===================================================================
--- trunk/migratetags/migratetags.cpp	2023-04-13 08:31:02 UTC (rev 554)
+++ trunk/migratetags/migratetags.cpp	2023-04-16 13:48:43 UTC (rev 555)
@@ -16,9 +16,9 @@
 #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";



More information about the sword-cvs mailing list