def apply_nb_text(result_training, test_text, neutral): vector = build_vector(test_text, neutral) # we get the vector representing the text test_document int_result = apply_nb(result_training, vector, neutral) if int_result == 1: return "positive" elif int_result == 0: return "negative" else: return "neutral"
def apply_nb_text(result_training, test_text, neutral): vector = build_vector( test_text, neutral) # we get the vector representing the text test_document int_result = apply_nb(result_training, vector, neutral) if int_result == 1: return "positive" elif int_result == 0: return "negative" else: return "neutral"
def get_documents_from_file(file_name, neutral): dom = parse(file_name + ".aa") handle_dom(dom, neutral) i = 0 while i < len(index_list): if ( ((index_list[i] == "positive") or (index_list[i] == "negative") or (neutral and (index_list[i] == "none"))) and index_list[i - 1].isdigit() and index_list[i - 2].isdigit() ): text = fetch_text(file_name + ".ac", int(index_list[i - 2]), int(index_list[i - 1])) true_list.append(Document(build_vector(text, neutral), index_list[i])) i = i + 1
def get_documents_from_file(file_name, neutral): dom = parse(file_name + '.aa') handle_dom(dom, neutral) i = 0 while i < len(index_list): if (((index_list[i] == "positive") or (index_list[i] == "negative") or (neutral and (index_list[i] == "none"))) and index_list[i - 1].isdigit() and index_list[i - 2].isdigit()): text = fetch_text(file_name + ".ac", int(index_list[i - 2]), int(index_list[i - 1])) true_list.append( Document(build_vector(text, neutral), index_list[i])) i = i + 1