Add tool for dumping SQLite table to file
diff --git a/sbs-table-dev/README.org b/sbs-table-dev/README.org
index a2519df..aa4d293 100755
--- a/sbs-table-dev/README.org
+++ b/sbs-table-dev/README.org
@@ -13,7 +13,7 @@
- ~global_dictionary_dump.csv~
- import the dictionary
#+BEGIN_SRC sh
- cd table-dev
+ cd sbs-table-dev
cat matthias_buchmeier_german_frequency_list_1_5000.txt \
matthias_buchmeier_german_frequency_list_5001_10000.txt \
matthias_buchmeier_german_frequency_list_10001_15000.txt \
@@ -43,3 +43,7 @@
wc -l sbs-contractions.ctb
wc -l sbs-patterns.dic
#+END_SRC
+- export the dictionary to plain text file again
+ #+BEGIN_SRC sh
+ ./dump_rows_sbs -d sbs-dictionary.sqlite > sbs-dictionary.csv
+ #+END_SRC
diff --git a/sbs-table-dev/dump_rows_sbs b/sbs-table-dev/dump_rows_sbs
new file mode 100755
index 0000000..67aca8e
--- /dev/null
+++ b/sbs-table-dev/dump_rows_sbs
@@ -0,0 +1,3 @@
+#!/bin/bash
+CURDIR=$(cd $(dirname "$0") && pwd)
+bash wrap_python.sh $CURDIR/dump_rows_sbs.py "$@"
diff --git a/sbs-table-dev/dump_rows_sbs.py b/sbs-table-dev/dump_rows_sbs.py
new file mode 100644
index 0000000..1d57cd1
--- /dev/null
+++ b/sbs-table-dev/dump_rows_sbs.py
@@ -0,0 +1,13 @@
+import argparse
+from utils import *
+
+def main():
+ parser = argparse.ArgumentParser(description="Dump dictionary to CSV format.")
+ parser.add_argument('-d', '--dictionary', required=True, dest="DICTIONARY", help="dictionary file")
+ args = parser.parse_args()
+ conn, c = open_dictionary(args.DICTIONARY)
+ c.execute("SELECT text,braille FROM dictionary WHERE braille IS NOT NULL")
+ for text, braille in c.fetchall():
+ println("*\t%s\t%s\t" % (text, braille))
+
+if __name__ == "__main__": main()