Beispiel #1
0
    def __init__(self):

        member_query = """
        select * from expert_10_50
        """

        count_query = """
        select count(*) from expert_10_50
        """

        self.query = """
        select l.list_id,l.list_name,l.list_description from list_rec as l
        join list_member_rec as lm1
        on lm1.list_id=l.list_id
        where lm1.member_id = %s;
        """

        conn_string = "dbname='nlstudent' user = '******' password ='******'"

        self.connection = connect(conn_string)
        self.ind = 0
        self.parser = StringParser()
        self.cursor = self.connection.cursor()
        self.cursor.execute(member_query)
        self.members = self.cursor.fetchall()

        self.cursor.execute(count_query)
        self.N_members = self.cursor.fetchone()[0]
        print(self.N_members)
import string
from nltk import FreqDist
import nltk
from psycopg2._psycopg import DatabaseError
import sys
from parsers.string_parser import StringParser, latin_letters
import psycopg2

__author__ = 'Katharine'

conn_string = "dbname='nlstudent' user = '******' password ='******'"

conn = psycopg2.connect(conn_string)
cursor = conn.cursor()

f = StringParser()
s = {}

get_listinfo_for_member = """SELECT l.list_name,l.list_description FROM list_rec as l JOIN
	list_member_rec as lm ON l.list_id = lm.list_id
	where lm.member_id = %s"""

get_listcount_for_member = """SELECT count FROM member_list_count_rec as lm JOIN
	list_rec as l ON l.list_id = lm.list_id
	where lm.member_id = %s;"""

get_listinfo_for_list = """SELECT l.list_name,l.list_description FROM list_rec as l
	where list_id = %s"""

get_all_listinfo_for_all_lists = """SELECT l.list_id,l.list_name,l.list_description FROM list_rec as l"""
from django.core.validators import URLValidator
from django.db.models import Q
import requests

__author__ = 'James'

from bs4 import BeautifulSoup
import feedparser
from content_acquisition.models import FeedRec
from articles.models import ArticleRec
from content_acquisition.ArticleWrapper import ArticleWrapper
from newspaper import Article, ArticleException
from parsers.string_parser import StringParser

clf = pickle.load(open('./pipe.p', 'rb'))
parser = StringParser()

from django import setup

setup()
val = URLValidator()


def aggregate():
    ArticleRec.objects.filter(
        article_published__lte=datetime.datetime.today() -
        datetime.timedelta(days=7)).delete()

    for f in shuffle(FeedRec.objects.all()):

        u = f.feed_url