Open amansani opened 3 years ago
May be something like this:
``def processSubjectObjectPairs(tokens): subject = '' object = '' relation = ''
**subjectObjectConstruction** = ''
for token in tokens:
#printToken(token)
if "punct" in token.dep_:
continue
if isRelationCandidate(token):
relation = appendChunk(relation, token.lemma_)
**if isConstructionCandidate(token):
subjectObjectConstruction = appendChunk(subjectObjectConstruction, token.text)**
if "subj" in token.dep_:
subject = appendChunk(subject, token.text)
subject = appendChunk(**subjectObjectConstruction**, subject)
**subjectObjectConstruction** = ''
if "obj" in token.dep_:
object = appendChunk(object, token.text)
object = appendChunk(**subjectObjectConstruction**, object)
**subjectObjectConstruction** = ''
Hello, Thanks for writing this code. It gives us basic idea to start working with KG.
In knowledgegraph.py file, once we enter the processSubjectObjectPairs(tokens) function, you are assigning empty string to subjectConstruction and objectConstruction variables. After that there is no update of value to that variable, to update we need to pass "if subjectConstruction" or "if objectConstruction" conditions. But the values to those variables are empty strings, so we can never pass that condition to update those values. Can you please fix it? Thanks.
if isConstructionCandidate(token): if subjectConstruction: subjectConstruction = appendChunk(subjectConstruction, token.text) if objectConstruction: objectConstruction = appendChunk(objectConstruction, token.text)