#!/usr/bin/perl -s 
use strict;
use warnings;
use Lingua::Jspell 'any2str';

our ($comp, $p,$d);

$d ||= "port";

my $pt = Lingua::Jspell->new($d, $p);

while(<>){
 chomp; 
 next if /^#/;
 next unless /\S/;
 my ($p,$c,$fs)=split(/\//,$_);
 for my $w ($pt->der($p)){
   if($comp){ print join("\n", (map {"$w $_"} $pt->featags($w))),"\n";}
   else     { print join("\n", (map {"$w ".any2str($_,'compact')}  $pt->fea($w))),"\n";}
 } 
}

=head1 NAME

jspell-dump

=head1 SYNOPSIS

  jspell-dump [-d port] [-p personal] [-comp]

=head1 DESCRIPTION

This tool receives a set of words fron standard input (one work per line), and
prints all derived words (together with their morphological analysis), one per line.

The tool is prepared to receive as input the source dictionary for a jspell dicitonary.
In this case, all recognized words are printed, together with their morphological analysis.

Recognized options are:

=over 4

=item C<-d>

Used to specify the dictionary to used. By default the portuguese dictionary will be used.

=item C<-p>

Used to specify a personal dictionary.

=item C<-comp>

When used, instead of the full morphological analysis, a compact tag will be used.

=back

=head1 SEE ALSO

Lingua::Jspell

=head1 AUTHOR

José João Almeira E<lt>jj@di.uminho.ptE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2009 by Projecto Natura

=cut


