MCPcopy Create free account
hub / github.com/clips/pattern / properties

Method properties

pattern/graph/commonsense.py:44–53  ·  view source on GitHub ↗

Returns the top properties in the concept halo, sorted by betweenness centrality. The return value is a list of concept id's instead of Concepts (for performance).

(self)

Source from the content-addressed store, hash-verified

42
43 @property
44 def properties(self):
45 """ Returns the top properties in the concept halo, sorted by betweenness centrality.
46 The return value is a list of concept id's instead of Concepts (for performance).
47 """
48 if self._properties is None:
49 g = self.graph.copy(nodes=self.halo)
50 p = (n for n in g.nodes if n.id in self.graph.properties)
51 p = [n.id for n in reversed(sorted(p, key=lambda n: n.centrality))]
52 self._properties = p
53 return self._properties
54
55def halo(concept, depth=2):
56 return concept.flatten(depth=depth)

Callers

nothing calls this directly

Calls 1

copyMethod · 0.45

Tested by

no test coverage detected