Incrementally adds one to a list of indices given positions of specified item in list

Published: 10/10/2019
Incrementally adds one to a list of indices given positions of specified item in list
Source: STACKOVERFLOW.COM

Given a list of tokens, input: >>> tokenized_text = "[CLS] my dog is cute [SEP] he likes slack ##ing [SEP]".split() >>> tokenized_text ['[CLS]', 'my', 'dog', 'is', 'cute', '[SEP]', 'he', 'likes', 'slack', '##ing', '[SEP]'] The goal is to create an index for up till every [SEP] from left to right, find the [SEP] tokens and then incrementally adds the 1 afte

Read more
Related news
Comment
FACEBOOK