miotto / treetagger-python Goto Github PK
View Code? Open in Web Editor NEWA Python module for interfacing with the Treetagger by Helmut Schmid.
License: Other
A Python module for interfacing with the Treetagger by Helmut Schmid.
License: Other
Hello Sir,
I installed all the prerequisites. But when the run the code treetagger_python2.py I got the above error, though when I go through the actual file I could see the init method does take the parameter encoding
File "treetagger_python2.py", line 47, in main.TreeTagger
Failed example:
tt = TreeTagger(encoding='utf-8',language='english')
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.7/doctest.py", line 1315, in __run
compileflags, 1) in test.globs
File "<doctest main.TreeTagger[1]>", line 1, in
tt = TreeTagger(encoding='utf-8',language='english')
TypeError: init() got an unexpected keyword argument 'encoding'
I've installed the TreeTagger and treetagger-python from pip. I want to tag my sentence with this package. But, it only return empty array, i've tried some other sentence and it goes same. Here is my code. It has no error.
from treetagger import TreeTagger
tt = TreeTagger(language='english')
row = row[0]
sentence = "When I am alone in a room with no contact with anyone - a loneliness draines me."
print(sentence)
tt.tag(sentence)
Please help, Thanks
Hi, i have succesfully installed treetagger and i can now pos tag sentences in italian, but treetaggerchunker does not detect the same language i use with treetagger. Do i have to install the language in a different way?
Thanks
Hi, you might recognize the code from your "README", I'm sorry to bother if my question is stupid and I thank you for the work you provided for us.
Here is the code I use ;
from treetagger import TreeTagger
tt = TreeTagger(path_to_treetagger='C:\TreeTagger')
tmp = tt.tag('What is the airspeed of an unladen swallow?')
print(tmp)
with or without the tmp and the print, I get the same return which is "[['Usage: tag-english file {file}']]".
I should get something different, in your example you get a proper answer. I tried some tests and added some prints in the tag function they all go right. I don't understand the problem and I would be grateful if you could help me.
The tt.get_installed_lang() method works just fine and so does the Tree Tagger on his own when I call it with a .txt file.
Many thanks again for your work.
PS: I'm sorry for the many mistakes you will find in this text, english is not my mother tongue.
Hello,
I am trying to use treetagger-python and I don't seem to have it working properly.
I downloaded TreeTagger and installed it in ~/treetagger and therefore set TREETAGGER_HOME to this path in my .bashrc file.
However, when I want to use it, I get the following error:
NLTK was unable to find the TreeTagger bin!
I think it comes from a TREETAGGER_HOME which is misconfigured, but I actually have no clue of what could be the correct path.
I also may be wrong and the error could come from somewhere else.
Could you please enlighten me?
Thanks a lot!
When executing I am getting the following Error Message.
Traceback (most recent call last):
File "tt_testfile.py", line 7, in <module>
pprint(tt.tag('What is the airspeed of an unladen swallow?'))
File "build/bdist.linux-i686/egg/treetagger.py", line 123, in tag
TypeError: str() takes at most 1 argument (2 given)
The Error points to (stdout, stderr) = p.communicate(bytes(_input, 'UTF-8'))
.
Actually, if I download and install treetagger (http://www.cis.uni-muenchen.de/~schmid/tools/TreeTagger/), with a language, for exemple, french, a python call to treetagger fail, because installed language was not found.
https://github.com/miotto/treetagger-python/blob/master/treetagger.py#L135
The language file is named french.par, but treetagger-python try to find a *-utf8.par . I don't know why, maybe the naming convention was recently changed.
To temporaly fix the problem, we should copy (not move, if you want treetagger still work) the .par file, and add -utf8 before the dot. Like that: french.par -> french-utf8.par
(P.S: Thanks for your work !)
I tried to automatically port the script to python3 but failed.
https://docs.python.org/3/howto/pyporting.html
I am know too little python to find out why.
Would you please make a python3 version? Thank you!
Dear Mirko,
could you please add a license to treetagger-python
?
Best,
Arne
I ran the given example code and got the following error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build/bdist.linux-x86_64/egg/treetagger.py", line 141, in tag File "/usr/lib/python2.7/subprocess.py", line 710, in __init__ errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 8] Exec format error
Hello:
I'm trying to run the example:
from treetagger import TreeTagger
tt = TreeTagger(language='english')
tt.tag('What is the airspeed of an unladen swallow?')
and i get the following error:
AttributeError: 'TreeTagger' object has no attribute '_treetagger_bin'
I can use some help. Thanks
Hi. I need some help. I was able to run it before. But I dont know why it doesnt work anymore. It prints this error below. I've edited the .bash_profile and .zshrc also. I'm sorry also, I dont know if I should ask it here.
LookupError:
NLTK was unable to find the tree-tagger-english file!
Use software specific configuration paramaters or set the TREETAGGER environment variable.
Searched in:
- .
- /usr/bin
- /usr/local/bin
- /opt/local/bin
- /Applications/bin
- /Users/roybayot/bin
- /Users/roybayot/Applications/bin
- /Users/roybayot/work/TreeTagger/cmd
For more information, on tree-tagger-english, see:
export TREE_TAGGER_PATH='/Users/roybayot/Desktop/new_tree_tagger/'
export TREE_TAGGER_PATH=$TREE_TAGGER_PATH:/Users/roybayot/Desktop/new_tree_tagger
export TREE_TAGGER_PATH=$TREE_TAGGER_PATH:/Users/roybayot/Desktop/new_tree_tagger/bin
export TREE_TAGGER_PATH=$TREE_TAGGER_PATH:/Users/roybayot/Desktop/new_tree_tagger/cmd
export TREETAGGER_HOME='/Users/roybayot/Desktop/new_tree_tagger/'
export TREETAGGER_HOME=$TREETAGGER_HOME:/Users/roybayot/Desktop/new_tree_tagger
export TREETAGGER_HOME=$TREETAGGER_HOME:/Users/roybayot/Desktop/new_tree_tagger/bin
export TREETAGGER_HOME=$TREETAGGER_HOME:/Users/roybayot/Desktop/new_tree_tagger/cmd
export TREETAGGER='/Users/roybayot/Desktop/new_tree_tagger/'
export TREETAGGER=$TREETAGGER:/Users/roybayot/Desktop/new_tree_tagger
export TREETAGGER=$TREETAGGER:/Users/roybayot/Desktop/new_tree_tagger/bin
export TREETAGGER=$TREETAGGER:/Users/roybayot/Desktop/new_tree_tagger/cmd
export TAGDIR=/Users/roybayot/Desktop/new_tree_tagger/
export TREETAGGER_HOME=/Users/roybayot/Desktop/new_tree_tagger
export TREETAGGER_HOME=$TREETAGGER_HOME:/Users/roybayot/Desktop/new_tree_tagger/cmd
export TREETAGGER_HOME=$TREETAGGER_HOME:/Users/roybayot/Desktop/new_tree_tagger/bin
export TREE_TAGGER_PATH=/Users/roybayot/Desktop/new_tree_tagger
export TREE_TAGGER_PATH=$TREE_TAGGER_PATH:/Users/roybayot/Desktop/new_tree_tagger/cmd
export TREE_TAGGER_PATH=$TREE_TAGGER_PATH:/Users/roybayot/Desktop/new_tree_tagger/bin
export TREETAGGER_HOME=/Users/roybayot/Desktop/new_tree_tagger
export TREETAGGER_HOME=$TREETAGGER_HOME:/Users/roybayot/Desktop/new_tree_tagger/cmd
export TREETAGGER_HOME=$TREETAGGER_HOME:/Users/roybayot/Desktop/new_tree_tagger/bin
export PYTHONPATH=$PYTHONPATH:/Users/roybayot/Desktop/new_tree_tagger/
export PYTHONPATH=$PYTHONPATH:/Users/roybayot/Desktop/new_tree_tagger/cmd/
export PYTHONPATH=$PYTHONPATH:/Users/roybayot/Desktop/new_tree_tagger/bin/
PATH=/usr/local/git/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/local/bin:/opt/local/sbin:/usr/X11/bin:/Users/roybayot/Desktop/TreeTagger:/Users/roybayot/Desktop/TreeTagger/cmd:/Users/roybayot/Desktop/TreeTagger/bin:/Users/roybayot/Desktop/new_tree_tagger:/Users/roybayot/Desktop/new_tree_tagger/cmd:/Users/roybayot/Desktop/new_tree_tagger/bin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.