<commit_before>;
; parse-rank.scm
;
; Provide a score for a link-grammar parse, based on how well it matches
; a minimum spanning tree formed from word-pair mutual information.
;
; Requires access to a database containing previously computed word-pair
; mutual information values.
; 
; Copyright (c) 2008 <NAME> <<EMAIL>>
;
; login information and database
(define db-login "linas:asdf:lexat:tcp:localhost:5432")

; (use-modules (dbi dbi))
; (define db-connection (dbi-open "postgresql" db-login))

; Loop over SentenceNode
(define (prt-sent h) (display h) #f)

(define (prt-stuff h) (display (cog-incoming-set h)) #f)

(cog-map-type prt-stuff  'SentenceNode)

; need to look for ParseLink in the incoming set

(define (filter-plink proc data) 
	(cond 
		((null? data) #f)
		((eq? (caar data) 'ParseLink) 
			(display "hola") ) 
		(else (display "boogaloo") )
	)
	(filter-plink proc (cdr data))
	#f)

(define (filter-plink proc data) (display data) #f)
(define (filter-plink proc data) (display (pair? (car data))) #f)


(define (prt-stuff h) (filter-plink #t (cog-incoming-set h)) #f)<commit_msg>start implementation of prse ranking.<commit_after>;
; parse-rank.scm
;
; Provide a score for a link-grammar parse, based on how well it matches
; a minimum spanning tree formed from word-pair mutual information.
;
; Requires access to a database containing previously computed word-pair
; mutual information values.
; 
; Copyright (c) 2008 <NAME> <<EMAIL>>
;
; login information and database
(define db-login "linas:asdf:lexat:tcp:localhost:5432")

; (use-modules (dbi dbi))
; (define db-connection (dbi-open "postgresql" db-login))

(define (do-stuff h) (display "zoom\n") #f)

; Look for ParseLink's in the incoming set
(define (process-parses h) 
	(cog-filter 'ParseLink do-stuff (cog-incoming-set h))
	#f
)

; Loop over all atoms of type SentenceNode, processing 
; each corresponding parse.
(cog-map-type process-parses 'SentenceNode)


{'fraction_non_alphanumeric': 0.13047962867457452, 'fraction_numerical': 0.008251676121712223, 'mean_word_length': 4.542857142857143, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3485956', 'n_tokens_mistral': 703, 'n_tokens_neox': 666, 'n_words': 225}