| … | … | @@ -25,19 +25,33 @@ |
| 25 | 25 | ; |
| 26 | 26 | (define (obs-txt PLAIN-TEXT) |
| 27 | 27 | |
| 28 | | (define parser |
| 28 | (define (incr-cnt edge) |
| 29 | (SetValue edge (Predicate "count") |
| 30 | (Plus (Number 0 0 1) |
| 31 | (Cond (FloatValueOf edge (Predicate "count")) |
| 32 | (FloatValueOf edge (Predicate "count")) |
| 33 | (FloatValueOf (Number 0 0 0)))))) |
| 34 | |
| 35 | (define parseli |
| 29 | 36 | (PureExecLink (LgParseBonds (Phrase PLAIN-TEXT) DICT NUML))) |
| 30 | | (define filt |
| 37 | (define filty |
| 31 | 38 | (Filter |
| 32 | | (Lambda |
| 33 | | (Variable "$x") |
| 39 | (Rule |
| 40 | ; Type decl |
| 41 | (Glob "$x") |
| 42 | ; Match clause - one per parse. |
| 34 | 43 | (LinkSignature |
| 35 | | (Type 'LinkValue) |
| 36 | | (Type 'LinkValue) |
| 37 | | (Variable "$x"))) |
| 38 | | parser)) |
| 44 | (Type 'LinkValue) ; the wrapper for the pair |
| 45 | (Type 'LinkValue) ; the word-list |
| 46 | (LinkSignature ; the edge-list |
| 47 | (Type 'LinkValue) ; edge-list wrapper |
| 48 | (Glob "$x"))) ; all of the edges |
| 49 | ; Rewrite |
| 50 | (incr-cnt (Glob "$x")) |
| 51 | ) |
| 52 | parseli)) |
| 39 | 53 | |
| 40 | | (define parses (cog-execute! filt)) |
| 54 | (define parses (cog-execute! filty)) |
| 41 | 55 | parses |
| 42 | 56 | ) |
| 43 | 57 | |