URI: 
       Scale agrep errors by hashtag string length. - annna - Annna the nice friendly bot.
  HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
       ---
   DIR commit 2626d2adbaed035067dbbf759afb1edeaa388618
   DIR parent 197a022b0448e15a18957ccb5d3d91a94513ca64
  HTML Author: Annna Robert-Houdin <annna@bitreich.org>
       Date:   Sun,  7 Aug 2022 21:18:35 +0200
       
       Scale agrep errors by hashtag string length.
       
       Diffstat:
         M annna-meme-recommend                |      24 +++++++++++++++++++++++-
       
       1 file changed, 23 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/annna-meme-recommend b/annna-meme-recommend
       @@ -12,8 +12,30 @@ hashtagfile="$HOME/bin/modules/hashtags/hashtags.txt"
        
        hashtag="$1"
        
       +# Scale allowed errors by input hashtag length.
       +hashtaglen=$(($(utf8expr length "$hashtag") - 1))
       +case $hashtaglen in
       +0|1)
       +        nerrors=1;;
       +2|3)
       +        nerrors=2;;
       +4|5)
       +        nerrors=3;;
       +6|7)
       +        nerrors=4;;
       +8|9)
       +        nerrors=5;;
       +10|11)
       +        nerrors=6;;
       +12|13)
       +        nerrors=7;;
       +*)
       +        nerrors=8;;
       +esac
       +
       +
        # n differences == -4; up to 8
       -agrep -i -4 "^#${hashtag} " "${hashtagfile}" \
       +agrep -i -$nerrors "^#${hashtag} " "${hashtagfile}" \
                | head -n 5 \
                | cut -d' ' -f 1 \
                | tr "\n" " "