OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-agents commits / 2de41df

Pull out edges from list.
2de41dfd583a44ed789ef0830e3ad8b614a13bb7
by Linas Vepštas <linasvepstas@gmail.com> · 2024-04-04T22:31:04.000Z

Changed files (1) +22 -12

scm/pair-agent/count-agent.scm +22 -12
……@@ -8,26 +8,36 @@
88(define DICT (LgDict "any"))
99
1010
11; From inside to out:
12; LGParseBonds tokenizes a sentence, and then parses it.
13; The PureExecLink makes sure that the parsing is done in a sub-AtomSpace
14; so that the main AtomSpace is not garbaged up.
15;
16; The result of parsing is a list of pairs. First item in a pair is
17; the list of words in the sentence; the second is a list of the edges.
18; Thus, each pair has the form
19; (LinkValue
20; (LinkValue (Word "this") (Word "is") (Word "a") (Word "test"))
21; (LinkValue (Edge ...) (Edge ...) ...))
22;
23; The Filter matches this, so that (Variable "$x") is equated with the
24; list of Edges.
25;
1126(define (obs-txt PLAIN-TEXT)
1227 (define parses (cog-execute!
1328 (Filter
14 (Signature
15 (Type 'LinkValue))
29 (Lambda
30 (Variable "$x")
31 (LinkSignature
32 (Type 'LinkValue)
33 (Type 'LinkValue)
34 (Variable "$x")))
1635 (PureExecLink (LgParseBonds (Phrase PLAIN-TEXT) DICT NUML)))))
1736 parses
1837)
1938
20;first in pair is wordlist, second is edgelist.
21
22; LinkValueSignatureLink ?
23; (LinkSignatureLink (TypeNode 'blah) contents)
24
2539; Parses arrive as link values. We want to apply a function to each.
26; How?
27; Need:
28; 1) execute in subspace DONE PureExecLink
29; 2) FilterLink with LinkValue signature
30; Half done. Need to support globs.
40; How? Need:
3141; 3) ConcatenateLink like AccumulatLink, but flattens
3242; 4) IncrementLinks link cog-inc-value!
3343