#!/bin/bash if [[ $# -ne 4 ]]; then cat <&2 out=$("$(dirname "$0")"/apertium-eval-translator -b $b "$@") cur=$(grep -m1 WER <<<"${out}") if [[ "$last" = "$cur" ]]; then echo "Stabilised; got the same result as with -beam $lastb: $cur" >&2 echo "${out}" break else echo "got $cur" >&2 lastb="$b" (( b += b )) last="$cur" fi done