Skip to content

Commit

Permalink
Added search data collater
Browse files Browse the repository at this point in the history
  • Loading branch information
thoppe committed Sep 28, 2015
1 parent bd6ab93 commit 498c989
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 4 deletions.
24 changes: 24 additions & 0 deletions collate_search_data.py
@@ -0,0 +1,24 @@
import os, glob, json, codecs

F_SEARCH = sorted(glob.glob("search_data/*"))

def load_word_file(f):
with codecs.open(f,'r','utf-8') as FIN:
js = json.loads(FIN.read())
return js

for f in F_SEARCH:
js = load_word_file(f)

try:
js["items"] = [item["full_name"] for item in js["items"]]
except:
print "{} looks to be collated already".format(f)
continue

with codecs.open(f,'w','utf-8') as FOUT:
FOUT.write(json.dumps(js))

print "Completed {}".format(f)


3 changes: 2 additions & 1 deletion run_fixer.py
@@ -1,4 +1,5 @@

import os, glob
from src.word_fix import fix_word

'''
def load_word_file(f):
Expand Down
Empty file added src/__init__.py
Empty file.
3 changes: 0 additions & 3 deletions word_fix.py → src/word_fix.py
Expand Up @@ -4,9 +4,6 @@
logging.basicConfig(level=logging.INFO)
logging.getLogger("requests").setLevel(logging.WARNING)

## TO DO:
## LOG AS COMPLETE!

FLAG_fork = True
FLAG_delete = True

Expand Down

0 comments on commit 498c989

Please sign in to comment.