paragraphs

master
Castro0o 5 years ago
parent a8ea89ace4
commit f9aac615b7

@ -0,0 +1,20 @@
from nltk import word_tokenize, pos_tag
# faceapp_file = open('faceapp.txt','r')
with open('tos_file/faceapp.txt', 'r') as faceapp_file:
faceapp_text = faceapp_file.read()
faceapp_text_list = faceapp_text.split("\n\n")
for paragraph in faceapp_text_list:
tokenized = word_tokenize(paragraph)
tagged = pos_tag(tokenized)
print('<p>')
for word, pos in tagged:
print('<span class="{}">{}</span>'.format(
pos.replace('.', 'DOT'), word))
print('</p>')
print('</div>')

File diff suppressed because one or more lines are too long

@ -284,65 +284,43 @@ print('''<!DOCTYPE html>
<body> <body>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
if ($('.TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC').click( $('.TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC').click(
function() { function() {
$('.TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC').toggleClass('hide'); // reset $('.TO, .DT, .IN, .WDT, .WP, .MD, .PRP, .CC').toggleClass('hide'); // reset
})); });
})
$(document).ready(function() { $('.JJ').click(
if ($('.JJ').click(
function() { function() {
$('.JJ').toggleClass('adjective'); // reset $('.JJ').toggleClass('adjective'); // reset
})); });
})
$(document).ready(function() { $('.NN, .NNS').click(
if ($('.NN, .NNS').click(
function() { function() {
$('.NN, .NNS').toggleClass('noun'); // reset $('.NN, .NNS').toggleClass('noun'); // reset
})); });
})
$(document).ready(function() { $('.NNP, .NNPS').click(
if ($('.NNP, .NNPS').click(
function() { function() {
$('.NNP, .NNPS').toggleClass('propernoun'); // reset $('.NNP, .NNPS').toggleClass('propernoun'); // reset
})); });
})
$(document).ready(function() { $('.RB').click(
if ($('.RB').click(
function() { function() {
$('.RB').toggleClass('adverb'); // reset $('.RB').toggleClass('adverb'); // reset
})); });
})
$(document).ready(function() { $('.RBR, .JJR').click(
if ($('.RBR, .JJR').click(
function() { function() {
$('.RBR, .JJR').toggleClass('adverb-comparative'); // reset $('.RBR, .JJR').toggleClass('adverb-comparative'); // reset
})); });
})
$(document).ready(function() { $('.RBS').click(
if ($('.RBS').click(
function() { function() {
$('.RBS').toggleClass('adverb-superlative'); // reset $('.RBS').toggleClass('adverb-superlative'); // reset
})); });
}) })
</script>''')
</script>
''')
# $('div.t_chosen_words_{0}').mouseover(function(){ # $('div.t_chosen_words_{0}').mouseover(function(){
@ -380,26 +358,27 @@ print('</div></div>')
print('<div class ="paragraph">') print('<div class ="paragraph">')
# for paragraph in faceapp_text_list: for paragraph in faceapp_text_list:
# tokenized = word_tokenize(paragraph) tokenized = word_tokenize(paragraph)
# tagged = pos_tag(tokenized) tagged = pos_tag(tokenized)
# print('<p>') print('<p>')
# for word, pos in tagged: for word, pos in tagged:
# print('<span class="{}">{}</span>'.format(pos, word)) print('<span class="{}">{}</span>'.format(pos, word))
# print('</p>') print('</p>')
# print('</div>')
#faceapp_text
tokenized = word_tokenize(faceapp_text)
tagged = pos_tag(tokenized)
print('<p>')
for word, pos in tagged:
print('<span class="{}">{}</span>'.format(pos, word))
print('</p>')
print('</div>') print('</div>')
# #faceapp_text
# tokenized = word_tokenize(faceapp_text)
# tagged = pos_tag(tokenized)
# print('<p>')
# for word, pos in tagged:
# print('<span class="{}">{}</span>'.format(pos, word))
# print('</p>')
# print('</div>')
#colonial words list #colonial words list
print('<div class="top_words"><div class="top_words_title" style="-webkit-text-decoration-line: underline; text-decoration-line: underline;" >colonial words:</div>') print('<div class="top_words"><div class="top_words_title" style="-webkit-text-decoration-line: underline; text-decoration-line: underline;" >colonial words:</div>')

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save