pileofrogs,
This really isn't on topic, so let me suggest turning it into a challenge that is.

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:

area code code of ethics ethics committee

Here are some (likely not all) edge cases that I thought of.

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


In reply to Multi-token word chains (was The Threeve Game) by Limbic~Region
in thread The Threeve Game by pileofrogs

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.