On 10/9/10 2:02 AM, Alex Rozenshteyn wrote:
This came up as I was doing homework for natural language processing.
I'm constructing a trigram model from training data, but I also need the
bigram and unigram counts. I could, for each triple of characters, add the
3 tuple to a trigram map and
This came up as I was doing homework for natural language processing.
I'm constructing a trigram model from training data, but I also need the
bigram and unigram counts. I could, for each triple of characters, add the
3 tuple to a trigram map and increment its count (I know I'm not actually
What you describe sounds like a perfect job for a trie, so that's what I
think you should look into.
- Jake
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Hmm.
It seems that both the trie packages I found just provide a standard
map-like interface, without exposing their trie-ness. Makes sense, but
limits usefulness for me.
Thanks.
On Sat, Oct 9, 2010 at 3:08 PM, Jake McArthur jake.mcart...@gmail.comwrote:
What you describe sounds like a
Does there exist a library which allows me to have maps whose elements are
maps whose elements ... with a convenient syntax.
Alternatively, does there exist a library like Data.Tree where forests are
sets rather than lists?
--
Alex R
___
Alex,
The containers library can do this already - there are no constraints
on the elements of a Map. For example:
type TripleNestedMap a = Map Int (Map Char (Map String a))
But this is rather silly as you can just do:
type MapOfTriples a = Map (Int ,Char, String) a
for most uses.
Cheers,
On 10/08/2010 04:23 PM, Alex Rozenshteyn wrote:
Does there exist a library which allows me to have maps whose elements
are maps whose elements ... with a convenient syntax.
It sounds like you might be looking for a trie of some sort. Would
something like the TrieMap package suit your needs?
On 10/8/10 5:46 PM, Thomas DuBuisson wrote:
Alex,
The containers library can do this already - there are no constraints
on the elements of a Map. For example:
type TripleNestedMap a = Map Int (Map Char (Map String a))
But this is rather silly as you can just do:
type MapOfTriples a = Map