| … | … | @@ -8,26 +8,36 @@ |
| 8 | 8 | (define DICT (LgDict "any")) |
| 9 | 9 | |
| 10 | 10 | |
| 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 | ; |
| 11 | 26 | (define (obs-txt PLAIN-TEXT) |
| 12 | 27 | (define parses (cog-execute! |
| 13 | 28 | (Filter |
| 14 | | (Signature |
| 15 | | (Type 'LinkValue)) |
| 29 | (Lambda |
| 30 | (Variable "$x") |
| 31 | (LinkSignature |
| 32 | (Type 'LinkValue) |
| 33 | (Type 'LinkValue) |
| 34 | (Variable "$x"))) |
| 16 | 35 | (PureExecLink (LgParseBonds (Phrase PLAIN-TEXT) DICT NUML))))) |
| 17 | 36 | parses |
| 18 | 37 | ) |
| 19 | 38 | |
| 20 | | ;first in pair is wordlist, second is edgelist. |
| 21 | | |
| 22 | | ; LinkValueSignatureLink ? |
| 23 | | ; (LinkSignatureLink (TypeNode 'blah) contents) |
| 24 | | |
| 25 | 39 | ; 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: |
| 31 | 41 | ; 3) ConcatenateLink like AccumulatLink, but flattens |
| 32 | 42 | ; 4) IncrementLinks link cog-inc-value! |
| 33 | 43 | |