You can use the HMMDecoder function to decode the parts of speech (adjective, noun, verb, and so on.) for a word set, if the set of phrases or words have been trained using a HMMSupervised or HMMUnsupervisedLearner. Assume that you have a set of phrases (shown in the following table) whose parts of speech are unknown and you have the three trained state tables (initial, state_transition and emission) readily available.
In this example, the parts of speech correspond to the hidden states of the HMM function. There are two hidden states in this example: A(Adjective) and N(noun). HMMDecoder can be used to find these parts of speech.
model | phrase_id | word |
---|---|---|
1 | 1 | clown |
1 | 1 | crazy |
1 | 1 | killer |
1 | 1 | problem |
1 | 2 | nice |
1 | 2 | weather |
The following is a table of initial states:
model | tag | probability |
---|---|---|
1 | A | 0.25 |
1 | N | 0.75 |
The following is a table of state transitions:
model | from_tag | to_tag | probability |
---|---|---|---|
1 | A | A | 0 |
1 | A | N | 1 |
1 | N | A | 0.5 |
1 | N | N | 0.5 |
The following is a table of emissions:
model | tag | word | probability |
---|---|---|---|
1 | A | clown | 0 |
1 | N | clown | 0.4 |
1 | A | crazy | 1 |
1 | N | crazy | 0 |
1 | A | killer | 0 |
1 | N | killer | 0.3 |
1 | A | problem | 0 |
1 | N | problem | 0.3 |