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.

97 lines
3.4 KiB
Python

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

post_tag = [
[('You', 'PRP'), ('hereby', 'VBP'), ('grant', 'JJ'), ('to', 'TO'),
('FaceApp', 'VB'), ('a', 'DT'), ('fully', 'RB'), ('paid', 'VBN'), (',', ','),
('royalty-free', 'JJ'), (',', ','), ('perpetual', 'JJ'), (',', ','),
('irrevocable', 'JJ'), (',', ','), ('worldwide', 'JJ'), (',', ','),
('non-exclusive', 'JJ'), (',', ','), ('and', 'CC'), ('fully', 'RB'),
('sublicensable', 'JJ'), ('right', 'NN'), ('and', 'CC'), ('license', 'NN'),
('to', 'TO'), ('use', 'VB'), (',', ','), ('reproduce', 'VB'), (',', ','),
('perform', 'VB'), (',', ','), ('display', 'NN'), (',', ','),
('distribute', 'NN'), (',', ','), ('adapt', 'NN'), (',', ','),
('modify', 'VB'), (',', ','), ('re-format', 'JJ'), (',', ','),
('create', 'JJ'), ('derivative', 'JJ'), ('works', 'NNS'), ('of', 'IN'),
(',', ','), ('and', 'CC'), ('otherwise', 'RB'), ('commercially', 'RB'),
('or', 'CC'), ('non-commercially', 'RB'), ('exploit', 'NNS'), ('in', 'IN'),
('any', 'DT'), ('manner', 'NN'), (',', ','), ('any', 'DT'), ('and', 'CC'),
('all', 'DT'), ('Feedback', 'NNP'), (',', ','), ('and', 'CC'), ('to', 'TO'),
('sublicense', 'VB'), ('the', 'DT'), ('foregoing', 'NN'), ('rights', 'NNS'),
(',', ','), ('in', 'IN'), ('connection', 'NN'), ('with', 'IN'), ('the', 'DT'),
('operation', 'NN'), ('and', 'CC'), ('maintenance', 'NN'), ('of', 'IN'),
('the', 'DT'), ('Services', 'NNPS'), ('and/or', 'NN'), ('FaceApp', 'NNP'),
('', 'NNP'), ('s', 'NN'), ('business', 'NN'), ('.', '.')]
]
# * list = whole text []
# * [ [] ] sublist = paragraph
# * [ [ (word, classification), (word, classification) ] ]
# to what structure do you to have this in?
'''
dict_class_ = { 'NN': ['s', ',maintenance', ...],
'NNP': [..., ,]
dict_word_class {'maintenance': 'NN',
####
# colonial glossary
######
dict_word_coloniality = {'maintenance': 50,
'business': 85, }
dict_word_coloniality = {'maintenance':
{'meaning': 'the colonial meaning of maintance',
'value': 50},
'business': {'meaning': ,
'value':},
}
Here is an an example source_text: "This business had maintenance"
dict_word_coloniality.get('This') => None
dict_word_coloniality.get('business') => {'meaning': 'the colonial meaning
of business',
'value': 50},
"This <span class="value_85 business">business <div class="business_definition"> the colonial meaning of maintance</div></span>" had
maintenance"
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_85 {}
business {}
$('.business').do
idea: gathering all the words that are 50
# jinja with lists
{% for word in text %}
<span>{{word}} <span>
{% end for }
# jinja with dictionaries # ouput only keys
{ % for key, value in colon_dict.iteritems() %}
{% endfor %}
'''