1. 程式人生 > >自然語言處理基礎技術之組合範疇文法

自然語言處理基礎技術之組合範疇文法

宣告:轉載請註明出處,謝謝:https://blog.csdn.net/m0_37306360/article/details/84719074
另外,更多實時更新的個人學習筆記分享,請關注:
知乎:https://www.zhihu.com/people/yuquanle/columns
公眾號:StudyForAI


之前在讀論文的時候看到CCG這個概念,所以之查閱學習了一波~~


定義:

  • 組合範疇語法(Combinatory categorial grammar,CCG),是在AB演算基礎上進行擴充套件而產生的範疇語法。從語法理論視角看,CCG是一種詞彙形式化的方法;從計算語言學視角看,CCG屬於一類適度上下文相關文法;從邏輯語義學視角看,CCG在句法與語義的介面方面非常融洽。無論是CCG語言的、計算的,還是邏輯的特徵,都使得 CCG非常適用於自然語言資訊處理,對於計算語言學具有很好的理論和實際價值。

  • 維基百科定義:Combinatory categorial grammar (CCG) is an efficiently parsable, yet linguistically expressive grammar formalism. It has a transparent interface between surface syntax and underlying semantic representation, including predicate-argument structure, quantification and information structure. The formalism generates constituency-based structures (as opposed to dependency-based ones) and is therefore a type of phrase structure grammar (as opposed to a dependency grammar).

  • 組合範疇文法,簡稱 CCG,是一種型別驅動的詞彙化文法,通過詞彙範疇顯式地提供從句法到語義的介面,屬於短語結構文法。CCG 的基本操作包括:1)原子範疇(Atomic Category),用於表達基本的詞彙類別和句法功能; 2)組合範疇(Function Category),由原子範疇構成,通常用 X/Y 或 X\Y 來表示可以向左或者向右尋找變元 Y 來獲得組合 X。


例子:

  • 在CCG中,句子沒有單一的結構,就像在其他語法模型中一樣。這裡用一個維基百科的例子直觀的感受一下。
    例子地址:https://en.wikipedia.org/wiki/Combinatory_categorial_grammar

    Given a sentence:the dog bit John
    在這裡插入圖片描述
  • 另外,看了一篇IJCAI2017的文章,這篇文章是做sentence representation的。文章指出大多數現有模型在學習sentence representation通常會平均對待句子中的每個單詞。所以文章通過為組成單詞的向量分配不同的權重來改進句子表示,這可以被視為單個句子上的注意機制。為此,文章提出了新穎的注意力模型,就包括使用CCG supertags來推導注意力權重。 換句話簡單的說,文章提出不同的詞性應該有不同的重要性,其中就提出了給不同詞性不同CCG的詞分配不同的權重。
    有興趣的可以去看文章:Learning Sentence Representation with Guidance of Human Attention
    文章下載地址https://arxiv.org/pdf/1609.09189.pdf
    作者也開源了程式碼https://github.com/wangshaonan/Learning-sentence-representation-with-guidance-of-human-attention

一些工具: