예제 #1
0
from app.config import config

from tweepy.error import TweepError
from mongoengine.errors import NotUniqueError, OperationError
from pymongo.errors import DuplicateKeyError

import random

# Logging
from app.logger import logger
logger = logger(__name__)

# Load the classifier and markov.
# Loaded here so we can keep it in memory.
# accessible via app.brain.CLS or app.brain.MKV
CLS = Classifier()
MKV = Markov(ramble=config().ramble,
             ngram_size=config().ngram_size,
             spasm=config().spasm)


def ponder():
    """
    Fetch tweets from the Muses
    and memorize them;
    i.e. train classifier or Markov on them.
    """
    logger.info('Pondering new twitter data...')

    # Each of these are just a list
    # of tweets as strings.
예제 #2
0
 def setUp(self):
     self.clf = Classifier(filepath=test_filepath)