예제 #1
0
    def __init__(self, facts, ranked_attrs, taxonomy):
        """
        Initializes class with a set of facts about objects in the world (see 
            example method), a set of ranked attributes, and a taxonomy.
    
        facts is expected to be a list where each element is a list of the form:
            [fact category, fact name, object id, ...]

            fact category may be Type, or a user-defined name (all facts that 
                use Rel will be ignored for this algorithm).
            fact name may be any string.
            object id must be a unique identifier for a given object.
            ... = more object ids if fact category is Rel.

        ranked_attrs is expected to be a list of attributes in descending order
            of preference. Attributes may be either Type or user-defined names 
            used in the fact set above.
        
        taxonomy is expected to be a Taxonomy (or an object which implements the 
            methods listed in the Taxonomy documentation), which contains a 
            taxonomy for the fact names.
        """
        self.facts = deepcopy(facts)
        self.object_ids = validate_facts(self.facts)
        self.object_ids_list = list(self.object_ids)

        # TODO: may want to validate the attribute list and/or the taxonomy
        self.ranked_attrs = ranked_attrs
        self.tree = taxonomy
예제 #2
0
    def __init__(self, facts, ranked_attrs, taxonomy):
        """
        Initializes class with a set of facts about objects in the world (see 
            example method), a set of ranked attributes, and a taxonomy.
    
        facts is expected to be a list where each element is a list of the form:
            [fact category, fact name, object id, ...]

            fact category may be Type, or a user-defined name (all facts that 
                use Rel will be ignored for this algorithm).
            fact name may be any string.
            object id must be a unique identifier for a given object.
            ... = more object ids if fact category is Rel.

        ranked_attrs is expected to be a list of attributes in descending order
            of preference. Attributes may be either Type or user-defined names 
            used in the fact set above.
        
        taxonomy is expected to be a Taxonomy (or an object which implements the 
            methods listed in the Taxonomy documentation), which contains a 
            taxonomy for the fact names.
        """
        self.facts = deepcopy(facts)
        self.object_ids = validate_facts(self.facts)
        self.object_ids_list = list(self.object_ids)

        # TODO: may want to validate the attribute list and/or the taxonomy
        self.ranked_attrs = ranked_attrs
        self.tree = taxonomy
예제 #3
0
  def __init__(self, facts):
    """
    Initializes class with a set of facts about objects in the world (see example method).
    facts is expected to be a list with each element being a list of the form:
      [fact category, fact name, object id]

    fact category may be Type or a user-defined name.
    fact name may be any string.
    object id must be a unique identifer for a given object.
    """
    self.facts = facts
    self.object_ids = validate_facts(self.facts)
    assert not any(map(lambda f: f == Rel, self.facts)), "Full Brevity does not support relationships"
예제 #4
0
  def __init__(self, facts):
    """
    Initializes class with a set of facts about objects in the world (see example method).
    facts is expected to be a list with each element being a list of the form:
      [fact category, fact name, object id, ...]

    fact category may be Type, Rel, or a user-defined name.
    fact name may be any string.
    object id must be a unique identifer for a given object.
    ... = more object ids if fact category is Rel
    """
    self.facts = deepcopy(facts)
    self.object_ids = validate_facts(self.facts)
    self.object_ids_list = list(self.object_ids)