Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem: function OpenIE "long document" #3

Closed
sangyao opened this issue Oct 8, 2017 · 6 comments
Closed

Problem: function OpenIE "long document" #3

sangyao opened this issue Oct 8, 2017 · 6 comments

Comments

@sangyao
Copy link

sangyao commented Oct 8, 2017

hello Mr. Swart,

I am using functional OpenIE for English from your adapter, but when I enter a long English article, the following error occurred:

Fatal error: Uncaught GuzzleHttp\Exception\ServerException: Server error: POST http://localhost:9000/` resulted in a 500 Internal Server Error response: CoreNLP request timed out. Your document may be too long. in D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php:113 Stack trace: #0 D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\promises\src\Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2 D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\promises\src\Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array) #3 D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\promises\src\TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}() #4 D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\prom in D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 113`

so i have re-set the java server response time, like this:
java -mx8g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000

the following error occurred:

Fatal error: Uncaught RuntimeException: Error creating resource: [message] fopen(http://localhost:9000/): failed to open stream: HTTP request failed! [file] D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php [line] 324 in D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php:252 Stack trace: #0 D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php(335): GuzzleHttp\Handler\StreamHandler->createResource(Object(Closure)) #1 D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\Handler\StreamHandler.php(52): GuzzleHttp\Handler\StreamHandler->createStream(Object(GuzzleHttp\Psr7\Request), Array) #2 D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\PrepareBodyMiddleware.php(66): GuzzleHttp\Handler\StreamHandler->__invoke(Object(GuzzleHttp\Psr7\Request), Array) #3 D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\Middleware.php(30): GuzzleHttp\PrepareBodyMiddleware->__invoke(Object(GuzzleHttp\Psr7\Request), Array) # in D:\Apache24\htdocs\stanford1\vendor\guzzlehttp\guzzle\src\Exception\RequestException.php on line 52

**how can i solve this problem?

Thank you and best regards**

Yao

@DennisDeSwart
Copy link
Owner

Looks like a timeout of the NLP server. It is probably because the text is long.

  1. Check if a short text works
  2. Try running NLP server without "-timeout". Only this:
    java -mx8g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000
  3. Remember that the speed may only be 100 words per second. That is about 4 sentences to 6 sentences per second. So it can take minutes to do a long text
  4. Also check if the PHP.ini execution time is long enough

Greetings,
Dennis

@sangyao
Copy link
Author

sangyao commented Oct 9, 2017

Hello,
thank you for your answer,

  1. Check if a short text works. (it works)
    2.Try running NLP server without "-timeout". Only this:
    java -mx8g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 (I have tried it, but it works only for short text (like 50 words))
  2. Remember that the speed may only be 100 words per second. That is about 4 sentences to 6 sentences per second. So it can take minutes to do a long text
    4.Also check if the PHP.ini execution time is long enough (also tried, but didn't work)

I used the code you uploaded for testing, and didn't change anything. There will be an error for more than 50 words of article.

thank you

Best regards

Yao

@DennisDeSwart
Copy link
Owner

In the file "bootstrap.php" find this line:
define('USE_GUZZLE', TRUE);

Try setting:
define('USE_GUZZLE', FALSE);

Normally CoreNLP_adapter uses "Guzzle" but maybe this is causing a problem for you. By setting it off, it will do a cURL call. Maybe this will solve the problem

@DennisDeSwart
Copy link
Owner

Also, in "bootstrap.php" there is this line:
define('ONLINE_API', FALSE);

If you set:
define('ONLINE_API', TRUE);

Then you can use the online version of CoreNLP. If that works, the way that you setup the Java server is the problem.

@sangyao
Copy link
Author

sangyao commented Nov 4, 2017

thank you for your answer, it works, if the text max. 500 word. But it is ok for my projekt.

@sangyao
Copy link
Author

sangyao commented Nov 4, 2017

hello,
I still have a question,every time i must start the CoreNLP serve from the command line. just like you write "java -mx8g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000"

How can my system automatically connect java server,can Apache achieve this function?

thank you very much

yao

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants