in reply to unglue words joined together by juncture rules
Save your juncture rules in a hash.
my %juncture_of = ( inm => 'imm', # immature abt => 'abst', # abstract adt => 'att', # attempt # etc. ); sub join_euphoniously { my $compound = join '', @_; while ( my ($raw, $joined) = each %juncture_of ) { $compound =~ s/$raw/$joined/; } return $compound; } sub unjoin { my $compound = shift; # maybe no juncture rules applied to this one my @possibilities = ( $compound ); # analyze whether $string resulted from a juncture rule while (my ($raw, $joined) = each %juncture_of ) { for my $possibility (@possibilities) { if ( $possibility =~ s/$joined/$raw/ ) { push @possibilities, $possibility } } } return \@possibilities; }
Still to do: decompose each possibility into dictionary words.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: unglue words joined together by juncture rules
by oko1 (Deacon) on Mar 21, 2008 at 23:29 UTC |