def classify_traffic(text,classifier):
    pro_text = preprocessor().preprocess(text,[])
    ft_pro_text = dict([(word, True) for word in pro_text])
    label = classifier.classify(ft_pro_text)
    isTraffic = False
    probability = 0
    #>>>>>>>>>>>>>>>>>>>>>FIND THE PROBABILITY<<<<<<<<<<<<<<<<<
    if label == 'traffic':
        isTraffic = True 
        probability_dict  = classifier.prob_classify(ft_pro_text)
        probability = probability_dict.prob('traffic')
		
	print text, probability, isTraffic
    return isTraffic, probability
Esempio n. 2
0
def classify_traffic(text, classifier):
    pro_text = preprocessor().preprocess(text, [])
    ft_pro_text = dict([(word, True) for word in pro_text])
    label = classifier.classify(ft_pro_text)
    isTraffic = False
    probability = 0
    #>>>>>>>>>>>>>>>>>>>>>FIND THE PROBABILITY<<<<<<<<<<<<<<<<<
    if label == 'traffic':
        isTraffic = True
        probability_dict = classifier.prob_classify(ft_pro_text)
        probability = probability_dict.prob('traffic')

        print text, probability, isTraffic
    return isTraffic, probability
Esempio n. 3
0
def classify_traffic(text, classifier):
    pro_text = preprocessor().preprocess(text, [])
    ft_pro_text = dict([(word, True) for word in pro_text])
    label = classifier.classify(ft_pro_text)
    isTraffic = False
    probability = 0

    # Find the probability
    if label == 'traffic':
        isTraffic = True
        probability_dict = classifier.prob_classify(ft_pro_text)
        probability = probability_dict.prob('traffic')

    return isTraffic, probability
Esempio n. 4
0
def classify_traffic(text, classifier):
    pro_text = preprocessor().preprocess(text, [])
    ft_pro_text = dict([(word, True) for word in pro_text])
    label = classifier.classify(ft_pro_text)
    isTraffic = False
    probability = 0

    # Find the probability
    if label == "traffic":
        isTraffic = True
        probability_dict = classifier.prob_classify(ft_pro_text)
        probability = probability_dict.prob("traffic")

    return isTraffic, probability