summaryrefslogtreecommitdiffstats
path: root/flashtools
diff options
context:
space:
mode:
authorTroy A. Griffitts <scribe@crosswire.org>2008-09-28 21:53:32 +0000
committerTroy A. Griffitts <scribe@crosswire.org>2008-09-28 21:53:32 +0000
commit6d057ded23a6693af3d58f792bb6f7c093f8d82b (patch)
tree0ce11bdd2312c332fdcd21212ea0cd40512600e1 /flashtools
parentf0d79b0577e5cce2a7ff79f9324d870f735980e5 (diff)
downloadsword-tools-6d057ded23a6693af3d58f792bb6f7c093f8d82b.tar.gz
git-svn-id: https://www.crosswire.org/svn/sword-tools/trunk@145 07627401-56e2-0310-80f4-f8cd0041bdcd
Diffstat (limited to 'flashtools')
-rw-r--r--flashtools/csvconv.cpp11
-rw-r--r--flashtools/flash.cpp59
2 files changed, 62 insertions, 8 deletions
diff --git a/flashtools/csvconv.cpp b/flashtools/csvconv.cpp
index c6d67bd..9ff33e2 100644
--- a/flashtools/csvconv.cpp
+++ b/flashtools/csvconv.cpp
@@ -12,11 +12,16 @@ void processLine(SWBuf line) {
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 @@ int main(int argc, char **argv) {
FileMgr fmgr;
SWBuf line;
- char *fname = "hebrewDiB.csv";
+ char *fname = "STRONGSLIST.csv";
if (argc > 1) fname = argv[1];
diff --git a/flashtools/flash.cpp b/flashtools/flash.cpp
index 48d7b72..6f2a578 100644
--- a/flashtools/flash.cpp
+++ b/flashtools/flash.cpp
@@ -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 @@ public:
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 @@ SWBuf escapedUTF8(SWBuf inText) {
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 @@ void outputFlash(const vector<Word> &wordList, const char *outputDir = ".", bool
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 @@ vector<Word> processWords(const char *range, bool addAll = true) {
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 @@ vector<Word> processWords(const char *range, bool addAll = true) {
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') {