From a16d70e01a441193c6bb8a38d7cf093a7ebed19c Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Fri, 22 Apr 2011 07:31:53 -0400 Subject: add English Editor to speed up English input BUG=none TEST=build fine Review URL: http://codereview.appspot.com/4200041 Patch from Peng Wu . --- data/Makefile.am | 16 ++++++++++++++++ data/english.awk | 25 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 data/english.awk (limited to 'data') diff --git a/data/Makefile.am b/data/Makefile.am index d0ca35c..02e8feb 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -18,9 +18,25 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +WORDLIST = wordlist +ENGLISH_AWK = english.awk +ENGLISH_DB = english.db SUBDIRS = \ db \ icons \ $(NULL) + +EXTRA_DIST = \ + $(WORDLIST) \ + $(ENGLISH_AWK) \ + $(NULL) + +english_db_DATA = \ + $(ENGLISH_DB) \ + $(NULL) +english_dbdir = $(pkgdatadir)/db + +$(ENGLISH_DB): $(WORDLIST) + $(AWK) -f english.awk $< |sqlite3 $@ diff --git a/data/english.awk b/data/english.awk new file mode 100644 index 0000000..1828d2c --- /dev/null +++ b/data/english.awk @@ -0,0 +1,25 @@ +#!/usr/bin/awk + +BEGIN { + # Begin a transaction + print "BEGIN TRANSACTION;" + + # Create english table + print "CREATE TABLE IF NOT EXISTS \"english\" ( " \ + "\"word\" TEXT NOT NULL PRIMARY KEY," \ + "\"freq\" FLOAT NOT NULL DEFAULT(0)" \ + ");"; + + # Create desc table + print "CREATE TABLE IF NOT EXISTS desc (name TEXT PRIMARY KEY, value TEXT);"; + print "INSERT OR IGNORE INTO desc VALUES ('version', '1.2.0');"; +} + + # Insert data into english table + { printf "INSERT INTO english (word, freq) VALUES (\"%s\", \"%f\");\n", $1, $2} + + #quit sqlite3 +END { + # Commit the transcation + print "COMMIT;" +} \ No newline at end of file -- cgit