open my $termino, "$ARGV[1]";
@patrons=<$termino>;
close $termino;

open my $entree, "$ARGV[0]";
@pos=();
@token=();
while (my $ligne=<$entree>) {

	next if $ligne=~m/^#|\d+-\d+/ ;
	$ligne=~s/\r?\n//g;
	if ($ligne ne "") {
	my @ligne = split /\t/, $ligne;
	push @pos, $ligne[3];
	push @token, $ligne[1];
	}

	else {
	foreach my $suitedepos (@patrons) {
		$long=0;
		$suitedepos=~s/\r?\n//g;
		while ($suitedepos=~/ /g) {$long++}
		$i=0;
		foreach my $element (@pos) {
			$i++;
			if ($suitedepos =~/^$element/) {
			$suite="";		
			for ($j=$i-1;$j<=$long+$i-1;$j++) {$suite=$suite.$pos[$j]." "}
			if ($suite=~/$suitedepos/) {

				$extract = join(" ", @token[$i-1..$j-1]);
				$dict{lc($extract)}++;
				print "$extract\n";
					}
				}
			}
		}
		
	@pos=();
	@token=();
	}
}
