• 沒有找到結果。

主角問答題自動評分

本章將介紹建立英文文章的語意關係圖的方法,以及如何運用語意關係圖計 算文章中名詞的重要性分數,找出文章中的重要名詞,以進行主角問答題自動評 分。以下將分成兩小節分別介紹語意關係圖建立及計算重要性分數的方法。圖 3 及圖 4 所示為以下文中所使用之範例文章。

4-1 語意關係圖建立

本研究根據文章中的文法結構關係建立出語意關係圖,分成以下三個主要處 理步驟。

(一) 字詞標記處理

本研究採用 Stanford [16] 提供的 Stanford Corenlp version 3.2.0 對文章中的每 一個字詞進行詞性標記(part-of-speech tagging)以及指稱代名詞處理。Stanford Corenlp 中具有 POS Tagger 可以將文章中每一個字詞依據標記出字詞在該句子中 的詞性,以範例一為例,詞性標記結果如圖 5 所示。

圖 3 文章範例一:敘述類型文章

圖 4 文章範例二:對話類型文章

Gary’s father is a cook. He is fifty-four years old. He is tall, thin, and handsome. He doesn’t wear glasses. He runs a Japanese restaurant in Taipei.

It opens six days a week, from Tuesday to Sunday. Gary’s mother, Susan, and the other cook, Mr. Chen, also work in the restaurant. They work together from 11:30 a.m. to 09:30 p.m. Many people eat in the restaurant during lunch break. Families and friends also get together to enjoy dinner.

It is a popular restaurant in the neighborhood.

David: Hey, did you watch the baseball game last night?

Oscar: Yeah, I did. So sad.

David: I agree. I thought we could have won the game.

Oscar: Me too. You know, when the 7th inning was over, we still led by 2 runs in the game. I felt we would definitely win, so I went to take a shower. When I came back, the Japanese team had tied the game 3-3. I was so surprised!

David: I know how you felt. I had the same feelings.

Oscar: Then, I decided not to watch the game because I was tired of watching our team losing.

David: Well, it’s just a game, not the end of the world!

Oscar: You’re right. Maybe I need to learn to deal with my feelings.

David: We’re playing again tomorrow evening. Do you want to watch it with me? We can cheer for our team!

Oscar: Sounds like a great idea!

圖 5 詞性標記結果

(二) 代名詞替換處理

文章中代名詞的目的在可增加語法上的流暢性,但是在處理文章內容時不易 分析,因此我們使用 Coreference Resolution System 透過詞性標記的結果,找出文 章中的代名詞對應的名詞,將代名詞替換成其對應的名詞。

以範例一為例,如圖 6 所示,第二句原句為「He is tall, thin, and handsome.」, 將代名詞 He 替換後,對應的名詞是 Gary’s father,因此句子成為「Gary’s father is tall, thin, and handsome.」,且也會將詞性標記結果中的代名詞 He 的詞性 PRP 替換

He runs a Japanese restaurant in Taipei . PRP VBZ DT JJ NN IN NNP .

Many people eat in the restaurant during lunch break . JJ NNS VBP IN DT NN IN NN NN .

Families and friends also get together to enjoy dinner . NNS CC NNS RB VBP RB TO VB NN .

It is a popular restaurant in the neighborhood . PRP VBZ DT JJ NN IN DT NN .

成 Gary’s father 的詞性 NNP POS NN。

圖 6 代名詞替代結果

敘述文章的句子可透過 Stanford Corenlp 的 Coreference Resolution System 處 理代名詞,但在對話的文章中,Coreference Resolution System 無法有效的處理,

因此對於對話的文章,本論文透過判斷對話的人物及其對應的語句,針對於第一 人稱及第二人稱的代名詞進行替換處理。以範例二的文章為例,如圖 7 所示,第 一句原句為「David: Hey, did you watch the baseball game last night?」,經由判斷說 話的人為 David,與 David 對話的人為 Oscar,因此句子中的 you 應替換成 Oscar,

Gary 's father runs a Japanese restaurant in Taipei . NNP POS NN VBZ DT JJ NN IN NNP .

restaurant opens six days a week , from Tuesday to Sunday . NN VBZ CD NNS DT NN , IN NNP TO NNP .

Gary 's mother , Susan , and the other cook , Mr. Chen , also work in the restaurant.

