Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@lf.apply('ja')
def tokenize(x):
return [START_TOKEN] + x.split() + [END_TOKEN]
@lf.apply('en')
@lf.apply('ja')
def tokenize(x):
return [START_TOKEN] + x.split() + [END_TOKEN]
def get_indexer(key, token_to_index, unk_index):
def indexer(token_to_index, unk_index, x):
return [token_to_index.get(token, unk_index) for token in x]
return lf.apply(key)(partial(indexer, token_to_index, unk_index))