#!/usr/bin/perl use MLDBM qw(DB_File); #use DBM_Filter; use DB_File; use utf8::all; use Data::Dumper; use Storable ; use Fcntl ; use dpl; use Lingua::Jspell; my $pt=Lingua::Jspell->new("port"); my $file = shift; &dpl::plexinit($file); my $parser=new dpl::grammar; my %h; tie %h, MLDBM, "$file.Xdb", O_RDWR|O_CREAT|O_TRUNC, 0644, $DB_BTREE or die $! ; # $x->Filter_Push("utf8"); # this is the magic bit #dpl::grammar::setMetaProcessFunction(sub { store(shift,"$file.store") }); dpl::grammar::setMetaProcessFunction( sub { $h{'!meta'}=shift; #print STDERR Dumper($h{'!meta'}); }); dpl::grammar::setDictProcessFunction(sub { for (@{$_[0]}) { $name = $_->{'!name'}; delete $_->{'!name'}; $tmp = [@{$h{$name}}, $_ ] ; $h{$name} = $tmp; } }); $parser -> YYParse(yylex=>\&dpl::yylex, yyerror=>\&dpl::yyerror); untie %h; rename "$file.Xdb", "$file.db"; my $d1 = dpl::opendb("$file"); open A,">", "$file.Xwrdlst" or die "cant open file\n"; for (keys %{$d1->{h}}) { print A "$_\n"; } close A; rename "$file.Xwrdlst", "$file.wrdlst"; $pt->mkradtxtutf8 ("$file.wrdlst","$file.wrdlstnl");