--- /dev/null
+#!/usr/bin/env python
+# -*- coding:utf8 -*-
+# Copyright (C) 2014 FinalsClub Foundation
+from django.core.management import BaseCommand
+from karmaworld.apps.notes.tasks import tweet_note
+
+
+class Command(BaseCommand):
+ """ Tweet about a note that has recently been uploaded """
+ args = 'none'
+ help = "Send one tweet about a newly uploaded note."
+
+ def handle(self, *args, **kwargs):
+ tweet_note()
--- /dev/null
+#!/usr/bin/env python
+# -*- coding:utf8 -*-
+# Copyright (C) 2014 FinalsClub Foundation
+from django.core.management import BaseCommand
+from karmaworld.apps.quizzes.tasks import get_extract_keywords_results
+
+
+class Command(BaseCommand):
+ """ Download results from Mechanical Turk """
+ args = 'none'
+ help = "Download results from Mechanical Turk."
+
+ def handle(self, *args, **kwargs):
+ get_extract_keywords_results()
+++ /dev/null
-#!/usr/bin/env python2
-from django.core.management import BaseCommand
-
-import nltk
-
-
-class Command(BaseCommand):
- help = "Download the data needed for the Natural Language Toolkit to find note keywords."
-
- def handle(self, *args, **kwargs):
- nltk.download('punkt')
- nltk.download('maxent_treebank_pos_tagger')
- nltk.download('stopwords')
-
def get_extract_keywords_results():
try:
- from karmaworld.secret.mturk import AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, MTURK_HOST
+ MTURK_HOST = os.environ['MTURK_HOST']
except ImportError:
logger.warn('Could not find Mechanical Turk secrets, not running get_extract_keywords_results')
return
- connection = MTurkConnection(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY,
+ connection = MTurkConnection(settings.AWS_ACCESS_KEY_ID, settings.AWS_SECRET_ACCESS_KEY,
host=MTURK_HOST)
reviewable_hits = connection.get_reviewable_hits(page_size=100)
for hit in reviewable_hits:
+ logger.info('Found HIT {0}'.format(hit.HITId))
try:
note_id = connection.get_hit(hit.HITId)[0].RequesterAnnotation
note_id = int(note_id)