Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract triples (also an example of extracting obj-verb-obj) #178

Open
stephbuon opened this issue May 18, 2023 · 3 comments
Open

Extract triples (also an example of extracting obj-verb-obj) #178

stephbuon opened this issue May 18, 2023 · 3 comments
Assignees

Comments

@stephbuon
Copy link
Owner

sent = 'He just finished his undergraduate degree in genealogy at a university known for its Greek life, Southern Axolotl University (SAU).'

triples = grammatical_triples.extract(sent, TripleExtractorOptions(prep_phrase = True))

for triple in triples:
    print(triple)

Returns:

He finished degree
He finished just
He finished at university

But should return:

He finished degree in genealogy
He finished at university known for greek life
Southern Axolotl University known for greek life # example of obj-verb-obj
@stephbuon
Copy link
Owner Author

To extract the object-verb-prep-object "Southern Axolotl University-known-for-greek life"

Identify the verb. If the verb's head is pobj, visit it.

If the verb's child is poa, visit it.

If the poa's child is pobj, visit it.

@stephbuon
Copy link
Owner Author

@stephbuon -- any other verb types?

@stephbuon
Copy link
Owner Author

@stephbuon

|He||||finished||at|||university||| |0
|He||||finished|||||degree||| |0
|He||||finished|||||just||| |0
|degree||||finish||at|||university||| |0
|degree||||finish|||||degree||| |0
|degree||||finish|||||just||| |0
|just||||finished||at|||university||| |0
|just||||finished|||||degree||| |0
|just||||finished|||||just||| |0
|He||||known||at|||university||| |0
|He||||known||for|||life||| |0
|university||||known||at|||univer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants