OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-agents commits / d731729

Adjust the description
d731729b6f1df60518b092861878ed3106817611
by Linas Vepštas <linasvepstas@gmail.com> · 2024-05-03T06:03:23.000Z

Changed files (1) +17 -6

examples/pair-count.scm +17 -6
……@@ -32,11 +32,20 @@
3232 (LgParseBonds (Phrase "this is a test") (LgDict "any") (Number 1)))
3333
3434; The `(Number 1)` says that only one parse is wanted.
35; Note how a bunch of Edges flew by; these specify the word pairs.
36; Note how the list of edges is wrapped by a `LinkValue`.
37; Note how a list of words is generated, before the edges; it is also
38; wrapped in a LinkValue. The graph, as a whole, consisting of a list of
39; vertexes (the words) and edges, is wrapped in a LinkValue.
35;
36; The result of parsing is a list of pairs. First item in a pair is
37; the list of words in the sentence; the second is a list of the edges.
38; Thus, each pair has the form
39; (LinkValue
40; (LinkValue (Word "this") (Word "is") (Word "a") (Word "test"))
41; (LinkValue (Edge ...) (Edge ...) ...))
42;
43; This pair should be thought of as a graph G = (V,E) where V is the
44; set of vertices in the graph (here, the words) and E is the set of
45; edges (here, these are word-pairs).
46;
47; One graph G is generated for each distinct parse. To avoid flooding
48; the screen, only pne parse is asked for; thus, `(Number 1)`.
4049
4150; View the contents of the AtomSpace:
4251(cog-report-counts)
……@@ -223,7 +232,9 @@
223232(cog-execute! (ValueOf (Concept "foobar") (Predicate "count")))
224233
225234; Use the previous utility function to wire the counter into
226; the parsing pipeline.
235; the parsing pipeline. Note that the Rule is a bit fancier, here.
236; It includes a type declaration to avoid counting if passed bad
237; data: it insists that each individual edge really is of type 'Edge.
227238(define (edge-counter EDGE-LIST)
228239 (Filter
229240 (Rule