0

I'm using stanza/spacy nlp for finding the dependency parsing between words. For example doc=nlp("His home was in violation of local and state zoning and environmental regulations, and there was no access to a road"). keyword={""changes"": [""no access""], ""features"": [""road""]}. The values of variable keyword ,"no access" and "road" are present in doc. If both of this words has any relation then I need to print "True". If no relation then print False. How can I write this code ? Can anyone please help?

  • What have you tried? If you have dependencies you should be able to just walk the tree. – polm23 Aug 26 '21 at 05:03
  • Actually this sentence is from a dataframe which contains 200 leads.Count of the keywords is also same. So values of the keywords will change based on its sentence. I need to create a loop which outputs True/False , if the values of features and changes has relation. Adding to that, is it possible to extract relationship of two specific words from a sentence without using displacy? – Sangeeth Saseendran Nair Aug 27 '21 at 06:43
  • Try reading this section in the spaCy docs https://spacy.io/usage/linguistic-features#navigating – polm23 Aug 28 '21 at 02:30

0 Answers0