| … | … | @@ -13,5 +13,40 @@ |
| 13 | 13 | (use-modules (opencog sensory)) |
| 14 | 14 | (use-modules (srfi srfi-1)) |
| 15 | 15 | |
| 16 | ; How many edges? |
| 17 | (cog-incoming-size (Bond "ANY")) |
| 18 | |
| 19 | ; Find next word after WORD |
| 20 | (define (make-next-word-qry WORD) |
| 21 | (Meet (Variable "next") ; vardecl |
| 22 | (EdgeLink (Bond "ANY") |
| 23 | (List WORD (Variable "next"))))) |
| 24 | |
| 25 | ; check it out |
| 26 | (cog-incoming-size (Word "start")) |
| 27 | (cog-incoming-size-by-type (Word "start") 'List) |
| 28 | |
| 29 | (define next-list |
| 30 | (cog-execute! (make-next-word-qry (Word "start")))) |
| 31 | |
| 32 | (length (cog-value->list next-list)) |
| 33 | |
| 34 | ; The MI sits on the edges, so repeat the above, with edges. |
| 35 | (define (make-next-edge-qry WORD) |
| 36 | (Query (Variable "next") ; vardecl |
| 37 | (EdgeLink (Bond "ANY") (List WORD (Variable "next"))) ; pattern |
| 38 | (EdgeLink (Bond "ANY") (List WORD (Variable "next"))) ; output |
| 39 | )) |
| 40 | |
| 41 | ; Look at it. |
| 42 | (define next-edges |
| 43 | (cog-execute! (make-next-edge-qry (Word "start")))) |
| 44 | |
| 45 | (length (cog-value->list next-edges)) |
| 46 | (cog-keys (car (cog-value->list next-edges))) |
| 47 | |
| 48 | (cog-value (car (cog-value->list next-edges)) (Predicate "*-Mutual Info Key-*")) |
| 49 | |
| 50 | |
| 16 | 51 | |
| 17 | 52 | |