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

Doesn't work with attributes #19

Open
ifmaq1 opened this issue Mar 1, 2022 · 6 comments
Open

Doesn't work with attributes #19

ifmaq1 opened this issue Mar 1, 2022 · 6 comments

Comments

@ifmaq1
Copy link

ifmaq1 commented Mar 1, 2022

Hi, I tried to generate the graph for sentences like

a white and red toothbrush
a black computer monitor

however the parser doesn't work with these sentences. I get it, this parser works with subject relation and object. Can you please guide me, how do I manage these lines to generate graph for such sentences.

Thank you

@vacancy
Copy link
Owner

vacancy commented Mar 1, 2022

The second sentence should work:

In [2]: sng_parser.parse("a black computer monitor")
Out[2]:
{'entities': [{'span': 'a black computer monitor',
   'lemma_span': 'a black computer monitor',
   'head': 'computer monitor',
   'lemma_head': 'computer monitor',
   'span_bounds': (0, 4),
   'modifiers': [{'dep': 'det', 'span': 'a', 'lemma_span': 'a'}],
   'type': 'unknown'}],
 'relations': []}

@vacancy
Copy link
Owner

vacancy commented Mar 1, 2022

Due to 14ed400

The first sentence should also work now.

In [1]: import sng_parser

In [2]: sng_parser.parse('a white and red toothbrush')
Out[2]:
{'entities': [{'span': 'a white and red toothbrush',
   'lemma_span': 'a white and red toothbrush',
   'head': 'toothbrush',
   'lemma_head': 'toothbrush',
   'span_bounds': (0, 5),
   'modifiers': [{'dep': 'det', 'span': 'a', 'lemma_span': 'a'},
    {'dep': 'amod', 'span': 'white', 'lemma_span': 'white'},
    {'dep': 'amod', 'span': 'red', 'lemma_span': 'red'}],
   'type': 'unknown'}],
 'relations': []}

@ifmaq1
Copy link
Author

ifmaq1 commented Mar 4, 2022

Hi, Thanks for your response.
For relations table, it was easy to create graph by picking the words from relation's table. Like
object relation and subject

how to extract the information for graphs through entities table when we can't have relations' table. I want to create this graph.

image

For the a black computer monitor sentence. I want one node to be Black and other node to be computer monitor. Just like white and table in above image

Also, It couldn't detect a man is in the water & the man is laying down in relation's table. Although these sentences include relation in it.

vacancy added a commit that referenced this issue Mar 4, 2022
@vacancy
Copy link
Owner

vacancy commented Mar 4, 2022

Hi,

There are two unresolved cases in the previous model:

  • a black computer monitor. It wasn't able to detect black as a modifier to monitor.
  • a man is in the water. It wasn't able to detect man-in-water.
    These two cases have been fixed in #a96e37c

For "the man is laying down". Currently, the model does not handle any intransitive verbs. I don't think they should be treated as "relations".

@ifmaq1
Copy link
Author

ifmaq1 commented Mar 5, 2022

here are some more sentences it couldn't detect

umbrella is blue and white.
microwave oven in the kitchen.
stainless steel oven
red fire hydrant in snow
bear with black eyes
green wall behind the tennis court
the bears head
the water is blue.
umbrella is open.
the water is calm.
sky is clear and blue.
two teddy bears on a shelf.
the train is in the station.

@hbai98
Copy link

hbai98 commented Dec 31, 2022

One case from my tests.
"A rainforest bird mating ritual dance."
{'entities': [{'head': 'rainforest bird', 'lemma_head': 'rainforest bird', 'lemma_span': 'a rainforest bird', 'modifiers': [{'dep': 'det', 'lemma_span': 'a', 'span': 'a'}], 'span': 'a rainforest bird', 'span_bounds': (0, 3), 'type': 'unknown'}, {'head': 'dance', 'lemma_head': 'dance', 'lemma_span': 'ritual dance', 'modifiers': [{'dep': 'amod', 'lemma_span': 'ritual', 'span': 'ritual'}], 'span': 'ritual dance', 'span_bounds': (4, 6), 'type': 'unknown'}], 'relations': [{'lemma_relation': 'mate', 'object': 1, 'relation': 'mating', 'subject': 0}]}

It interprets 'dance' as an entity, which should not be.

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

3 participants