一、产生UnicodeDecodeError错误
# -*- coding: utf-8 -*-
"""Preprocesses Cornell Movie Dialog data."""
import nltk
import tensorflow as tf
tf.app.flags.DEFINE_string("raw_data",
"../cornell_movie_dialogs_corpus/movie_lines.txt",
"Raw data path")
tf.app.flags.DEFINE_string("out_file",
"../preprocessed_data/preprocessed_movie_lines.txt",
"File to write preprocessed data "
"to.")
FLAGS = tf.app.flags.FLAGS
def main(_):
with open(FLAGS.raw_data, "r", encoding='utf-8') as raw_data, \
open(FLAGS.out_file, "w"