Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60174

Re: Recursive generator for combinations of a multiset?

References <20131121174614.53450d51@mini.home>
Date 2013-11-21 12:59 -0800
Subject Re: Recursive generator for combinations of a multiset?
From Dan Stromberg <drsalists@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.3015.1385067574.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Wed, Nov 20, 2013 at 10:46 PM, John O'Hagan <research@johnohagan.com>wrote:

>
> Short story: the subject says it all, so if you have an answer already,
> fire away. Below is the long story of what I'm using it for, and why I
> think it needs to be recursive. It may even be of more general
> interest in terms of filtering the results of generators.
>

I think you probably need permutations rather than combinations.

Also, I think you'll need to form a word (partitioned off by spaces), and
then check it against a set containing /usr/share/dict/words before
recursing for the remainder of the sentence - this should speed things up a
LOT.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Recursive generator for combinations of a multiset? Dan Stromberg <drsalists@gmail.com> - 2013-11-21 12:59 -0800

csiph-web