#!/usr/local/bin/perl

# ./make-noun-entries.pl < noun-list.txt >! noun.trf

# Uncomment to create noun lexical entries which are approximately correct, 
# some will need revision, since gender and number will not always be correct
while (<>){
    @fields = split " ", $_;
#    for ($i = 0; $i < @fields; $i++) {
#	print "$fields[$i]\n";
#    }

    $fields[0] =~ tr/A-z/a-z/;

    print "N::N |: [$fields[0]] -> [$fields[1]]
(
(X1::Y1)
((x0 form) = $fields[0])
((x0 agr pers) = 3)\n";

    $last_char = chop($fields[1]);
    if ($last_char eq "s") {
	print "((x0 agr num) = pl)\n";
	$plast_char = chop($fields[1]); # it now has one less character
	if ($plast_char eq "a") {
	    print "((x0 agr gen) = fem)\n";
	} else {
	    print "((x0 agr gen) = masc)\n";
	}
    }
    else {
        print "((x0 agr num) = sg)\n";
	if ($last_char eq "a") {
	    print "((x0 agr gen) = fem)\n";
	} else {
	    print "((x0 agr gen) = masc)\n";
	}
    }
    # if there is another field (semtype), output it
    if ($fields[2] ne ""){
	print "((x0 semtype) = $fields[2])\n)\n\n";
    } else {
	print ")\n\n";
    }

}
# this creates, an entry like the following:
#N::N |: [school] -> [escuela]
#(
#(X1::Y1)
#((x0 form) = school)
#((x0 agr pers) = 3)
#((x0 agr num) = sg)
#((x0 agr gen) = fem)
#((x0 semtype) = loc)
#)







