-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make petrarch2 output more JSON friendly #44
Comments
Definitely agree, and this is a thing that has been plaguing us for awhile. It breaks hypnos downstream and causes other issues as well. I don't think those particular fields are used anywhere downstream ( @cnnorris or @philip-schrodt could maybe shed more light on that) so changing the format slightly probably wouldn't cause the program to go haywire. This is very much something that should be fixed, though. I just don't think anyone's had the time to get around to it. |
Yes, definitely an issue, though we're transitioning to the next generation of the coder, which uses universal-dependency (CONLL-U) parses as the input, and will be generating both CAMEO and PLOVER events as the output. So that is where our effort is going at the moment, though we will definitely try to stick with strictly json-compliant formats there (or at least that is the intention). |
@johnb30 @philip-schrodt Thanks for the update. |
I'll be posting some new code on the pschrodt branch of Universal Petrarch next week to produce output in PLOVER JSON format, though I think we'll probably maintain parallel systems for CAMEO (the existing tab-delimited format) and PLOVER. A prototype of that output routine is in the mudflat system: https://github.com/philip-schrodt/mudflat. [reference for PLOVER is https://github.com/openeventdata/PLOVER: there's a current draft of the manual there with the output format. |
When using the petratch output, it would be helpful to make the output python friendly and json. Currently, the petrarch output is a Python specific. Can we make the output abide by json rules? This way the data can still be read in python (via json package) and other language can easily read and use the output without custom converters (i.e. mongo, Redis).
Below is a snippet out petrarch2 output that shows. The main issues is that the
actorroot
,actortext
,eventtext
contains dictionaries, those dictionaries have a Tuple as its key.Three alternatives are:
Quotify the key:
'actortext': {('TUNJUD', 'NGAEDU', '173'): ['Tunisian court', 'Nigerian student']},
to
'actortext': {"['TUNJUD', 'NGAEDU', '173']": ["Tunisian court", 'Nigerian student"]},
Use arrays instead of tuples/dictionaries
'actortext': {('TUNJUD', 'NGAEDU', '173'): ['Tunisian court', 'Nigerian student']},
to
'actortext': [["TUNJUD", "NGAEDU", "173"], ["Tunisian court", "Nigerian student"]},
Use more descriptive dictionaries (code, text key pairs)
'actortext': {('TUNJUD', 'NGAEDU', '173'): ['Tunisian court', 'Nigerian student']},
to
'actortext': {"code" : ["TUNJUD", "NGAEDU", "173"], "text": ["Tunisian court", "Nigerian student"]},
This output/structure is decided during the
do_coding
phase of petrarch2. It seems like this change may break a lot of existing code.The text was updated successfully, but these errors were encountered: