OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-agents commits / a99a90a

Update, because the file API changed.
a99a90a21b1503f17bc3dca8dc5465aa7c25948c
by Linas Vepštas <linasvepstas@gmail.com> · 2024-05-02T17:20:38.000Z

Changed files (2) +7 -11

scm/pair-agent/count-agent.scm +6 -10
……@@ -9,7 +9,7 @@
99; This source blocks if there's nothing to be read; else it
1010; returns the next PhraseNode. The SRFI's call this a generator.
1111; For now, see `sensory.scm` module and example.
12; It uses a FileReadNode to loop voer a text file.
12; It uses a FileReadNode to loop over a text file.
1313; 2) (Optional) Some way to split one source into multiple sources.
1414; Maybe this:
1515; https://wiki.opencog.org/w/PromiseLink#Multiplex_Example
……@@ -29,7 +29,7 @@
2929; The below demos this design.
3030;
3131; Open issues:
32; *) Need to call cog-execute! in a loop to loop over whole file.
32; *) Need to call cog-execute! in a loop, to loop over whole file.
3333; Would be nicer to not have to do this.
3434; *) End-of-file results in a throw from parser. This is a side
3535; effect. We need some proper end-of-file handling.
……@@ -137,15 +137,11 @@
137137 (define txt-stream (ValueOf (Concept "foo") (Predicate "some place")))
138138 (define parser (make-parser txt-stream))
139139
140 (define phrali (FileRead (string-append "file://" FILE-NAME)))
140 (define phrali (Open (Type 'TextFileStream)
141 (Sensory (string-append "file://" FILE-NAME))))
141142
142 ; This will do the trick to set the value. Except it creates an Atom
143 ; (cog-execute!
144 ; (SetValue (Concept "foo") (Predicate "some place")
145 ; (FileRead "file:///tmp/demo.txt")))
146 ; Same as bove, without creating Atom.
147 (cog-set-value! (Concept "foo") (Predicate "some place")
148 (cog-execute! phrali))
143 (cog-execute!
144 (SetValue (Concept "foo") (Predicate "some place") phrali))
149145
150146 ; Parse only first line of file:
151147 ; (cog-execute! parser)
scm/pair-agent/generate-agent.scm +1 -1
……@@ -26,7 +26,7 @@ subset of all possible edges. This will be called the "focus set" or the
2626iterated and sorted into high-to-low MI order. This provides a weighted
2727distribution, from which a rescaled uniform-random choice can be made.
2828
292) Random sample N out of full incomng set.
292) Random sample N out of full incoming set.
3030
3131
3232Lets steam-process this: Query returns list of edges