Skip to content

Commit

Permalink
Fix up one of teh sentence utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
linas committed Dec 7, 2013
1 parent baaf281 commit 561f705
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions opencog/nlp/scm/nlp-utils.scm
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,18 @@
; other than #f. This routine returns the last value that stopped the
; recusrsion.
;
(define (map-parses proc sent)
(if (not (eq? (cog-type sent) 'SentenceNode))
(throw 'wrong-atom-type 'map-parses
"Error: expecting SentenceNode" sent)
)
(cog-map-chase-link-dbg 'ParseLink ParseAnchor
" ========= sentence ============ \n" ""
proc sent
(define (map-parses proc sent-or-list)
(if (list? sent-or-list)
(map (lambda (one-sent) (map-parses proc one-sent)) sent-or-list)
; if we are here, its not a list.
(if (eq? (cog-type sent-or-list) 'SentenceNode)
(cog-map-chase-link 'ParseLink ParseAnchor
proc sent-or-list
)
; If we are here, its not a sentence
(throw 'wrong-atom-type 'map-parses
"Error: expecting SentenceNode" sent-or-list)
)
)
)

Expand Down

0 comments on commit 561f705

Please sign in to comment.