Code Comments
Programming Forum and web based access to our favorite programming groups.Hi.
I have a file with a word and it's part-of-speech on each line.
I have so far put all words in one array and the part-of-speech in another s
o that one word's index corresponds with the part of speech.
But what I really want to do is to check which part-of-speech one word has (
it can have more than one) and then count how many times it has the differe
nt part-of-speech.
So I was thinking about using a hash of hashes where the parent hash has wor
ds as keys and hashes as value. The child hashes should have part-of-speech
as keys and the number of these as values.
Like this example:
# %wordPos = (
# cat => {
# noun => 30,
# },
# race => {
# noun => 6,
# verb => 2,
# },
# jump => {
# noun => 3,
# verb => 7,
# },
# );
I don't know if there is a better way to do it. But I still don't know how t
o build this hash of hashes with the input I get.
/Maria
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.