From 848622e34e8a31024a0ccdef7bbcbbd3fdbf8968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Thu, 20 Feb 2014 08:03:09 -0800 Subject: [PATCH] --- ES_MA_NIF | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ PT_HA_NIF | 80 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 ES_MA_NIF create mode 100644 PT_HA_NIF diff --git a/ES_MA_NIF b/ES_MA_NIF new file mode 100644 index 0000000..cbab36b --- /dev/null +++ b/ES_MA_NIF @@ -0,0 +1,102 @@ +{% set sheet=f.sheet_by_index(0) %} +{ + "@context": { + "@base": "http://demos.gsi.dit.upm.es/eurosentiment/generator#{{ filename }}", + "dc": "http://purl.org/dc/terms/", + "dc:subject": { + "@type": "@id" + }, + "emotions": { + "@container": "@list", + "@id": "onyx:hasEmotionSet", + "@type": "onyx:EmotionSet" + }, + "marl": "http://www.gsi.dit.upm.es/ontologies/marl#", + "nif": "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#", + "onyx": "http://www.gsi.dit.upm.es/ontologies/onyx#", + "pt": "http://paradigmatecnologico.com/domains#", + "opinions": { + "@container": "@list", + "@id": "marl:hasOpinion", + "@type": "marl:Opinion" + }, + "prov": "http://www.w3.org/ns/prov#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "results": { + "@container": "@index", + "@id": "@graph" + }, + "strings": { + "@reverse": "nif:hasContext", + "@type": "nif:String" + }, + "wnaffect": "http://www.gsi.dit.upm.es/ontologies/wnaffect#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "brand": { + "@id": "_:brand", + "@type" : "xsd:string", + "http://www.w3.org/2000/01/rdf-schema#label": "Brand of the entity" + }, + "model": { + "@id": "_:model", + "@type" : "xsd:string", + "http://www.w3.org/2000/01/rdf-schema#label": "Model of the entity" + }, + "part": { + "@id": "_:part", + "@type" : "xsd:string", + "http://www.w3.org/2000/01/rdf-schema#label": "Part of the entity" + }, + "quality": { + "@id": "_:quality", + "@type" : "xsd:string", + "http://www.w3.org/2000/01/rdf-schema#label": "Quality" + } + }, + "results": { + "analysis": [ + { + {% set analysisName = "".join(linesplit(filename,"/")[-1].rsplit(".")[:-1]) %} + "@id": "{{ analysisName}}", + "@type": "marl:SentimentAnalysis" + } +], +"entries": [ +{% set first = True %} +{% for i in range(1, sheet.nrows) %} +{% set node="_:BlankNode%s" % i %} + {% set row= sheet.row_values(i) %} + {% set TEXT = row[0] %} + {% set LEMMA = row[1] %} + {% set WN_POS = row[2] %} + {% set WN_SYNSET = row[3] %} + {% set DOMAIN = row[4] %} + {% set BRAND = row[5] %} + {% set KIND = row[6] %} + {% set PRODUCT = row[7] %} + {% set PART = row[8] %} + {% set QUALITY = row[9] %} + {% set SENTIMENT = row[10] %} + {% set EMOTION = row[11] %} + {% if DOMAIN %} + {% if first %} {% set first = False %} {% else %} ,{% endif %} { + "@id": "{{ node }}", + "dc:subject": "expsys:{{ DOMAIN | escape }}", + "strings": [ {{ TEXT | escapejs }} ], + "opinions": [ { + "marl:polarity": "expsys:{{ SENTIMENT | escape }}", + "brand": {{ BRAND | escapejs }}, + "kind": {{ KIND | escapejs }}, + "product": {{ PRODUCT | escapejs }}, + "quality": {{ QUALITY | escapejs }} + }], + "emotions": [ { + "onyx:hasEmotion": { "onyx:hasEmotionCategory": {{ EMOTION | escapejs }} } + }], + "prov:wasGeneratedBy": "{{ analysisName }}" + } + {% endif %} +{% endfor %} +] +} +} \ No newline at end of file diff --git a/PT_HA_NIF b/PT_HA_NIF new file mode 100644 index 0000000..ce1add7 --- /dev/null +++ b/PT_HA_NIF @@ -0,0 +1,80 @@ +{ + "@context": { + "@base": "http://demos.gsi.dit.upm.es/eurosentiment/generator#{{ filename }}", + "dc": "http://purl.org/dc/terms/", + "dc:subject": { + "@type": "@id" + }, + "emotions": { + "@container": "@list", + "@id": "onyx:hasEmotionSet", + "@type": "onyx:EmotionSet" + }, + "marl": "http://www.gsi.dit.upm.es/ontologies/marl#", + "nif": "http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#", + "onyx": "http://www.gsi.dit.upm.es/ontologies/onyx#", + "pt": "http://paradigmatecnologico.com/domains#", + "opinions": { + "@container": "@list", + "@id": "marl:hasOpinion", + "@type": "marl:Opinion" + }, + "prov": "http://www.w3.org/ns/prov#", + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "results": { + "@container": "@index", + "@id": "@graph" + }, + "strings": { + "@reverse": "nif:hasContext", + "@type": "nif:String" + }, + "wnaffect": "http://www.gsi.dit.upm.es/ontologies/wnaffect#", + "xsd": "http://www.w3.org/2001/XMLSchema#" + }, + "@id": "{{ linesplit(f.name,"/")[-1] }}", + "results": { + "analysis": [ + { + "@id": "{{ linesplit(f.name,"/")[-1] }}#Analysis1", + "@type": [ + "marl:SentimentAnalysis" + ], + "dc:language": "{{ language}}", + "marl:maxPolarityValue": 1.0, + "marl:minPolarityValue": 0.0 + } + ], + "entries": [ +{% for line in f %} +{% set i=linesplit(line, "\t") %} +{% set node="_:BlankNode%s" % loop.index %} + { + "@id": "{{ node }}", + "dc:subject": "pt:{{ i[1] }}", + "opinions": [ + { +{% set pol= i[6] | int %} +{% if pol%} + "marl:polarityValue": {{ pol }}, +{% if pol > 5 %} + "marl:hasPolarity": "marl:Positive", +{% elif pol < 5 %} + "marl:hasPolarity": "marl:Negative", +{% else %} + "marl:hasPolarity": "marl:Neutral", +{% endif %} +{% endif %} + "marl:describesObject": "pt:{{ i[3] }}", + "marl:extractedFrom": "{{ i[5] }}" + } + ], + "nif:isString": {{ i[2] | escapejs }}, + "prov:generatedBy": "pt:agent", + "strings": [ + ] + } {% if not loop.last %} , {% endif %} +{% endfor%} + ] + } +} \ No newline at end of file