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


Groups > comp.lang.python > #42938 > unrolled thread

Error in Python NLTK

Started bysubhabangalore@gmail.com
First post2013-04-06 12:56 -0700
Last post2013-04-07 15:11 -0700
Articles 9 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  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

#42938 — Error in Python NLTK

Fromsubhabangalore@gmail.com
Date2013-04-06 12:56 -0700
SubjectError in Python NLTK
Message-ID<8dd5cddd-792a-489f-bc1a-46026a227aa8@googlegroups.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.

[toc] | [next] | [standalone]


#42942

FromDave Angel <davea@davea.name>
Date2013-04-06 16:44 -0400
Message-ID<mailman.209.1365281115.3114.python-list@python.org>
In reply to#42938
On 04/06/2013 03:56 PM, subhabangalore@gmail.com wrote:
> 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))

This 'and' operator is going to try to interpret the previous list as a 
boolean.  Could that be your problem?  Why aren't you putting these two 
statements on separate lines?  And what version of Python are you using? 
  If 2.x, you should get a syntax error because print is a statement. 
If 3.x, you should get a different error because you don't put parens 
around the preint expression.

>
> 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.
>

Your error display has been trashed, thanks to googlegroups.
     http://wiki.python.org/moin/GoogleGroupsPython
Try posting with a text email message, since this is a text forum.

Your code is also sparse.  Why do you point us to fragments on the net, 
when you could show us the exact code you were running when it failed? 
I'm guessing you're running it from the interpreter, which can be very 
confusing once you have to ask for help.  Please put a sample of code 
into a file, run it, and paste into your text email both the contents of 
that file and the full traceback.  thanks.

The email address to post on this forum is  python-list@python.org


-- 
DaveA

[toc] | [prev] | [next] | [standalone]


#42947

Fromsubhabangalore@gmail.com
Date2013-04-06 14:13 -0700
Message-ID<73d6289a-945d-4d1b-8a0c-9895ce7d6253@googlegroups.com>
In reply to#42942
On Sunday, April 7, 2013 2:14:41 AM UTC+5:30, Dave Angel wrote:
> On 04/06/2013 03:56 PM, subhabangalore@gmail.com wrote:
> 
> > 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))
> 
> 
> 
> This 'and' operator is going to try to interpret the previous list as a 
> 
> boolean.  Could that be your problem?  Why aren't you putting these two 
> 
> statements on separate lines?  And what version of Python are you using? 
> 
>   If 2.x, you should get a syntax error because print is a statement. 
> 
> If 3.x, you should get a different error because you don't put parens 
> 
> around the preint expression.
> 
> 
> 
> >
> 
> > 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.
> 
> >
> 
> 
> 
> Your error display has been trashed, thanks to googlegroups.
> 
>      http://wiki.python.org/moin/GoogleGroupsPython
> 
> Try posting with a text email message, since this is a text forum.
> 
> 
> 
> Your code is also sparse.  Why do you point us to fragments on the net, 
> 
> when you could show us the exact code you were running when it failed? 
> 
> I'm guessing you're running it from the interpreter, which can be very 
> 
> confusing once you have to ask for help.  Please put a sample of code 
> 
> into a file, run it, and paste into your text email both the contents of 
> 
> that file and the full traceback.  thanks.
> 
> 
> 
> The email address to post on this forum is  python-list@python.org
> 
> 
> 
> 
> 
> -- 
> 
> DaveA

Thanks Dave for your kind suggestions. I am checking on them and if I get any questions I am sending the room in detailed manner. Regards,Subhabrata.

[toc] | [prev] | [next] | [standalone]


#42948

Fromsubhabangalore@gmail.com
Date2013-04-06 14:13 -0700
Message-ID<mailman.212.1365282845.3114.python-list@python.org>
In reply to#42942
On Sunday, April 7, 2013 2:14:41 AM UTC+5:30, Dave Angel wrote:
> On 04/06/2013 03:56 PM, subhabangalore@gmail.com wrote:
> 
> > 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))
> 
> 
> 
> This 'and' operator is going to try to interpret the previous list as a 
> 
> boolean.  Could that be your problem?  Why aren't you putting these two 
> 
> statements on separate lines?  And what version of Python are you using? 
> 
>   If 2.x, you should get a syntax error because print is a statement. 
> 
> If 3.x, you should get a different error because you don't put parens 
> 
> around the preint expression.
> 
> 
> 
> >
> 
> > 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.
> 
> >
> 
> 
> 
> Your error display has been trashed, thanks to googlegroups.
> 
>      http://wiki.python.org/moin/GoogleGroupsPython
> 
> Try posting with a text email message, since this is a text forum.
> 
> 
> 
> Your code is also sparse.  Why do you point us to fragments on the net, 
> 
> when you could show us the exact code you were running when it failed? 
> 
> I'm guessing you're running it from the interpreter, which can be very 
> 
> confusing once you have to ask for help.  Please put a sample of code 
> 
> into a file, run it, and paste into your text email both the contents of 
> 
> that file and the full traceback.  thanks.
> 
> 
> 
> The email address to post on this forum is  python-list@python.org
> 
> 
> 
> 
> 
> -- 
> 
> DaveA

