12.垃圾邮件分类2

#1.读取数据集 def read_dataset(): file_path = r\'D:\SMSSpamCollection.txt\' sms = open(file_path, encoding=\'utf-8\') sms_data = [] sms_label = [] csv_reader = csv.reader(sms, delimiter=\'\t\') for line in csv_reader: sms_label.append(line[0]) #提取出标签 sms_data.append(preprocessing(line[1])) #提取出特征 sms.close() return sms_data, sms_label

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zzxsyj.html