mirror of
https://github.com/balkian/gists.git
synced 2024-11-01 08:01:44 +00:00
e167429310
git-subtree-dir: repos/06c454a48156dccc6f55 git-subtree-mainline:bef5400be9
git-subtree-split:214ea51a72
48 lines
1.4 KiB
Plaintext
48 lines
1.4 KiB
Plaintext
{% set f = open_file() %}
|
|
{% if not base %}
|
|
{% set base = "http://demos.gsi.dit.upm.es/eurosentiment-translator/default" %}
|
|
{% endif %}
|
|
{
|
|
"@context": [
|
|
"http://demos.gsi.dit.upm.es/eurosentiment/static/context.jsonld"
|
|
],
|
|
"@id": "{{ base }}",
|
|
"results": {
|
|
"analysis": [
|
|
{
|
|
"@id": "{{ base }}#HumanAnnotated",
|
|
"@type": [
|
|
"marl:SentimentAnalysis"
|
|
],
|
|
"dc:language": "{{ language}}",
|
|
"marl:maxPolarityValue": 10.0,
|
|
"marl:minPolarityValue": 0.0
|
|
}
|
|
],
|
|
"entries": [
|
|
{% for line in f %}
|
|
{% set i=linesplit(line, "\t") %}
|
|
{% set node="_:BlankNode%s" % loop.index %}
|
|
{
|
|
"@id": "{{ node }}",
|
|
"opinions": [
|
|
{
|
|
{% set text = i[0] %}
|
|
{% set pol = i[1] | float %}
|
|
"marl:polarityValue": {{ pol/10.0 }},
|
|
{% if pol > 5 %}
|
|
"marl:hasPolarity": "marl:Positive"
|
|
{% elif pol < 5 %}
|
|
"marl:hasPolarity": "marl:Negative"
|
|
{% else %}
|
|
"marl:hasPolarity": "marl:Neutral"
|
|
{% endif %}
|
|
}
|
|
],
|
|
"nif:isString": {{ text | escapejs }},
|
|
"prov:generatedBy": "pt:agent"
|
|
} {% if not loop.last %} , {% endif %}
|
|
{% endfor%}
|
|
]
|
|
}
|
|
} |