; Linas's grammatical-MI similarity, with exactly the fixed stage-E recipe of oracle/g0.scm, on a small
; set of Sections. Prints <a>\t<b>\t<fmi>\t<rmi> for every word pair. Used only to check cover.c.
; guile linas_sim_tiny.scm <sections.scm> <shim.scm> <scratch-rocks-dir>
(use-modules (opencog) (opencog persist) (opencog persist-rocks) (opencog lg) (opencog matrix) (opencog learn) (srfi srfi-1))
(define args (cdr (command-line)))
(load (list-ref args 1))
(define rsn (RocksStorageNode (string-append "rocks://" (list-ref args 2))))
(cog-open rsn)
(load (list-ref args 0))
(define pca (make-pseudo-cset-api))
(define pcs (add-pair-stars (add-count-api pca)))
(define sha (add-count-api (shim-cover-pair-count (add-covering-sections pcs))))
(sha 'explode-sections)
((add-support-compute sha) 'cache-all)
((batch-transpose sha) 'mmt-marginals)
(define smi (add-symmetric-mi-compute sha))
(define words (sort (map cog-name ((add-pair-stars sha) 'left-basis)) string<?))
(for-each (lambda (a)
(for-each (lambda (b)
(when (string<=? a b)
(format #t "~A\t~A\t~A\t~A\n" a b (smi 'mmt-fmi (Word a) (Word b)) (smi 'mmt-rmi (Word a) (Word b)))))
words))
words)
(cog-close rsn)