Comments (5)
This is because you're deploying it via the Java server option using the normal socket. You should be building it as a .war file (see Makefile) and deploy it as a servlet under Tomcat.
from pyner.
If this is the mode that you're interested in running, take a look at the SocketNER class. That is what you're looking for.
from pyner.
I found this worked on a fresh stanford-ner 3.4 and pyner --
$ cp stanford-ner.jar stanford-ner-with-classifier.jar
$ jar -uf stanford-ner-with-classifier.jar classifiers/english.all.3class.distsim.crf.ser.gz
$ java -mx500m -cp stanford-ner-with-classifier.jar edu.stanford.nlp.ie.NERServer -port 2020
-loadClassifier classifiers/english.all.3class.distsim.crf.ser.gz &
Define the tagger
tagger = ner.SocketNER(host='localhost', port=2020, output_format='slashTags')
If I leave out the output_format, or try another format, I get {} output. The actual output format, however, is not slashTags but a clearly superior (more informative) dict format:
tagger.get_entities(text)
{u'ORGANIZATION': [u'UNIVERSITY OF CALIFORNIA'], u'LOCATION': [u'CALIFORNIA', u'UNITED STATES'], u'O': [u'IS LOCATED IN', u',']}
from pyner.
Incidentally, I also discovered that pyner works fine for stanford-pos too, though none of the custom formatting of the result string works. Just use tag_text for raw output and you have pypos.
from pyner.
I think this case should be re-opened. Even using SocketNER I experienced the same issue but once output_format was specified to "slashTags" everything worked well
Without specifying output_format:
tagger = ner.SocketNER(host='localhost',port=9191)
tagger.get_entities("University of California is located in California, United States")
Returned:
{}
With specifying output_format:
tagger = ner.SocketNER(host='localhost',port=9191, output_format='slashTags')
tagger.get_entities("University of California is located in California, United States")
Returned:
{u'LOCATION': [u'California', u'United States'],
u'O': [u'is located in', u','],
u'ORGANIZATION': [u'University of California']}
Either way, appreciate of the work you're doing dat. Thank you so much for all that you do
from pyner.
Related Issues (13)
- error: [Errno 61] Connection refused HOT 2
- Timeout HOT 2
- premature socket shutdown
- Custom Tagger
- devise release strategy and deploy to pypi
- Attribute Error
- socket.error: [Errno 10061] HOT 6
- TypeError: '<' not supported between instances of 'NoneType' and 'str' HOT 2
- cannot use a string pattern on a bytes-like object HOT 3
- tagger.get_entities() only returns 'TITLE': ['Not Found - CUPS v1.7rc1'] HOT 2
- Error 57 after 20 queries using SocketNER HOT 2
- "No module named Ner" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyner.