[sword-svn] r145 - trunk/flashtools

scribe at www.crosswire.org scribe at www.crosswire.org
Sun Sep 28 14:53:34 MST 2008


Author: scribe
Date: 2008-09-28 14:53:32 -0700 (Sun, 28 Sep 2008)
New Revision: 145

Modified:
   trunk/flashtools/csvconv.cpp
   trunk/flashtools/flash.cpp
Log:


Modified: trunk/flashtools/csvconv.cpp
===================================================================
--- trunk/flashtools/csvconv.cpp	2008-06-19 09:45:09 UTC (rev 144)
+++ trunk/flashtools/csvconv.cpp	2008-09-28 21:53:32 UTC (rev 145)
@@ -12,11 +12,16 @@
 	line += "|";
 	const char *field = line.stripPrefix('|');
 	cout << "[" << field << "]\n";
-	const char *keys[] = { "Language", "TWOT", "Form", "GkRelated", "FullerMeaning", "UnpointedHeb", "CALUnpointedAscii", "TABSUnpointedAscii", "PointedHeb", "Transliteration", "Phonetic", "Notes", "Meaning", "FullMeaning", "TranslationInAV", 0 };
+	const char *keys[] = { "PointedHeb", "Language", "Meaning", "TWOT", "Form", "GkRelated", "FullerMeaning", "UnpointedHeb", "CALUnpointedAscii", "TABSUnpointedAscii", "Transliteration", "Phonetic", "Notes", "FullMeaning", "TranslationInAV", 0 };
 	for (int i = 0; keys[i]; i++) {
 		field = line.stripPrefix('|');
 		if (!field) break;
-		cout << keys[i] << "=" << field << "\n";
+          if (!strcmp("PointedHeb", keys[i])) {
+               cout << "UTF8=" << field << "\n";
+          }
+          else {
+               cout << keys[i] << "=" << field << "\n";
+          }
 	}
 }
 
@@ -28,7 +33,7 @@
 	FileMgr fmgr;
 	SWBuf line;
 
-	char *fname = "hebrewDiB.csv";
+	char *fname = "STRONGSLIST.csv";
 
 	if (argc > 1) fname = argv[1];
 

Modified: trunk/flashtools/flash.cpp
===================================================================
--- trunk/flashtools/flash.cpp	2008-06-19 09:45:09 UTC (rev 144)
+++ trunk/flashtools/flash.cpp	2008-09-28 21:53:32 UTC (rev 145)
@@ -36,6 +36,7 @@
 using namespace sword;
 using namespace std;
 
+namespace {
 // used to hold a KJV translation phrase for a greek/hebrew word
 // and any greek/hebrew words combined to make this KJV phrase
 // e.g. hO QEOS = QEOS: [+ hO ]: God
@@ -102,6 +103,9 @@
 string itoa(int v) { stringstream str; str << v; return str.str(); }
 
 
+SWConfig greek("greek.conf");
+SWConfig hebrew("hebrew.conf");
+
 bool compareFreq(const Word &w1, const Word &w2) {
 	if (w1.freq != w2.freq) return w1.freq > w2.freq;
 	SWBuf s1 = w1.strong;
@@ -175,13 +179,60 @@
 	return retBuf;
 }
 
+} // END anonymous namespace
 
+
 // output a simple CSV ('|' separated really) format for importing into OOo or excel
 void outputCSV(const vector<Word> &wordList) {
+     // output header
+     cout
+          << "FreqKJV|"
+          << "PointedHeb|"
+          << "Meaning|"
+          << "Strongs|"
+          << "Language|"
+          << "TWOT|"
+          << "Form|"
+          << "GkRelated|"
+          << "FullerMeaning|"
+          << "UnpointedHeb|"
+          << "CALUnpointedAscii|"
+          << "TABSUnpointedAscii|"
+          << "Transliteration|"
+          << "Phonetic|"
+          << "Notes|"
+          << "FullMeaning|"
+          << "TranslationInAV"
+          << "\n";
+
 	for (vector<Word>::const_iterator it = wordList.begin(); it != wordList.end(); it++) {
 		const Word &w = (*it);
+		SWBuf s = w.strong;
+		char gh = s[0];
+		if (gh == 'G' || gh == 'H') {
+			s << 1;
+		}
+          s = itoa(atoi(s.c_str())).c_str();
 //		cout << w->freq << "|" << escapedUTF8(w->utf8).c_str() << "|" << w->strong << "|" << prettyKJVFreq(w->kjvFreq).c_str() << "\n";
-		cout << w.freq << "|" << w.utf8.c_str() << "|" << w.strong << "|" << w.def << "\n";
+		cout
+               << w.freq << "|"
+			<< hebrew[s]["UTF8"] << "|"
+			<< hebrew[s]["Meaning"] << "|"
+			<< s << "|"
+			<< hebrew[s]["Language"] << "|"
+			<< hebrew[s]["TWOT"] << "|"
+			<< hebrew[s]["Form"] << "|"
+			<< hebrew[s]["GkRelated"] << "|"
+			<< hebrew[s]["FullerMeaning"] << "|"
+			<< hebrew[s]["UnpointedHeb"] << "|"
+			<< hebrew[s]["CALUnpointedAscii"] << "|"
+			<< hebrew[s]["TABSUnpointedAscii"] << "|"
+			<< hebrew[s]["Transliteration"] << "|"
+			<< hebrew[s]["Phonetic"] << "|"
+			<< hebrew[s]["Notes"] << "|"
+			<< hebrew[s]["FullMeaning"] << "|"
+			<< hebrew[s]["TranslationInAV"]
+               << "\n";
 	}
 	std::cout << std::endl;
 }
@@ -272,9 +323,6 @@
 vector<Word> processWords(const char *range, bool addAll = true) {
 	SWMgr manager;
 	map<SWBuf, Word> wordList;
-
-	SWConfig greek("greek.conf");
-	SWConfig hebrew("hebrew.conf");
 	
 	SWModule *tmpBible = manager.getModule("KJV");
 	if (!tmpBible) {
@@ -342,7 +390,7 @@
 		r = TOP;
 		if (VerseKey(r).Testament() == 1) {
 			for (SectionMap::iterator it = hebrew.Sections.begin(); it != hebrew.Sections.end(); it++) {
-				wordList[(SWBuf)"H"+it->first].utf8;  // just access to be sure created.  We'll add later.
+				wordList[(SWBuf)"H0"+it->first].utf8;  // just access to be sure created.  We'll add later.
 			}
 		}
 		r = BOTTOM;
@@ -357,6 +405,7 @@
 	for (map<SWBuf, Word>::iterator it = wordList.begin(); it != wordList.end(); it++) {
 		// pull strongs key from map and populate Word
 		SWBuf s = it->first;
+//cout << s.c_str() << "\n";
 		it->second.strong = s;
 		char gh = s[0];
 		if (gh == 'G' || gh == 'H') {




More information about the sword-cvs mailing list