From: John Benediktsson Date: Tue, 25 Jan 2022 22:30:42 +0000 (-0800) Subject: did-you-mean: prototype of a spelling corrector word search X-Git-Tag: 0.99~1641 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=ed3118f0e9dab093eaabd54adf063be8d221e36b did-you-mean: prototype of a spelling corrector word search --- diff --git a/extra/did-you-mean/authors.txt b/extra/did-you-mean/authors.txt new file mode 100644 index 0000000000..e091bb8164 --- /dev/null +++ b/extra/did-you-mean/authors.txt @@ -0,0 +1 @@ +John Benediktsson diff --git a/extra/did-you-mean/did-you-mean.factor b/extra/did-you-mean/did-you-mean.factor new file mode 100644 index 0000000000..300853630e --- /dev/null +++ b/extra/did-you-mean/did-you-mean.factor @@ -0,0 +1,12 @@ +! Copyright (C) 2022 John Benediktsson +! See http://factorcode.org/license.txt for BSD license + +USING: accessors assocs continuations kernel math +math.statistics parser sequences spelling vocabs vocabs.parser ; + +IN: did-you-mean + +: did-you-mean ( name -- words ) + dup all-words [ [ name>> ] histogram-by corrections ] keep + [ name>> swap member? ] with filter + throw-restarts no-word-restarted ;