mirror of
https://github.com/balkian/gists.git
synced 2024-11-24 02:12:29 +00:00
e167429310
git-subtree-dir: repos/06c454a48156dccc6f55 git-subtree-mainline:bef5400be9
git-subtree-split:214ea51a72
45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
{% set f = open_file(encoding="utf-8-sig") %}
|
|
{% set posdic = {
|
|
"N": "lexinfo:noun",
|
|
"AJ": "lexinfo:adjective",
|
|
"V": "lexinfo:verb"
|
|
}
|
|
%}
|
|
{% if not language %}
|
|
|
|
{% endif %}
|
|
{
|
|
"@context": {
|
|
{% if baseuri %}
|
|
"@base": {{ baseuri | escapejs }},
|
|
{% endif %}
|
|
"lemon": "http://lemon-model.net/lemon#",
|
|
"marl": "http://www.gsi.dit.upm.es/ontologies/marl/ns#",
|
|
"lexinfo": "http://www.lexinfo.net/ontology/2.0/lexinfo",
|
|
"entries": {
|
|
"@type": "lemon:LexicalEntry",
|
|
"@id": "lemon:entry"
|
|
},
|
|
"sense": {
|
|
"@id": "lemon:sense",
|
|
"@type": "lemon:Sense"
|
|
}
|
|
},
|
|
"@type": "lemon:Lexicon",
|
|
{% if language %}
|
|
"lemon:language": {{ language | escapejs }},
|
|
{% endif %}
|
|
"entries": [
|
|
{% for line in islice(f, 1, None) %}
|
|
{
|
|
{% set i=re.split('[^\w.]+', line.strip(" \t\n\r")) %}
|
|
"lemon:canonicalForm": { "lemon:writtenRep": {{ i[0].strip() | escapejs }}},
|
|
"sense": {
|
|
"marl:hasPolarityValue": {{ i[2] | escapejs }}
|
|
},
|
|
"lexinfo:partOfSpeech": {{ posdic.get(i[1],i[1]) | escapejs }},
|
|
"weight": {{ i[3] | escapejs }}
|
|
} {{ "," if not loop.last }}
|
|
{% endfor %} {# for line #}
|
|
]
|
|
} |