Apache OpenNLP python包装器 - 服务器超时

时间:2018-06-08 10:23:00

标签: apache server opennlp

您好我正在尝试将Apache OpenNLP与Python包装器一起使用,但现在当我尝试启动服务器时它只是超时而我无法找到我应该延长超时的地方。我是否需要安装与Apache相关的其他任何能够运行服务器?

python opennlp/opennlp.py --path /home/sandra/apache-opennlp-1.8.4
Starting OpenNLP
Traceback (most recent call last):
  File "opennlp/opennlp.py", line 67, in <module>
    main()
  File "opennlp/opennlp.py", line 60, in main
    nlp = OpenNLP(options.path)
  File "opennlp/opennlp.py", line 23, in __init__
    self.process.expect('done')
  File "/home/sandra/miniconda2/lib/python2.7/site-packages/pexpect/spawnbase.py", line 321, in expect
    timeout, searchwindowsize, async)
  File "/home/sandra/miniconda2/lib/python2.7/site-packages/pexpect/spawnbase.py", line 345, in expect_list
    return exp.expect_loop(timeout)
  File "/home/sandra/miniconda2/lib/python2.7/site-packages/pexpect/expect.py", line 107, in expect_loop
    return self.timeout(e)
  File "/home/sandra/miniconda2/lib/python2.7/site-packages/pexpect/expect.py", line 70, in timeout
    raise TIMEOUT(msg)
pexpect.exceptions.TIMEOUT: Timeout exceeded.
<pexpect.pty_spawn.spawn object at 0x7f3ff84d5d50>
command: /home/sandra/apache-opennlp-1.8.4/bin/opennlp
args: ['/home/sandra/apache-opennlp-1.8.4/bin/opennlp', 'Parser', '/home/sandra/apache-opennlp-1.8.4/models/en-parser-chunking.bin']
buffer (last 100 chars): ''
before (last 100 chars): ''
after: <class 'pexpect.exceptions.TIMEOUT'>
match: None
match_index: None
exitstatus: None
flag_eof: False
pid: 18013
child_fd: 6
closed: False
timeout: 30
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile("done")

1 个答案:

答案 0 :(得分:0)

检查apache open nlp的路径。你在哪里安装的?也许你的代码的一部分你必须写在你的问题上。我有同样的问题,这是因为apache的路径打开nlp。

token = opennlp.OpenNLP(&#34; opennlp-python / apache-opennlp-1.8.4&#34;,&#34; TokenNameFinder&#34;,&#34; sq-ner-location.bin&#34 ;)             persed = token.parse(data)             打印(persed)

查看opennlp