in reply to Perl and Morphology

Think this might be a start ? .. only tested on your data: ;))
#!/usr/bin/perl -w use strict; sub FindRoot; my %Word=map {chomp;split /,/} <>; for (keys %Word) { print "Word: $_, etc: $Word{$_}\n"; }; my $Root=FindRoot("Longest",keys %Word); my @Words=map {split} (values %Word); my $Word=FindRoot("Shortest",@Words); print "\n---\n$Root:$Word\n"; for (keys %Word) { print "-",substr($_,length$Root),":"; print "",substr($Word{$_},0,rindex($Word{$_},$Word)),"\n"; }; sub FindRoot { my $Order=shift; my %Container; my $Min="xxxxxxxxxxxxxxx"; print "Finding $Order\n"; if ($Order eq "Shortest") { $Min=""; $Min=((length $_)>(length $Min))?$_:$Min for (@_); } else { $Min=((length $_)<(length $Min))?$_:$Min for (@_); }; for my $Word (@_) { $Container{substr lc $Word,0,$_}++ for(2..length $Min); }; my $Root=""; $Min=0; my @List=sort keys %Container; @List=reverse@List if ($Order eq "Longest"); print "List: @List\n"; for (@List) { if ($Container{$_}>$Min) { $Root=$_; $Min=$Container{$_}; }; }; return $Root; };

It`s probably not the cleanest code, but it was fun to do, so
I thought I`d post it :)))
I figure you can use this as a start to really solve your
problem, it shouldn`t be too hard to once you got the Root,
take the substring out of the hash, and start looking for the next
one (using that FindRoot sub) which would give you `lar` ,
making the next root `BasLar` ...

Hmmmmm... actually I think I got that to work here...
Looking forward to more test-data :))


print "profeth still\n" if /bird|devil/;