From ed3118f0e9dab093eaabd54adf063be8d221e36b Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Tue, 25 Jan 2022 14:30:42 -0800 Subject: [PATCH] did-you-mean: prototype of a spelling corrector word search --- extra/did-you-mean/authors.txt | 1 + extra/did-you-mean/did-you-mean.factor | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 extra/did-you-mean/authors.txt create mode 100644 extra/did-you-mean/did-you-mean.factor 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 ; -- 2.34.1