import os
>>> import numpy as np
>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>> from tensorflow.keras.preprocessing.text import Tokenizer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>> from tensorflow.keras.preprocessing.sequence import pad_sequences
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tensorflow'
>>>
>>> # 读取文本数据
>>> def read_data(file_path):
...     with open(file_path, ‘r’, encoding=‘utf-8’) as file:
  File "<stdin>", line 2
    with open(file_path, ‘r’, encoding=‘utf-8’) as file:
                         ^
SyntaxError: invalid character '‘' (U+2018)
>>>         data = file.readlines()
  File "<stdin>", line 1
    data = file.readlines()
IndentationError: unexpected indent
>>>     return data
  File "<stdin>", line 1
    return data
IndentationError: unexpected indent
>>>
>>> # 清洗和预处理文本
>>> def clean_text(data):
...     cleaned_data = []
...     for sentence in data:
...         # 可以根据需求进行其他的清洗步骤，例如去除标点符号和特殊字符等
...         cleaned_data.append(sentence.strip())
...     return cleaned_data
...
>>> # 构建训练数据
>>> def prepare_data(data, num_words, max_sequence_length):
...     # 使用Keras中的Tokenizer来将文本转化为数字序列
...     tokenizer = Tokenizer(num_words=num_words, oov_token=‘<OOV>’)
  File "<stdin>", line 3
    tokenizer = Tokenizer(num_words=num_words, oov_token=‘<OOV>’)
                                                         ^
SyntaxError: invalid character '‘' (U+2018)
>>>     tokenizer.fit_on_texts(data)
  File "<stdin>", line 1
    tokenizer.fit_on_texts(data)
IndentationError: unexpected indent
>>>     sequences = tokenizer.texts_to_sequences(data)
  File "<stdin>", line 1
    sequences = tokenizer.texts_to_sequences(data)
IndentationError: unexpected indent
>>>     # 填充序列，使得每个序列都有相同的长度
>>>     padded_sequences = pad_sequences(sequences, maxlen=max_sequence_length, padding=‘post’)
  File "<stdin>", line 1
    padded_sequences = pad_sequences(sequences, maxlen=max_sequence_length, padding=‘post’)
IndentationError: unexpected indent
>>>
>>>     return padded_sequences, tokenizer
  File "<stdin>", line 1
    return padded_sequences, tokenizer
IndentationError: unexpected indent
>>>
>>> # 保存预处理后的数据和tokenizer
>>> def save_preprocessed_data(padded_sequences, tokenizer, save_dir):
...     np.save(os.path.join(save_dir, ‘padded_sequences.npy’), padded_sequences)
  File "<stdin>", line 2
    np.save(os.path.join(save_dir, ‘padded_sequences.npy’), padded_sequences)
                                   ^
SyntaxError: invalid character '‘' (U+2018)
>>>     tokenizer_json = tokenizer.to_json()
  File "<stdin>", line 1
    tokenizer_json = tokenizer.to_json()
IndentationError: unexpected indent
>>>     with open(os.path.join(save_dir, ‘tokenizer.json’), ‘w’, encoding=‘utf-8’) as file:
  File "<stdin>", line 1
    with open(os.path.join(save_dir, ‘tokenizer.json’), ‘w’, encoding=‘utf-8’) as file:
IndentationError: unexpected indent
>>>         file.write(tokenizer_json)
  File "<stdin>", line 1
    file.write(tokenizer_json)
IndentationError: unexpected indent
>>>
>>> # 设定参数
>>> file_path = ‘D:/NanoGPT-修仙小说/data/shakespeare_char/input.txt’  # 替换为你的数据文件路径
  File "<stdin>", line 1
    file_path = ‘D:/NanoGPT-修仙小说/data/shakespeare_char/input.txt’  # 替换为你的数据文件路径
                ^
SyntaxError: invalid character '‘' (U+2018)
>>> num_words = 10000  # 限制词汇表的大小
>>> max_sequence_length = 100  # 设定每个序列的最大长度
>>> save_dir = ‘preprocessed_data’  # 保存预处理数据的目录
  File "<stdin>", line 1
    save_dir = ‘preprocessed_data’  # 保存预处理数据的目录
               ^
SyntaxError: invalid character '‘' (U+2018)
>>>
>>> # 准备和保存数据
>>> data = read_data(file_path)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'read_data' is not defined
>>> cleaned_data = clean_text(data)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'data' is not defined
>>> padded_sequences, tokenizer = prepare_data(cleaned_data, num_words, max_sequence_length)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'prepare_data' is not defined
>>> save_preprocessed_data(padded_sequences, tokenizer, save_dir)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'save_preprocessed_data' is not defined  我应该如何修改呢