From 44a8b35713e561b45cc6728fa1870a7c0a11a76f Mon Sep 17 00:00:00 2001 From: Castro0o Date: Thu, 9 Apr 2020 13:55:05 +0200 Subject: [PATCH] pseudo code for colonial_dictionary --- sandbox/converting_list.py | 97 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sandbox/converting_list.py diff --git a/sandbox/converting_list.py b/sandbox/converting_list.py new file mode 100644 index 0000000..96cecb5 --- /dev/null +++ b/sandbox/converting_list.py @@ -0,0 +1,97 @@ +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 business
the colonial meaning of maintance
" had +maintenance" + +template_a = Template( +

+{% for word in text %} + + {% if word in colon_dict.keys() %} + {{ + word}}

{{colon_dict[{{word}}][ + 'definition']}}
+ {% else %} + {{word}} +{% endfor %} +

+) +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 %} + {{word}} +{% end for } + +# jinja with dictionaries # ouput only keys +{ % for key, value in colon_dict.iteritems() %} + +{% endfor %} + +''' \ No newline at end of file