| … | … | @@ -14,9 +14,9 @@ |
| 14 | 14 | ; The steps proceed as follows: |
| 15 | 15 | ; 1) Example of using the Link Grammar parser to generate word-pairs. |
| 16 | 16 | ; 2) A debug printing utility. |
| 17 | | ; 3) Using filters to extract subelements of a data stream. |
| 17 | ; 3) Using filters to extract sub-elements of a data stream. |
| 18 | 18 | ; 4) Using filters to increment counts on elements of a data stream. |
| 19 | | ; 5) Reading text from a file. |
| 19 | ; 5) Reading text from a file, and running it through the pipe. |
| 20 | 20 | ; |
| 21 | 21 | (use-modules (opencog) (opencog exec) (opencog persist)) |
| 22 | 22 | (use-modules (opencog nlp) (opencog nlp lg-parse)) |
| … | … | @@ -284,6 +284,13 @@ |
| 284 | 284 | ; That's it. Now wire it all together: |
| 285 | 285 | (cog-execute! (edge-filter parse-stream edge-counter)) |
| 286 | 286 | |
| 287 | ; If end-of-file is hit while experimenting, rest to the begining, |
| 288 | ; be re-opening the file: |
| 289 | (cog-execute! |
| 290 | (SetValue (Anchor "pipe demo") (Predicate "text src") |
| 291 | (Open (Type 'TextFileStream) |
| 292 | (Sensory "file:///tmp/demo.txt")))) |
| 293 | |
| 287 | 294 | ; Note the actual flow is different from the how this is written, above. |
| 288 | 295 | ; First, the parse stream flows to the edge-filter, and then the |
| 289 | 296 | ; edge-counter runs. Some twiddling about in scheme could straighten |