37b54afef51c7430f8fa00db2f07e3532a7408da,dit/distribution.py,BaseDistribution,zipped,#BaseDistribution#Any#,661

Before Change


            // that does not rely on the particular implementation"s storage
            // mechanism.  Here is one way.
            //
            outcomes = list(self.sample_space())
            zero = self.ops.zero
            probs = [zero] * len(outcomes)

            _outcomes = self.outcomes
            _pmf = self.pmf
            i, j = 0, 0
            while j < len(_pmf):
                if outcomes[i] == _outcomes[j]:
                    probs[i] = _pmf[j]
                    j += 1
                i += 1
        else:
            outcomes = self.outcomes
            probs = self.pmf

        return izip(outcomes, probs)



    ////// We choose to implement only scalar multiplication and distribution

After Change


            raise ditException("Invalid mode.")

        if mode == "pmf":
            for x in izip(self.outcomes, self.pmf):
                yield x
        elif mode == "atoms":
            // Then we want to iterate over the sample space.
            //
            // There are many ways to do this, but we need to do it in a way
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 5

Instances


Project Name: dit/dit
Commit Name: 37b54afef51c7430f8fa00db2f07e3532a7408da
Time: 2013-10-01
Author: chebee7i@gmail.com
File Name: dit/distribution.py
Class Name: BaseDistribution
Method Name: zipped


Project Name: chartbeat-labs/textacy
Commit Name: 2cca6953b0d90832cabfab1a091ca0f6140eee42
Time: 2016-02-20
Author: burton@chartbeat.com
File Name: textacy/extract.py
Class Name:
Method Name: named_entities


Project Name: chartbeat-labs/textacy
Commit Name: 2cca6953b0d90832cabfab1a091ca0f6140eee42
Time: 2016-02-20
Author: burton@chartbeat.com
File Name: textacy/extract.py
Class Name:
Method Name: ngrams


Project Name: chartbeat-labs/textacy
Commit Name: 2cca6953b0d90832cabfab1a091ca0f6140eee42
Time: 2016-02-20
Author: burton@chartbeat.com
File Name: textacy/extract.py
Class Name:
Method Name: words