44f80b5872b1bb9679d15b8230c1731fd26ac527,torchnlp/text_encoders/static_tokenizer_encoder.py,StaticTokenizerEncoder,__init__,#StaticTokenizerEncoder#Any#Any#Any#Any#Any#,15
Before Change
self.lower = lower
self.tokenize = tokenize
self.append_eos = append_eos
self.tokens = Counter()
for text in sample:
self.tokens.update(self._preprocess(text))
After Change
if not isinstance(sample, list):
raise TypeError("Sample needs to be a list of strings.")
self.append_eos = append_eos
self.tokens = Counter()
self.tokenize = tokenize if tokenize else lambda x: x
for text in sample:
self.tokens.update(self.tokenize(text))
self.stoi = RESERVED_STOI.copy()
self.itos = RESERVED_ITOS[:]
for token, count in self.tokens.items():
if count >= min_occurrences:
self.itos.append(token)
self.stoi[token] = len(self.itos) - 1
@property
def vocab(self):
Return a list of tokens
return self.itos
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: PetrochukM/PyTorch-NLP
Commit Name: 44f80b5872b1bb9679d15b8230c1731fd26ac527
Time: 2018-03-10
Author: petrochukm@gmail.com
File Name: torchnlp/text_encoders/static_tokenizer_encoder.py
Class Name: StaticTokenizerEncoder
Method Name: __init__
Project Name: dmlc/gluon-nlp
Commit Name: 043e3000ad4a59f434e1975f9f0f7c0ac9aead53
Time: 2018-04-22
Author: xshiab@ust.hk
File Name: scripts/nmt/bleu.py
Class Name:
Method Name: compute_bleu
Project Name: OpenNMT/OpenNMT-py
Commit Name: d556116728d4f505eb14be081f29e32212145725
Time: 2017-09-01
Author: bpeters@coli.uni-saarland.de
File Name: onmt/IO.py
Class Name:
Method Name: merge_vocabs