forked from fulldecent/google-voice-numbers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
3. Collect words.txt
executable file
·54 lines (39 loc) · 1.77 KB
/
3. Collect words.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Find Words
**Prerequisites:**
* `./numbers` is all the numbers
* You need your own words list
*
## Put numbers into database
##
## Dictionaries are in word-number format:
## tr abcdefghijklmnopqrstuvwxyz 2223334445556667777888999 < 9letter.txt > 9letter.txt123
## paste PHRASES.10 PHRASES.10123 > PHRASES.10txt123
##
##
## Put numbers in database
##
sqlite3 numbers.db
CREATE TABLE numbersStaging (num, PRIMARY KEY(num));
CREATE TABLE numbers (num, last7, last4, PRIMARY KEY(num));
CREATE INDEX l7 on numbers (last7);
CREATE INDEX l4 on numbers (last4);
.import numbers numbersStaging
INSERT OR IGNORE INTO numbers SELECT num, substr(num,4), substr(num,7) FROM numbersStaging;
##
## Put words in database
##
CREATE TABLE wordsStaging (word, PRIMARY KEY(word));
CREATE TABLE words (word, wnum, wnumfirst10, PRIMARY KEY(word));
CREATE INDEX wnum on words (wnum);
CREATE INDEX w10 on words (wnumfirst10);
.import ../Wordlists/MarkDavies/PHRASES wordsStaging
.import ../Wordlists/Scrabble/10letter.txt wordsStaging
.import ../Wordlists/Scrabble/9letter.txt wordsStaging
INSERT OR IGNORE INTO words SELECT word,word,word FROM wordsStaging;
UPDATE words SET wnum = replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(word,'a','2'),'b','2'),'c','2'),'d','3'),'e','3'),'f','3'),'g','4'),'h','4'),'i','4'),'j','5'),'k','5'),'l','5'),'m','6'),'n','6'),'o','6'),'p','7'),'q','7'),'r','7'),'s','7'),'t','8'),'u','8'),'v','8'),'w','9'),'x','9'),'y','9'),'z','9');
UPDATE words SET wnumfirst10 = substr(wnum,1,10);
##
## Extract
##
SELECT * FROM numbers,words WHERE num=wnum;
SELECT * FROM numbers,words WHERE last7=wnum;