Paste: simple string similarity
Author: | randy7 |
Mode: | factor |
Date: | Mon, 26 Jan 2009 11:02:18 |
Plain Text |
USING: grouping kernel math sequences sets unicode.case ;
: similarity ( string string -- n )
[ >upper 2 clump ] bi@ [ intersect length 2 * ] 2keep
[ length ] bi@ + / ;
Author: | randy7 |
Mode: | factor |
Date: | Mon, 26 Jan 2009 12:04:16 |
Plain Text |
USING: kernel math sequences splitting ;
: (one-result) ( item seq -- n )
swap [ = ] curry map
[ [ ] filter length ] [ length ] bi / ;
: sentence-similarity ( sentence sentence -- n )
[ " " split ] bi@
'[ _ (one-result) ] map sum ;
New Annotation