Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-27-2019 02:19 PM
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???
08-27-2019 02:27 PM
Unrelated to python, but did you have a look at the stanford nlp plugin for Neo4j, we seamlessly integrate Stanford with cypher procedures only
08-28-2019 03:13 AM
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.
All the sessions of the conference are now available online