in reply to The Threeve Game
Assume we have a list of multi-token words. In fact, assume that it is obtained using the following code:
#!/usr/bin/perl use strict; use warnings; use WWW::Mechanize; my $mech = WWW::Mechanize->new(autocheck => 1); for ('a' .. 'z') { my $url = "http://wordlist.com/index-$_.htm"; eval { $mech->get($url) }; if ($@) { warn "Unable to get link for letter '$_': $@\n"; next; } for my $link ($mech->links) { my $word = $link->text; next if ! $word || index($word, ' ') == -1; print "$word\n"; } }
The challenge is to make the longest chain of multi-token words where the end of one word overlaps the beginning of the next word by at least one token. Each word may only be used once in the chain. Here is an example:
Here are some (likely not all) edge cases that I thought of.area code code of ethics ethics committee
I realize that this particular list stinks but I couldn't find a better one. If you use an alternate source, please link to it so that others may compete using the same list. Oh, I am pretty sure there is a fairly well known computer science problem hidden within so heuristics solutions are likely necessary.
It should be fairly obvious, but here is a hint if you are having a hard time dealing with such a large list:
Cheers - L~R
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multi-token word chains (was The Threeve Game)
by planetscape (Chancellor) on Feb 10, 2010 at 02:12 UTC | |
|
Re: Multi-token word chains (was The Threeve Game)
by blokhead (Monsignor) on Feb 11, 2010 at 00:53 UTC | |
by Limbic~Region (Chancellor) on Feb 11, 2010 at 15:46 UTC | |
|
Re: Multi-token word chains (was The Threeve Game)
by MidLifeXis (Monsignor) on Feb 10, 2010 at 14:40 UTC |