Spacy: How to flag sentences with possible multiple meanings

Created on 24 May 2018  路  3Comments  路  Source: explosion/spaCy

I understand that if the CFG gives multiple parse trees then your sentence can have multiple meanings. Since we directly don't have that functionality in spacy i was wondering how i would approach this problem. Using dependency parse i can get the sub-trees well and good but that itself isn't sufficient information to know if a statement is ambiguous as spacy is using greedy parse to give me the best possible parse tree (correct me if i am wrong).

Other way could be to match specific rule to either POS or TAG labels of the sentence.
Perhaps we can use wordnet to find different possible meanings. _E.g : Sentences with_ bank, milk, tire _etc (where verb and noun mean different things) like_ _I saw bats_.

However is there any way to conclude if a statement is ambiguous without doing matching? Possibly using dependency parse trees or is there any way to specify CFG grammar and find possible constructs of parse tree and say its ambiguous if it comes to be more than 1?
@ines @honnibal can you give me some guidance?

feat / parser

Most helpful comment

Hello,
I'll explain the issue in several steps.

  1. a. Some words can have more than one irrelevant meanings. For instance bank (bench, financial institute); tire(car rubber, exhaustion).
    b. Some words are both a verb and a noun. e.g.: milk, result
    c. Some words have many meanings, related somehow. For instance:
    run a marathon
    run a company
    running up that hill (like Placebo song)

          go for a walk
          go for your ambitions
         go for the chicken wings
    

Notice:
a. POS tags are the same; both bank(bench) and bank(financial institute) are used as nouns.
b. Meanings are close, but POS tags are different. In semantic tasks, "milk" verb or noun not very important, provides more or less the same meaning.
c. Happens a lot with verbs like run, go, get...

How you differentiate the meaning is
a. From the surrounding words:
bank, riverside, sit, tree --> bench
bank, account, credit card, ATM -> financial institute

b. POS tags
c. Same as (a) but more difficult

  1. Words can have several/ambigious meanings but sentences can't. Sentence as a concept, aims to include the meaning fully together with the action, agent, place etc. Even if the sentence contains an ambigious word, meaning is always clear from the context.
    So, please change the issue title:)

  2. Wordnet can be used for word-sense disambiguation, if you want. This way you can disambiguate the word's meaning, I repeat not the sentence, a sentence has only one meaning.
    http://www.nltk.org/howto/wsd.html
    https://web.stanford.edu/~jurafsky/slp3/slides/Chapter18.wsd.pdf

  3. Word-sense disambiguation is rather a semantic task. Parse trees in general syntax won't help much. For instance

I sat onto the bank.
I went to the bank.

has the same parse tree structure, what helps you to disambiguate is the verbs "to sit" vs " to go".

  1. However, I doubt you need it. if take the sentence as a whole. If you feed the context to your algorithm, sense comes intrinsically from the surrounding context. For instance check out https://github.com/facebookresearch/InferSent .
    What is your task btw?

Cheers,
Duygu.

All 3 comments

Hello,
I'll explain the issue in several steps.

  1. a. Some words can have more than one irrelevant meanings. For instance bank (bench, financial institute); tire(car rubber, exhaustion).
    b. Some words are both a verb and a noun. e.g.: milk, result
    c. Some words have many meanings, related somehow. For instance:
    run a marathon
    run a company
    running up that hill (like Placebo song)

          go for a walk
          go for your ambitions
         go for the chicken wings
    

Notice:
a. POS tags are the same; both bank(bench) and bank(financial institute) are used as nouns.
b. Meanings are close, but POS tags are different. In semantic tasks, "milk" verb or noun not very important, provides more or less the same meaning.
c. Happens a lot with verbs like run, go, get...

How you differentiate the meaning is
a. From the surrounding words:
bank, riverside, sit, tree --> bench
bank, account, credit card, ATM -> financial institute

b. POS tags
c. Same as (a) but more difficult

  1. Words can have several/ambigious meanings but sentences can't. Sentence as a concept, aims to include the meaning fully together with the action, agent, place etc. Even if the sentence contains an ambigious word, meaning is always clear from the context.
    So, please change the issue title:)

  2. Wordnet can be used for word-sense disambiguation, if you want. This way you can disambiguate the word's meaning, I repeat not the sentence, a sentence has only one meaning.
    http://www.nltk.org/howto/wsd.html
    https://web.stanford.edu/~jurafsky/slp3/slides/Chapter18.wsd.pdf

  3. Word-sense disambiguation is rather a semantic task. Parse trees in general syntax won't help much. For instance

I sat onto the bank.
I went to the bank.

has the same parse tree structure, what helps you to disambiguate is the verbs "to sit" vs " to go".

  1. However, I doubt you need it. if take the sentence as a whole. If you feed the context to your algorithm, sense comes intrinsically from the surrounding context. For instance check out https://github.com/facebookresearch/InferSent .
    What is your task btw?

Cheers,
Duygu.

@DuyguA Thanks for taking the time to explain this --- it was a great answer!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings