AI-MicroStructure

 view release on metacpan or  search on metacpan

bin/leo  view on Meta::CPAN

#!/bin/bash
if [ -z "${1}" ]; then
    search='oil'
else
    search=${1}
fi
if [ -z "${2}" ]; then
    from='en'
else
    from=${2}
fi

if [ -z "${3}" ]; then
    to='de'
else
    to=${3}
fi

onetwo='.{1,2}'
re="$1"
re="${re//[^abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]/.}"
re="${re//ue/$onetwo}"
re="${re//ae/$onetwo}"
re="${re//oe/$onetwo}"
re="${re//ss/$onetwo}"

# have to use perl for grepping because of umlauts

q=$(lynx -dump -nolist  'http://dict.leo.org/'$from$to'?lp='$from$to'&lang='$from'&searchLoc=0&cmpType=strict&sectHdr=on&spellToler=on&search='$search'&relink=on' | perl -n -e "print if /$re/i")
#perl -MHTML::Entities  -le ' print \$q,encode_entities(\$q),\n';

#echo "$q";

perl  -MEncode -le "print decode('utf-8','$q');";

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.541 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )