Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom word #162

Open
niranjan8129 opened this issue Jul 29, 2018 · 1 comment
Open

custom word #162

niranjan8129 opened this issue Jul 29, 2018 · 1 comment

Comments

@niranjan8129
Copy link

niranjan8129 commented Jul 29, 2018

how to train custom word like

source word --------------------- target word

1- #U@SAA$ -------------------------- USA
2- %Goo@#g-le ----------------------- Google

@rohan12345a
Copy link

#You can refer to the below code as a starting point:

import tensorflow as tf

Define the source and target word pairs

source_words = ['#U@SAA$', '%Goo@#g-le']
target_words = ['USA', 'Google']

Define the simple neural network architecture a basic one.

model = tf.keras.Sequential([
tf.keras.layers.Embedding(input_dim=vocab_size, output_dim=embedding_dim),
tf.keras.layers.GlobalAveragePooling1D(),
tf.keras.layers.Dense(output_dim)
])

Compile the model

model.compile(optimizer='adam', loss='mse')

Train the model

model.fit(source_words, target_words, epochs=num_epochs, batch_size=batch_size)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants