コード例 #1
0
def populate(engine):
    This_rule_base = engine.get_create('key_rules')

    fc_rule.fc_rule('take', This_rule_base, take, (
        ('chest', 'closed', (pattern.pattern_literal(False), ), False),
        ('key', 'inChest', (pattern.pattern_literal(True), ), False),
    ), (pattern.pattern_literal(False), ))
コード例 #2
0
def populate(engine):
    This_rule_base = engine.get_create('pcb')

    fc_rule.fc_rule('needs_hifreq', This_rule_base, needs_hifreq,
                    (('pcb', 'is_hf',
                      (contexts.variable('circuit'), ), False), ),
                    (contexts.variable('circuit'), ))
コード例 #3
0
def populate(engine):
  This_rule_base = engine.get_create('chest_rules')
  
  fc_rule.fc_rule('open', This_rule_base, open,
    (('chest', 'closed',
      (pattern.pattern_literal(True),),
      False),),
    (pattern.pattern_literal(False),))
コード例 #4
0
def populate(engine):
  This_rule_base = engine.get_create('door_rules')
  
  fc_rule.fc_rule('open', This_rule_base, open,
    (('door', 'hasKey',
      (pattern.pattern_literal(True),),
      False),),
    (pattern.pattern_literal(False),))
コード例 #5
0
def populate(engine):
  This_rule_base = engine.get_create('krbparse_test')
  
  fc_rule.fc_rule('name1', This_rule_base, name1,
    (('a', 'b',
      (pattern.pattern_literal('x'),
       contexts.variable('b'),),
      False),),
    (contexts.variable('b'),))
コード例 #6
0
ファイル: key_rules_fc.py プロジェクト: AriiMoose/Tall-Tales
def populate(engine):
  This_rule_base = engine.get_create('key_rules')
  
  fc_rule.fc_rule('take', This_rule_base, take,
    (('chest', 'closed',
      (pattern.pattern_literal(False),),
      False),
     ('key', 'inChest',
      (pattern.pattern_literal(True),),
      False),),
    (pattern.pattern_literal(False),))
コード例 #7
0
def populate(engine):
    This_rule_base = engine.get_create('reasonable')

    fc_rule.fc_rule('reasonable', This_rule_base, reasonable,
                    (('uber', 'labels', (
                        contexts.variable('concept1'),
                        contexts.variable('concept2'),
                        contexts.variable('concept3'),
                    ), False), ), (
                        contexts.variable('concept1'),
                        contexts.variable('a'),
                        contexts.variable('concept2'),
                        contexts.variable('concept3'),
                    ))
コード例 #8
0
def populate(engine):
  This_rule_base = engine.get_create('diagnose')
  
  fc_rule.fc_rule('collect_diagnosis', This_rule_base, collect_diagnosis,
    (('patient', 'feels',
      (contexts.variable('patient'),
       contexts.variable('symptom'),),
      False),
     ('choroby', 'symptom_of',
      (contexts.variable('symptom'),
       contexts.variable('disease'),),
      True),),
    (contexts.variable('diseases'),
     contexts.variable('patient'),))
コード例 #9
0
def populate(engine):
    This_rule_base = engine.get_create('fc_area_recommend')

    fc_rule.fc_rule('move_01', This_rule_base, move_01, (
        ('coil_area', 'coil_information', (
            contexts.variable('steel_kind'),
            contexts.variable('coil_kind'),
            contexts.variable('size'),
            contexts.variable('next_unit'),
        ), False),
        ('coil_area', 'coil_area_ruler', (
            contexts.variable('coil_kind'),
            contexts.variable('p0'),
            contexts.variable('p1'),
            contexts.variable('status'),
        ), False),
    ), (
        contexts.variable('coil_kind'),
        contexts.variable('p1'),
        contexts.variable('status'),
    ))

    fc_rule.fc_rule('move_02', This_rule_base, move_02, (
        ('coil_area', 'coil_information', (
            contexts.variable('steel_kind'),
            contexts.variable('coil_kind'),
            contexts.variable('size'),
            contexts.variable('next_unit'),
        ), False),
        ('coil_area', 'coil_area_ruler', (
            contexts.variable('coil_kind'),
            contexts.variable('p1'),
            contexts.variable('p2'),
            contexts.variable('status'),
        ), False),
    ), (
        contexts.variable('coil_kind'),
        contexts.variable('p2'),
        contexts.variable('status'),
    ))

    fc_rule.fc_rule('move_03', This_rule_base, move_03, (
        ('coil_area', 'coil_information', (
            contexts.variable('steel_kind'),
            contexts.variable('coil_kind'),
            contexts.variable('size'),
            contexts.variable('next_unit'),
        ), False),
        ('coil_area', 'coil_area_ruler', (
            contexts.variable('coil_kind'),
            contexts.variable('p2'),
            contexts.variable('p3'),
            contexts.variable('status'),
        ), False),
    ), (
        contexts.variable('coil_kind'),
        contexts.variable('p3'),
        contexts.variable('status'),
    ))

    fc_rule.fc_rule('move_04', This_rule_base, move_04, (
        ('coil_area', 'coil_information', (
            contexts.variable('steel_kind'),
            contexts.variable('coil_kind'),
            contexts.variable('size'),
            contexts.variable('next_unit'),
        ), False),
        ('coil_area', 'coil_area_ruler', (
            contexts.variable('coil_kind'),
            contexts.variable('p3'),
            contexts.variable('p4'),
            contexts.variable('status'),
        ), False),
    ), (
        contexts.variable('coil_kind'),
        contexts.variable('p4'),
        contexts.variable('status'),
    ))

    fc_rule.fc_rule('move_05', This_rule_base, move_05, (
        ('coil_area', 'coil_information', (
            contexts.variable('steel_kind'),
            contexts.variable('coil_kind'),
            contexts.variable('size'),
            contexts.variable('next_unit'),
        ), False),
        ('coil_area', 'coil_area_ruler', (
            contexts.variable('coil_kind'),
            contexts.variable('p4'),
            contexts.variable('p5'),
            contexts.variable('status'),
        ), False),
    ), (
        contexts.variable('coil_kind'),
        contexts.variable('p5'),
        contexts.variable('status'),
    ))

    fc_rule.fc_rule('move_06', This_rule_base, move_06, (
        ('coil_area', 'coil_information', (
            contexts.variable('steel_kind'),
            contexts.variable('coil_kind'),
            contexts.variable('size'),
            contexts.variable('next_unit'),
        ), False),
        ('coil_area', 'coil_area_ruler', (
            contexts.variable('coil_kind'),
            contexts.variable('p5'),
            contexts.variable('p6'),
            contexts.variable('status'),
        ), False),
    ), (
        contexts.variable('coil_kind'),
        contexts.variable('p6'),
        contexts.variable('status'),
    ))

    fc_rule.fc_rule('move_07', This_rule_base, move_07, (
        ('coil_area', 'coil_information', (
            contexts.variable('steel_kind'),
            contexts.variable('coil_kind'),
            contexts.variable('size'),
            contexts.variable('next_unit'),
        ), False),
        ('coil_area', 'coil_area_ruler', (
            contexts.variable('coil_kind'),
            contexts.variable('p6'),
            contexts.variable('p7'),
            contexts.variable('status'),
        ), False),
    ), (
        contexts.variable('coil_kind'),
        contexts.variable('p7'),
        contexts.variable('status'),
    ))
コード例 #10
0
def populate(engine):
    This_rule_base = engine.get_create('example')

    fc_rule.fc_rule('son_of', This_rule_base, son_of, (('family', 'son_of', (
        contexts.variable('child'),
        contexts.variable('father'),
        contexts.variable('mother'),
    ), False), ), (
        contexts.variable('child'),
        contexts.variable('father'),
        pattern.pattern_literal('father'),
        pattern.pattern_literal('son'),
        contexts.variable('mother'),
        pattern.pattern_literal('mother'),
    ))

    fc_rule.fc_rule('daughter_of', This_rule_base, daughter_of,
                    (('family', 'daughter_of', (
                        contexts.variable('child'),
                        contexts.variable('father'),
                        contexts.variable('mother'),
                    ), False), ), (
                        contexts.variable('child'),
                        contexts.variable('father'),
                        pattern.pattern_literal('father'),
                        pattern.pattern_literal('daughter'),
                        contexts.variable('mother'),
                        pattern.pattern_literal('mother'),
                    ))

    fc_rule.fc_rule('brothers', This_rule_base, brothers, (
        ('family', 'son_of', (
            contexts.variable('brother1'),
            contexts.variable('father'),
            contexts.variable('mother'),
        ), False),
        ('family', 'son_of', (
            contexts.variable('brother2'),
            contexts.variable('father'),
            contexts.variable('mother'),
        ), False),
    ), (
        contexts.variable('brother1'),
        contexts.variable('brother2'),
        pattern.pattern_literal('brother'),
    ))

    fc_rule.fc_rule('sisters', This_rule_base, sisters, (
        ('family', 'daughter_of', (
            contexts.variable('sister1'),
            contexts.variable('father'),
            contexts.variable('mother'),
        ), False),
        ('family', 'daughter_of', (
            contexts.variable('sister2'),
            contexts.variable('father'),
            contexts.variable('mother'),
        ), False),
    ), (
        contexts.variable('sister1'),
        contexts.variable('sister2'),
        pattern.pattern_literal('sister'),
    ))

    fc_rule.fc_rule('brother_and_sister', This_rule_base, brother_and_sister, (
        ('family', 'son_of', (
            contexts.variable('brother'),
            contexts.variable('father'),
            contexts.variable('mother'),
        ), False),
        ('family', 'daughter_of', (
            contexts.variable('sister'),
            contexts.variable('father'),
            contexts.variable('mother'),
        ), False),
    ), (
        contexts.variable('brother'),
        contexts.variable('sister'),
        pattern.pattern_literal('sister'),
        pattern.pattern_literal('brother'),
    ))

    fc_rule.fc_rule('facts_for_bc_rules', This_rule_base, facts_for_bc_rules,
                    (), (
                        pattern.pattern_literal('brother'),
                        pattern.pattern_literal('uncle'),
                        pattern.pattern_literal('sister'),
                        pattern.pattern_literal('aunt'),
                        pattern.pattern_literal('son'),
                        pattern.pattern_literal('nephew'),
                        pattern.pattern_literal('daughter'),
                        pattern.pattern_literal('niece'),
                    ))
コード例 #11
0
def populate(engine):
    This_rule_base = engine.get_create('fc_rules')

    fc_rule.fc_rule('gender', This_rule_base, gender, (
        ('famous', 'knownFor', (
            contexts.variable('person'),
            contexts.variable('status'),
        ), False),
        ('famous', 'gender', (
            contexts.variable('person'),
            contexts.variable('gender'),
        ), True),
    ), (
        contexts.variable('person'),
        pattern.pattern_literal('male'),
    ))

    fc_rule.fc_rule('dictator', This_rule_base, dictator, (
        ('famous', 'rules', (
            contexts.variable('person'),
            contexts.variable('nation'),
        ), False),
        ('famous', 'free_elections', (contexts.variable('nation'), ), True),
    ), (contexts.variable('person'), ))

    fc_rule.fc_rule('freely_elected', This_rule_base, freely_elected, (
        ('famous', 'rules', (
            contexts.variable('person'),
            contexts.variable('nation'),
        ), False),
        ('famous', 'free_elections', (contexts.variable('nation'), ), False),
    ), (contexts.variable('person'), ))

    fc_rule.fc_rule('president', This_rule_base, president, (
        ('famous', 'rules', (
            contexts.variable('person'),
            contexts.variable('nation'),
        ), False),
        ('famous', 'title', (
            contexts.variable('person'),
            contexts.variable('title'),
        ), True),
    ), (
        contexts.variable('person'),
        pattern.pattern_literal('president'),
    ))

    fc_rule.fc_rule('allies', This_rule_base, allies, (
        ('famous', 'allies', (
            contexts.variable('nation1'),
            contexts.variable('nation2'),
        ), False),
        ('famous', 'rules', (
            contexts.variable('person1'),
            contexts.variable('nation1'),
        ), False),
        ('famous', 'rules', (
            contexts.variable('person2'),
            contexts.variable('nation2'),
        ), False),
    ), (
        contexts.variable('person1'),
        contexts.variable('nation2'),
        contexts.variable('person2'),
        contexts.variable('nation1'),
    ))

    fc_rule.fc_rule('children', This_rule_base, children, (
        ('famous', 'famousFor', (
            contexts.variable('person'),
            contexts.variable('skill'),
        ), False),
        ('famous', 'children', (
            contexts.variable('person'),
            contexts.variable('yesno'),
        ), True),
    ), (
        contexts.variable('person'),
        pattern.pattern_literal('No'),
    ))

    fc_rule.fc_rule('race', This_rule_base, race, (
        ('famous', 'famousFor', (
            contexts.variable('person'),
            contexts.variable('skill'),
        ), False),
        ('famous', 'race', (
            contexts.variable('person'),
            contexts.variable('race'),
        ), True),
    ), (
        contexts.variable('person'),
        pattern.pattern_literal('Caucasian'),
    ))

    fc_rule.fc_rule('princess', This_rule_base, princess,
                    (('famous', 'princess',
                      (contexts.variable('person'), ), False), ), (
                          contexts.variable('person'),
                          pattern.pattern_literal('female'),
                      ))
コード例 #12
0
def populate(engine):
  This_rule_base = engine.get_create('fc_example')
  
  fc_rule.fc_rule('son_of', This_rule_base, son_of,
    (('family', 'son_of',
      (contexts.variable('child'),
       contexts.variable('father'),
       contexts.variable('mother'),),
      False),),
    (contexts.variable('child'),
     contexts.variable('father'),
     pattern.pattern_literal('father'),
     pattern.pattern_literal('son'),
     contexts.variable('mother'),
     pattern.pattern_literal('mother'),))
  
  fc_rule.fc_rule('daughter_of', This_rule_base, daughter_of,
    (('family', 'daughter_of',
      (contexts.variable('child'),
       contexts.variable('father'),
       contexts.variable('mother'),),
      False),),
    (contexts.variable('child'),
     contexts.variable('father'),
     pattern.pattern_literal('father'),
     pattern.pattern_literal('daughter'),
     contexts.variable('mother'),
     pattern.pattern_literal('mother'),))
  
  fc_rule.fc_rule('brothers', This_rule_base, brothers,
    (('family', 'son_of',
      (contexts.variable('brother1'),
       contexts.variable('father'),
       contexts.variable('mother'),),
      False),
     ('family', 'son_of',
      (contexts.variable('brother2'),
       contexts.variable('father'),
       contexts.variable('mother'),),
      False),),
    (contexts.variable('brother1'),
     contexts.variable('brother2'),
     pattern.pattern_literal('brother'),))
  
  fc_rule.fc_rule('sisters', This_rule_base, sisters,
    (('family', 'daughter_of',
      (contexts.variable('sister1'),
       contexts.variable('father'),
       contexts.variable('mother'),),
      False),
     ('family', 'daughter_of',
      (contexts.variable('sister2'),
       contexts.variable('father'),
       contexts.variable('mother'),),
      False),),
    (contexts.variable('sister1'),
     contexts.variable('sister2'),
     pattern.pattern_literal('sister'),))
  
  fc_rule.fc_rule('brother_and_sister', This_rule_base, brother_and_sister,
    (('family', 'son_of',
      (contexts.variable('brother'),
       contexts.variable('father'),
       contexts.variable('mother'),),
      False),
     ('family', 'daughter_of',
      (contexts.variable('sister'),
       contexts.variable('father'),
       contexts.variable('mother'),),
      False),),
    (contexts.variable('brother'),
     contexts.variable('sister'),
     pattern.pattern_literal('sister'),
     pattern.pattern_literal('brother'),))
  
  fc_rule.fc_rule('facts_for_bc_rules', This_rule_base, facts_for_bc_rules,
    (),
    (pattern.pattern_literal('brother'),
     pattern.pattern_literal('uncle'),
     pattern.pattern_literal('sister'),
     pattern.pattern_literal('aunt'),
     pattern.pattern_literal('son'),
     pattern.pattern_literal('nephew'),
     pattern.pattern_literal('daughter'),
     pattern.pattern_literal('niece'),))
  
  fc_rule.fc_rule('niece_or_nephew_and_aunt_or_uncle', This_rule_base, niece_or_nephew_and_aunt_or_uncle,
    (('family', 'child_parent',
      (contexts.variable('nn'),
       contexts.variable('parent'),
       contexts.variable('depth'),
       contexts.anonymous('_'),
       contexts.variable('child_type'),),
      False),
     ('family', 'siblings',
      (contexts.variable('parent'),
       contexts.variable('au'),
       contexts.variable('sibling_type'),
       contexts.anonymous('_'),),
      False),
     ('family', 'as_au',
      (contexts.variable('sibling_type'),
       contexts.variable('au_type'),),
      False),
     ('family', 'as_nn',
      (contexts.variable('child_type'),
       contexts.variable('nn_type'),),
      False),),
    (contexts.variable('greats'),
     contexts.variable('nn'),
     contexts.variable('au'),
     contexts.variable('au_type'),
     contexts.variable('nn_type'),))
  
  fc_rule.fc_rule('parent_and_child', This_rule_base, parent_and_child,
    (('family', 'child_parent',
      (contexts.variable('child'),
       contexts.variable('parent'),
       contexts.variable('parent_type'),
       contexts.variable('child_type'),),
      False),),
    (contexts.variable('child'),
     contexts.variable('parent'),
     pattern.pattern_literal(()),
     contexts.variable('parent_type'),
     contexts.variable('child_type'),))
  
  fc_rule.fc_rule('grand_parent_and_child', This_rule_base, grand_parent_and_child,
    (('family', 'child_parent',
      (contexts.variable('child'),
       contexts.variable('parent'),
       contexts.anonymous('_'),
       contexts.variable('child_type'),),
      False),
     ('family', 'child_parent',
      (contexts.variable('parent'),
       contexts.variable('grand_parent'),
       contexts.variable('parent_type'),
       contexts.anonymous('_'),),
      False),),
    (contexts.variable('child'),
     contexts.variable('grand_parent'),
     pattern.pattern_literal(('grand',)),
     contexts.variable('parent_type'),
     contexts.variable('child_type'),))
  
  fc_rule.fc_rule('great_grand_parent_and_child', This_rule_base, great_grand_parent_and_child,
    (('family', 'child_parent',
      (contexts.variable('child'),
       contexts.variable('grand_child'),
       contexts.anonymous('_'),
       contexts.variable('child_type'),),
      False),
     ('family', 'child_parent',
      (contexts.variable('grand_child'),
       contexts.variable('grand_parent'),
       pattern.pattern_tuple((contexts.variable('a'),), contexts.variable('b')),
       contexts.variable('parent_type'),
       contexts.anonymous('_'),),
      False),),
    (contexts.variable('child'),
     contexts.variable('grand_parent'),
     pattern.pattern_tuple((pattern.pattern_literal('great'), contexts.variable('a'),), contexts.variable('b')),
     contexts.variable('parent_type'),
     contexts.variable('child_type'),))
  
  fc_rule.fc_rule('first_cousins', This_rule_base, first_cousins,
    (('family', 'child_parent',
      (contexts.variable('cousin1'),
       contexts.variable('sibling1'),
       contexts.anonymous('_'),
       contexts.anonymous('_'),),
      False),
     ('family', 'siblings',
      (contexts.variable('sibling1'),
       contexts.variable('sibling2'),
       contexts.anonymous('_'),
       contexts.anonymous('_'),),
      False),
     ('family', 'child_parent',
      (contexts.variable('cousin2'),
       contexts.variable('sibling2'),
       contexts.anonymous('_'),
       contexts.anonymous('_'),),
      False),),
    (contexts.variable('cousin1'),
     contexts.variable('cousin2'),
     pattern.pattern_literal(1),))
  
  fc_rule.fc_rule('nth_cousins', This_rule_base, nth_cousins,
    (('family', 'child_parent',
      (contexts.variable('next_cousin1'),
       contexts.variable('cousin1'),
       contexts.anonymous('_'),
       contexts.anonymous('_'),),
      False),
     ('family', 'cousins',
      (contexts.variable('cousin1'),
       contexts.variable('cousin2'),
       contexts.variable('n'),),
      False),
     ('family', 'child_parent',
      (contexts.variable('next_cousin2'),
       contexts.variable('cousin2'),
       contexts.anonymous('_'),
       contexts.anonymous('_'),),
      False),),
    (contexts.variable('next_n'),
     contexts.variable('next_cousin1'),
     contexts.variable('next_cousin2'),))
  
  fc_rule.fc_rule('how_related_child_parent', This_rule_base, how_related_child_parent,
    (('family', 'child_parent',
      (contexts.variable('person1'),
       contexts.variable('person2'),
       contexts.variable('prefix'),
       contexts.variable('p2_type'),
       contexts.variable('p1_type'),),
      False),),
    (contexts.variable('relationship'),
     contexts.variable('person1'),
     contexts.variable('person2'),))
  
  fc_rule.fc_rule('how_related_parent_child', This_rule_base, how_related_parent_child,
    (('family', 'child_parent',
      (contexts.variable('person2'),
       contexts.variable('person1'),
       contexts.variable('prefix'),
       contexts.variable('p1_type'),
       contexts.variable('p2_type'),),
      False),),
    (contexts.variable('relationship'),
     contexts.variable('person1'),
     contexts.variable('person2'),))
  
  fc_rule.fc_rule('how_related_siblings', This_rule_base, how_related_siblings,
    (('family', 'siblings',
      (contexts.variable('person1'),
       contexts.variable('person2'),
       contexts.variable('p2_type'),
       contexts.variable('p1_type'),),
      False),),
    (contexts.variable('person1'),
     contexts.variable('person2'),
     pattern.pattern_tuple((contexts.variable('p1_type'), contexts.variable('p2_type'),), None),))
  
  fc_rule.fc_rule('how_related_nn_au', This_rule_base, how_related_nn_au,
    (('family', 'nn_au',
      (contexts.variable('person1'),
       contexts.variable('person2'),
       contexts.variable('prefix'),
       contexts.variable('p2_type'),
       contexts.variable('p1_type'),),
      False),),
    (contexts.variable('relationship'),
     contexts.variable('person1'),
     contexts.variable('person2'),))
  
  fc_rule.fc_rule('how_related_au_nn', This_rule_base, how_related_au_nn,
    (('family', 'nn_au',
      (contexts.variable('person2'),
       contexts.variable('person1'),
       contexts.variable('prefix'),
       contexts.variable('p1_type'),
       contexts.variable('p2_type'),),
      False),),
    (contexts.variable('relationship'),
     contexts.variable('person1'),
     contexts.variable('person2'),))
  
  fc_rule.fc_rule('how_related_cousins', This_rule_base, how_related_cousins,
    (('family', 'cousins',
      (contexts.variable('cousin1'),
       contexts.variable('cousin2'),
       contexts.variable('n'),),
      False),),
    (contexts.variable('nth'),
     contexts.variable('cousin1'),
     contexts.variable('cousin2'),
     pattern.pattern_tuple((contexts.variable('nth'), pattern.pattern_literal('cousins'),), None),))
  
  fc_rule.fc_rule('how_related_removed_cousins', This_rule_base, how_related_removed_cousins,
    (('family', 'child_parent',
      (contexts.variable('removed_cousin1'),
       contexts.variable('cousin1'),
       contexts.variable('grand'),
       contexts.anonymous('_'),
       contexts.anonymous('_'),),
      False),
     ('family', 'cousins',
      (contexts.variable('cousin1'),
       contexts.variable('cousin2'),
       contexts.variable('n'),),
      False),),
    (contexts.variable('nth'),
     contexts.variable('r1'),
     contexts.variable('removed_cousin1'),
     contexts.variable('cousin2'),
     pattern.pattern_tuple((contexts.variable('nth'), pattern.pattern_literal('cousins'), contexts.variable('r1'), pattern.pattern_literal('removed'),), None),))
  
  fc_rule.fc_rule('how_related_cousins_removed', This_rule_base, how_related_cousins_removed,
    (('family', 'cousins',
      (contexts.variable('cousin1'),
       contexts.variable('cousin2'),
       contexts.variable('n'),),
      False),
     ('family', 'child_parent',
      (contexts.variable('removed_cousin2'),
       contexts.variable('cousin2'),
       contexts.variable('grand'),
       contexts.anonymous('_'),
       contexts.anonymous('_'),),
      False),),
    (contexts.variable('nth'),
     contexts.variable('r1'),
     contexts.variable('cousin1'),
     contexts.variable('removed_cousin2'),
     pattern.pattern_tuple((contexts.variable('nth'), pattern.pattern_literal('cousins'), contexts.variable('r1'), pattern.pattern_literal('removed'),), None),))
コード例 #13
0
def populate(engine):
  This_rule_base = engine.get_create('off_state_rules')
  
  fc_rule.fc_rule('init_rule', This_rule_base, init_rule,
    (('off_state_questions', 'beep_question',
      (contexts.variable('ans'),),
      False),),
    (contexts.variable('ans'),))
  
  fc_rule.fc_rule('ram_yes_rule', This_rule_base, ram_yes_rule,
    (('off_state_facts', 'beep_answer',
      (pattern.pattern_literal(True),),
      False),),
    ())
  
  fc_rule.fc_rule('ram_no_rule', This_rule_base, ram_no_rule,
    (('off_state_facts', 'beep_answer',
      (pattern.pattern_literal(False),),
      False),),
    (pattern.pattern_literal('speaker'),))
  
  fc_rule.fc_rule('speaker_rule', This_rule_base, speaker_rule,
    (('off_state_facts', 'problem_from',
      (pattern.pattern_literal('speaker'),),
      False),
     ('off_state_questions', 'speaker_question',
      (contexts.variable('ans'),),
      False),),
    (contexts.variable('ans'),))
  
  fc_rule.fc_rule('speaker_yes_rule', This_rule_base, speaker_yes_rule,
    (('off_state_facts', 'speaker_answer',
      (pattern.pattern_literal(True),),
      False),
     ('off_state_questions', 'monitor_check_question',
      (contexts.variable('ans'),),
      False),),
    (contexts.variable('ans'),))
  
  fc_rule.fc_rule('speaker_no_rule', This_rule_base, speaker_no_rule,
    (('off_state_facts', 'speaker_answer',
      (pattern.pattern_literal(False),),
      False),),
    ())
  
  fc_rule.fc_rule('monitor_yes_rule', This_rule_base, monitor_yes_rule,
    (('off_state_facts', 'monitor_answer',
      (pattern.pattern_literal(True),),
      False),),
    ())
  
  fc_rule.fc_rule('monitor_no_rule', This_rule_base, monitor_no_rule,
    (('off_state_facts', 'monitor_answer',
      (pattern.pattern_literal(False),),
      False),),
    ())
  
  fc_rule.fc_rule('is_problem_solved_question', This_rule_base, is_problem_solved_question,
    (('off_state_questions', 'is_problem_solved_question',
      (contexts.variable('ans'),),
      False),),
    (contexts.variable('ans'),))
  
  fc_rule.fc_rule('if_problem_solved_yes_rule', This_rule_base, if_problem_solved_yes_rule,
    (('off_state_facts', 'problem_solved',
      (pattern.pattern_literal(True),),
      False),),
    ())
コード例 #14
0
def populate(engine):
  This_rule_base = engine.get_create('fc_pcb')
  
  fc_rule.fc_rule('hf', This_rule_base, hf,
    (('pcb', 'is_hf',
      (contexts.variable('net'),),
      False),),
    (contexts.variable('net'),))
  
  fc_rule.fc_rule('needs_no_hf', This_rule_base, needs_no_hf,
    (('pcb', 'is_not_hf',
      (contexts.variable('net'),),
      False),),
    (contexts.variable('net'),))
  
  fc_rule.fc_rule('large_budget_1', This_rule_base, large_budget_1,
    (('pcb', 'is_short_timeline',
      (contexts.variable('circuit'),),
      False),),
    (contexts.variable('circuit'),))
  
  fc_rule.fc_rule('large_budget_2', This_rule_base, large_budget_2,
    (('pcb', 'is_critical',
      (contexts.variable('circuit'),),
      False),),
    (contexts.variable('circuit'),))
  
  fc_rule.fc_rule('recommend__material_1', This_rule_base, recommend__material_1,
    (('pcb', 'needs_hf_mat',
      (contexts.variable('net'),),
      False),
     ('pcb', 'needs_large_budget',
      (contexts.variable('circuit'),),
      False),
     ('pcb', 'is_hf_mat',
      (contexts.variable('material'),),
      False),
     ('pcb', 'is_expensive_mat',
      (contexts.variable('material'),),
      False),),
    (contexts.variable('net'),
     contexts.variable('material'),))
  
  fc_rule.fc_rule('recommend__material_2', This_rule_base, recommend__material_2,
    (('pcb', 'needs_hf_mat',
      (contexts.variable('net'),),
      False),
     ('pcb', 'is_hf_mat',
      (contexts.variable('material'),),
      False),),
    (contexts.variable('net'),
     contexts.variable('material'),))
  
  fc_rule.fc_rule('recommend__material_3', This_rule_base, recommend__material_3,
    (('pcb', 'needs_no_hf_mat',
      (contexts.variable('net'),),
      False),
     ('pcb', 'is_not_hf_mat',
      (contexts.variable('material'),),
      False),),
    (contexts.variable('net'),
     contexts.variable('material'),))
  
  fc_rule.fc_rule('gnd_separation', This_rule_base, gnd_separation,
    (('pcb', 'requires_isolation',
      (contexts.variable('net1'),
       contexts.variable('net2'),),
      False),),
    (contexts.variable('net1'),))
コード例 #15
0
def populate(engine):
    This_rule_base = engine.get_create('fb_checkin_fc')

    fc_rule.fc_rule('prior', This_rule_base, prior, (('fb_checkin', 'prior', (
        contexts.variable('node'),
        contexts.variable('value'),
    ), False), ), (
        contexts.variable('node'),
        pattern.pattern_literal(0),
    ))

    fc_rule.fc_rule('inc_num_samples', This_rule_base, inc_num_samples,
                    (('fb_checkin', 'inc_num_samples', (
                        contexts.variable('node'),
                        contexts.variable('value'),
                        contexts.variable('prob'),
                    ), False), ), (
                        contexts.variable('node'),
                        contexts.variable('value'),
                        pattern.pattern_literal(0),
                    ))

    fc_rule.fc_rule('inc_num_features', This_rule_base, inc_num_features,
                    (('fb_checkin', 'inc_num_features', (
                        contexts.variable('node'),
                        contexts.variable('value'),
                        contexts.variable('prob'),
                    ), False), ), (
                        contexts.variable('node'),
                        contexts.variable('value'),
                        pattern.pattern_literal(0),
                    ))

    fc_rule.fc_rule('accuracy', This_rule_base, accuracy,
                    (('fb_checkin', 'accuracy',
                      (contexts.variable('new_value'), ), False), ),
                    (contexts.variable('new_value'), ))

    fc_rule.fc_rule('sample_size', This_rule_base, sample_size,
                    (('fb_checkin', 'sample_size', (
                        contexts.variable('node'),
                        contexts.variable('value'),
                    ), False), ), (
                        contexts.variable('node'),
                        contexts.variable('value'),
                    ))

    fc_rule.fc_rule('feature', This_rule_base, feature,
                    (('fb_checkin', 'feature', (
                        contexts.variable('node'),
                        contexts.variable('value'),
                    ), False), ), (
                        contexts.variable('node'),
                        contexts.variable('value'),
                    ))

    fc_rule.fc_rule('threshold', This_rule_base, threshold,
                    (('fb_checkin', 'threshold',
                      (contexts.variable('value'), ), False), ),
                    (contexts.variable('value'), ))
