def compute_features(): t = open("./package/training_set_3.csv", 'w') c = csv.writer(t) c.writerow(["serial no"]) i = 1 while i < 10: c.writerow([i]) i = i + 1 t.close() #two files 1_chat and 2_chat are created #first feature to extract ////"""average words per line"""" average_word( "./package/test_final.txt", 3 ) #creates a text file named number_word_1 which contains number of word in each line. #print "average_word_feature extracted" #second feature """word length per line"'' word_length( "./package/test_final.txt", 3 ) #creates a text file named word_length_1 which contains number of word in each line. #print "word_length_feature extracted" #third feature ""uppercase_lowrcase ratio"""" ratio( "./package/test_final.txt", 3 ) #creates a text file named word_length_1 which contains number of word in each line. #print "ratio_feature extracted" #fourth feature ""time_chat , time to give that particular reply""" #sixth feature """smiley count """every 10 line feature usage smiley_count("./package/test_final.txt", 3) #print "smiley count extracted" #fifth feature """stopwaord usagee in a line""""every 10 line feature stopword_usage("./package/test_final.txt", 3) #print "stopword feature extracted" #seventh feature """punchuation usage"""" punctuation("./package/test_final.txt", 3) #print "punctuation_feature extracted" #eighth feature """message length "" msg_length("./package/test_final.txt", 3) #print "msg_length_feature extracted" #ninth feature """acronym count """ acro_line("./package/test_final.txt", 3)
def compute_features(): t = open("./package/training_set_3.csv", "w") c = csv.writer(t) c.writerow(["serial no"]) i = 1 while i < 10: c.writerow([i]) i = i + 1 t.close() # two files 1_chat and 2_chat are created # first feature to extract ////"""average words per line"""" average_word( "./package/test_final.txt", 3 ) # creates a text file named number_word_1 which contains number of word in each line. # print "average_word_feature extracted" # second feature """word length per line"'' word_length( "./package/test_final.txt", 3 ) # creates a text file named word_length_1 which contains number of word in each line. # print "word_length_feature extracted" # third feature ""uppercase_lowrcase ratio"""" ratio( "./package/test_final.txt", 3 ) # creates a text file named word_length_1 which contains number of word in each line. # print "ratio_feature extracted" # fourth feature ""time_chat , time to give that particular reply""" # sixth feature """smiley count """every 10 line feature usage smiley_count("./package/test_final.txt", 3) # print "smiley count extracted" # fifth feature """stopwaord usagee in a line""""every 10 line feature stopword_usage("./package/test_final.txt", 3) # print "stopword feature extracted" # seventh feature """punchuation usage"""" punctuation("./package/test_final.txt", 3) # print "punctuation_feature extracted" # eighth feature """message length "" msg_length("./package/test_final.txt", 3) # print "msg_length_feature extracted" # ninth feature """acronym count """ acro_line("./package/test_final.txt", 3)
#fifth feature ""stopwaord usagee in a line""every 10 line feature stopword_usage('./chats_process/'+str(first)+'_'+str(second)+'/'+first+'.txt',str(first),str(second),1) stopword_usage('./chats_process/'+str(first)+'_'+str(second)+'/'+second+'.txt',str(first),str(second),2) #print "stopword feature extracted" #sixth feature""punchuation usage"" punctuation('./chats_process/'+str(first)+'_'+str(second)+'/'+first+'.txt',str(first),str(second),1) punctuation('./chats_process/'+str(first)+'_'+str(second)+'/'+second+'.txt',str(first),str(second),2) #print "punctuation_feature extracted" #seventh feature ""message length "" msg_length('./chats_process/'+str(first)+'_'+str(second)+'/'+first+'.txt',str(first),str(second),1) msg_length('./chats_process/'+str(first)+'_'+str(second)+'/'+second+'.txt',str(first),str(second),2) #print "msg_length_feature extracted" #eighth feature ""acronym count " acro_line('./chats_process/'+str(first)+'_'+str(second)+'/'+first+'.txt',str(first),str(second),1) acro_line('./chats_process/'+str(first)+'_'+str(second)+'/'+second+'.txt',str(first),str(second),2) #print "acro_line extracted" #ninth feature ""elongation of vowel count"" elongation_vowel('./chats_process/'+str(first)+'_'+str(second)+'/'+first+'.txt',str(first),str(second),1) elongation_vowel('./chats_process/'+str(first)+'_'+str(second)+'/'+second+'.txt',str(first),str(second),2) #print "elongation of vowel count"
print "smiley count extracted" #fifth feature """stopwaord usagee in a line""""every 10 line feature stopword_usage("./package/1_chat.txt",1) stopword_usage("./package/2_chat.txt",2) print "stopword feature extracted" #seventh feature """punchuation usage"""" punctuation("./package/1_chat.txt",1) punctuation("./package/2_chat.txt",2) print "punctuation_feature extracted" #eighth feature """message length "" msg_length("./package/1_chat.txt",1) msg_length("./package/2_chat.txt",2) print "msg_length_feature extracted" #ninth feature """acronym count """ acro_line("./package/1_chat.txt",1) acro_line("./package/2_chat.txt",2) print "acro_line extracted" #tenth feature """elongation of vowel count""" elongation_vowel("./package/1_chat.txt",1) elongation_vowel("./package/2_chat.txt",2) print "elongation of vowel count" #eleventh feature """suspension count """