-
Notifications
You must be signed in to change notification settings - Fork 0
/
polissemico.py
60 lines (54 loc) · 1.32 KB
/
polissemico.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from openpyxl import Workbook
import openpyxl
import sys
book = openpyxl.load_workbook('tfreq-gl-filter.xlsx')
sheet = book.active
i = 0
j = 0
termos = []
polissemicos = []
for r in sheet.iter_rows():
# Ignora a primeira linha (label)
if i != 0:
#print(r[1].value)
termos.append(r[1].value)
i += 1
# COMPARE
for t in termos:
for p in termos:
if t == p:
#print(t)
j += 1
if j > 1:
polissemicos.append(t)
j = 0
i = 1
print(len(polissemicos))
exit()
print('letsgo')
for r in sheet.iter_rows():
# Ignora a primeira linha (label)
if i != 0:
#print(r[1].value)
if r[1].value in polissemicos:
sheet['I' + str(i)] = 'SIM'
polissemicos.remove(r[1].value)
else:
sheet['I' + str(i)] = 'não'
'''for p in polissemicos:
if r[1].value == p:
#if r[8].value != 'SIM':
print(i, p)
#i += 1
#exit()
sheet['I' + str(i)] = 'SIM'
#book.save('poli-tfreq-gl-filter.xlsx')
i+=1
polissemicos.remove(p)
#print('remove ', p)
#exit()
'''
i += 1
book.save('poli-tfreq-gl-filter.xlsx')
#print(polissemicos)
#print(len(polissemicos))