0

I am trying to figure out how Neoj4 Desktop can be used to handel NLP usgin this blog. Everything was ok until the text classification moment:

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: 'content',
       write:true
    }) YIELD graph RETURN distinct 'done'",
    {batchSize:10})

Instead of returning categories, it returns "The requested URL /v1/documents:classifyText?key=apiKey was not found on this server" error

Maybe it is something with GCP credentials, but I have done everything as suggested.

Davy de Vries
  • 4,578
  • 2
  • 14
  • 29
user1680859
  • 1,160
  • 2
  • 24
  • 40

1 Answers1

1

Thanks for reading my blog post! :)

Please try the following command:

RETURN apoc.static.get('gcp.apiKey')

Does it return anything? It should return your google API key. If it doesn't work you can always just try to copy your API key into the query. On the other hand, if apoc.static.get works as intended, maybe try to Enable your Natural Language API in the google console. That could be one issue.

Tomaž Bratanič
  • 6,319
  • 2
  • 18
  • 31
  • Yes, RETURN apoc.static.get('gcp.apiKey') works correct. But "Enable your Natural Language API" was using billing account (-:. Such a pitty that there is no option for free learning of Google API. – user1680859 May 21 '20 at 19:56
  • 1
    Try free options like spacy: https://www.google.com/amp/s/tbgraph.wordpress.com/2019/09/01/network-analysis-of-prisoners-of-zenda-book-with-spacy-and-neo4j/amp/ – Tomaž Bratanič May 21 '20 at 23:07
  • Thank you, I have used Spacy for text classification using simple Python scripts, are there any advantages using Spacy with Neo4j? – user1680859 May 22 '20 at 09:29