コード例 #16
0
def populate(engine):
  This_rule_base = engine.get_create('animalia_fc')
  
  fc_rule.fc_rule('gives_milk', This_rule_base, gives_milk,
    (('animalia', 'gives_milk',
      (contexts.variable('animal'),
       contexts.variable('type'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('type'),
     pattern.pattern_literal('mammal'),
     pattern.pattern_literal('gives_milk'),))
  
  fc_rule.fc_rule('have_feathers', This_rule_base, have_feathers,
    (('animalia', 'have_feathers',
      (contexts.variable('animal'),
       contexts.variable('type'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('type'),
     pattern.pattern_literal('bird'),
     pattern.pattern_literal('have_feathers'),))
  
  fc_rule.fc_rule('eats_meat', This_rule_base, eats_meat,
    (('animalia', 'eats_meat',
      (contexts.variable('animal'),
       contexts.variable('type'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('type'),
     pattern.pattern_literal('carnivore'),
     pattern.pattern_literal('eats_meat'),))
  
  fc_rule.fc_rule('can_swim', This_rule_base, can_swim,
    (('animalia', 'can_swim',
      (contexts.variable('animal'),
       contexts.variable('type'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('type'),
     pattern.pattern_literal('aquatic'),
     pattern.pattern_literal('can_swim'),))
  
  fc_rule.fc_rule('lays_eggs', This_rule_base, lays_eggs,
    (('animalia', 'lays_eggs',
      (contexts.variable('animal'),
       contexts.variable('type'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('type'),
     pattern.pattern_literal('bird'),
     pattern.pattern_literal('lays_eggs'),))
  
  fc_rule.fc_rule('has_hair', This_rule_base, has_hair,
    (('animalia', 'has_hair',
      (contexts.variable('animal'),
       contexts.variable('type'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('type'),
     pattern.pattern_literal('mammal'),
     pattern.pattern_literal('has_hair'),))
  
  fc_rule.fc_rule('have_scales', This_rule_base, have_scales,
    (('animalia', 'have_scales',
      (contexts.variable('animal'),
       contexts.variable('type'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('type'),
     pattern.pattern_literal('aquatic'),
     pattern.pattern_literal('have_scales'),))
  
  fc_rule.fc_rule('has_antenna', This_rule_base, has_antenna,
    (('animalia', 'has_antenna',
      (contexts.variable('animal'),
       contexts.variable('type'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('type'),
     pattern.pattern_literal('insect'),
     pattern.pattern_literal('has_antenna'),))
  
  fc_rule.fc_rule('have_webbed_feet', This_rule_base, have_webbed_feet,
    (('animalia', 'have_webbed_feet',
      (contexts.variable('animal'),
       contexts.variable('type'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('type'),
     pattern.pattern_literal('amphibian'),
     pattern.pattern_literal('have_webbed_feet'),))
  
  fc_rule.fc_rule('find_animal_feature', This_rule_base, find_animal_feature,
    (('animalia', 'animal_kind',
      (contexts.variable('animal'),
       contexts.variable('type'),
       contexts.variable('kind'),
       contexts.variable('feature'),),
      False),),
    (contexts.variable('animal'),
     contexts.variable('feature'),
     contexts.variable('kind'),))