コード例 #1
0
 def extend_properties(self, category):
     """Extend the category's properties per the inheritance rules."""
     positive = set(category.positive_properties)
     negative = set(category.negative_properties)
     more = True
     while more:
         more = False
         for rule in self._property_inheritance_rules:
             new = rule(category.name, positive, negative)
             if new:
                 new_positive, new_negative = new
                 new_positive -= positive
                 new_negative -= negative
                 if new_positive or new_negative:
                     more = True
                     positive |= new_positive
                     negative |= new_negative
     negative -= positive
     return categorization.Category(category.name, positive, negative)
コード例 #2
0
 def __str__(self) -> str:
     return str(
         categorization.Category('last_term', self._positive_properties,
                                 self._negative_properties))
コード例 #3
0
ファイル: compound_match.py プロジェクト: hosford42/pyramids
 def __str__(self) -> str:
     return str(categorization.Category('compound', self._positive_properties,
                                        self._negative_properties))