#!/usr/local/bin/perl

## Create a NNP dict

use strict;
use warnings;

# binmode(STDOUT,":utf8");

my $fileName = shift;

open(IFILE, "<:encoding(utf8)",$fileName) or die("Couldn't open the file $fileName\n");
my %dict = ();
while(<IFILE>){
	chomp;
	my @tokens = split /\s+/;
	foreach my $word (@tokens){
		next unless($word =~ /__[BI]-(PER|ORG)$/);
		$word =~ s/__[BI]-(PER|ORG)$//;
		$dict{$word} = 1;
	}
}
close IFILE;

foreach my $nnp (keys %dict){
	print $nnp,"\n";
}
