created a new virtual environment and fixed some code in tag_comparison.py

master
bootje 4 years ago
parent 282d370c2e
commit a1461fa9cf

@ -173,7 +173,7 @@ $('span').click(
function(){
var selectedclass = $(this).attr('class');
$('span').css('background-color', 'white').css('color','black'); // reset
$('span.' + selectedclass).css('background-color', 'lightgreen'); //highlighting the select
$('span.' + selectedclass).css('background-color', '#FF4500').css('color', 'white'); //highlighting the select
});
@ -5846,7 +5846,7 @@ function(){
<span class="t_info-Location"><div class="info_t_title" style="-webkit-text-decoration-line: underline; text-decoration-line: underline;" >Location</div><div class="t_info_content">Tartu, Estonia</div></span><br>
<span class="t_info-Signed"><div class="info_t_title" style="-webkit-text-decoration-line: underline; text-decoration-line: underline;" >Signed</div><div class="t_info_content">February 2, 1920</div></span><br>
<span class="t_info-Type"><div class="info_t_title" style="-webkit-text-decoration-line: underline; text-decoration-line: underline;" >Type</div><div class="t_info_content">bilateral peace treaty</div></span><br>
<span class="t_info-source"><div class="info_t_title" style="-webkit-text-decoration-line: underline; text-decoration-line: underline;" >source</div><div class="t_info_content"><a href="https://en.wikipedia.org/wiki/Treaty_of_Tartu_(RussianEstonian)">link</a></div></span><br>
<span class="t_info-source"><div class="info_t_title" style="-webkit-text-decoration-line: underline; text-decoration-line: underline;" >source</div><div class="t_info_content"><a href="https://en.wikipedia.org/wiki/Treaty_of_Tartu_(Russian-Estonian)">link</a></div></span><br>
<span class="t_info-Description"><div class="info_t_title" style="-webkit-text-decoration-line: underline; text-decoration-line: underline;" >Description</div><div class="t_info_content">The Tartu Peace Treaty or Treaty of Tartu is a peace treaty between Estonia and Russian Soviet Federative Socialist Republic signed on 2 February 1920, ending the Estonian War of Independence.</div></span><br>
</div>
<div class="t_paragraph">

@ -1,14 +1,11 @@
from __future__ import division
import glob
from nltk import *
import re
import nltk
import codecs
from nltk import sent_tokenize, word_tokenize, pos_tag
from nltk.probability import FreqDist
from nltk.corpus import stopwords
import nltk
import glob
import re
import codecs
import base64
@ -16,11 +13,11 @@ nltk.download('stopwords')
# faceapp_file = open('faceapp.txt','r')
with open('faceapp.txt', 'r') as faceapp_file:
with open('tos_file/faceapp.txt', 'r') as faceapp_file:
faceapp_text = faceapp_file.read()
faceapp_text_list = faceapp_text.split("\n\n")
with open('russia-estonia.txt', 'r') as russia_file:
with open('treaty_file/russia-estonia.txt', 'r') as russia_file:
russia_text = russia_file.read()
russia_text_list = russia_text.split("\n\n")
@ -207,7 +204,7 @@ $('span').click(
function(){
var selectedclass = $(this).attr('class');
$('span').css('background-color', 'white').css('color','black'); // reset
$('span.' + selectedclass).css('background-color', 'lightgreen'); //highlighting the select
$('span.' + selectedclass).css('background-color', '#FF4500').css('color', 'white'); //highlighting the select
});
@ -248,6 +245,16 @@ print('<div class ="paragraph">')
# 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, word))
# print('</p>')
# print('</div>')
# #faceapp_text
tokenized = word_tokenize(faceapp_text)
tagged = pos_tag(tokenized)
@ -295,7 +302,7 @@ print(t_image)
#t_info box
print('<div class ="t_info">')
t_infotext = [('Name of Treaty', 'Peace Treaty of Tartu'), ('Date', 'February 2, 1920'), ('Location', 'Tartu, Estonia'), ('Signed', 'February 2, 1920'), ('Type', 'bilateral peace treaty'), ('source', '<a href="https://en.wikipedia.org/wiki/Treaty_of_Tartu_(RussianEstonian)">link</a>'), ('Description', 'The Tartu Peace Treaty or Treaty of Tartu is a peace treaty between Estonia and Russian Soviet Federative Socialist Republic signed on 2 February 1920, ending the Estonian War of Independence.')]
t_infotext = [('Name of Treaty', 'Peace Treaty of Tartu'), ('Date', 'February 2, 1920'), ('Location', 'Tartu, Estonia'), ('Signed', 'February 2, 1920'), ('Type', 'bilateral peace treaty'), ('source', '<a href="https://en.wikipedia.org/wiki/Treaty_of_Tartu_(Russian-Estonian)">link</a>'), ('Description', 'The Tartu Peace Treaty or Treaty of Tartu is a peace treaty between Estonia and Russian Soviet Federative Socialist Republic signed on 2 February 1920, ending the Estonian War of Independence.')]
for t_title, t_info in t_infotext:
print('<span class="t_info-{0}"><div class="info_t_title" style="-webkit-text-decoration-line: underline; text-decoration-line: underline;" >{0}</div><div class="t_info_content">{1}</div></span><br>'.format(t_title, t_info))

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