diff --git a/cross-reader.tfidf/readings.py b/cross-reader.tfidf/readings.py index cb06076..64e9018 100644 --- a/cross-reader.tfidf/readings.py +++ b/cross-reader.tfidf/readings.py @@ -187,7 +187,7 @@ def request_mappings(mapping_type): sentences = [] for sentence in index[document]['sentences']: for word in tokenizer.tokenize(sentence): - if mapping_type == 'tfidf': + if mapping_type == 'tfidf' or mapping_type == 'tfidf-mapping': tfidf = index[document]['tfidf'][word.lower()] * multiplier # lowercased! (!important) if [tfidf, word.lower()] not in mappings: # lowercased! (!important) mappings.append([tfidf, word.lower()]) # lowercased! (!important) diff --git a/cross-reader.tfidf/start.py b/cross-reader.tfidf/start.py index 5a3e573..29c325e 100644 --- a/cross-reader.tfidf/start.py +++ b/cross-reader.tfidf/start.py @@ -71,8 +71,7 @@ def render_list_for_document(list_type, filename): def get_contrast_mappings(mapping_type): """ Displays the page accessible at '/mappings'. - A TF-IDF visualisation is displayed, - using the TF-IDF values as font-size. + A listed overview of all values in the dataset is displayed. """ mappings, filenames = readings.request_mappings(mapping_type) suggestions = open('words.txt', 'r').readlines() diff --git a/cross-reader.tfidf/static/css/pacifico/Pacifico.ttf b/cross-reader.tfidf/static/css/pacifico/Pacifico.ttf new file mode 100644 index 0000000..6d47cdc Binary files /dev/null and b/cross-reader.tfidf/static/css/pacifico/Pacifico.ttf differ diff --git a/cross-reader.tfidf/static/css/pacifico/SIL Open Font License.txt b/cross-reader.tfidf/static/css/pacifico/SIL Open Font License.txt new file mode 100644 index 0000000..692e9d7 --- /dev/null +++ b/cross-reader.tfidf/static/css/pacifico/SIL Open Font License.txt @@ -0,0 +1,44 @@ +Copyright (c) 2011, Vernon Adams (vern@newtypography.co.uk), +with Reserved Font Name Pacifico. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others. + +The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the copyright statement(s). + +"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment. + +"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission. + +5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE. \ No newline at end of file diff --git a/cross-reader.tfidf/static/css/stylesheet.css b/cross-reader.tfidf/static/css/stylesheet.css index d5c88ab..296909f 100644 --- a/cross-reader.tfidf/static/css/stylesheet.css +++ b/cross-reader.tfidf/static/css/stylesheet.css @@ -1,12 +1,19 @@ +@font-face{ + font-family: 'header'; + src: url('./pacifico/Pacifico.ttf'); +} body{ margin:20px; font-size: 16px; - line-height: 22px; + line-height: 1.4; overflow-x: hidden; } h1, h2, h3{ font-size: 100%; - margin:2em 0 1em 0; + margin:2.1em 0 0 0; +} +h2{ + font-weight: normal; } hr{ border:0; @@ -20,23 +27,28 @@ a, a:active, a:hover{ border-bottom:1px dotted; padding:0; margin:0; + z-index: 1; } -#nav-wrapper{ +#nav-wrapper, #nav-wrapper a{ z-index: -1; + color:magenta; } #nav{ display: inline-block; + position: absolute; + top:12px; } #logo{ margin:0 30px 30px 0; - font-family: monospace,; - font-size: 16px; + font-family: 'header', monospace; + font-size: 500%; line-height: 1.1; font-weight: normal; } #logo a{ border:0; + color:magenta; } #search{ width: 400px; @@ -48,7 +60,7 @@ a, a:active, a:hover{ width: 100%; height: 30px; padding:0px 10px; - border:1px solid rgba(190,190,190,1); + border:1px solid magenta; } #search #submit{ position: absolute; @@ -60,6 +72,7 @@ a, a:active, a:hover{ border-radius: 100%; background-color:transparent; text-align: center; + color:magenta; } #search #submit:hover{ cursor: pointer; @@ -67,7 +80,7 @@ a, a:active, a:hover{ #txt-list{ position: absolute; width:250px; - right: 0; + right: 10px; top:0; z-index: 3; } @@ -87,8 +100,8 @@ a, a:active, a:hover{ } #suggestions{ position: absolute; - width: 250px; - right: 300px; + width: 150px; + right: 320px; top:0; z-index: 2; } @@ -102,21 +115,50 @@ a, a:active, a:hover{ #results{ max-width: 800px; } - #results h2{ - } #results .line{ - margin:0.5em 0 1em; + margin:0 0 1em; + font-size: 125%; } #results strong.query{ width: 100%; height: 12em; padding: 2em 6em 2em 6em; margin:-9.7em -6em -10.5em -6em; + z-index: -3; } #mappings{ - line-height: 1.5; + line-height: 1; +} +#list{ + line-height: 1.4; } #analytics{ margin:2em 0; } + +@media print{ + #nav-wrapper{ + display: none; + } + #wrapper{ + width: 90%; + } + a{ + border:0; + } + #results h2{ + margin:2.1em 0 0; + } + #results .line{ + margin:0 0 0.7em; + } + #results strong.query{ + margin:0 0.2em 0 0; + padding:0.15em 0.25em 0.3em 0.5em; + height: auto; + border:1px dotted magenta; + border-radius: 25px 15px; + } +} + diff --git a/cross-reader.tfidf/templates/base.html b/cross-reader.tfidf/templates/base.html index 2608e7b..124c18a 100644 --- a/cross-reader.tfidf/templates/base.html +++ b/cross-reader.tfidf/templates/base.html @@ -7,16 +7,18 @@