[marf-cvs] apps/ProbabilisticParsingApp Makefile,1.29,1.30 ProbabilisticParsingApp.java,1.34,1.35 te
Brought to you by:
mokhov
From: Serguei A. M. <mo...@us...> - 2006-01-30 03:51:18
|
Update of /cvsroot/marf/apps/ProbabilisticParsingApp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv515 Modified Files: Makefile ProbabilisticParsingApp.java testing.sh Log Message: Add more save and logical extraction of the filename argument in the application from the invalid option set instead of a hardcoded assumption. Improve the `test' target with more comprehensive test suite and add the `expected' directory to the distros. Rewrite testing.sh in bash and add an "--all" option to it to enable automated testing with all possible option combinations. Index: ProbabilisticParsingApp.java =================================================================== RCS file: /cvsroot/marf/apps/ProbabilisticParsingApp/ProbabilisticParsingApp.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** ProbabilisticParsingApp.java 29 Jan 2006 22:10:43 -0000 1.34 --- ProbabilisticParsingApp.java 30 Jan 2006 03:51:09 -0000 1.35 *************** *** 4,7 **** --- 4,8 ---- import java.io.StringReader; import java.util.Hashtable; + import java.util.NoSuchElementException; import java.util.Vector; *************** *** 204,208 **** { // Grammar filename ! String strFilename = argv[argv.length - 1]; oProbabilisticParser = new ProbabilisticParser(strFilename); --- 205,209 ---- { // Grammar filename ! String strFilename = (String)soGetOpt.getInvalidOptions().firstElement(); oProbabilisticParser = new ProbabilisticParser(strFilename); *************** *** 246,250 **** } } ! catch(ArrayIndexOutOfBoundsException e) { System.err.println("Missing required argument."); --- 247,251 ---- } } ! catch(NoSuchElementException e) { System.err.println("Missing required argument."); Index: Makefile =================================================================== RCS file: /cvsroot/marf/apps/ProbabilisticParsingApp/Makefile,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Makefile 29 Jan 2006 22:10:43 -0000 1.29 --- Makefile 30 Jan 2006 03:51:09 -0000 1.30 *************** *** 61,65 **** .classpath .project Makefile manifest.mf \ README coding.html COPYRIGHT \ ! data grammars bundle: src binary --- 61,65 ---- .classpath .project Makefile manifest.mf \ README coding.html COPYRIGHT \ ! data grammars expected bundle: src binary *************** *** 73,77 **** COPYRIGHT README \ $(EXE).jar testing.sh \ ! marf.jar data grammars copyright: ../../marf/COPYRIGHT --- 73,77 ---- COPYRIGHT README \ $(EXE).jar testing.sh \ ! marf.jar data grammars expected copyright: ../../marf/COPYRIGHT *************** *** 90,98 **** test: all ! @echo "Tesing has begun... Please wait as this may take a while (~1 hour)." time ./testing.sh > testing.log 2>&1 rm -rf current && mkdir -p current mv grammars/*.log current ! diff --exclude CVS -rcb expected current @echo "Tests seem to have succeeded and are within the range." --- 90,99 ---- test: all ! @echo "Tesing has begun... Please wait as this may take a while." time ./testing.sh > testing.log 2>&1 + time ./testing.sh --all >> testing.log 2>&1 rm -rf current && mkdir -p current mv grammars/*.log current ! diff --exclude CVS -rub expected current @echo "Tests seem to have succeeded and are within the range." Index: testing.sh =================================================================== RCS file: /cvsroot/marf/apps/ProbabilisticParsingApp/testing.sh,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** testing.sh 29 Jan 2006 22:10:43 -0000 1.34 --- testing.sh 30 Jan 2006 03:51:09 -0000 1.35 *************** *** 1,35 **** ! #!/bin/tcsh -f ! #set options = "-char -interactive" ! echo "Making sure java files get compiled..." ! make ! if($? != 0) then ! echo "Make failed." ! exit 1 ! endif ! echo "Testing..." ! foreach grammar ( grammars/grammar.*.txt ) ! echo "Compiling grammar: $grammar" ! java -ea -cp .:marf.jar ProbabilisticParsingApp --train "$grammar" >&! "$grammar.log" ! echo -n "Parsing..." ! if("$grammar" == "grammars/grammar.asmt.txt") then ! time java -ea -cp .:marf.jar ProbabilisticParsingApp --parse < "data/asmt-sentences.txt" >&! "$grammar-parse.log" ! else ! time java -ea -cp .:marf.jar ProbabilisticParsingApp --parse < "data/test-sentences.txt" >&! "$grammar-parse.log" ! endif ! echo "Done" ! echo "Look for parsing results in $grammar-parse.log\n" ! end echo "Testing done." --- 1,93 ---- ! #!/bin/bash ! # ! # Batch Processing of All Grammars and Test Sentences ! # ! # Copyright (C) 2003 Serguei Mokhov ! # Copyright (C) 2003 - 2006 The MARF Research and Development Group ! # ! # $Header$ ! # ! #options="-char -interactive" ! function testApp() ! { ! echo "Testing with options: $* ..." ! strLogOptions=`echo "$*" | sed 's/ /\n/g' | sort -u | perl -e 'while(<STDIN>){chomp; print}'` ! for grammar in grammars/grammar.*.txt ; ! do ! echo -n "Compiling grammar: $grammar... " ! if [ -e "$grammar$strLogOptions.log" ]; then ! echo "already done per $grammar$strLogOptions.log" ! return 0; ! fi ! java -ea -Xmx512m -cp .:marf.jar \ ! ProbabilisticParsingApp --train $* "$grammar" \ ! > "$grammar$strLogOptions.log" 2>&1 ! echo "Done." ! echo "Parsing..." ! ! if [ -e "$grammar-parse$strLogOptions.log" ]; then ! echo "Parse for this set of options is already done per $grammar-parse$strLogOptions.log" ! return 0; ! fi ! if [ "$grammar" == "grammars/grammar.asmt.txt" ]; then ! time java -Xmx512m -ea -cp .:marf.jar \ ! ProbabilisticParsingApp --parse $* \ ! < "data/asmt-sentences.txt" \ ! > "$grammar-parse$strLogOptions.log" 2>&1 ! else ! time java -Xmx512m -ea -cp .:marf.jar \ ! ProbabilisticParsingApp --parse $* \ ! < "data/test-sentences.txt" \ ! > "$grammar-parse$strLogOptions.log" 2>&1 ! fi ! ! echo "Done" ! echo "Look for parsing results in $grammar-parse$strLogOptions.log\n" ! ! done ! return 0 ! } ! # ! # Main ! # ! echo "Making sure java files get compiled..." ! make ! ! if [ $? != 0 ]; then ! echo "Make failed." ! exit 1 ! fi ! ! echo "Testing..." ! ! if [ "$1" == "--all" ]; then ! for option1 in "-case" "-num" "-quote" "-eos" ; ! do ! for option2 in "-case" "-num" "-quote" "-eos" ; ! do ! for option3 in "-case" "-num" "-quote" "-eos" ; ! do ! for option4 in "-case" "-num" "-quote" "-eos" ; ! do ! testApp $option1 $option2 $option3 $option4 ! done ! done ! done ! done ! else ! testApp ! fi echo "Testing done." |