Пример #1
0
    def __init__(self):
        self.al_object = alchemy()
        self.tw_object = twitter()
        self.meta_data = np.empty([25258,6],dtype='|S1000')
        with open('metadata.csv', 'rb') as csvfile:
            spamreader = csv.reader(csvfile, delimiter=',')
            i = 0
            for row in spamreader:
                self.meta_data[i, :] = row
                i += 1

        self.meta_data_concepts = []
        iter = 10 #self.meta_data[:,0].size
        for i in range(0, iter):
            s = " ";
            seq = (self.meta_data[i][0], self.meta_data[i][1], self.meta_data[i][2], self.meta_data[i][3], self.meta_data[i][4], self.meta_data[i][5])
            self.meta_data_concepts.append(self.al_object.find_keywords(s.join(seq)))
Пример #2
0
            },
            {
                'title':u'World in White',
                'synopsis':u'Surrounded by dark forces who suppress and ridicule him, the Hero slowly blossoms into a mature figure who ultimately gets riches, a kingdom, and the perfect mate.',
                'imgurl':u'http://uploads.neatorama.com/images/posts/95/58/58095/1360112719-0.jpg',
                'trailerurl':u'https://www.youtube.com/watch?v=a2MnKebNlRo',
                'genre':u'classic,thriller'
            }
        ]
    },
]

meta = {
    'location': u'London, UK',
    'weather': weather.getWeather(2882, 'London'),
    'trends': twitter().get_trends()
}

def get_lists(recommendation):
    ts = int(time.time())
    datapoint = np.array([weekday(ts), hour_of_day(ts), 1])
    #print datapoint
    #datapoint = np.array([6,10,1])
    list_of_rec = recommendation.get_kmeans_recommendations(datapoint)
    return jsonify({'lists': mapping.programs_to_data(list_of_rec, recommendation.get_meta_data())})

def get_trending_concepts(recommendation):
    list_of_rec = recommendation.get_trend_recommendations()
    return jsonify({'lists': mapping.programs_to_data(list_of_rec, recommendation.get_meta_data())})

def metadata():