Skip to content

Instantly share code, notes, and snippets.

@cutiko
Last active February 1, 2019 20:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cutiko/e3bcaa5e0fd1feb51b2bd93aef7fafb9 to your computer and use it in GitHub Desktop.
Save cutiko/e3bcaa5e0fd1feb51b2bd93aef7fafb9 to your computer and use it in GitHub Desktop.
Simple script for spelling correction from a file

This scripts use LanguageTool for english spelling you can change it if you want to

This scripts also use Pando please make sure installing it before continue

  1. Copy the script to your bin directory, on mine is called spelling
  2. sudo chmod 755 FILENAME
  3. Use it :)
read -e -p "Which file? " file
cp $file backup_$file
echo "creating backup file"
pandoc $backup_$file -f markdown -t plain -o interpretation.txt
echo "interpretation created"
echo "contacting Language Tool, please wait "
plain=`cat interpretation.txt`
curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --data-urlencode "text=$plain" -d 'language=en-US&enabledOnly=false' 'https://languagetool.org/api/v2/check' -o spelling_errors.json
rm interpretation.txt
echo "interpretation file cleaned"
rm backup_$file
echo "backup file cleanded"
echo "opening results"
open spelling_errors.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment