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.

How to store a python input into neo4j graph db?

Hello,
I am trying to use Stanford NLP framework along with neo4j for a project. I want to know how can I use a input from python to be stored into a node in neo4j graph database so then I could use NLP to this node and start building a knowledge graph based on the input that I will get? I tried the code below but it is not working (I am using py2neo and also cypher queries at the beginning just to create the idea):

from py2neo import Graph, Node, Relationship

graph = Graph("bolt://xxx.x.xxx.xxx:7687", auth=("xxxx", "xxxxx"))

nlp = input("Text: ")

def get(nlp):
query = '''
Merge (t:Text)
SET t.text = {nlp}
'''
graph.run(query,nlp).data()

def find():
query_find = '''
Match (t:Text)
CALL ga.nlp.annotate({text: t.text, id: id(t)})
YIELD result
MERGE (t)-[:HAS_ANNOTATED_TEXT]->(result)
RETURN result
'''
graph.run(query_find).data()

I would be pleased if someone helps me with this thing???

2 REPLIES 2

Unrelated to python, but did you have a look at the stanford nlp plugin for Neo4j, we seamlessly integrate Stanford with cypher procedures only

Well yes, I already integrated Stanford NLP in my neo4j database. Now I just want to use the text that I will get from python input and store it to a node. Then from this node I will use NLP for keyword extraction or other things.