#!/usr/local/bin/perl

## Collect source sentences

use strict;
use warnings;

my $fileName = shift;
my $srcFileName = shift;

my %refs = ();
open(IFILE, $fileName) or die("Couldn't open the file $fileName\n");
while(<IFILE>){
	chomp;
	next if($_ eq '');
# 	/^<seg id="?(\d+)"?>/;
# 	$refs{$1} = 1;
	$refs{$_} = 1;
# 	print $1,"\n";
}
close IFILE;

my %hyps = ();
open(IFILE, $srcFileName) or die("Couldn't open the file $srcFileName\n");
while(<IFILE>){
	chomp;
# 	print $_,"\n";
	next unless(/^<seg id="?(\d+)"?>(.+)<\/seg>/);
# 	print $1,"\n";
# 	next unless(defined $refs{$1});
	next if(defined $refs{$1});
	print $_,"\n";
}
close IFILE;
