Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #92638
| From | Laura Creighton <lac@openend.se> |
|---|---|
| Subject | Re: Creating .exe file in Python |
| References | <349bb66f-bd3c-47ec-bd1d-35f46d23cf95@googlegroups.com> <mailman.484.1434373285.13271.python-list@python.org><c257d498-fb90-4206-9dee-72f80456fd9d@googlegroups.com> |
| Date | 2015-06-15 16:44 +0200 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.486.1434379493.13271.python-list@python.org> (permalink) |
In a message of Mon, 15 Jun 2015 06:42:48 -0700, subhabrata.banerji@gmail.com w
>I wrote a script as NLQ3. py
>
>the code is written as,
>
>import nltk
>import itertools
>def nlq3(n):
> inp=raw_input("Print Your Query:")
> tag=nltk.pos_tag(nltk.wordpunct_tokenize(inp))
> print "The Tagged Value Is:",tag
> noun=[word[0] for word in tag if 'NN' in word[1]]
> #print noun
> #COMBINATION OF ALL ELEMENTS
> for i in xrange(1,len(noun)+1):
> comb= list(itertools.combinations(noun,i))
> for i,v in enumerate(comb):
> #print v
> v1=list(v)
> print v1
>
>I tried to call it as,
>C:\Tutorial>python hello.py
>...
>as
>
>C:\Python27>python NLQ3.py
>
>C:\Python27>
>
>But I am not getting any output.
You need to fix your script first, and package it later.
That you are not getting any output indicates that you have
a severe problem. And you do. There is no main function in
the code that you posted. So I made 2 small changes.
First, you aren't using n in your nlq3. So I changed the function
definition to it to.
def nlq3():
Then I added these lines to the very bottom of the file.
if __name__ == "__main__":
nlq3()
My file is named nlq3.py and now python nlq3.py gives output. This
is an improvement. But the code is still wrong.
It gets to here:
tag=nltk.pos_tag(nltk.wordpunct_tokenize(inp))
and nltk is very unhappy about this.
lac@smartwheels:~/python$ python nlq3.py
Print Your Query:hello
Traceback (most recent call last):
File "nlq3.py", line 18, in <module>
nlq3()
File "nlq3.py", line 5, in nlq3
tag=nltk.pos_tag(nltk.wordpunct_tokenize(inp))
File "/usr/local/lib/python2.7/dist-packages/nltk/tag/__init__.py", line 103, in pos_tag
tagger = load(_POS_TAGGER)
File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 781, in load
opened_resource = _open(resource_url)
File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 895, in _open
return find(path_, path + ['']).open()
File "/usr/local/lib/python2.7/dist-packages/nltk/data.py", line 624, in find
raise LookupError(resource_not_found)
LookupError:
**********************************************************************
Resource u'taggers/maxent_treebank_pos_tagger/english.pickle'
not found. Please use the NLTK Downloader to obtain the
resource: >>> nltk.download()
Searched in:
- '/home/lac/nltk_data'
- '/usr/share/nltk_data'
- '/usr/local/share/nltk_data'
- '/usr/lib/nltk_data'
- '/usr/local/lib/nltk_data'
- u''
**********************************************************************
I don't know enough about nltk to know how to fix this. You will have
to read nltk docs for that. But get the code to work, first and
package it later, ok?
Laura
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 04:42 -0700
Re: Creating .exe file in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-15 13:07 +0100
Re: Creating .exe file in Python sohcahtoa82@gmail.com - 2015-06-15 10:09 -0700
Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-15 15:01 +0200
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 06:42 -0700
Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-15 16:44 +0200
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 07:03 -0700
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 07:40 -0700
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-15 09:11 -0700
Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-15 18:29 +0200
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-16 03:46 -0700
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-16 06:56 -0700
Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-16 17:04 +0200
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-16 08:17 -0700
Re: Creating .exe file in Python Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-16 10:00 -0600
Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-17 02:03 +1000
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-16 09:23 -0700
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 06:10 -0700
Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-17 23:20 +1000
Re: Creating .exe file in Python hamilton <hamilton@nothere.com> - 2015-06-17 07:33 -0600
Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-17 23:52 +1000
Re: Creating .exe file in Python Steven D'Aprano <steve@pearwood.info> - 2015-06-18 01:39 +1000
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 08:46 -0700
Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-18 01:58 +1000
Re: Creating .exe file in Python random832@fastmail.us - 2015-06-17 10:17 -0400
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 07:30 -0700
Re: Creating .exe file in Python Chris Angelico <rosuav@gmail.com> - 2015-06-18 00:38 +1000
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 06:33 -0700
Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-17 15:54 +0200
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 07:04 -0700
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 07:16 -0700
Re: Creating .exe file in Python Laura Creighton <lac@openend.se> - 2015-06-17 17:21 +0200
Re: Creating .exe file in Python subhabrata.banerji@gmail.com - 2015-06-17 08:30 -0700
csiph-web