class Generator():
    def __init__(self, spec: Spec):
        self.foundry = Foundry(Optimize())
        self.foundry.applySpec(spec)
        self.spec = spec

    def createNew(self):
        try:
            pitches = self.foundry.extractPitches(self.spec.line)
        except Exception:
            return []
        self.foundry.apply(distinctFromExample(self.spec.line, [ConstPitch(x) for x in pitches]))
        return pitches
Пример #2
0
def test_goodCFIsS1Sat(s1GoodCF):
    foundry = Foundry(Optimize())
    foundry.applySpec(s1GoodCF)
    assert foundry.check() == sat
Пример #3
0
def test_badCFIsS3Sat(s3BadCF):
    foundry = Foundry(Optimize())
    foundry.applySpec(s3BadCF)
    assert foundry.check() == sat
def workingCF(cantus):
    f = Foundry(Optimize())
    f.applySpec(cantus)
    return f.extractPitches(cantus.line)