tf.keras.preprocessing.text.text_to_word_sequence
| View source on GitHub |
Преобразует текст в последовательность слов (или токенов).
tf.keras.preprocessing.text.text_to_word_sequence(
input_text, filters='!"#$%&()*+,-./:;<=>?@[\\]^_`{|}~\t\n', lower=True, split='
'
)
Эта функция преобразует строку текста в список слов, игнорируя filters символы, включая знаки препинания по умолчанию.
sample_text = 'This is a sample sentence.' tf.keras.preprocessing.text.text_to_word_sequence(sample_text) ['this', 'is', 'a', 'sample', 'sentence']
| Аргументы | ||
|---|---|---|
input_text | Входной текст (строка). | |
filters | список (или объединение) символов для фильтрации, таких как знаки препинания. По умолчанию: '!"#$%&()*+,-./:;<=>?@[\]^_{|}~\t\n', includes basic punctuation, tabs, and newlines. </td> </tr><tr> <td>нижний регистр</td> <td> boolean. Whether to convert the input to lowercase. </td> </tr><tr> <td>разделение` | str. Разделитель для разделения слов. |
| Возвращаемые значения | |
|---|---|
| Список слов (или токенов). |
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.3/api_docs/python/tf/keras/preprocessing/text/text_to_word_sequence