-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlivros.py
64 lines (51 loc) · 1.64 KB
/
livros.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
61
62
63
64
import pandas as pd
import xlrd
import re
def count_livros(livros):
book = livros.split('\n')
conteudo_book=[]
for x in book[1:]:
conteudo_book.append(x.split('\t'))
LIVROS_PUBLICADOS = []
LIVROS_ORGANIZADOS =[]
for i in range(0, len(conteudo_book)-1):
if(conteudo_book[i][5] == 'LIVRO_ORGANIZADO_OU_EDICAO'):
LIVROS_ORGANIZADOS.append(conteudo_book[i])
elif(conteudo_book[i][5] == 'LIVRO_PUBLICADO'):
LIVROS_PUBLICADOS.append(conteudo_book[i])
i =i+1
j=0
editores = []
#pegando os editores q organizaram/editaram
while(j<len(LIVROS_ORGANIZADOS)):
for nome in LIVROS_ORGANIZADOS[j][13].split(';'):
editores.append(nome)
j=j+1
editores
c=0
pontuacao_editores1={}
while(c < len(editores)):
pontuacao_editores1.update({editores[c]:(editores.count(editores[c])*80)})
c=c+1
pontuacao_editores = 0
for e in pontuacao_editores1:
pontuacao_editores = pontuacao_editores + pontuacao_editores1[e]
pontuacao_editores
#livros autoria propria
#pegando os autores
k=0
autores= []
while(k<len(LIVROS_PUBLICADOS)):
for nome in LIVROS_PUBLICADOS[k][13].split(';'):
autores.append(nome.strip())
k=k+1
p=0
pontuacao_autores1={}
while(p < len(autores)):
pontuacao_autores1.update({autores[p]:(autores.count(autores[p])*120)})
p=p+1
pontuacao_autores=0
for a in pontuacao_autores1:
pontuacao_autores = pontuacao_autores + pontuacao_autores1[a]
pontuacao_autores
return pontuacao_autores + pontuacao_editores