cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Apoc NLP error

Hi, I am trying to create a natural language query to cypher query and retrieve relevant information to the user. I'm using the apoc plugin to achieve that. When I'm trying to iterate over my files and perform nlp actions and tag the categories of the articles.

I'm using the below piece of code: 

CALL apoc.periodic.iterate("
   // get all articles
   MATCH (node:Article) RETURN node
  ","
   // classify each article
   CALL apoc.nlp.gcp.classify.graph(node, {
       // we retrieve gcp api key from static value storage
       key: apoc.static.get('gcp.apiKey       // node property that contains the text
       nodeProperty:'Text',
       write:true
    }) YIELD graph RETURN distinct 'done'",
    {batchSize:10})
 
I'm get the following error message:
{
"Invalid input 'T': expected whitespace, '.', node labels or rel types, '[', '^', '*', '/', '%', '+', '-', "=~", IN, STARTS, ENDS, CONTAINS, IS, '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, ',' or ')' (line 6, column 23 (offset: 292))\r\n" nodeProperty: 'Text',"\r\n ^": 51
}
 
batch error: 
{
"total": 51,
"committed": 0,
"failed": 51,
"errors": {
"org.neo4j.graphdb.QueryExecutionException: Invalid input 'T': expected whitespace, '.', node labels or rel types, '[', '^', '*', '/', '%', '+', '-', "=~", IN, STARTS, ENDS, CONTAINS, IS, '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, ',' or ')' (line 6, column 23 (offset: 292))\r\n" nodeProperty: 'Text',"\r\n ^": 51
 
Could someone help me with this?
}
}

 

2 REPLIES 2

koji
Ninja
Ninja

Hi @SushmiT 

I found the mistake.
Please add '), to this line.

 

key: apoc.static.get('gcp.apiKey       // node property that contains the text
key: apoc.static.get('gcp.apiKey'),    // node property that contains the text

 

 



hi I'm going to sound obvious, but did you run an unit test ? just passing one node , and no comments inside apoc procedure ?
I've been using Azure Cognitive Services without trouble ...