| … | … | @@ -32,11 +32,20 @@ |
| 32 | 32 | (LgParseBonds (Phrase "this is a test") (LgDict "any") (Number 1))) |
| 33 | 33 | |
| 34 | 34 | ; 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)`. |
| 40 | 49 | |
| 41 | 50 | ; View the contents of the AtomSpace: |
| 42 | 51 | (cog-report-counts) |
| … | … | @@ -223,7 +232,9 @@ |
| 223 | 232 | (cog-execute! (ValueOf (Concept "foobar") (Predicate "count"))) |
| 224 | 233 | |
| 225 | 234 | ; 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. |
| 227 | 238 | (define (edge-counter EDGE-LIST) |
| 228 | 239 | (Filter |
| 229 | 240 | (Rule |