Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use wordnet instead of spell to find English words #3242

Merged
merged 3 commits into from Jul 3, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
37 changes: 33 additions & 4 deletions util/fp-finder/spell.sh
@@ -1,7 +1,36 @@
#!/bin/bash

if ! command -v spell > /dev/null 2>&1; then
echo "This program requires spell to be installed. Aborting"
# This program uses WordNet to find English words. The WorNet license:
theseion marked this conversation as resolved.
Show resolved Hide resolved

# WordNet Release 3.0 This software and database is being provided to you,
# the LICENSEE, by Princeton University under the following license.
# By obtaining, using and/or copying this software and database, you agree that you have read,
# understood, and will comply with these terms and conditions.: Permission to use, copy,
# modify and distribute this software and database and its documentation for any purpose and
# without fee or royalty is hereby granted, provided that you agree to comply with
# the following copyright notice and statements, including the disclaimer, and that the same
# appear on ALL copies of the software, database and documentation, including modifications
# that you make for internal use or for distribution.
# WordNet 3.0 Copyright 2006 by Princeton University.
# All rights reserved.
# THIS SOFTWARE AND DATABASE IS PROVIDED "AS IS" AND PRINCETON UNIVERSITY MAKES NO REPRESENTATIONS
# OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PRINCETON UNIVERSITY
# MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCHANT- ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE
# OR THAT THE USE OF THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD
# PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
# The name of Princeton University or Princeton may not be used in advertising or publicity
# pertaining to distribution of the software and/or database. Title to copyright in this
# software, database and any associated documentation shall at all times remain with
# Princeton University and LICENSEE agrees to preserve same.

if ! command -v wn > /dev/null 2>&1; then
cat <<EOF
This program requires WordNet to be installed. Aborting.

The WordNet shell utility 'wn' can be obtained via the package
manager of your choice (the package is usually called 'wordnet').
EOF

exit 1
fi

Expand All @@ -14,8 +43,8 @@ check() {
fi

for word in $(grep -E '^[a-z]+$' "${datafile}" | uniq | sort); do
IS_NOT_ENGLISH=$(echo "${word}" | spell | wc -l)
if [ "${IS_NOT_ENGLISH}" -lt 1 ]; then
# wordnet exit code is equal to number of search results
if ! wn "${word}"> /dev/null 2>&1; then
if ! ${MACHINE_READABLE}; then
printf " \`- found English word: "
fi
Expand Down