NNP POS NN , NNP , CC DT JJ NN , NNP NNP , RB NN IN DT NN . They work together from 11:30 a.m. to 09:30 p.m. .

PRP VBP RB IN CD NN TO CD NN .

Many people eat in the restaurant during lunch break . JJ NNS VBP IN DT NN IN NN NN .

Families and friends also get together to enjoy dinner . NNS CC NNS RB VBP RB TO VB NN .

It is a popular restaurant in the neighborhood . PRP VBZ DT JJ NN IN DT NN .

替換後的句子為「David: Hey, did Oscar watch the baseball game last night?」。

圖 7 代名詞替代結果

(三) 語意關係圖建立

本研究以 [12] 所提出概念圖建立之方法為基礎,建立文章內容的語意關係 圖。但[12]所考慮的資料是來自多篇同一主題的文件,而本研究是針對於一篇文 章。資料量少,因此對於建立的方法進行修改。

本研究建立三種語意關係圖,無方向性語意關係圖、單方向性語意關係圖,

雙方向性語意關係圖,以下說明三種語意關係圖的建立。

1.

無方向性語意關係圖建立

對於一篇文章,系統先取名詞做為語意關係圖的語意節點,以及取名詞與名 詞間的動詞,做為語意關係圖中,連結語意節點的語意關係。除了名詞及動詞之

David: Hey, did Oscar watch the baseball game last night?

Oscar: Yeah, Oscar did. So sad.

David: David agree. David thought we could have won the game.

Oscar: Oscar too. David know, when the 7th inning was over, we still led by 2 runs in the game. Oscar felt we would definitely win, so Oscar went to take a shower. When Oscar came back, the Japanese team had tied the game 3-3. I was so surprised!

David: David know how you felt. David had the same feelings.

Oscar: Then, Oscar decided not to watch the game because Oscar was tired of watching our team losing.

David: Well, it’s just a game, not the end of the world!

Oscar: David’re right. Maybe Oscar need to learn to deal with my feelings.

David: We’re playing again tomorrow evening. Do Oscar want to watch it with me? We can cheer for our team!

Oscar: Sounds like a great idea!

外,有許多形容詞與副詞,若是將所有形容詞與副詞皆放入語意關係圖中,將使 得語意關係圖所包含的內容過於繁瑣。本研究認為句子中,用來形容主詞的形容 詞及副詞,可表示主詞的相關語意資訊,因此另外將這種形容詞及副詞也表示為 語意節點,放入語意關係圖中。取出動詞做為連結語意關係圖中兩個語意節點的 語意關係,此語意關係為無方向性的連結關係。

以範例一為例,如圖 8 所示,從文章中擷取出名詞、名詞片語、形容詞及副 詞為語意節點,動詞為語意關係,圖中將形成語意節點的名詞、名詞片語、形容 詞及副詞標注底線,以粗體字表示語意關係的動詞,所形成的無方向性語意關係 圖如圖 9 所示。範例一文章中的第一個句子「Gary’s father is a cook.」,詞性標記 結果為「NNP POS NN VBZ DT NN .」。其中名詞 Gary’s father 以及 cook 表示為 語意節點,動詞 is 為 Gary’s father 和 cook 兩個語意節點之間的無方向性語意 關係。第三個句子「Gary’s father is tall, thin, and handsome.」,詞性為「NNP POS NN VBZ JJ , JJ , CC JJ .」。因此 名詞 Gary’s father、tall、thin 以及 handsome 表 示為語意節點,動詞 is 為 Gary’s father 和 tall、thin、handsome 之間的語意關 係。

圖 8 範例一文章的語意節點及語意關係

Gary’s father is a cook. Gary’s father is fifty-four years old. Gary’s father is tall, thin, and handsome. Gary’s father doesn’t wear glasses. Gary’s father runs a Japanese restaurant in Taipei. restaurant opens six days a week, from Tuesday to Sunday. Gary’s mother, Susan, and the other cook, Mr.

Chen, also work in the restaurant. They work together from 11:30 a.m. to 09:30 p.m. Many people eat in the restaurant during lunch break. Families and friends also get together to enjoy dinner. It is a popular restaurant in the neighborhood.

圖 9 範例一文章構成的無方向性語意關係圖

2.

