如何运行CMU Phoenix Parser

时间:2013-05-30 00:27:28

标签: parsing compilation

我需要使用CMU Phoenix语义解析器。

在其文档中,它没有提供有关编译语法所需的程序/编译器的信息。编译脚本粘贴在下面。如果你能确定它是什么类型的脚本,你可以帮助我。

我使用的是Windows 7.包含以下代码的文件没有任何扩展名。在解析器的手册中,它只是声明通过从命令行写入文件名来运行该文件。我从命令行转到该文件所在的目录,但是当我调用compile命令时它什么也没做。它只是给出错误,没有名为compile的命令。

如果这是一个perl脚本(我不确定),我的计算机上安装了Perl。只是解析器用C编写的额外信息。

如果您推荐任何源或教程来运行此解析器,我将不胜感激。

由于

#!/bin/tcsh

# compile grammars in .
# put compiled nets in file $TASK.net
# set PHOENIX to point to root of Phoenix system
# set LIBS to .gra files to load from $PHOENIX/Grammars
# if SingleFile == 1, then all grammar rules are in file $TASK.gra
# if SingleFile == 0, then compiles all files in dir with extension .gra

set TASK="EX"
set LIBS="date_time.gra number.gra next.gra"
set PHOENIX="../../../Phoenix"
@ SingleFile = 0

set DIR=`pwd`

# if separate files, pack into single file
if( $SingleFile == 0 ) then
#   if file exists, save it as *.old
if ( -e $TASK.gra )  then
    mv $TASK.gra $TASK.gra.old
endif
cat *.gra > xxx
mv xxx $TASK.gra
endif

# append lib grammars to file
cd $PHOENIX/Grammars
cat $LIBS >> $DIR/$TASK.gra
cd $DIR

# remove old compiled files
rm base.dic
rm nets
rm log
rm $TASK.net

# create list of nets to be compiled
cat $TASK.gra | $PHOENIX/Scripts/mk_nets.perl > nets

# compile grammar output messages to file "log"
echo "compiling grammar"
$PHOENIX/ParserLib/compile_grammar -f $TASK > log
grep ERROR log
grep WARN log

# flag leaf nodes for extracts function
echo "flagging leaf nodes"
$PHOENIX/ParserLib/concept_leaf -grammar $TASK.net

1 个答案:

答案 0 :(得分:0)

这是一个Linux shell脚本。您应该在Linux机器,虚拟Linux机器或Cygwin下运行它。

谷歌这三个解决方案,并检查哪一个最适合你。