⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dropize_phrase_table.pl.svn-base

📁 解码器是基于短语的统计机器翻译系统的核心模块
💻 SVN-BASE
字号:
#!/usr/bin/perl#add_empties_to_phrase_table: go through an old-style pharaoh phrase table (no empty target sources) and add one such line for each single-word source phrase in the table,#complete with factors (note the number and type of factors are hardcoded here);#also add deletion-cost factors as necessary to all lines#Evan Herbst 7 / 11 / 06#usage: aetpt INPUT_PTABLE OUTPUT_PTABLEmy ($inputFile, $outputFile) = @ARGV;my $DELETIONCOST = 2.718; #weight for an individual deletionopen(INFILE, "<$inputFile") or die "couldn't open '$inputFile' for read\n";open(OUTFILE, ">$outputFile") or die "couldn't open '$outputFile' for write\n";my ($lastSrcPhrase, $srcPhrase);while(my $line = <INFILE>){	chop($line);	$lastSrcPhrase = $srcPhrase;	my @tokens = split(/\|\|\|/, $line);	$srcPhrase = $tokens[0];	if($srcPhrase ne $lastSrcPhrase && $srcPhrase =~ /^\s*\S+\s*$/) #new source phrase of a single word; add deletion line	{		print OUTFILE "$srcPhrase |||  ||| 1 1 1 1 2.718 $DELETIONCOST\n";	}	print OUTFILE "$line 1\n";}close(INFILE);close(OUTFILE);

⌨️ 快捷键说明

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