Constituent Parsing & Dependency Parsing 句法分析簡介

轉自:trayfour

由於博主前面在學習句法分析的時候發現,相關的學習資料少之又少,費了不少功夫收集和整理。所以寫幾個筆記記錄一下。

關於Parsing的一些基礎知識:主要包括Parsing任務是幹什麼的,有什麼作用,怎麼做。
可以參考Christopher Manning的視頻。以前在course上面有視頻,現在得翻牆看
這是視頻鏈接https://www.youtube.com/playlist?list=PL6397E4B26D00A269
這裏寫圖片描述
不過他所有修改過的ppt能夠找到。下面是ppt鏈接,裏面還有其他nlp方面的介紹。
http://web.stanford.edu/~jurafsky/NLPCourseraSlides.html

話不多說,上面的資料很好,講的很清楚。

1 Two views of linguistic structure。
兩種句法結構的異同,依存句法和成分句法是兩種不同的句法,
Phrase structure organizes words into nested constituents.
這裏寫圖片描述
成分句法把句子組織成短語的形式,如eating fish就是一個動詞短語。

Phrase structure:
A constituency parse tree breaks a text into sub-phrases.
Non-terminals in the tree are types of phrases,
the terminals are the words in the sentence, and the edges are unlabeled.
interested in sub-phrases within the sentence

Dependency structure shows which words depend on (modify or are arguments of) which other words.
這裏寫圖片描述
而依存句法主要揭示了句子中詞的依賴關係。

Dependency structure:
A dependency parse connects words according to their relationships.
Each vertex in the tree represents a word,
child nodes are words that are dependent on the parent, and edges are labeled by the relationship.
interested in the dependency relationships between words

兩種語法結構能夠揭示句子中不同的信息,所以當你在其他任務中,需要用到句子中的短語結構就用constituent ,而需要用到詞與詞之間的依賴關係就用dependency。

順帶提一個小常識,依存句法樹能夠根據成分句法樹轉換而來,但成分句法樹不能通過依存樹轉化來。轉換的規則是head-finding rules from Zhang and Clark 2008

另外一個對於初學者比較頭疼的問題就是什麼是head word。
博主剛開始以爲有明確的定義,但沒找到,後面才知道,head word在不同的Parsing方案中不一樣,有的(比如Stanford的那一套規則)可能在這一句話中把這個詞定爲head word,而有的卻是另外一個詞。當然這些不同只是在一小部分比較特殊的語句中。

什麼是head word???

在成分句法分析中。
這裏寫圖片描述
如上圖,在”布朗訪問上海“這一整棵樹中head word就是“訪問”這個詞,而在右子樹上head word是“訪問”。
在constituent parsing中,一個長短語的head word表示最能表示整個短語的那個詞,名詞短語一般是名詞,動詞短語一般是動詞。而具體怎麼選,則根據不同的parser採取的方案有不同的規定,不過大部分的句子是一樣的,如上圖這些簡單的句子,不同的parser規則,得到的樹應該是一樣的。

在依存句法分析中。
這裏寫圖片描述
比如eating fish 中心是就是eating,因爲fish依賴於eating。
很好理解。

而中心詞的作用可以理解成在parse的過程中的一個重要的特徵。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章