| … | … | @@ -326,7 +326,9 @@ class OpencogAgent: |
| 326 | 326 | self.percepta_record.append(set()) |
| 327 | 327 | self.percepta_record[i].add(timed_atom) |
| 328 | 328 | |
| 329 | | def timed_percepta_to_scheme_str(self, timed_percepta: set[Atom], with_member: bool = False) -> str: |
| 329 | def timed_percepta_to_scheme_str( |
| 330 | self, timed_percepta: set[Atom], with_member: bool = False |
| 331 | ) -> str: |
| 330 | 332 | """Convert percepta at a given cycle into a string in Scheme format. |
| 331 | 333 | |
| 332 | 334 | Percepta are preceded by a comment in human readable form. |
| … | … | @@ -338,8 +340,10 @@ class OpencogAgent: |
| 338 | 340 | |
| 339 | 341 | # Wrap member to percepta record concept around each perceptum |
| 340 | 342 | if with_member: |
| 341 | | timed_percepta = {self.add_to_percepta_atomspace(timed_perceptum) |
| 342 | | for timed_perceptum in timed_percepta} |
| 343 | timed_percepta = { |
| 344 | self.add_to_percepta_atomspace(timed_perceptum) |
| 345 | for timed_perceptum in timed_percepta |
| 346 | } |
| 343 | 347 | cmt = "\n".join(";; " + to_human_readable_str(tpm) for tpm in timed_percepta) |
| 344 | 348 | scm = "\n".join(tpm.long_string() for tpm in timed_percepta) |
| 345 | 349 | return "\n".join([cmt, scm]) |
| … | … | @@ -351,8 +355,12 @@ class OpencogAgent: |
| 351 | 355 | |
| 352 | 356 | """ |
| 353 | 357 | |
| 354 | | return "\n\n".join([self.timed_percepta_to_scheme_str(tp, with_member) |
| 355 | | for tp in self.percepta_record]) |
| 358 | return "\n\n".join( |
| 359 | [ |
| 360 | self.timed_percepta_to_scheme_str(tp, with_member) |
| 361 | for tp in self.percepta_record |
| 362 | ] |
| 363 | ) |
| 356 | 364 | |
| 357 | 365 | def add_to_percepta_atomspace(self, timed_atom: Atom) -> Atom: |
| 358 | 366 | """Add member link around timestamped atom to Percepta Atomspace. |
| … | … | @@ -524,9 +532,7 @@ class OpencogAgent: |
| 524 | 532 | # Log the percepta record in Scheme format, useful for |
| 525 | 533 | # debugging the pattern miner |
| 526 | 534 | agent_log.fine( |
| 527 | | "Percepta record:\n{}".format( |
| 528 | | self.percepta_record_to_scheme_str() |
| 529 | | ) |
| 535 | "Percepta record:\n{}".format(self.percepta_record_to_scheme_str()) |
| 530 | 536 | ) |
| 531 | 537 | |
| 532 | 538 | # All resulting cognitive schematics |