You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.7 KiB
Python
69 lines
2.7 KiB
Python
from jinja2 import Environment, FileSystemLoader
|
|
|
|
#example of colonial glossary
|
|
dict_verb_coloniality = {
|
|
|
|
'grant':
|
|
{'meaning': 'to give or allow someone something, usually in an officialway',
|
|
'value': 90},
|
|
|
|
'modify': {'meaning': 'to change something, usually to improve it or make it more acceptable',
|
|
'value':},
|
|
|
|
'reproduce': {'meaning': ' to produce a copy of something',
|
|
'value': 80},
|
|
|
|
'display': {'meaning': 'to arrange something or a collection of things so that it can be seen by the public',
|
|
'value': 80},
|
|
|
|
'provide': {'meaning': ' to give someone something that they need',
|
|
'value': 60},
|
|
|
|
'use': {'meaning': ' building to a particular purpose',
|
|
'value': 50},
|
|
|
|
}
|
|
|
|
|
|
dict_noun_coloniality = {
|
|
|
|
'service':
|
|
{'meaning': 'private organization that is responsible for a particular type of activity, or for providing a particular thing that people need',
|
|
'value': 80},
|
|
|
|
'services':
|
|
{'meaning': 'private organization that is responsible for a particular type of activity, or for providing a particular thing that people need',
|
|
'value': 80},
|
|
|
|
'agreement': {'meaning': 'the situation in which people have the same opinion',
|
|
'value': 90 },
|
|
|
|
}
|
|
|
|
|
|
|
|
# example
|
|
"You<span class="value_90 grant">grant<div class="grant_definition">to give or allow someone something, usually in an officialway</div></span>" FaceApp a nonexclusive, royalty-free, worldwide, fully paid license to use, reproduce, modify, adapt, create derivative works from, distribute, perform and display your User Content during the term of this Agreement solely to provide you with the Services."
|
|
|
|
template_a = Template(
|
|
<p>
|
|
{% for word in text %}
|
|
|
|
{% if word in colon_dict.keys() %}
|
|
<span class="value_{{colon_dict[{{word}}]['value']}} {{word|lower}}">{{word}}
|
|
<div class="{{word|lower}}_definition">{{colon_dict[{{word}}]['definition']}}</div></span>
|
|
{% else %}
|
|
{{word}}
|
|
{% endfor %}
|
|
</p>
|
|
)
|
|
template_a.render(text=source_text_list,
|
|
colon_dict = dict_word_coloniality)
|
|
|
|
value_90 {}
|
|
grant {}
|
|
|
|
$('.grant').do
|
|
|
|
|