0bcc8da0344cddc9dfff82a788df519c19489500,nltk/tokenize/treebank.py,TreebankWordTokenizer,span_tokenize,#TreebankWordTokenizer#Any#,147

Before Change


        // Do this only if original text contains double quote(s)
        if """ in text:
            // Find double quotes and converted quotes
            matched = [m.group() for m in re.finditer(r"[(``)(\"\")(")]+", text)]
            
            // Replace converted quotes back to double quotes
            tokens = [matched.pop(0) if tok in [""", "``", """"] else tok for tok in raw_tokens]
        else:
            tokens = raw_tokens

        return align_tokens(tokens, text)

After Change


        ix = 0

        spans = []
        for word_token in self.tokenize(text):
            if word_token in ("``", """"):
                orig_idx = text.find(word_token, ix)
                quote_idx = text.find(""", ix)
                if orig_idx < 0:
                    real_token = """
                elif quote_idx < 0:
                    real_token = word_token
                elif orig_idx < quote_idx:
                    real_token = word_token
                else:
                    real_token = """
            else:
                real_token = word_token
            ix = text.find(real_token, ix)
            end = ix + len(real_token)
            spans.append((ix, end))
            ix = end

        return spans


class TreebankWordDetokenizer(TokenizerI):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: nltk/nltk
Commit Name: 0bcc8da0344cddc9dfff82a788df519c19489500
Time: 2017-10-17
Author: lyyb46@gmail.com
File Name: nltk/tokenize/treebank.py
Class Name: TreebankWordTokenizer
Method Name: span_tokenize


Project Name: CyberReboot/NetworkML
Commit Name: ea318fd60a1410e95aebea3fdaa33ae0812ab382
Time: 2020-02-18
Author: josh@vandervecken.com
File Name: networkml/algorithms/base.py
Class Name: BaseAlgorithm
Method Name: parse_pcap_name


Project Name: HyperGAN/HyperGAN
Commit Name: 1e339c1a0a186da155c9dc2ab8798075d248dc3e
Time: 2018-11-06
Author: mikkel@255bits.com
File Name: hypergan/optimizers/curl_optimizer.py
Class Name: CurlOptimizer
Method Name: apply_gradients