diff options
author | Peng Wu <alexepico@gmail.com> | 2013-01-21 16:11:00 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2013-01-21 16:11:00 +0800 |
commit | de8ba1a1f3eafc368b819c55aea1996507996a55 (patch) | |
tree | 9d6947a531e80ecf4c30f065f7802447bb76e964 | |
parent | c0569803eca7c318dc21c694faf1aeb7be5839f2 (diff) | |
download | trainer-de8ba1a1f3eafc368b819c55aea1996507996a55.tar.gz trainer-de8ba1a1f3eafc368b819c55aea1996507996a55.tar.xz trainer-de8ba1a1f3eafc368b819c55aea1996507996a55.zip |
improves populatebigram.py
-rw-r--r-- | populatebigram.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/populatebigram.py b/populatebigram.py index 0ce6402..036e1b7 100644 --- a/populatebigram.py +++ b/populatebigram.py @@ -15,6 +15,14 @@ CREATE TABLE bigram ( ); ''' +CREATE_BIGRAM_PREFIX_INDEX_DDL = ''' +CREATE INDEX bigram_prefix_index on bigram(prefix); +''' + +CREATE_BIGRAM_POSTFIX_INDEX_DDL = ''' +CREATE INDEX bigram_postfix_index on bigram(postfix); +''' + SELECT_ALL_NGRAM_DML = ''' SELECT words, freq FROM ngram; ''' @@ -45,6 +53,8 @@ def createBigramSqlite(indexpath, workdir): conn = sqlite3.connect(filepath) cur = conn.cursor() cur.execute(CREATE_BIGRAM_DDL) + cur.execute(CREATE_BIGRAM_PREFIX_INDEX_DDL) + cur.execute(CREATE_BIGRAM_POSTFIX_INDEX_DDL) conn.commit() if conn: conn.close() |