def score_tweet_file(fp, scores):
    #count = 0
    non_sentiments = {}
    with fp as data_file:
        for line in data_file:
            tweet = parse_raw_tweet(line)
            score = score_tweet(tweet, scores)
            sentiment_tweet(tweet, score, non_sentiments)
            #count += 1
            #if count == 100:
            #    break
    return non_sentiments
 def parse_place(raw_tweet):
     place = parse_raw_tweet(raw_tweet, "place")
     if place is not None and place != "":
         if "full_name" in place:
             tmpstr = place["full_name"]
             state = search_state(tmpstr)
             if state != "":
                 return state
         if "name" in place:
             state = search_state(tmpstr)
             if state != "":
                 return state
     return ""
def parse_tweet_file(fp, scores):
    count = 0
    states = {}
    with fp as data_file:
        for line in data_file:
            tweet = parse_raw_tweet(line, "text")
            score = score_tweet(tweet, scores)
            state = get_tweet_state(line)
            update_state_dict(states, state, score)    
            count += 1
            #if count == 20:
            #    break
    return states
 def parse_user(raw_tweet):
     user = parse_raw_tweet(raw_tweet, "user")
     if (type(user) == dict):
         location = user["location"]
         return search_state(location.encode('utf-8'))
     return ""
def score_tweet_file(fp, scores):
#     count = 0
    with fp as data_file:
        for line in data_file:
            tweet = parse_raw_tweet(line)
            print score_tweet(tweet, scores)