在保留语义的同时重写句子 [英] Rewriting sentences while retaining semantic meaning

查看:301
本文介绍了在保留语义的同时重写句子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 WordNet 重写句子,以使句子的语义仍然可以相同(或基本相同)?

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)?

让我说这句话:

Obama met with Putin last week.




  1. 是否可以使用WordNet将句子改写为

  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.


  • 如果无法更改句子结构,可以使用WordNet代替仅相关的

  • If changing the sentence structure is not possible, can WordNet be used to replace only the relevant synonyms?

    例如:

    Obama met Putin the previous week.
    



  • 推荐答案

    如果问题是使用 WordNet 进行句子复述的可能性。可能有许多语法/语法成分。您将需要以下系统:

    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:


    • 首先获取标记的各个语义,然后解析其语法的句子。

    • 然后了解复合句子的整体语义(尤其是在隐喻的情况下)

    • 然后使用一些语法生成器重新整理句子。

    到目前为止,我只知道ACE解析器/生成器可以执行类似的操作,但是需要大量的系统破解工作使它可以用作释义生成器。 http://sweaglesw.org/linguistics/ace/

    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/

    所以要回答您的问题,

    是否可以使用WordNet将句子改写为其他选项?可悲的是,WordNet不是不是银弹。

    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.

    如果无法更改句子结构,可以使用WordNet来仅替换相关的同义词吗? / strong>是的,这是可能的。但是要弄清楚哪个同义词是可替换的是困难的...而且您还需要一些形态/语法组件。

    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
    

    [出]:

    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')]
    

    然后甚至如果您知道意思(让我们说第一种意思),则每种意义上您会得到多个单词,并且句子中并非每个单词都可以被替换。而且,它们采用 lemma 形式而不是表面形式(例如,动词采用其基本形式(简单的现在时态)而名词采用单数形式):

    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
    

    [出]:

    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']
    

    这篇关于在保留语义的同时重写句子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