Skip to content

Commit

Permalink
Merge pull request #1 from openeventdata/names
Browse files Browse the repository at this point in the history
Update name to petrarch2.
  • Loading branch information
johnb30 committed Oct 29, 2015
2 parents 594969c + 057927a commit 4cad56e
Show file tree
Hide file tree
Showing 40 changed files with 117 additions and 127 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
language: python
python:
- "2.7"
install: "pip install -e ."
install:
- pip install -e .
- pip install -r requirements.txt
script: py.test
sudo: false
sudo: false
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from petrarch import petrarch, PETRglobals, PETRreader, utilities
from petrarch import PETRtree as ptree
from petrarch2 import petrarch2, PETRglobals, PETRreader, utilities
from petrarch2 import PETRtree as ptree


config = petrarch.utilities._get_data('data/config/', 'PETR_config.ini')
config = petrarch2.utilities._get_data('data/config/', 'PETR_config.ini')
print("reading config")
petrarch.PETRreader.parse_Config(config)
petrarch2.PETRreader.parse_Config(config)
print("reading dicts")
petrarch.read_dictionaries()
petrarch2.read_dictionaries()




def test_version():
assert petrarch.get_version() == "1.0.0"
assert petrarch2.get_version() == "1.0.0"


def test_read():
Expand All @@ -38,7 +38,7 @@ def test_noun_meaning1():
phrase = test.tree.children[0]

head, headphrase = phrase.get_head()

assert head== "STATE"
assert headphrase == phrase
assert phrase.get_meaning() == ["IMGMUSISI"]
Expand All @@ -52,7 +52,7 @@ def test_noun_meaning2():
phrase = test.tree.children[0]

head, headphrase = phrase.get_head()

assert head== "ORGANIZATION"
assert headphrase == phrase
assert phrase.get_meaning() == ["IGOWSTNAT"]
Expand All @@ -64,7 +64,7 @@ def test_noun_meaning3():
test = ptree.Sentence(parse,"Barack Obama and Vladimir Putin", "081315")

phrase = test.tree.children[0]

assert sorted(phrase.get_meaning()) == sorted(["USAGOV","RUSGOV"])


Expand All @@ -74,7 +74,7 @@ def test_prepmeaning():
test = ptree.Sentence(parse,"to the market", "081315")

phrase = test.tree.children[0]

assert phrase.get_meaning() == ['TUR']
assert phrase.head == "MARKET"
assert phrase.get_prep() == "TO"
Expand All @@ -86,7 +86,7 @@ def test_noun_meaning4():
test = ptree.Sentence(parse,"The rebels from Syria", "081315")

phrase = test.tree.children[0]

assert phrase.get_meaning() == ['SYRREB']
assert phrase.get_head()[0] == "REBELS"
assert phrase.get_head()[1] == phrase
Expand Down Expand Up @@ -159,11 +159,11 @@ def test_simple():
text = "Germany invaded France"
parse = "(ROOT (S (NP (NNP Germany)) (VP (VBD invaded) (NP (NNP France)))))"
parsed = utilities._format_parsed_str(parse)

dict = {u'test123': {u'sents': {u'0': {u'content': text, u'parsed': parsed}},
u'meta': {u'date': u'20010101'}}}

return_dict = petrarch.do_coding(dict,None)
return_dict = petrarch2.do_coding(dict,None)
print(return_dict)
assert return_dict['test123']['sents']['0']['events'] == [('DEU','FRA','192')]

Expand All @@ -176,7 +176,7 @@ def test_simple2():
dict = {u'test123': {u'sents': {u'0': {u'content': text, u'parsed': parsed}},
u'meta': {u'date': u'20010101'}}}

return_dict = petrarch.do_coding(dict,None)
return_dict = petrarch2.do_coding(dict,None)
print(return_dict)
assert return_dict['test123']['sents']['0']['events'] == [('DEU','FRA','173')]

Expand Down Expand Up @@ -208,7 +208,7 @@ def test_complex1():

dict = {u'test123': {u'sents': {u'0': {u'content': text, u'parsed': parsed}},
u'meta': {u'date': u'20010101'}}}
return_dict = petrarch.do_coding(dict,None)
return_dict = petrarch2.do_coding(dict,None)
print(return_dict)
assert return_dict['test123']['sents']['0']['events'] == [('TUNJUD','NGAEDU','173')]

Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 4cad56e

Please sign in to comment.