Commit 45b4024e authored by Sacha's avatar Sacha Committed by SXibolet@2PITAU
Browse files

removes any reference to Orientalist 'mechanical turk'

parent fdd61fd9
......@@ -14,7 +14,7 @@ from flask import Flask, session, redirect, render_template, request, Blueprint,
from jinja2 import TemplateNotFound
from functools import wraps
from api import api
from mturk import mturk
from highlighting import highlighting
from config import *
from datetime import datetime
from dateutil.relativedelta import relativedelta
......@@ -29,7 +29,7 @@ ANON_UNAME = 'bourbaki@illinois.edu'
application = Flask(__name__)
application.register_blueprint(api, url_prefix='/api')
application.register_blueprint(mturk, url_prefix='/training')
application.register_blueprint(highlighting, url_prefix='/training')
application.secret_key = SECRET_KEY
application.config['RECAPTCHA_PUBLIC_KEY'] = CAPTCHA_PUBLIC
......
......@@ -206,16 +206,3 @@ def most_controversial():
FROM Queries
ORDER BY EntropyScore DESC''')
return cur.fetchall()
def add_mturk_read(author, url):
"""add entry to mturk
"""
cur, _ = get_cursor()
cur.execute('''
INSERT INTO
MturkRead
(Author, URL)
VALUES
(%s, %s)''', (author, url))
_.commit()
......@@ -15,7 +15,7 @@ import itertools
from nltk.tokenize import RegexpTokenizer
mturk = Blueprint('/training', __name__)
highlighting = Blueprint('/training', __name__)
sent_detector = nltk.data.load('tokenizers/punkt/english.pickle')
tokenizer = RegexpTokenizer(r'\w+')
......@@ -40,30 +40,30 @@ def success():
})
@mturk.errorhandler(UsageError)
@highlighting.errorhandler(UsageError)
def handle_error(error):
response = jsonify(error.to_dict())
response.status_code = error.status_code
return response
@mturk.route('/', methods=['GET', 'POST'])
@highlighting.route('/', methods=['GET', 'POST'])
def index():
css = digest('mturk/highlight.css')
js = digest('mturk/highlight.js')
css = digest('highlighting/highlight.css')
js = digest('highlighting/highlight.js')
if not is_human():
form = forms.BeginHIT()
if form.validate_on_submit():
session['human'] = 'yes'
else:
return render_template('mturk_welcome.html',
return render_template('highlighting_welcome.html',
form=form,
css=css,
js=js)
article = get_next_doc()
if article is None:
return render_template('mturk_no_tasks.html',
return render_template('highlighting_none.html',
css=css)
n_sentences = len(article['full'])
......@@ -81,7 +81,7 @@ def index():
session['n_sentences'] = sum(map(lambda x: len(x), article['full']))
session['reading_url'] = article['url']
return render_template('mturk_highlight.html',
return render_template('highlight.html',
css=css,
js=js,
minimum_time=minimum_time,
......@@ -91,7 +91,7 @@ def index():
article=article)
@mturk.route('/mark_available')
@highlighting.route('/mark_available')
@require_human
def mark_available():
toggle_being_read(get_articles_collection(),
......@@ -100,7 +100,7 @@ def mark_available():
return success()
@mturk.route('/submit', methods=['GET', 'POST'])
@highlighting.route('/submit', methods=['GET', 'POST'])
@require_human
def update_doc():
if 'checked' not in request.args:
......@@ -122,17 +122,17 @@ def update_doc():
return success()
@mturk.route('/submitted')
@highlighting.route('/submitted')
@require_human
def submitted():
css = digest('mturk/highlight.css')
return render_template('mturk_submitted.html', **locals())
css = digest('highlighting/highlight.css')
return render_template('highlighting_submitted.html', **locals())
@mturk.route('/dataset')
@highlighting.route('/dataset')
def dataset():
css = digest('mturk/highlight.css')
return render_template('mturk_dataset.html', **locals())
css = digest('highlighting/highlight.css')
return render_template('highlighting_dataset.html', **locals())
......
# -*- coding: utf-8 -*-
import mturk
import highlighting
import querier
import os
import itertools
......@@ -14,7 +14,7 @@ from config import ADMIN_PHONE, TWILIO_SID, TWILIO_AUTH_TOKEN
# source of terms --> http://arxiv.org/pdf/1409.8152v1.pdf
TT_DIR = 'training_terms'
HELP_STR = 'options:\n\t``test`` <-- uses small subset of training terms \n\t\t\tfor testing mturk\n\t```` <-- (no options) loads all training keywords\n\t``help`` or ``--help`` <-- displays this message\n'
HELP_STR = 'options:\n\t``test`` <-- uses small subset of training terms \n\t\t\tfor testing highlighting\n\t```` <-- (no options) loads all training keywords\n\t``help`` or ``--help`` <-- displays this message\n'
def sms_admin(m):
......@@ -58,7 +58,7 @@ if __name__ == '__main__':
n_docs = 0
n_dup_keywords = 0
for term in terms:
if mturk.keyword_exists(term):
if highlighting.keyword_exists(term):
n_dup_keywords += 1
continue
......@@ -68,10 +68,10 @@ if __name__ == '__main__':
# no articles
continue
col = mturk.get_articles_collection()
social['result']['articles'] = filter(lambda x: mturk.article_is_new(x['url']),
col = highlighting.get_articles_collection()
social['result']['articles'] = filter(lambda x: highlighting.article_is_new(x['url']),
social['result']['articles'])
n_docs += mturk.new_doc(social)
n_docs += highlighting.new_doc(social)
n_done += 1
update_progress(n_done, n_tasks)
......@@ -80,5 +80,5 @@ if __name__ == '__main__':
print('\t... done')
summary = 'summary: %s doc(s) ready for training from %s terms (%s skipped)' % (n_docs, n_tasks, n_dup_keywords)
sms_admin('mturk_loader finished. %s' % summary)
sms_admin('highlighting_loader finished. %s' % summary)
print('\t ...' % summary)
......@@ -3,6 +3,6 @@ sass home.scss:home.css --style compressed
sass app.scss:app.css --style compressed
sass login.scss:login.css --style compressed
sass account.scss:account.css --style compressed
cd ../mturk
cd ../highlighting
sass highlight.scss:highlight.css --style compressed
cd ../css
cd -
/*!
* IE10 viewport hack for Surface/desktop Windows 8 bug
* Copyright 2014-2015 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
// See the Getting Started docs for more information:
// http://getbootstrap.com/getting-started/#support-ie10-width
(function () {
'use strict';
if (navigator.userAgent.match(/IEMobile\/10\.0/)) {
var msViewportStyle = document.createElement('style')
msViewportStyle.appendChild(
document.createTextNode(
'@-ms-viewport{width:auto!important}'
)
)
document.querySelector('head').appendChild(msViewportStyle)
}
})();
{% extends "mturk_base.html" %}
{% extends "highlighting_base.html" %}
{% block content %}
<!-- ``being_read``: {{ article.being_read }} -->
<!-- ``n_reads``: {{ article.n_reads }} -->
......@@ -30,7 +30,7 @@
</div>
</div>
<div class="col-md-6" id="copyright">
<p class="text-muted">Study from the University of Illinois at Urbana&ndash;Champaign <img src="{{ url_for('static', filename='img/affiliation.jpg') }}">. Articles &copy; 2015, The New York Times Company <img src="{{ url_for('static', filename='img/nytimes.png') }}" />. All rights reserved.</p>
<p class="text-muted">Study from the University of Illinois at Urbana&ndash;Champaign. Articles &copy; 2015, The New York Times Company <img width='17px' src="{{ url_for('static', filename='img/NYT.svg') }}" />. All rights reserved.</p>
</div>
<div class="row" id="bot_bar">
<div class="col-md-12">
......@@ -42,7 +42,7 @@
</div>
</div>
</div>
<script type="text/javascript" src="{{ url_for('static', filename='mturk/jquery.min.js') }}"></script>
<script type="text/javascript" src="{{ url_for('static', filename='highlighting/jquery.min.js') }}"></script>
<script type="text/javascript">
<!-- Please don't you modify these variables via a console. -->
var controversial = [];
......
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel='icon' href='{{ url_for("static", filename="img/fav.png") }}' />
<link rel='stylesheet' href='{{ css }}' type='text/css' />
<title>training &mdash; CONTROVERSY</title>
</head>
<body>
<div class='container'>
{% block content %}
{% endblock %}
</div>
</body>
</html>
{% extends "mturk_base.html" %}
{% extends 'highlighting_base.html' %}
{% block content %}
<div class="row">
<div class="col-md-12">
<div class='row'>
<div class='col-md-12'>
<p><b>Thank you for your interest</b>. We will not employ microtask workers to annotate our training articles for <a href='https://www.jacobinmag.com/2017/12/middle-east-digital-labor-microwork-gaza-refugees-amazon'>ethical</a> <a href='https://www.jacobinmag.com/2015/08/amazon-google-facebook-privacy-bezos'>reasons</a> and personal frugality. A small subset of the articles has been annotated by volunteers.</p>
<p>The data are compiled dynamically and will update with new annotations as we receive them.</p>
<p class=text-danger>As of December 2017, downloads aren't ready; we're working on building a more efficient scraper.</p>
<p style="line-height: 275%">
<p style='line-height: 275%'>
<b>download &hellip;</b>
<button class="btn btn-success" type="submit">annotated only (json)</button>
<button class="btn btn-danger" type="submit">annotated &amp; unannotated (json, 0.953GB)</button>
<button class='btn btn-success' type='submit'>annotated only (json)</button>
<button class='btn btn-danger' type='submit'>annotated &amp; unannotated (json, 0.953GB)</button>
</p>
<p>Copyright (&copy;) 2017, with some rights reserved under CC BY-NC-SA 4.0. See <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">here</a> for details.</p>
<p>Copyright (&copy;) 2017, with some rights reserved under CC BY-NC-SA 4.0. See <a href='https://creativecommons.org/licenses/by-nc-sa/4.0/'>here</a> for details.</p>
</div>
</div>
{% endblock %}
{% extends "mturk_base.html" %}
{% extends 'highlighting_base.html' %}
{% block content %}
<div class="row">
<div class="col-md-4">
<p class="lead"><b>HITS completed</b></p>
<div class='row'>
<div class='col-md-4'>
<p class='lead'><b>HITS completed</b></p>
</div>
<div class="col-md-8">
<p>All articles in our training set have been annotated. Thank you for your interest. <a href="https://github.com/gdyer/controversy">Learn more about this project</a>.</p>
<div class='col-md-8'>
<p>All articles in our training set have been annotated. Thank you for your interest. <a href='https://github.com/gdyer/controversy'>Learn more about this project</a>.</p>
</div>
</div>
{% endblock %}
{% extends 'highlighting_base.html' %}
{% block content %}
<div class='row'>
<div class='col-md-4'>
<p class="lead"><b>You've completed this article &hellip; thanks!</b></p>
</div>
<div class='col-md-8'>
<p>Report feedback to us at <b><tt>postmaster</tt>@<tt>2pitau</tt>.<tt>org</tt></b> or <a href='https://github.com/SXibolet/CONTROVERSY'>learn more about this project</a>.</p>
</div>
</div>
{% endblock %}
{% extends "mturk_base.html" %}
{% extends 'highlighting_base.html' %}
{% block content %}
<div class="page-header">
<div class='page-header'>
<b>CONTROVERSY</b>
</div>
<div class="row">
<div class="col-md-12">
<p>(<b class=text-danger>!</b>) See <a href="dataset">here</a> if you're a researcher interested in this data.</p>
<div class='row'>
<div class='col-md-12'>
<p>(<b class=text-danger>!</b>) See <a href='dataset'>here</a> if you're a researcher interested in these data.</p>
</div>
<div class="col-md-12">
<p class="lead">Each task involves reading an article from <em>The New York Times</em>. You must be fluent in English to participate.</p>
<p class="lead">While reading on the next page, click any sentences which you believe to be controversial, i.e. expressing an opinion or qualified fact (e.g. <q>terrible losses</q>) that you believe could be debated. Use your knowledge of current events and history while determining whether a sentence is controversial. When done, click <b><q>Submit</q></b>. You have unlimited time to read, however there is a minimum time shown at the bottom that is determined by the length of the article. You may not submit before this time or with no or too many highlights. Examples are below.</p>
<blockquote class="good">
<div class='col-md-12'>
<p class='lead'>Each task involves reading an article from <em>The New York Times</em>. You must be fluent in English to participate.</p>
<p class='lead'>While reading on the next page, click any sentences which you believe to be controversial, i.e. expressing an opinion or qualified fact (e.g. <q>terrible losses</q>) that you believe could be debated. Use your knowledge of current events and history while determining whether a sentence is controversial. When done, click <b><q>Submit</q></b>. You have unlimited time to read, however there is a minimum time shown at the bottom that is determined by the length of the article. You may not submit before this time or with no or too many highlights. Examples are below.</p>
<blockquote class='good'>
<p>Across Russia, companies are <i>being forced</i> to prioritize patriotism over profits.</p>
</blockquote>
<p>This sentence is controversial because the it expresses a value-judgement, implying strongly that <q>patriotism</q> should be subordinate to <q>profits</q>. This obsession with profits is typical of American capitalism (much to the detriment of education, working conditions, healthcare, the environment, and so on), but perhaps not Russian capitalism. It also implies that governments should have minimal intervention in corporate affairs, which is also far from a law of nature. The choice of words puts readers on the side of the ostensibly victimized corporation. This is ideologically revealing, considering the company in question (Aeroflot) is majority owned by the Russian government (is it not a capitalist principal that shareholders dictate policy?). So, it's a value judgement from the <i>Times</i>:</p>
<p>Other examples of controversial sentences:</p>
<blockquote class="good">
<blockquote class='good'>
<p>The abortion clinic was destroyed soon after local Catholic extremist groups expressed <i>deep-seated hatred</i> for women's rights.</p>
<p>The airline has had <i>countless</i> safety problems in the past.</p>
<p>Worried about unemployment and political <i>unrest</i>, the government pushed back when Avtovaz, the maker of Lada cars, <i>moved quickly to cut</i> workers as the economy slowed.</p>
<p>In 1994, a pilot <i>let</i> his 16-year-old son fly an Airbus that <i>promptly</i> crashed, killing <i>all</i> 75 aboard.</p>
</blockquote>
<p>The following non-controversial sentence just states numbers:</p>
<blockquote class="bad">
<blockquote class='bad'>
<p><strike>During a demonstration flight in 2012, the plane crashed into a mountain in Indonesia with 37 aviation executives and journalists and eight crew members aboard.</strike></p>
</blockquote>
</div>
<div class="col-md-8">
<div class='col-md-8'>
<p>Complete the CAPTCHA. Once done, click <b><q>Next</q></b>.</p>
<form method=POST>
<div class="form-group">
<div class='form-group'>
{{ form.hidden_tag() }}
{{ form.recaptcha }}
</div>
<button type="submit" class="btn btn-lg btn-default" id="btn-next">Next</button>
<button type='submit' class='btn btn-lg btn-default' id='btn-next'>Next</button>
</form>
<br>
</div>
<div class="col-md-4">
<div class='col-md-4'>
<p>Problems preventing submission are unlikely. Should they nevertheless occur, email us your browser info: <b><tt>gdyer2</tt>@<tt>illinois</tt>.<tt>edu</tt></b>. Please contact this address, too, if these webpages could be made more accessibility-friendly.</p>
<br>
</div>
......
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="{{ url_for('static', filename='img/fav.png') }}" />
<link rel="stylesheet" href="{{ css }}" type="text/css" />
<title>Controversy &mdash; Training</title>
<!--[if lt IE 9]>
<script src="//oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js" type="text/javascript"></script>
<script src="//oss.maxcdn.com/respond/1.4.2/respond.min.js" type="text/javascript"></script>
<![endif]-->
</head>
<body>
<div class="container">
{% block content %}
{% endblock %}
</div>
<script src="{{ url_for('static', filename='mturk/ie10-bug.js') }}" type="text/javascript"></script>
</body>
</html>
{% extends "mturk_base.html" %}
{% block content %}
<div class="row">
<div class="col-md-4">
<p class="lead"><b>You've completed this HIT</b></p>
</div>
<div class="col-md-8">
<p>Report feedback to us at <b><tt>postmaster</tt>@<tt>2pitau</tt>.<tt>org</tt></b> or <a href="https://github.com/SXibolet/controversy">learn more about this project</a>. Thank you.</p>
</div>
</div>
{% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment