summaryrefslogtreecommitdiffstats
path: root/populatebigram.py
diff options
context:
space:
mode:
Diffstat (limited to 'populatebigram.py')
-rw-r--r--populatebigram.py10
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()