BLLIP / bllip-parser

BLLIP reranking parser (also known as Charniak-Johnson parser, Charniak parser, Brown reranking parser) See http://pypi.python.org/pypi/bllipparser/ for Python module.
http://bllip.cs.brown.edu/
227 stars 53 forks source link

bllip parser in Server #57

Closed jofatmofn closed 7 years ago

jofatmofn commented 7 years ago

Please let me know if bllip parser can be used in this fashion. I am using Flask.

During start-up: rrp = RerankingParser.fetch_and_load('WSJ-PTB3', verbose=True)

While processing (multiple concurrent) requests from clients (Same object rrp is reused): constituency_lisp_string = str(rrp.parse_tagged(tokens, possible_tags=dict(enumerate(postags)))[0].ptb_parse)

dmcc commented 7 years ago

It's fine to reuse a RerankingParser object, but BLLIP's multithreading doesn't work properly (see #16) so you'll need to ensure that only one parse is happening at a time (try something like https://stackoverflow.com/questions/5185568/python-conditional-with-lock-design ).

jofatmofn commented 7 years ago

Thanks. If I need to have multiple concurrent parses, then is it okay to maintain a pool of rrp objects?

dmcc commented 7 years ago

If each RRP is in a separate process, it will be alright (not sure if flask supports this). The RRPs are in the same process, they will almost certainly corrupt each other if they're used simultaneously, unfortunately.