Skip to content

Commit

Permalink
Add code health.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnb30 committed Jul 20, 2016
1 parent e5c6494 commit 30c2133
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[![Circle CI](https://circleci.com/gh/caerusassociates/hypnos.svg?style=svg)](https://circleci.com/gh/caerusassociates/hypnos)
[![Code Health](https://landscape.io/github/openeventdata/hypnos/petrarch2/landscape.svg?style=flat)](https://landscape.io/github/openeventdata/hypnos/petrarch2)

hypnos
======

A RESTful API around the [PETRARCH](https://github.com/openeventdata/petrarch)
**Note: hypnos now works with PETRARCH2 by default.**

A RESTful API around the [PETRARCH2](https://github.com/openeventdata/petrarch2)
event data coder. Using `docker compose`, this setup also integrates the
Stanford [CoreNLP](http://nlp.stanford.edu/software/corenlp.shtml) parser
using Casey Hilland's [docker container](https://github.com/chilland/ccNLP).
Expand Down
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def process_corenlp(output, date, STORYID):
event_dict[STORYID]['sents'] = {}
event_dict[STORYID]['meta'] = {}
event_dict[STORYID]['meta']['date'] = date
for i, sent in enumerate(output['sentences']):
for i, _ in enumerate(output['sentences']):
sents = output['sentences']
event_dict[STORYID]['sents'][str(i)] = {}
event_dict[STORYID]['sents'][str(i)]['content'] = ' '.join(sents[i]['tokens'])
Expand Down
1 change: 0 additions & 1 deletion petrarch/petrarch_app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import sys
import json
from petrarch2 import petrarch2
from tornado.ioloop import IOLoop
from tornado.wsgi import WSGIContainer
Expand Down
11 changes: 4 additions & 7 deletions usage/parse_mongo.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import requests
from pymongo import MongoClient
import json

connection = MongoClient()
db = connection.lexisnexis
Expand All @@ -16,17 +16,14 @@
headers = {'Content-Type': 'application/json'}

for i in t:
data = {'text': i['article_body'],
'id': i['doc_id'], 'date':
'20010101'}
data = {'text': i['article_body'], 'id': i['doc_id'], 'date': '20010101'}
data = json.dumps(data)
r = requests.get('http://localhost:5002/hypnos/extract', data=data,
headers=headers)
rj = r.json()
try: # clunky check for key
rj['status']
if 'status' in rj:
junk.append(rj)
except:
else:
output.append(rj)


Expand Down

0 comments on commit 30c2133

Please sign in to comment.