def solve_all_phrasings(self, constraints): all_phrasings = phrasings(constraints.phrases) self.answers_with_clues = [] for p in all_phrasings: constraints = constraints._replace(phrases=p) # constraints = Constraints(p, lengths, pattern, answer) if not self.quiet: print p for ann_ans in self.solve_constraints(constraints): self.answers_with_clues.append(ann_ans) if len(self.answers_with_clues) == 0 and constraints.pattern.replace('.', '') != "": self.answers_with_clues = [PatternAnswer(x, all_phrasings[0]) for x in SYNONYMS if matches_pattern(x, constraints.pattern, constraints.lengths)] self.answers_with_clues.sort(reverse=True) return self.answers_with_clues
def parse_clue_text(clue_text): phrases, lengths, pattern, answer = split_clue_text(clue_text) return phrasings(phrases), lengths, pattern, answer