Browse Source

potentially stupid book recommendation algorithm

master
crunk 4 years ago
parent
commit
127fa03a73
  1. 0
      library/__init.py__
  2. 0
      library/csvparser/__init.py__
  3. 12
      library/csvparser/csvparser.py
  4. 10
      library/library.egg-info/PKG-INFO
  5. 5
      library/library.egg-info/SOURCES.txt
  6. 1
      library/library.egg-info/dependency_links.txt
  7. 1
      library/library.egg-info/top_level.txt
  8. 0
      library/rnrfeed/__init.py__
  9. 40
      library/rnrfeed/rnrfeeder.py
  10. 3
      library/setup.py
  11. 10
      library/static/css/style.css

0
library/csvparser/__init__.py → library/__init.py__

0
library/csvparser/__init.py__

12
library/csvparser/csvparser.py

@ -86,6 +86,17 @@ def getlicenses():
return listoflicenses
def getfieldsofinterest():
libcsv = open(os.path.join(script_dir, "varlib.csv"), "r")
with libcsv:
csv_as_dict = csv.DictReader(libcsv)
fieldsofinterest = {}
for row in csv_as_dict:
fields = row["Fields"].split(',')
fieldsofinterest[row["Id"]] = fields
return fieldsofinterest
def getpublicationfromcsvrow(row):
year = row["Year"]
if not year:
@ -118,7 +129,6 @@ def getpublicationfromcsvrow(row):
def getfullpublication(pubid):
libcsv = open(os.path.join(script_dir, "varlib.csv"), "r")
pubinfo = {}
print(type(pubid))
with libcsv:
csv_as_dict = csv.DictReader(libcsv)
for row in csv_as_dict:

10
library/library.egg-info/PKG-INFO

@ -0,0 +1,10 @@
Metadata-Version: 1.0
Name: library
Version: 1.0
Summary: UNKNOWN
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Description: UNKNOWN
Platform: UNKNOWN

5
library/library.egg-info/SOURCES.txt

@ -0,0 +1,5 @@
setup.py
library.egg-info/PKG-INFO
library.egg-info/SOURCES.txt
library.egg-info/dependency_links.txt
library.egg-info/top_level.txt

1
library/library.egg-info/dependency_links.txt

@ -0,0 +1 @@

1
library/library.egg-info/top_level.txt

@ -0,0 +1 @@

0
library/rnrfeed/__init.py__

40
library/rnrfeed/rnrfeeder.py

@ -0,0 +1,40 @@
from feedparser import parse
from csvparser.csvparser import getfieldsofinterest, getfullpublication
feed = parse("http://varia.zone/en/feeds/all-en.rss.xml")
def getentries():
entries = {}
for entry in feed.entries:
if "Read & Repair" in entry.title:
entries[entry.title] = entry.description
return entries
def gettitles():
titles = []
for entry in feed.entries:
if "Read & Repair" in entry.title:
titles.append(entry.title)
return titles
def rabbithole():
entries = getentries()
fieldsofinterest = getfieldsofinterest()
for title, entry in entries.items():
for id, fields in fieldsofinterest.items():
if [f for f in fields if(f in entry)]:
publicationinfo = getfullpublication(id)
pubtitle = publicationinfo["Title"]
print(
"After {0} we recommend reading {1}".format(
title,
pubtitle)
)
print(rabbithole())

3
library/setup.py

@ -0,0 +1,3 @@
from setuptools import setup, find_packages
setup(name='library', version='1.0', packages=find_packages())

10
library/static/css/style.css

@ -29,7 +29,6 @@ body:after {
#varia {
line-height: 1.03em;
position: relative;
top: 10%;
left: 50%;
transform: translate(-50%, -50%);
color: #FFFFFF;
@ -62,7 +61,10 @@ body:after {
#bookshelf > div {
width: 100%;
break-inside: avoid;
margin: 10px auto;
margin-top: 0;
margin-bottom: 20px;
margin-left: auto;
margin-right: auto;
}
#bookshelf > div > a {
@ -79,7 +81,7 @@ button {
}
table {
margin: 1em;
margin: 0 1em 1em;
z-index: 10;
border: 3px solid black;
background-color: #f1f1f1;
@ -100,7 +102,7 @@ td {
background-color: #f1f1f1;
}
.tdimage {
padding: 0
padding: 0;
}
.tdimage > img {
width: 100%;

Loading…
Cancel
Save