#!/usr/bin/perl

use strict;
use Text::ChaSen qw(:all);

my %wordcheck;
my @namelist;
getopt_argv('chasen','-F','%m ');

while(my $line = <>){
	chomp($line);chomp($line);
	next if($line =~ /^;/);
	my($yomi,$word)=split(/\s/,$line,2);
	foreach(split(/\//,$word)){
		next unless $_;
		my($str,$hinshi)=split(/;/,$_);
		next if($wordcheck{$str}++);
		
		my @wakachi = split(/[\n\s]/,sparse_tostr($str));
		#print qq($str:$wakachi[0]:\n);
		next if($str eq $wakachi[0]);

		if($hinshi eq "人名 姓"){
			$hinshi = "人名 姓";
		}elsif($hinshi eq "名" || $hinshi eq "人名"){
			$hinshi = "人名 名";
		}else{
			$hinshi = "人名 一般";
		}
		my $cost=3500;
		$cost=3200 if(length($str) > 4);
		print <<EOF;
(品詞 (名詞 固有名詞 $hinshi)) ((見出し語 ($str $cost)) (読み $yomi))
EOF
	}
	
}


