#!/usr/bin/perl -w
# nerHide: perform named entity tagging and hide results in xml tag
# usage: nerHide < file
# 20050413 erikt@science.uva.nl

$ner = "/home/erikt/projects/clef/bin/ner";

$command = $0;

# perform named entity tagging
open(INFILE,"$ner |") or 
   die "$command: cannot run named entity tagger $ner\n";
while (<INFILE>) {
   $line = $_;
   chomp($line);
   if ($line =~ /^<.*>$/) { print "$line\n"; next; }
   @words = split(/\s+/,$line);
   @tags = ();
   for ($i=0;$i<=$#words;$i++) { 
      ($words[$i],$tags[$i]) = split(/\/+/,$words[$i]);
   }
   # show sentence
   $line = join(" ",@words);
   print "$line\n"; 
   # show NE tags
   $line = join("/",@tags);
   print "<$line>\n";
}
close(INFILE); 

exit(0);

