2

I am working on a task which involves information extraction, for which I require splitting a complex sentence into a bunch of simple sentences. For instance,

In optics a ray is an idealized model of light, obtained by choosing a line that is perpendicular to the wavefronts of the actual light, and that points in the direction of energy flow.

may be split as

  • ray is an idealized model of light.
  • ray is obtained by choosing a line that is perpendicular to wavefronts of actual light.
  • ray points in the direction of energy flow.

The only condition being, each simple form must in SVO (Subject-Verb-Object) format. For example for sentence ray is an idealized model of light

Subject - ray
Verb - is
Object - idealized model of light

What approach should I take? I am using NLTK and python 2.7. Can dependency parsing be of any help?

4
  • 1
    If you need only English, I would use spacy.io for this, it is much more lightweight and better than NLTK. eg displacy.spacy.io?share=2355455701063440884 – Adam Bittlingmayer Aug 19 '16 at 20:07
  • 1
    note: 'ray' is not a valid subject, but 'a ray' ('every ray') is. Your 3rd split is ambiguous; it may only be the 'chosen line' that points in the direction of energy flow. {It just happens that 'obtained' means 'equal to'} – amI Aug 19 '16 at 20:14
  • 1
    Dependency parses will give you all the dependencies so yes, dependency parsing would help you extract all the subtrees you're interested in. – Atamiri Aug 20 '16 at 16:36
  • It's not possible. In "A ray is [an idealised model of flight]", the bracketed element is a predicative complement, not an object. – BillJ Aug 22 '16 at 19:24
0

If you are familiar with spacy, you can use the dependency of the words in the sentence:

import spacy

nlp = spacy.load("en_core_web_sm")
doc = nlp("Apple is looking at buying U.K. startup for $1 billion")

for token in doc:
    print(token.text, token.lemma_, token.pos_, token.tag_, token.dep_,
            token.shape_, token.is_alpha, token.is_stop)

token.dep_ can give you the root ( verb) and the relations in the sentence.

DEPENDENCY EXAMPLE

import spacy
from spacy import displacy

nlp = spacy.load("en_core_web_sm")
doc = nlp("This is a sentence.")
displacy.serve(doc, style="dep")

displacy helps visualizing the relations in the sentences.

You can check https://spacy.io/ for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.