雙向語意關係圖建立

與無方向性語意關係圖的建立方法相同,但連結語意節點之間的語意關係改 為雙向的語意關係。

以範例一為例,如圖 8 所示,從文章中擷取出名詞、名詞片語、形容詞及副 詞為語意節點,動詞為語意關係,圖中將形成語意節點的名詞、名詞片語、形容 詞及副詞標注底線,以粗體字表示語意關係的動詞,所形成的雙向語意關係圖如 圖 10 所示。

圖 10 範例一文章構成的雙向語意關係圖

3.

單向語意關係圖建立

對於一篇文章,系統先取名詞以及用來形容主詞的形容詞及副詞做為語意關 係圖的語意節點。取名詞與名詞間的動詞,以及名詞與形容詞間的動詞,做為語 意關係圖中,連結語意節點的語意關係,此語意關係為主詞指向受詞的單向連結 關係。

以範例一為例,如圖 8 所示,從文章中擷取出名詞、名詞片語、形容詞及副 詞為語意節點,動詞為主詞指向受詞的單向語意關係,圖中將形成語意節點的名 詞、名詞片語、形容詞及副詞標注底線,以粗體字表示語意關係的動詞,所形成 的單方向性語意關係圖如圖 11 所示。範例一文章中的第一個句子「Gary’s father is a cook.」,詞性標記結果為「NNP POS NN VBZ DT NN .」。其中名詞 Gary’s father 以及 cook 表示為語意節點,動詞 is 為 Gary’s father 和 cook 兩個語意節點之 間的語意關係,Gary’s father 為句子中的主詞,cook 為句子中的受詞,此語意關 係為 Gary’s father 指向 cook 的單向語意關係。第三個句子「Gary’s father is tall, thin, and handsome.」,詞性為「NNP POS NN VBZ JJ , JJ , CC JJ .」。因此 名詞 Gary’s father、tall、thin 以及 handsome 表示為語意節點,動詞 is 為 Gary’s father 和 tall、thin、handsome 之間的語意關係,Gary’s father 為句子中的主詞,tall、

thin、handsome 為句子中的受詞,此語意關係為 Gary’s father 指向 tall、thin、

handsome 的單向語意關係。

圖 11 範例一文章構成的單向語意關係圖

4-2 重要性分數計算

根據文章內容將其表示成語意關係圖後,接下來必須從圖中自動分析出文章 中主要的人或物。我們認為在圖形的網絡中越是重要的節點,越可能對應文章中 的主要描述或討論的人或物的名詞,故我們對語意關係圖中的節點分析其在圖形 結構中的重要性分數。

根據不同的語意關係圖建立方法,重要性分數的計算方法也不同,以下說明 三種語意關係圖的建立方法的計算方式。

1.

無方向性語意關係圖重要性分數

設定每個語意節點的重要性分數值為語意節點在文章中出現的句子數量比 例值。以範例一為例,如圖 8 所示,節點 Gary’s father 在文章中出現的句子數量 為 5,文章中共有 11 個句子,因此重要性分數值為 0.45。

2.

雙向語意關係圖重要性分數

Random walk 是一個隨機程序的模型,經常用於許多領域。許多研究將 Random walk 的方法運用在對文件進行摘要句選取,以一個句子為單位對應到節 點,計算每一個節點的重要性,取出文件中重要的句子為摘要。本研究使用

Random walk with restart 的方法,從已建立好的語意關係圖中,計算每個節點的 重要性。

本研究中,由於英文文章所構成的語意關係圖中,可能會有孤立點,因此在 計算名詞的重要性分數時,設立一個空節點(Null node)與關係圖中各點連結,使 得孤立點可以與其它節點連結,所有節點之間的連結皆設為雙向。如圖 12 所示,

關係圖中間設立一個 null node 與其它節點相連。

圖 12 範例一計算重要性分數的雙向語意關係圖

表 2 圖八節點對應表

本研究設定兩個語意節點間關係連結的權重值為兩個語意節點在文章中同 一個句子中的句子數量,空節點與語意節點間的權重值設為 1。以範例一為例,

本研究設定兩個語意節點間關係連結的權重值為兩個語意節點在文章中同 一個句子中的句子數量,空節點與語意節點間的權重值設為 1。以範例一為例,

相關文件