import sys
import logging
import uuid
import datetime
import collections
import copy
try:
    import ujson as json
except ImportError:
    import json
from collections import defaultdict

from simple_n_grams.simple_n_grams import SimpleNGrams

logger = logging.getLogger("analysis")

def analyze_tweets(tweet_generator,results): 
    """ 
    Entry point for Tweet input.  A sequence of Tweet dicts and a results object are
    required.
    """ 
        
    for tweet in tweet_generator:
        analyze_tweet(tweet,results)

def compare_results(results_analyzed, results_baseline):

    results_output = {}

    produce_relative_text(results_output,
            results_analyzed,
            results_baseline
            )

    return results_output    

def deserialize_tweets(line_generator):
    """ 
    Generator function to manage JSON deserialization
    """
    for line in line_generator:
        try:
            yield json.loads(line)
        except ValueError:
            continue

def produce_relative_text(results_output,results_analyzed,results_baseline):