nbest-error

来自「这是一款很好用的工具包」· 代码 · 共 57 行

TXT
57
字号
#!/bin/sh## nbest-error --#	compute minimum error of nbest lists## $Header: /home/srilm/devel/utils/src/RCS/nbest-error,v 1.5 2003/01/11 01:25:44 stolcke Exp $#if [ $# -lt 2 ]; then	echo "usage: $0 score-dir refs [nbest-lattice-option ...]" >&2	echo "    or $0 file-list refs [nbest-lattice-option ...]" >&2	exit 2fiscoredir="$1"refs="$2"shift; shiftoption=-nbest-errorcase "$*" in*-lattice-error*)	option= ;;esacif [ ! -r $scoredir ]; then	echo "$0: cannot access $scoredir" >&2	exit 1fiif [ ! -r $refs ]; then	echo "$0: cannot access $refs" >&2	exit 1fiif [ -d $scoredir ]; then    find $scoredir -follow \	 	 -type f \( -name \*.score -o \			    -name \*.Z -o \			    -name \*.gz \) \		    -print | sortelse    cat $scoredirfi | \nbest-lattice -nbest-files - -refs $refs $option "$@" | \gawk '$2 ~ /^[0-9]*$/ && $10 ~ /^[0-9]*$/ && $9 == "words" {	nsents ++;	nwords += $10;	nerrors += $2;	print;}END {	printf "%d sentences, %d words, %d errors (%.2f%%)\n", \		nsents, nwords, nerrors, 100*nerrors/nwords;}'

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?