| … | … | @@ -77,7 +77,7 @@ |
| 77 | 77 | (define (parseli phrali) |
| 78 | 78 | (PureExecLink (LgParseBonds phrali DICT NUML))) |
| 79 | 79 | |
| 80 | | ; Given an Atom `phrali` hold text to be parsed, get that text, |
| 80 | ; Given an Atom `phrali` holding text to be parsed, get that text, |
| 81 | 81 | ; parse it, and increment the counts on the edges. |
| 82 | 82 | (define (filty phrali) |
| 83 | 83 | (Filter |
| … | … | @@ -100,7 +100,18 @@ |
| 100 | 100 | (filty txt-stream) |
| 101 | 101 | ) |
| 102 | 102 | |
| 103 | | ; Demo wrapper: Parse a string. |
| 103 | ; -------------------------------------------------------------- |
| 104 | ; Demo wrapper showing how to use the above: Parse a string. |
| 105 | ; PLAIN-TEXT should be a scheme string. |
| 106 | ; |
| 107 | ; Verify this works as follows: |
| 108 | ; (obs-txt "this is a test") |
| 109 | ; (cog-report-counts) |
| 110 | ; Note the abundance of WordNodes listed in the report. |
| 111 | ; (cog-get-atoms 'WordNode) |
| 112 | ; Cleanup after use: |
| 113 | ; (for-each cog-extract-recursive! (cog-get-atoms 'WordNode)) |
| 114 | ; (extract-type 'WordNode) |
| 104 | 115 | (define (obs-txt PLAIN-TEXT) |
| 105 | 116 | |
| 106 | 117 | ; We don't need to create this over and over; once is enough. |
| … | … | @@ -113,9 +124,11 @@ |
| 113 | 124 | (cog-execute! parser) |
| 114 | 125 | |
| 115 | 126 | ; Remove the phrase-link, return the list of edges. |
| 127 | (cog-set-value! (Concept "foo") (Predicate "some place") #f) |
| 116 | 128 | (cog-extract-recursive! phrali) |
| 117 | 129 | ) |
| 118 | 130 | |
| 131 | ; -------------------------------------------------------------- |
| 119 | 132 | ; Demo wrapper: Parse contents of a file. |
| 120 | 133 | (define (obs-file FILE-NAME) |
| 121 | 134 | |