Skip to content

Commit

Permalink
feat: new instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
severinsimmler committed Nov 22, 2018
1 parent 3d1a2c7 commit 3d31598
Show file tree
Hide file tree
Showing 40 changed files with 263 additions and 31,693 deletions.
32 changes: 6 additions & 26 deletions application/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,10 @@ def _update_textfile_sizes(db, data):
def _insert_into_parameters(db, data):
logging.info("Insert parameters into database...")
db.execute("""
INSERT INTO parameters (topics, iterations, documents, stopwords, hapax, tokens, types, log_likelihood)
VALUES(?, ?, ?, ?, ?, ?, ?, ?);
INSERT INTO parameters (content)
VALUES(?);
""",
[int(data["topics"]), int(data["iterations"]),
int(data["documents"]), int(data["stopwords"]), int(data["hapax"]), int(data["tokens"]), int(data["types"]), int(data["log_likelihood"])])
[data])


def _insert_into_model(db, data):
Expand Down Expand Up @@ -152,7 +151,7 @@ def _select_textfile_sizes(cursor):
def _select_parameters(cursor):
logging.info("Selecting parameters from database...")
return cursor.execute("""
SELECT topics, iterations, documents, stopwords, hapax, tokens, types, log_likelihood
SELECT content
FROM parameters;
""").fetchone()

Expand Down Expand Up @@ -227,7 +226,7 @@ def _select_textfile(cursor, title):
def _select_data_export(cursor):
"""Select model output from database.
"""
logging.info("Selectin stopwords from database...")
logging.info("Selecting stopwords from database...")
stopwords = cursor.execute("""
SELECT content
FROM stopwords;
Expand All @@ -238,23 +237,4 @@ def _select_data_export(cursor):
SELECT document_topic, topics, document_similarities, topic_similarities
FROM model;
""").fetchone()
document_topic, topics, document_similarities, topic_similarities = model

logging.info("Preparing document-topic distributions...")
document_topic = pd.read_json(document_topic, orient="index")

logging.info("Preparing topics...")
topics = pd.read_json(topics)
topics.index = ["Topic {}".format(n) for n in topics.index]
topics.columns = ["Word {}".format(n) for n in topics.columns]

logging.info("Preparing topic similarity matrix...")
topic_similarities = pd.read_json(topic_similarities)

logging.info("Preparing document similarity matrix...")
document_similarities = pd.read_json(document_similarities)
return {"document-topic-distribution": document_topic,
"topics": topics,
"topic-similarities": topic_similarities,
"document-similarities": document_similarities,
"stopwords": json.loads(stopwords)}
return model, stopwords
16 changes: 9 additions & 7 deletions application/static/css/dariah-styles.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*! Using parts of normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */

html {
-webkit-box-sizing: border-box;
box-sizing: border-box;
Expand Down Expand Up @@ -227,35 +228,35 @@ h6 {

@font-face {
font-family: MuseoSansRounded;
src: url(fonts/MuseoSansRounded-500-webfont.woff2) format("woff2"), url(fonts/MuseoSansRounded-500-webfont.woff) format("woff");
src: url(../fonts/MuseoSansRounded-500-webfont.woff2) format("woff2"), url(../fonts/MuseoSansRounded-500-webfont.woff) format("woff");
font-style: normal;
font-weight: 400
}

@font-face {
font-family: Roboto;
src: url(fonts/Roboto-Light.woff2) format("woff2"), url(fonts/Roboto-Light.woff) format("woff");
src: url(../fonts/Roboto-Light.woff2) format("woff2"), url(../fonts/Roboto-Light.woff) format("woff");
font-style: normal;
font-weight: 400
}

@font-face {
font-family: Roboto;
src: url(fonts/Roboto-LightItalic.woff2) format("woff2"), url(fonts/Roboto-LightItalic.woff) format("woff");
src: url(../fonts/Roboto-LightItalic.woff2) format("woff2"), url(../fonts/Roboto-LightItalic.woff) format("woff");
font-style: italic;
font-weight: 400
}

@font-face {
font-family: Roboto;
src: url(fonts/Roboto-Medium.woff2) format("woff2"), url(fonts/Roboto-Medium.woff) format("woff");
src: url(../fonts/Roboto-Medium.woff2) format("woff2"), url(../fonts/Roboto-Medium.woff) format("woff");
font-style: normal;
font-weight: 700
}

@font-face {
font-family: Roboto;
src: url(fonts/Roboto-MediumItalic.woff2) format("woff2"), url(fonts/Roboto-MediumItalic.woff) format("woff");
src: url(../fonts/Roboto-MediumItalic.woff2) format("woff2"), url(../fonts/Roboto-MediumItalic.woff) format("woff");
font-style: italic;
font-weight: 700
}
Expand Down Expand Up @@ -1003,7 +1004,7 @@ th {
}

.footer {
background: #f7f7f7 url(grain.png);
background: #f7f7f7 url(../img/grain.png);
color: #1a1a1a;
font-size: 14px;
padding: 12px 24px;
Expand Down Expand Up @@ -1158,7 +1159,7 @@ th {
}

.highlight {
background: #f7f7f7 url(grain.png);
background: #f7f7f7 url(../img/grain.png);
color: #1a1a1a;
margin: 0 -24px;
padding: 12px;
Expand Down Expand Up @@ -2840,6 +2841,7 @@ th {
.chart {
width: 0%;
animation: expand 1.5s ease forwards;
height: 80px;
}

.block {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
Loading

0 comments on commit 3d31598

Please sign in to comment.