This Sear%r%rch tool only works with one word.
diff --git a/cross-reader.tfidf/readings.py b/cross-reader.tfidf/readings.py index 212c031..cb06076 100644 --- a/cross-reader.tfidf/readings.py +++ b/cross-reader.tfidf/readings.py @@ -179,46 +179,6 @@ def request_results(query): return filenames, results, analytics -def get_tfidflistings(): - index = load_index() - languages = set([index[document]['language'] for document in index.keys()]) - tfidflistings = {} - for language in languages: - tfidflistings[language] = [] - for document in index.keys(): - if index[document]['language'] == language: - for word, value in index[document]['tfidf'].items(): - tfidflistings[language].append([value, word]) - tfidflistings[language].sort(reverse=True) - - # pp.pprint(tfidflistings) - print('*tfidflistings returned*') - return tfidflistings - -def get_tfidfcontext(query): - tfidflistings = get_tfidflistings() - tfidfcontext = {} - context_reach = 3 - for language in tfidflistings.keys(): - index = 0 - tfidfcontext[language] = [] - for value, word in tfidflistings[language]: - if word.lower() == query.lower(): - for x in range(1, context_reach): - cprev = tfidflistings[language][index - x] - cnext = tfidflistings[language][index + x] - tfidfcontext[language].append(cprev) - if x == 1: - tfidfcontext[language].append([value, word]) - tfidfcontext[language].append(cnext) - break - index += 1 - tfidfcontext[language].sort(reverse=True) - - # pp.pprint(tfidfcontext) - print('*tfidfcontext returned*') - return tfidfcontext - def request_mappings(mapping_type): index = load_index() filenames = [document for document, _ in index.items()] diff --git a/cross-reader.tfidf/start.py b/cross-reader.tfidf/start.py index 4c47a32..5a3e573 100644 --- a/cross-reader.tfidf/start.py +++ b/cross-reader.tfidf/start.py @@ -38,7 +38,6 @@ def index(): if request.args.get('q', ''): filenames, results, analytics = readings.request_results(query) - tfidfcontext = readings.get_tfidfcontext(query) return flask.render_template('results.html', query=query, results=results, filenames=filenames, suggestions=suggestions, analytics=analytics) else: diff --git a/cross-reader.tfidf/static/css/stylesheet.css b/cross-reader.tfidf/static/css/stylesheet.css index 1040e65..d5c88ab 100644 --- a/cross-reader.tfidf/static/css/stylesheet.css +++ b/cross-reader.tfidf/static/css/stylesheet.css @@ -1,10 +1,4 @@ -@font-face{ - font-family: 'unifont'; - src:url('fonts/unifont-11.0.03.ttf'); -} - body{ - /*background-color: rgba(220,220,220,0.6);*/ margin:20px; font-size: 16px; line-height: 22px; @@ -28,7 +22,6 @@ a, a:active, a:hover{ margin:0; } - #nav-wrapper{ z-index: -1; } @@ -72,13 +65,10 @@ a, a:active, a:hover{ cursor: pointer; } #txt-list{ - position: fixed; + position: absolute; width:250px; - right: 0px; - top:-7px; - margin:20px; - font-size: 16px; - line-height: 1.2; + right: 0; + top:0; z-index: 3; } #txt-list ul{ @@ -96,10 +86,10 @@ a, a:active, a:hover{ border: 0; } #suggestions{ - position: fixed; + position: absolute; width: 250px; right: 300px; - top:12px; + top:0; z-index: 2; } @@ -124,6 +114,9 @@ a, a:active, a:hover{ margin:-9.7em -6em -10.5em -6em; } +#mappings{ + line-height: 1.5; +} #analytics{ margin:2em 0; } diff --git a/cross-reader.tfidf/templates/base.html b/cross-reader.tfidf/templates/base.html index 85abe3b..2608e7b 100644 --- a/cross-reader.tfidf/templates/base.html +++ b/cross-reader.tfidf/templates/base.html @@ -20,12 +20,6 @@ -
Sear%r%rching and cross-reading through the following files:
This Sear%r%rch tool only works with one word.