def expand_all_semantics(production_rules, semantics_rules): """ Expands all semantics rules :param production_rules: :param semantics_rules: """ for utterance, parse in semantics_rules.items(): yield From( generate_sentence_parse_pairs(utterance, production_rules, semantics_rules, False))
def gen(): yield From([1, 2, 3]) yield [4, 5, 6]
def gen(): yield 1 yield From(subgen()) yield 4
def subgen(): yield From(subsubgen()) yield 3
def gen(): yield 1 ret = (yield From(subgen())) yield 4 yield ret
def gen(): yield From(non_gen())
def gen(): try: yield From(subgen()) except ValueError: yield 1
def gen(): yield 1 yield From(ValueError) yield From(None) yield 2