Python Forum

Full Version: Problem Using Python Library
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello ,
I am new on Python. I am trying to use a library called "bangla_pos_tagger"(1).
Rules to use it:


Install the module

python setup.py install

Code

import bangla_pos_tagger btagger=bangla_pos_tagger.BanglaTagger()

#Query is an array of Bangla words btagger.pos_tag(query)

#term is a single Bengali Term btagger.get_tag(term)

where query is a tokenized words for a given Bangla Sentence.

But it showing error on my terminal. I need instant help.


(1) https://github.com/abhishekgupta92/bangla_pos_tagger
Without showing the output of the error, we cannot help.
Further we should know: Windows or Linux  or ...
sudo python setup.py install
[sudo] password for bdbot:
running install
running build
running build_py
running install_lib
copying build/lib.linux-x86_64-2.7/bangla_pos_tagger.py -> /usr/local/lib/python2.7/dist-packages
byte-compiling /usr/local/lib/python2.7/dist-packages/bangla_pos_tagger.py to bangla_pos_tagger.pyc
running install_data
creating /usr/local/config
copying params.py -> /usr/local/config
running install_egg_info
Writing /usr/local/lib/python2.7/dist-packages/Bangla_POS_Tagger-1.0.egg-info
-----------------------------------------------------------------------------
Now code:
import bangla_pos_tagger btagger=bangla_pos_tagger.BanglaTagger()
queary= "আমার নাম খান"
btagger.pos_tag(query)
------------------------------
output:
python a.py
File "a.py", line 1
import bangla_pos_tagger btagger=bangla_pos_tagger.BanglaTagger()
^
SyntaxError: invalid syntax
The Python interpreter raises an error at this particular code:
import bangla_pos_tagger btagger=bangla_pos_tagger.BanglaTagger() 
Are you sure about the assignment? I would say these are two lines:
import bangla_pos_tagger
btagger=bangla_pos_tagger.BanglaTagger()
how did you attempt instalation, step by tiny (need every step) step
also on error, please post error messages verbatim.
did you use:
python setup.py install
?
(Nov-13-2017, 12:32 PM)j.crater Wrote: [ -> ]The Python interpreter raises an error at this particular code:
import bangla_pos_tagger btagger=bangla_pos_tagger.BanglaTagger() 
Are you sure about the assignment? I would say these are two lines:
import bangla_pos_tagger
btagger=bangla_pos_tagger.BanglaTagger()

I am following guidelines from here: https://github.com/abhishekgupta92/bangla_pos_tagger

(Nov-13-2017, 12:35 PM)Larz60+ Wrote: [ -> ]how did you attempt instalation, step by tiny (need every step) step
also on error, please post error messages verbatim.
did you use:
python setup.py install
?

Recheck the 3rd comment in this Thread.
I did not install the module and run the code. But that problematic line could simply be a bad copy-paste from code editor (not preserving newline). Have you tried separating that particular line into two?
After using import nltk
Now it's showing that no module named nltk
So I tried, sudo pip install -U nltk
from here: http://www.nltk.org/install.html
Result: sudo: pip: command not found

[Python 2.7.12 (default, Jul 1 2016, 15:12:24) ]
It's telling you 'pip' is not installed, at least for the 2.7 version. If you are on Linux, you probably have Python 3.x already installed. You could try sudo pip3 -V to see if pip is installed for the v3.x. If you get the same result, then you need to install pip, see the Basic Install here: https://python-forum.io/Thread-Basic-Par...nvironment.