Rewriting sentences while retaining semantic meaning

£可爱£侵袭症+ 提交于 2020-05-24 08:49:27

问题


Is it possible to use WordNet to rewrite a sentence so that the semantic meaning of the sentence still ways the same (or mostly the same)?

Let's say I have this sentence:

Obama met with Putin last week.
  1. Is it possible to use WordNet to rephrase the sentence into alternatives like:

    Obama and Putin met the previous week.
    Obama and Putin met each other a week ago.
    
  2. If changing the sentence structure is not possible, can WordNet be used to replace only the relevant synonyms?

    For example:

    Obama met Putin the previous week.
    

回答1:


If the question is the possibility to use WordNet to do sentence paraphrases. It is possible with much grammatical/syntax components. You would need system that:

  • First get the individual semantics of the tokens and parse the sentence for its syntax.
  • Then understand the overall semantics of the composite sentence (especially if it's metaphorical)
  • Then rehash the sentence with some grammatical generator.

Up till now I only know of ACE parser/generator that can do something like that but it takes a LOT of hacking the system to make it work as a paraphrase generator. http://sweaglesw.org/linguistics/ace/

So to answer your questions,

Is it possible to use WordNet to rephrase the sentence into alternatives? Sadly, WordNet isn't a silverbullet. You will need more than semantics for a paraphrase task.

If changing the sentence structure is not possible, can WordNet be used to replace only the relevant synonyms? Yes this is possible. BUT to figure out which synonym is replace-able is hard... And you would also need some morphology/syntax component.

First you will run into a problem of multiple senses per word:

from nltk.corpus import wordnet as wn
sent = "Obama met Putin the previous week"

for i in sent.split():
    possible_senses = wn.synsets(i)
    print i, len(possible_senses), possible_senses

[out]:

Obama 0 []
met 13 [Synset('meet.v.01'), Synset('meet.v.02'), Synset('converge.v.01'), Synset('meet.v.04'), Synset('meet.v.05'), Synset('meet.v.06'), Synset('meet.v.07'), Synset('meet.v.08'), Synset('meet.v.09'), Synset('meet.v.10'), Synset('meet.v.11'), Synset('suffer.v.10'), Synset('touch.v.05')]
Putin 1 [Synset('putin.n.01')]
the 0 []
previous 3 [Synset('previous.s.01'), Synset('former.s.03'), Synset('previous.s.03')]
week 3 [Synset('week.n.01'), Synset('workweek.n.01'), Synset('week.n.03')]

Then even if you know the sense (let's say the first sense), you get multiple words per sense and not every word can be replaced in the sentence. Moreover, they are in the lemma form not a surface form (e.g. verbs are in their base form (simple present tense) and nouns are in singular):

from nltk.corpus import wordnet as wn
sent = "Obama met Putin the previous week"

for i in sent.split():
    possible_senses = wn.synsets(i)
    if possible_senses:
        print i, possible_senses[0].lemma_names
    else:
        print i

[out]:

Obama
met ['meet', 'run_into', 'encounter', 'run_across', 'come_across', 'see']
Putin ['Putin', 'Vladimir_Putin', 'Vladimir_Vladimirovich_Putin']
the
previous ['previous', 'old']
week ['week', 'hebdomad']



回答2:


One approach is grammatical analysis with nltk read more here and after analysis convert your sentence in to active voice or passive voice.



来源:https://stackoverflow.com/questions/22897794/rewriting-sentences-while-retaining-semantic-meaning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!