286a864220a00732d382a75051e11877acf13c3f,deeppavlov/models/tokenizers/nltk_tokenizer.py,NLTKTokenizer,__init__,#NLTKTokenizer#Any#Any#,24

Before Change


        if download:
            nltk.download()
        self.tokenizer = getattr(nltk.tokenize, tokenizer, None)
        if not callable(self.tokenizer):
            raise AttributeError("Tokenizer {} is not defined in nltk.tokenizer".format(tokenizer))

    def infer(self, instance, *args, **kwargs):
        if type(instance) is str:
            return " ".join(self.tokenizer(instance))

After Change


class NLTKTokenizer(Inferable):

    def __init__(self, save_path=None, download=False, tokenizer="wordpunct_tokenize", *args, **kwargs):
        super().__init__(save_path=save_path)
        if download:
            nltk.download()
        self.tokenizer = getattr(nltk.tokenize, tokenizer, None)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: deepmipt/DeepPavlov
Commit Name: 286a864220a00732d382a75051e11877acf13c3f
Time: 2018-01-24
Author: ol.gure@gmail.com
File Name: deeppavlov/models/tokenizers/nltk_tokenizer.py
Class Name: NLTKTokenizer
Method Name: __init__


Project Name: NTMC-Community/MatchZoo
Commit Name: 53a93d8af5d041f6c5dfdef2fb763f8419e3023d
Time: 2019-01-19
Author: i@uduse.com
File Name: matchzoo/datasets/snli/load_data.py
Class Name:
Method Name: load_data


Project Name: deepmipt/DeepPavlov
Commit Name: 5390c650dadd1e86b6c43543ac0ed384e8ebfc4d
Time: 2018-05-15
Author: yoptar@gmail.com
File Name: deeppavlov/core/models/keras_model.py
Class Name: KerasModel
Method Name: save