1ea25b4fcd455be8eb03b49a71d3c9434f904e59,prosaic/dogma.py,SyllableCountRule,to_query,#SyllableCountRule#,41

Before Change


        self.strength = syllables

    def to_query(self):
        if 0 == self.strength:
            query = super().to_query()
        else:
            modifier = self.syllables - self.strength
            lte = self.syllables + modifier
            gte = self.syllables - modifier
            query = {"num_syllables": {"$lte": lte, "$gte": gte}}

        return query

class KeywordRule(Rule):
    __slots__ = ["keyword", "phrase_cache", "strength"]

After Change


        self.strength = syllables

    def to_query(self):
        if 0 == self.strength:
            return super().to_query()

        modifier = self.syllables - self.strength
        return "p.syllables >= {} and p.syllables <= {}".format(
                self.syllables + modifier,
                self.syllables - modifier)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: vilmibm/prosaic
Commit Name: 1ea25b4fcd455be8eb03b49a71d3c9434f904e59
Time: 2016-05-04
Author: nathanielksmith@gmail.com
File Name: prosaic/dogma.py
Class Name: SyllableCountRule
Method Name: to_query


Project Name: vilmibm/prosaic
Commit Name: 1ea25b4fcd455be8eb03b49a71d3c9434f904e59
Time: 2016-05-04
Author: nathanielksmith@gmail.com
File Name: prosaic/dogma.py
Class Name: KeywordRule
Method Name: to_query


Project Name: vilmibm/prosaic
Commit Name: 1ea25b4fcd455be8eb03b49a71d3c9434f904e59
Time: 2016-05-04
Author: nathanielksmith@gmail.com
File Name: prosaic/dogma.py
Class Name: FuzzyKeywordRule
Method Name: to_query