def main_program():
    option = '0'
    tweet_samples, filtered_samples, classifier = init()

    while option != '7':
        menu()
        option = raw_input('Enter new option: ')

        if option == '1':
            print_data(tweet_samples)
        elif option == '2':
            print_data(filtered_samples)
        elif option == '3':
            print classifier.show_most_informative_features(n=30)
        elif option == '4':
            sentence = raw_input("Sentence: ")
            cleaned_sentence = [
                word.lower() for word in sentence.split() if len(word) >= 3
            ]
            print 'This sentence is ' + classifier.classify(
                feature_extractor(cleaned_sentence))
        elif option == '5':
            negative, positive = find_overall_sentiment(
                filtered_samples, classifier)
            print_sentiment(positive, negative)
        elif option == '6':
            plot_bar(filtered_samples, classifier)
        clear()
def find_overall_sentiment(samples, classifier):
    positive = 0
    negative = 0
    for sample in samples:
        if classifier.classify(feature_extractor(sample)) == 'positive':
            positive += 1
        else:
            negative += 1
    
    return positive, negative
def find_overall_sentiment(samples, classifier):
    positive = 0
    negative = 0
    for sample in samples:
        if classifier.classify(feature_extractor(sample)) == 'positive':
            positive += 1
        else:
            negative += 1

    return positive, negative
def main_program():
    option = '0'
    tweet_samples, filtered_samples, classifier = init()
    
    while option != '7': 
        menu()
        option = raw_input('Enter new option: ')
        
        if option == '1':
            print_data(tweet_samples)
        elif option == '2':
            print_data(filtered_samples)
        elif option == '3':
            print classifier.show_most_informative_features(n=30)
        elif option == '4':
            sentence = raw_input("Sentence: ")
            cleaned_sentence = [word.lower() for word in sentence.split() if len(word) >=3]
            print 'This sentence is ' + classifier.classify(feature_extractor(cleaned_sentence))
        elif option == '5':
            negative, positive = find_overall_sentiment(filtered_samples, classifier)
            print_sentiment(positive, negative)
        elif option == '6':
            plot_bar(filtered_samples, classifier)
        clear()