Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #42938
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2013-04-06 12:56 -0700 |
| Message-ID | <8dd5cddd-792a-489f-bc1a-46026a227aa8@googlegroups.com> (permalink) |
| Subject | Error in Python NLTK |
| From | subhabangalore@gmail.com |
Dear Group,
I was using a package named NLTK in Python.
I was trying to write a code given in section 3.8 of
http://docs.huihoo.com/nltk/0.9.5/guides/tag.html.
Here, in the >>> test = ['up', 'down', 'up'] if I put more than 3 values and trying to write the reciprocal codes, like,
sequence = [(t, None) for t in test] and print '%.3f' % (model.probability(sequence))
I am getting an error as,
Traceback (most recent call last): File "", line 1, in model.probability(sequence) File "C:\Python27\lib\site-packages\nltk\tag\hmm.py", line 228, in probability return 2**(self.log_probability(self._transform.transform(sequence))) File "C:\Python27\lib\site-packages\nltk\tag\hmm.py", line 259, in log_probability alpha = self._forward_probability(sequence) File "C:\Python27\lib\site-packages\nltk\tag\hmm.py", line 694, in _forward_probability alpha[0, i] = self._priors.logprob(state) + \ File "C:\Python27\lib\site-packages\nltk\probability.py", line 689, in logprob elif self._prob_dict[sample] == 0: return _NINF ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
If any learned member may kindly assist me how may I solve the issue.
Regards,
Subhabrata.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Error in Python NLTK subhabangalore@gmail.com - 2013-04-06 12:56 -0700
Re: Error in Python NLTK Dave Angel <davea@davea.name> - 2013-04-06 16:44 -0400
Re: Error in Python NLTK subhabangalore@gmail.com - 2013-04-06 14:13 -0700
Re: Error in Python NLTK subhabangalore@gmail.com - 2013-04-06 14:13 -0700
Re: Error in Python NLTK subhabangalore@gmail.com - 2013-04-07 13:20 -0700
Re: Error in Python NLTK subhabangalore@gmail.com - 2013-04-07 13:20 -0700
Re: Error in Python NLTK subhabangalore@gmail.com - 2013-04-07 15:11 -0700
Re: Error in Python NLTK Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-07 22:40 +0000
Re: Error in Python NLTK subhabangalore@gmail.com - 2013-04-07 15:11 -0700
csiph-web