Advertisement
gl0Ppy

Untitled

Oct 7th, 2022
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. def translate(input_text):
  2.         encoder_our_text = np.zeros(
  3.         (1, max_encoder_seq_length, num_encoder_tokens), dtype="float32"
  4.         )
  5.         for t, char in enumerate(input_text):
  6.             encoder_our_text[0, t, input_token_index[char]] = 1.0
  7.         encoder_our_text[0, t + 1 :, input_token_index[" "]] = 1.0
  8.         print(encoder_our_text)
  9.        
  10.         print(input_seq)
  11.         decoded_sentence = decode_sequence(encoder_our_text)
  12.         print("-")
  13.         print("Input sentence:", input_text)
  14.         print("Decoded sentence:", decoded_sentence)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement