Last active
August 9, 2017 18:33
-
-
Save randcode-generator/ca673ec529594504b5ade78ab5ed134a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tensorflow as tf | |
MAX_DOCUMENT_LENGTH = 3 | |
vocab_processor = tf.contrib.learn.preprocessing.VocabularyProcessor( | |
MAX_DOCUMENT_LENGTH) | |
transform_word = vocab_processor.transform(['hello world', 'welcome my house', 'brown fox', 'have fun', 'having fun']) | |
list_word = list(transform_word) | |
x_train = np.array(list_word) | |
print(x_train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment