Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def generate_window_sequence(self, sentence_ix, sentence, label):
- window_sequences = []
- offset = int(self.window_size/2)
- ws = tf.strings.split([sentence], sep=' ').values
- ls = ws.get_shape()[0].value
- print(ls)
- for i in range(offset, ls-offset):
- window_sequences.append((tf.gather_nd(ws, [i-offset]), tf.gather_nd(ws, [i]) ))
- window_sequences.append((tf.gather_nd(ws, [i+offset]), tf.gather_nd(ws, [i]) ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement