<commit_before>(define (do-fuzzy-QA)
    (State fuzzy-qa-search search-started)

    (begin-thread
        (let* ((sent-node (get-input-sent-node))
               (fuz-ans (get-fuzzy-answers sent-node #:do-microplanning #f)))
            (if (null? fuz-ans)
                (State fuzzy-answers no-fuzzy-answers)

                ; Fuzzy matcher may return more than one answers that has the
                ; same score, randomly pick one of them if so
                (let* ((ans (list (list-ref fuz-ans (random (length fuz-ans)))))
                       (ans-in-words (List (map Word ans))))
                    (State fuzzy-answers ans-in-words)

                    ; TODO: Create a new psi-rule for this QA in the OpenCog AIML format
                )
            )

(newline)
(display "----------> Fuzzy answers:\n")
(display (car (append (cog-chase-link 'StateLink 'ListLink fuzzy-answers)
    (cog-chase-link 'StateLink 'ConceptNode fuzzy-answers))))
(newline)

        )
    )
)

(define (do-aiml-search)
    (State aiml-search search-started)

    (begin-thread
        (let ((aiml-resp (aiml-get-response-wl (get-input-word-list))))
            ; No result if it's a ListLink with arity 0
            (if (equal? (cog-arity aiml-resp) 0)
                (State aiml-replies no-aiml-reply)
                (State aiml-replies aiml-resp)
            )<commit_msg>Split the ans into words<commit_after>(define (do-fuzzy-QA)
    (State fuzzy-qa-search search-started)

    (begin-thread
        (let* ((sent-node (get-input-sent-node))
               (fuz-ans (get-fuzzy-answers sent-node #:do-microplanning #f)))
            (if (null? fuz-ans)
                (State fuzzy-answers no-fuzzy-answers)

                ; Fuzzy matcher may return more than one answers that has the
                ; same score, randomly pick one of them if so
                (let* ((ans (list (list-ref fuz-ans (random (length fuz-ans)))))
                       (ans-in-words (List (map Word (string-split (car ans) #\ )))))
                    (State fuzzy-answers ans-in-words)

                    ; TODO: Create a new psi-rule for this QA in the OpenCog AIML format
                )
            )

(newline)
(display "----------> Fuzzy answers:\n")
(display (car (append (cog-chase-link 'StateLink 'ListLink fuzzy-answers)
    (cog-chase-link 'StateLink 'ConceptNode fuzzy-answers))))
(newline)

        )
    )
)

(define (do-aiml-search)
    (State aiml-search search-started)

    (begin-thread
        (let ((aiml-resp (aiml-get-response-wl (get-input-word-list))))
            ; No result if it's a ListLink with arity 0
            (if (equal? (cog-arity aiml-resp) 0)
                (State aiml-replies no-aiml-reply)
                (State aiml-replies aiml-resp)
            )
{'fraction_non_alphanumeric': 0.13038793103448276, 'fraction_numerical': 0.0014367816091954023, 'mean_word_length': 1.7877877877877877, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1866267', 'n_tokens_mistral': 955, 'n_tokens_neox': 873, 'n_words': 236}