Thanks Dave for your kind suggestions. I am checking on them and if I get any questions I am sending the room in detailed manner. Regards,Subhabrata.

[toc] | [prev] | [next] | [standalone]


#43017

Fromsubhabangalore@gmail.com
Date2013-04-07 13:20 -0700
Message-ID<d5300580-2514-469b-af4e-1024e30fcdfc@googlegroups.com>
In reply to#42942
On Sunday, April 7, 2013 2:14:41 AM UTC+5:30, Dave Angel wrote:
> On 04/06/2013 03:56 PM, subhabangalore@gmail.com wrote:
> 
> > 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))
> 
> 
> 
> This 'and' operator is going to try to interpret the previous list as a 
> 
> boolean.  Could that be your problem?  Why aren't you putting these two 
> 
> statements on separate lines?  And what version of Python are you using? 
> 
>   If 2.x, you should get a syntax error because print is a statement. 
> 
> If 3.x, you should get a different error because you don't put parens 
> 
> around the preint expression.
> 
> 
> 
> >
> 
> > 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.
> 
> >
> 
> 
> 
> Your error display has been trashed, thanks to googlegroups.
> 
>      http://wiki.python.org/moin/GoogleGroupsPython
> 
> Try posting with a text email message, since this is a text forum.
> 
> 
> 
> Your code is also sparse.  Why do you point us to fragments on the net, 
> 
> when you could show us the exact code you were running when it failed? 
> 
> I'm guessing you're running it from the interpreter, which can be very 
> 
> confusing once you have to ask for help.  Please put a sample of code 
> 
> into a file, run it, and paste into your text email both the contents of 
> 
> that file and the full traceback.  thanks.
> 
> 
> 
> The email address to post on this forum is  python-list@python.org
> 
> 
> 
> 
> 
> -- 
> 
> DaveA

Dear Sir, 
I generally solved this problem from some other angle but I would like to fix this particular issue also so I am posting soon to you. 
Regards,
Subhabrata.

[toc] | [prev] | [next] | [standalone]


#43018

Fromsubhabangalore@gmail.com
Date2013-04-07 13:20 -0700
Message-ID<mailman.254.1365366047.3114.python-list@python.org>
In reply to#42942
On Sunday, April 7, 2013 2:14:41 AM UTC+5:30, Dave Angel wrote:
> On 04/06/2013 03:56 PM, subhabangalore@gmail.com wrote:
> 
> > 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))
> 
> 
> 
> This 'and' operator is going to try to interpret the previous list as a 
> 
> boolean.  Could that be your problem?  Why aren't you putting these two 
> 
> statements on separate lines?  And what version of Python are you using? 
> 
>   If 2.x, you should get a syntax error because print is a statement. 
> 
> If 3.x, you should get a different error because you don't put parens 
> 
> around the preint expression.
> 
> 
> 
> >
> 
> > 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.
> 
> >
> 
> 
> 
> Your error display has been trashed, thanks to googlegroups.
> 
>      http://wiki.python.org/moin/GoogleGroupsPython
> 
> Try posting with a text email message, since this is a text forum.
> 
> 
> 
> Your code is also sparse.  Why do you point us to fragments on the net, 
> 
> when you could show us the exact code you were running when it failed? 
> 
> I'm guessing you're running it from the interpreter, which can be very 
> 
> confusing once you have to ask for help.  Please put a sample of code 
> 
> into a file, run it, and paste into your text email both the contents of 
> 
> that file and the full traceback.  thanks.
> 
> 
> 
> The email address to post on this forum is  python-list@python.org
> 
> 
> 
> 
> 
> -- 
> 
> DaveA

Dear Sir, 
I generally solved this problem from some other angle but I would like to fix this particular issue also so I am posting soon to you. 
Regards,
Subhabrata.

[toc] | [prev] | [next] | [standalone]


#43026

Fromsubhabangalore@gmail.com
Date2013-04-07 15:11 -0700
Message-ID<880e60a6-71a8-40c3-9887-f494924b8401@googlegroups.com>
In reply to#43018
On Monday, April 8, 2013 1:50:38 AM UTC+5:30, subhaba...@gmail.com wrote:
> On Sunday, April 7, 2013 2:14:41 AM UTC+5:30, Dave Angel wrote:
> 
> > On 04/06/2013 03:56 PM, subhabangalore@gmail.com wrote:
> 
> > 
> 
> > > 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))
> 
> > 
> 
> > 
> 
> > 
> 
> > This 'and' operator is going to try to interpret the previous list as a 
> 
> > 
> 
> > boolean.  Could that be your problem?  Why aren't you putting these two 
> 
> > 
> 
> > statements on separate lines?  And what version of Python are you using? 
> 
> > 
> 
> >   If 2.x, you should get a syntax error because print is a statement. 
> 
> > 
> 
> > If 3.x, you should get a different error because you don't put parens 
> 
> > 
> 
> > around the preint expression.
> 
> > 
> 
> > 
> 
> > 
> 
> > >
> 
> > 
> 
> > > 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.
> 
> > 
> 
> > >
> 
> > 
> 
> > 
> 
> > 
> 
> > Your error display has been trashed, thanks to googlegroups.
> 
> > 
> 
> >      http://wiki.python.org/moin/GoogleGroupsPython
> 
> > 
> 
> > Try posting with a text email message, since this is a text forum.
> 
> > 
> 
> > 
> 
> > 
> 
> > Your code is also sparse.  Why do you point us to fragments on the net, 
> 
> > 
> 
> > when you could show us the exact code you were running when it failed? 
> 
> > 
> 
> > I'm guessing you're running it from the interpreter, which can be very 
> 
> > 
> 
> > confusing once you have to ask for help.  Please put a sample of code 
> 
> > 
> 
> > into a file, run it, and paste into your text email both the contents of 
> 
> > 
> 
> > that file and the full traceback.  thanks.
> 
> > 
> 
> > 
> 
> > 
> 
> > The email address to post on this forum is  python-list@python.org
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > -- 
> 
> > 
> 
> > DaveA
> 
> 
> 
> Dear Sir, 
> 
> I generally solved this problem from some other angle but I would like to fix this particular issue also so I am posting soon to you. 
> 
> Regards,
> 
> Subhabrata.

Dear Sir,
I was trying to give wrong input. I was making an input error.

Regards,
Subhabrata. 

[toc] | [prev] | [next] | [standalone]


#43029

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-04-07 22:40 +0000
Message-ID<5161f5f2$0$29995$c3e8da3$5496439d@news.astraweb.com>
In reply to#43026
On Sun, 07 Apr 2013 15:11:36 -0700, subhabangalore wrote:

[snip 200+ lines of irrelevant quoted text]
> Dear Sir,
> I was trying to give wrong input. I was making an input error.

Please, use the delete key to remove unnecessary text from your messages. 
We shouldn't have to scroll past THREE AND A HALF PAGES of quoted text to 
see a two line response.


Thank you.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#43027

Fromsubhabangalore@gmail.com
Date2013-04-07 15:11 -0700
Message-ID<mailman.259.1365372704.3114.python-list@python.org>
In reply to#43018
On Monday, April 8, 2013 1:50:38 AM UTC+5:30, subhaba...@gmail.com wrote:
> On Sunday, April 7, 2013 2:14:41 AM UTC+5:30, Dave Angel wrote:
> 
> > On 04/06/2013 03:56 PM, subhabangalore@gmail.com wrote:
> 
> > 
> 
> > > 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))
> 
> > 
> 
> > 
> 
> > 
> 
> > This 'and' operator is going to try to interpret the previous list as a 
> 
> > 
> 
> > boolean.  Could that be your problem?  Why aren't you putting these two 
> 
> > 
> 
> > statements on separate lines?  And what version of Python are you using? 
> 
> > 
> 
> >   If 2.x, you should get a syntax error because print is a statement. 
> 
> > 
> 
> > If 3.x, you should get a different error because you don't put parens 
> 
> > 
> 
> > around the preint expression.
> 
> > 
> 
> > 
> 
> > 
> 
> > >
> 
> > 
> 
> > > 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.
> 
> > 
> 
> > >
> 
> > 
> 
> > 
> 
> > 
> 
> > Your error display has been trashed, thanks to googlegroups.
> 
> > 
> 
> >      http://wiki.python.org/moin/GoogleGroupsPython
> 
> > 
> 
> > Try posting with a text email message, since this is a text forum.
> 
> > 
> 
> > 
> 
> > 
> 
> > Your code is also sparse.  Why do you point us to fragments on the net, 
> 
> > 
> 
> > when you could show us the exact code you were running when it failed? 
> 
> > 
> 
> > I'm guessing you're running it from the interpreter, which can be very 
> 
> > 
> 
> > confusing once you have to ask for help.  Please put a sample of code 
> 
> > 
> 
> > into a file, run it, and paste into your text email both the contents of 
> 
> > 
> 
> > that file and the full traceback.  thanks.
> 
> > 
> 
> > 
> 
> > 
> 
> > The email address to post on this forum is  python-list@python.org
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > -- 
> 
> > 
> 
> > DaveA
> 
> 
> 
> Dear Sir, 
> 
> I generally solved this problem from some other angle but I would like to fix this particular issue also so I am posting soon to you. 
> 
> Regards,
> 
> Subhabrata.

Dear Sir,
I was trying to give wrong input. I was making an input error.

Regards,
Subhabrata. 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web