Skip to content

Instantly share code, notes, and snippets.

@randcode-generator
Last active August 9, 2017 18:33
Show Gist options
  • Save randcode-generator/ca673ec529594504b5ade78ab5ed134a to your computer and use it in GitHub Desktop.
Save randcode-generator/ca673ec529594504b5ade78ab5ed134a to your computer and use it in GitHub Desktop.
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