proNlp1/infBack.py

37 lines
674 B
Python
Raw Permalink Normal View History

2017-10-30 16:20:44 +00:00
def get_vect():
2017-10-23 18:37:14 +00:00
2017-10-30 16:20:44 +00:00
import yaml
2017-10-23 18:37:14 +00:00
2017-10-30 16:20:44 +00:00
rawDat = open('rss_univ.txt', 'r')
2017-10-23 18:37:14 +00:00
2017-10-30 16:20:44 +00:00
strDat = rawDat.read()
2017-10-30 16:20:44 +00:00
rawDat = strDat.split(';\n')
2017-10-23 18:37:14 +00:00
2017-10-30 16:20:44 +00:00
index = len(rawDat) - 1
rawDat.pop(index)
2017-10-30 16:20:44 +00:00
strDat = []
2017-10-30 16:20:44 +00:00
for i in rawDat:
strDat.append(yaml.load(i))
del rawDat
impDat = []
for d in strDat:
impDat.append([d['entries'][0]['title'], d['entries'][0]['links'][0]['href'], d['entries'][0]['summary']])
del strDat
return impDat
2017-10-23 18:37:14 +00:00
# this section of the code show how to extract relevant data from the dictionaries
"""
print(dic['entries'][0]['title'])
print(dic['entries'][0]['links'][0]['href'])
print(dic['entries'][0]['summary'])
"""