生成查詢答案

已發表: 2022-05-05

這項最近授予的谷歌專利通常與生成查詢答案有關,並且該專利還引入了約束的概念來幫助回答查詢。

對查詢答案使用約束

該專利詢問與添加問題的實體的事實相關的內容的問題。

有關使用約束進行查詢回答的文檔如下:

    GRIP:圖查詢缺失答案的基於約束的解釋
    使用約束滿足的問答:QA-by-Dossier-with-Constraints

有趣的是,第一份文件引用了 Google 知識庫作為參考。 可能是因為它專注於通過使用約束來獲得問題的正確答案。

由於該專利非常關注語義搜索引擎優化。 它讓我想起了與該主題有關的其他 Google 專利,包括這兩項,值得仔細閱讀:

  • 谷歌知識圖對賬
  • Google 知識圖的實體提取

該專利提供了一些關於實體和實體屬性如何工作、如何在圖形搜索中使用元組以及對語義 SEO 的看法。

通過提供來自數據庫的事實來生成查詢答案

搜索系統可以通過提供來自數據庫的事實來生成對事實查詢的響應。

這些事實可能會存儲在可以實時更新的圖表中。

此類響應可能會被格式化為搜索結果列表而不是句子。

當用戶提出一個事實性問題時,例如,通過語音向對話系統提出問題時,可能希望對問題有一個自然的響應。

最自然的響應可能是將答案表述為滿足用戶問題以提供查詢答案的事實的語法陳述。

因此,根據本專利中描述的主題的一個一般方面,響應於事實查詢,存儲在數據庫中的事實被轉換成用戶語言的句子。

接收識別實體屬性的查詢答案

本說明書中描述的主題的一個方面可以體現在包括接收標識實體屬性的查詢的動作的方法中。 這些屬性是關於實體的事實。

然後,這些操作包括訪問基於實體屬性的查詢答案的候選模板。 每個候選模板都有字段; 其中每個區域與至少一個約束相關聯。

然後,這些動作包括獲得一組提供查詢答案的信息並從候選模板集合中選擇一個模板。 所選擇的模板具有最重要的字段數量,這些字段具有滿足信息集的約束。

與實體相關的語義三元組

該組信息可以是一組實體-屬性-值三元組。

動作還包括通過將信息集添加到所選模板的字段來生成短語,使得詞包括查詢答案。

短語是一個句子或句子的一部分。 最後,這些動作包括將單詞傳達給客戶端設備。

短語可以作為與單詞對應的音頻信號來傳達。

約束可能包括:

  • 類型約束
  • 時間約束
  • 性別限制
  • 關係約束
  • 單數/複數約束
  • 度量單位約束
  • 行列式約束。

一些實現涉及獲取響應於查詢中的單個屬性的多組信息。

這些行動還包括:

  • 根據實體的類型獲取句子模板,該句子模板包括多個短語字段
  • 將短語添加到句子模板的字段以形成句子
  • 從候選模板集中為每組信息選擇一個模板
  • 通過將相應的信息集添加到相應所選模板的字段中,為每個所選模板生成一個短語
  • 將包括短語的句子傳達給客戶端設備

這可能涉及包含許多屬性的查詢答案。

  • 接收標識實體的許多屬性的查詢答案
  • 為實體的每個屬性訪問一組基於實體的相應屬性的查詢答案的候選模板
  • 為實體的每個屬性獲取一組回答查詢的相應部分的信息
  • 從相應的候選模板集中選擇一個模板
  • 通過將相應的信息集添加到所選模板的字段中,為實體的每個屬性生成一個短語
  • 根據實體的類型獲取句子模板,該句子模板包括多個短語字段
  • 將短語添加到句子模板的字段中以形成句子
  • 將包含短語的句子傳達給客戶端設備

此過程的優點包括:

該系統是可配置的並且可擴展到復雜的事實斷言和答案。
它可以允許將實際數據庫與句子生成機製完全分離。
它可以允許通過任何合適的方法添加新模板。

該生成查詢答案專利位於

生成查詢答案
發明人:Engin Cinar Sahin、Vinicius J. Fortuna 和 Emma S. Persky
受讓人:谷歌有限責任公司
美國專利:11,321,331
授予:2022 年 5 月 3 日
提交日期:2018 年 7 月 23 日

抽象的

服務器接收標識實體屬性的查詢答案。

服務器訪問一組候選模板以基於實體的屬性回答查詢,每個候選模板具有字段,其中每個字段與至少一個約束相關聯。

服務器獲取一組信息和查詢答案,並從該組候選模板中選擇一個模板。

所選模板的字段數最多,且信息集滿足約束條件。

服務器通過將信息集添加到所選模板的字段來生成短語,使得該短語包括對查詢的回答。

最後,服務器將短語傳達給客戶端設備。

將事實從數據庫轉換為句子

當用戶提出事實問題時,搜索引擎可以通過訪問數據庫來提供查詢答案。

一些系統,例如基於語音的對話系統,允許用戶將查詢計劃為自然語言問題(例如,“誰是日本總統?”)。

在這種情況下,可能希望以句子的形式提供自然語言答案,而不是格式化為引用文檔的搜索結果的答案。

因此,本規範中描述的系統可以將數據庫中的事實轉換為句子。 例如,這可能是有利的,使得答案可以作為語音返回給用戶。

為了生成回答用戶問題的句子,可能需要從數據庫中檢索隨機事實。 但事實並不是隨機的——它們使用約束信息來提供查詢答案。 這似乎意味著更好地回答有關實體的查詢。

為了回答諸如某人結婚之類的查詢,系統可能會獲取包括所有過去婚姻、參與過去婚禮的人、結合日期和婚姻協議類型的數據。 使用圖形結構表示事實的靈活數據庫可以提供這些事實。

訪問候選模板以根據一個或多個屬性生成查詢答案

一旦收集了事實,答案引擎就可以訪問候選模板,以根據查詢中提供的一個或多個屬性生成答案。 例如,如果最初的問題是“伍迪艾倫嫁給了誰”,那麼重點可能是“婚姻”。 如果實際查詢是“伍迪艾倫多大了”,則屬性可能是“年齡”。 如下所述,問題的每個點可以對應於多個候選模板,例如,以支持或多或少詳細的答案。

例如,如果屬性是“年齡”,那麼答案引擎可以獲得一個包含出生日期和年齡的模板(例如,{<entity> 出生於 <date> 並且當前是 <value> 歲}),一個模板僅包含年齡(例如,{<entity> 當前為 <value> 歲})和包含出生日期和死亡日期的模板(例如,{<entity> 出生於 <date> 並死於 < /日期>})。

如以下更詳細描述的,包含在“< >”中的模板部分(即,字段)可能與它們可以保存的數據的各種約束相關聯。

一旦答案引擎獲得候選模板,它會根據多個啟發式方法選擇最相關的模板,並通過將事實插入模板來生成句子。 然後,答案引擎可以將更正的答案提供給用戶。

一種數據圖搜索系統

系統可能習慣於使用這裡描述的技術來實現數據圖的搜索引擎。

系統被描述為用於處理來自客戶端的查詢請求的數據圖的搜索引擎系統。 可以使用相關技術的其他配置和應用。 例如,查詢請求可以源自另一個服務器、批處理作業或與數據圖搜索系統通信的用戶終端。

數據圖搜索系統可以包括索引系統、搜索系統和索引集群。 索引系統、搜索系統和索引集群可以是採用若干不同設備形式的計算設備,例如標準服務器、一組這樣的服務器或機架服務器系統。

此外,索引系統、搜索系統和索引集群可以在個人計算機中實現,例如膝上型計算機。

數據圖搜索系統可以包括基於圖的數據存儲。 這樣的數據圖存儲節點和邊,可以從中創建圖。

節點可以稱為實體,邊可以稱為兩個實體之間的關係。 這種關係可以通過多種方式存儲。

在一個示例中,基於圖的數據存儲存儲表示實體和關係的三元組。

表示實體和關係的三元組

三元組還可以包括一個格式,實體表示起始實體,點表示相關實體的特徵,作為從實體重新定義的邊,值表示相關實體。

三元組的一個例子是實體 Woody Allen 作為主語(或實體),關係作為謂詞(或屬性),實體 Annie Hall 作為賓語(或值)。

當然,具有許多實體甚至有限數量關係的數據圖可能有數十億個三元組。

索引系統可以包括被配置為執行機器可執行指令或軟件、固件或其組合的處理器。

查找查詢答案

搜索系統可以包括從客戶端的用戶接收查詢並將那些查詢提供給搜索系統的服務器(未示出)。

搜索系統可負責搜索數據圖和其他數據源,例如來自互聯網或內聯網的文檔語料庫,以響應查詢。

例如,搜索系統可以從客戶端(例如客戶端)接收查詢,執行一些查詢處理,並將查詢發送到索引集群和存儲用於搜索其他源的索引的其他索引集群。

搜索系統可以具有編譯來自所有來源的結果並將編譯結果提供給客戶端的模塊。

搜索系統可以只向索引集群發送查詢,並且可以將來自索引集群的搜索結果提供給客戶端。

搜索系統可以通過網絡與客戶端通信。

查找查詢答案的索引簇

該系統還可以包括索引集群。 索引集群可以是單個計算設備或具有計算設備的分佈式數據庫系統,每個計算設備都有自己的處理器和內存。

組成索引集群的計算設備的數量可能會有所不同,為了簡潔起見,索引集群被顯示為單個實體。

每個索引集群可以包括被配置為執行機器可執行指令或軟件、固件或其組合的處理器。

計算集群可以包括操作系統(未示出)和計算機存儲器,例如主存儲器,其被配置為臨時、永久、半永久地或它們的組合存儲多條數據。

存儲器可以包括以處理器可以讀取和執行的格式存儲信息的任何類型的存儲設備,包括易失性存儲器、非易失性存儲器或其組合。

訪問索引以檢索響應於查詢的結果的查詢解析器

索引集群還可以包括訪問索引以檢索響應於查詢的結果的模塊,例如查詢解析器。

查詢解析器也可能是搜索系統的一部分,或者可能分佈在搜索系統和索引集群之間。

越來越複雜的查詢和查詢答案

一個涉及一個屬性(“年齡”)並產生一個三重答案的簡單查詢。

一個簡單查詢的示例,它涉及一個屬性(“婚姻”),但會產生多個三重答案。

涉及兩個屬性(“家鄉和母校”)並導致多個三重答案的複雜查詢示例。

一個生成句子以響應事實查詢的示例係統。

該系統包括客戶端設備、搜索系統、索引集群和答案引擎。

實體可以作為系統的一部分來實現。

用戶使用客戶端設備發起具有查詢詞的查詢。

用戶可以將原始查詢格式化為句子。

與基於語音的對話系統交互

用戶可以使用基於語音的對話系統與客戶端設備交互。

例如,用戶可以向客戶端設備的麥克風說出查詢“伍迪艾倫多大了”。

客戶端設備然後可以執行語音識別以將話語轉換為轉錄,然後將轉錄傳輸到搜索引擎。

或者,客戶端設備可以發送對話語進行編碼的音頻語音數據。

搜索系統從客戶端設備接收查詢(例如,“伍迪艾倫幾歲”)。

如果查詢被編碼為音頻語音數據,則搜索系統可以將音頻語音數據轉換為轉錄。

然後搜索系統將原始查詢解析並格式化為 <entity; 屬性> 格式(例如 <woody Allen/age<),例如使用合適的自然語言解析引擎。

然後搜索系統將格式化的查詢發送到索引集群。

索引簇訪問索引以檢索響應於查詢的結果。

以三元組的形式查詢答案

這些結果可能是一組三元組形式的事實信息(例如,</woody><woody Allen/born on/Dec. 1,>

然后索引簇傳輸格式化的查詢(例如,</woody><woody Allen/age> 和回答查詢的事實信息(例如,</woody><woody Allen/born on/Dec. 1, 1935>)到答案引擎。

使用格式化的查詢和事實信息,答案引擎然後以一個或多個句子的形式生成答案。

答案引擎生成的答案如下。 首先,答案引擎從格式化的查詢中獲取一個或多個屬性。

然後,答案引擎使用一個或多個屬性來訪問來自模板數據庫的候選句子或短語模板。

接下來,答案引擎基於事實信息和與候選模板相關聯的各種約束來選擇模板之一。

最後,答案引擎使用事實信息填寫所選模板中的字段。

獲取一個或多個屬性的應答引擎

更詳細地說,答案引擎首先通過解析查詢從格式化查詢中獲取一個或多個屬性。 例如,假設查詢被格式化為 <entity/attribute> 對,答案引擎會提取該對的屬性部分。

在某些情況下,格式化查詢可能包含多個屬性。 例如,格式化查詢可以是<entity/attribute/attribute>的形式。 在這種情況下,答案引擎可以從查詢中提取每個屬性。

接下來,答案引擎從模板數據庫訪問查詢中每個屬性的候選模板。

每個模板可以對應於完整的句子或句子的一部分(例如,短語)。

每個模板都包含可以插入事實信息的字段(顯示為“< >”括號中的部分)。

例如,模板可能是“在 <date>,<entity> 與 <value> 結婚”。 模板可以手動或算法生成。

用戶語言的候選模板

答案引擎識別用戶的語言並選擇用戶語言的候選模板。

例如,答案引擎可以從搜索引擎接收指示原始查詢語言的數據。 有利地,這樣的配置可以促進答案的國際化。

字段可能與管理每個字段可能包含的數據的約束相關聯。

如在本說明書中使用的,符號“<X/Y>”表示具有“X”約束和“Y”約束的字段。

樣本約束可以包括類型約束、時間約束、性別約束、關係約束、單數/複數約束、度量單位約束和行列式約束。

不同的約束可能需要不同的數據類型

類型約束可能需要特定類型的數據,例如,<date> 約束可能需要日期,<entity> 約束可能需要實體名稱或其他標識符,以及約束可能需要一個數字。

例如,時間約束可能要求日期或時間在過去或將來,例如,包含<日期/過去>的字段可能要求該字段包括過去的日期。 例如,性別約束可能需要男性或女性。

例如,關係約束可能需要與另一個實體的關係類型,例如,包含<entity/spouse> 的字段可能要求該字段包括作為另一個實體的配偶的實體。 例如,單數/複數約束可能要求字段中的數據為單數或複數形式。

例如,測量單位約束可能要求以特定的測量單位(例如,英寸、英尺、厘米、米等)測量現場中的數據。 例如,行列式約束可能要求“the”一詞位於字段之前。

查詢中的每個屬性都可以用作訪問一組候選模板的鍵。 例如,屬性“年齡”可能會導致模板的檢索。 示例模板包括第一個模板“ 出生於<日期/過去&glt; 並且當前是 <value> 歲”,這需要 <entity&lgt; 的實體名稱。 字段,過去的日期字段,以及 <value< 字段的數字(例如,年齡)。

第二個模板,“<entity> 當前是 <value< years old”,需要 <entity> 字段的實體名稱和 <value> 字段的數字(例如,年齡)。

第三個模板,“<entity> 出生於 <date/past>,死亡於 <date/past>”,需要 </entity><entity> 字段的實體名稱和 <date/ 兩個過去的日期過去>領域。

給定屬性的多個模板

有利地,具有給定屬性的多個模板使實現能夠支持部分事實。 例如,對於年齡模板,如果知道出生年份但不知道具體日期,則合適的模板可能是“</entity><entity> 出生於 <year/past>”。 為給定屬性提供多個模板還允許改變事實的不同部分的時態(例如,“伍迪艾倫結婚了”和“伍迪艾倫結婚了”)。

在獲得候選模板後,答案引擎根據各種啟發式方法從候選模板中選擇一個模板。 例如,答案引擎可以檢查性別一致性和正確時態。 此外,答案引擎可以確定原始查詢的答案數量與所選模板的字段數量相匹配。

回答引擎還可以確定所選模板的約束和字段是否得到滿足。 回答引擎可以選擇具有由事實信息滿足的約束的具有最大數量的字段的模板(例如,數據最豐富的模板)。 事實信息是“<woody Allen/born on/Dec. 1, 1935 年>。”

在這個例子中,第一個候選模板是“<entity> 出生於 <date/past> 並且當前是歲。” 這個模板有一個字段、<date/past> 字段和 <value> 字段。 事實信息提供滿足 <entity> 字段約束的實體和滿足場約束。

答案引擎可以基於事實信息得出值。 答案引擎因此可以計算年齡值以滿足基於出生日期的<value<字段約束。 由於事實信息滿足第一個模板中字段的所有約束,因此答案引擎選擇第一個模板。

答案引擎選擇第一個模板,其字段可由事實信息填充,並且不執行任何附加處理。 或者,答案引擎可以處理候選模板中的每個模板,並選擇具有最多可以被事實信息填充的字段的模板。

選擇模板後,答案引擎會根據模板生成句子或短語。 例如,答案引擎可以用來自事實信息的適當數據替換模板中的字段。 答案引擎使用所選模板生成句子“Woody Allen 出生於 1935 年 12 月 1 日,現年 77 歲”。

答案引擎然後將答案傳輸到客戶端設備,其中答案包括生成的句子。答案可以是客戶端設備轉換為語音並呈現給用戶的轉錄。

根據事實查詢生成句子的系統

該系統包括客戶端設備、搜索系統、索引集群和答案引擎。 例如,所示實體可以作為系統的一部分來實現。

客戶端設備發起具有查詢項的查詢。

例如,用戶可以在客戶端設備的網絡瀏覽器中輸入查詢“伍迪艾倫嫁給了誰”。

搜索系統從客戶端設備接收查詢(例如,“伍迪艾倫嫁給了誰”)。

然後搜索系統將原始查詢解析並格式化為格式(例如, ) 使用例如合適的自然語言解析引擎。

在該示例中,格式化查詢包括實體的標識符(例如,伍迪艾倫)、實體的類型(例如,人)和屬性(例如,婚姻)。

類型信息可用於生成元模板,如下所述。 然後搜索系統將格式化的查詢發送到索引集群。

索引集群訪問索引以檢索一組響應查詢的事實信息

索引簇訪問索引以檢索一組響應查詢的事實信息。 這些結果包括至少兩個三元組(例如, , 和 <路易絲·拉塞爾/妻子/1966/1970>)。

然后索引簇傳輸格式化的查詢(例如,<woody Allen/age> 和回答查詢的事實信息(例如,<Soon-Yi Previn/wife/1997> 和 <louise Lasser/wife/1966/1970> ) 到答案引擎。

使用格式化的查詢和事實信息,答案引擎然後生成一個或多個句子形式的答案,如下所示。

首先,答案引擎從格式化的查詢(例如,人)中獲取類型信息。

類型信息標識查詢所基於的實體類型。 使用類型信息,答案引擎訪問與“人”類型實體相關聯的候選元模板。

如本規範中所述,元模板是具有配置為包含其他模板的字段的模板。

每個候選元模板包括用於實體名稱或標識符的字段以及用於添加其他模板的至少一個字段。

這些模板允許答案引擎生成句子,以包含具有關於一個人的信息的各種短語。

回答引擎還從格式化的查詢中獲得一個或多個屬性,並使用該一個或多個屬性從模板數據庫中訪問候選短語模板。

這些短語模板旨在整合到元模板中。

如上所述,查詢中的每個屬性都可以用作訪問一組候選短語模板的鍵。

例如,屬性“婚姻”可能導致檢索短語模板。

示例短語模板包括第一個模板“自 <date/past> 以來已與 <entity/spouse> 結婚”,該模板要求與格式化查詢中的實體結婚的實體字段,以及過去的日期場地。

第二個模板“與 <entity/spouse> 結婚”需要一個與格式化查詢中的實體結婚的實體場地。

第三個模板“已婚”不需要額外信息。

第四個模板“從 <date/past > 到 <date/past > 與 <entity/spouse > 結婚”,需要一個與格式化查詢中的實體結婚的實體<date/past> 字段為過去的兩個日期。 第五個模板“與 <entity/spouse> 結婚”需要一個與 <entity/spouse> 字段的格式化查詢中的實體結婚的實體。 第六個模板“已婚”不需要額外信息。

接下來,答案引擎根據包含在事實信息中的信息類型選擇候選元模板之一。 具體來說,答案引擎根據包含在事實信息中的三元組的數量來選擇候選元模板。 兩個三元組包含在事實信息中。 因此,答案引擎選擇具有兩個模板字段的“person”元模板,即“<entity><template> 和 </template><template>”。

對於事實信息中包含的每個三元組,答案引擎還從候選短語模板中選擇一個模板。 答案引擎可以選擇具有由事實信息滿足的約束的最大字段數的短語模板(例如,數據最豐富的模板)。

事實信息中包含的第一個三元組是<Soon-Yi Previn/wife/1997>。” 在這個例子中,第一個候選短語模板是“已經結婚自從。” 這個模板有一個 <ntity/spouse&g; 字段和一個 <日期/過去> 字段。

第一個三元組具有與格式化查詢中滿足 <entity/spouse> 字段約束的實體具有配偶關係的實體,以及滿足 <date/past> 字段約束的過去日期。 由於第一個三元組滿足第一個模板中字段的所有約束,因此答案引擎為第一個三元組選擇第一個模板。

事實信息中包含的第二個三元組是<louise Lasser/wife/1966/1970>。” 第四個候選短語模板是“從 <date/past> 到 <date/past> 與 <entity/spouse> 結婚”,它有一個 <entity/spouse> 字段和兩個 <date/past> 字段。 事實信息中的第二個三元組提供與格式化查詢中滿足 <entity/spouse> 字段約束的實體具有配偶關係的實體,以及過去的兩個日期滿足場約束。

由於第二個三元組滿足第四個模板中字段的所有約束,因此答案引擎為第二個三元組選擇第四個模板。

答案引擎選擇第一個模板,其字段可由事實信息填充,並且不執行任何附加處理。 或者,答案引擎可以處理候選模板中的每個模板,並選擇具有最多可以被事實信息填充的字段的模板。

選擇模板後,答案引擎會根據模板生成一個句子。 例如,答案引擎可以用來自事實信息的適當數據替換所選模板中的字段。

答案引擎可以用來自第一個三元組的信息替換第一個選擇的短語模板中的字段(即,“自從 <<date/past> 以來已經與 <entity/spouse> 結婚”)以生成短語“has got mapped自 1997 年以來與 Soon-Yi Previn到包含生成句子的客戶端設備。答案可能包含在包含句子和其他搜索結果的搜索結果頁面中。搜索結果頁面還包括顯示原始搜索查詢的搜索框(即,“伍迪是誰Allen 結婚了”)。搜索結果頁面然後可以由客戶端設備呈現。該句子也可以作為允許客戶端設備生成語音的轉錄或作為對句子進行編碼的音頻信號來傳輸在客戶端設備上渲染。

生成句子以響應事實查詢的系統

該系統包括客戶端設備、搜索系統、索引集群和答案引擎。

客戶端設備向客戶端設備處的網絡瀏覽器發起具有兩個查詢詞(“伍迪艾倫的家鄉和母校在哪裡”)的查詢。

搜索系統從客戶端設備接收查詢(例如,“伍迪艾倫的家鄉和母校在哪裡”)。 然後,搜索系統使用例如合適的自然語言解析引擎將原始查詢解析並格式化為<entity/type/attribute>格式(例如,>woody Allen/person/hometown/college<)。

在該示例中,格式化查詢包括實體的標識符(例如,Woody Allen)、實體的類型(例如,人)和兩個屬性(例如,家鄉和大學)。 然後搜索系統將格式化的查詢發送到索引集群。

使用格式化的查詢和事實信息,答案引擎然後生成一個或多個句子形式的答案,如下所示。 First, the answer engine obtains the type information from the formatted query (eg, person).

Using the type information, the answer engine accesses candidate meta-templates that are associated with a “person” type of entity.

As referred to in this specification, meta-templates are templates that have fields configured to contain other templates.

The answer engine also obtains the attributes from the formatted query and uses the attributes to access candidate phrase templates from template databases.

These phrase templates get designed to get incorporated into the meta-templates.

As described above, each attribute in the query may function as a key for accessing a set of candidate phrase templates. For example, the attribute “hometown” may result in the retrieval of the phrase templates. The sample phrase templates include a first template “currently lives in >location<,” which requires a geographic location for the 場地。

The second template, “has lived in </location><location> since <date/past>,” requires a geographic location for the </location<>location> field and a date in the past for the <date/past> field. The third template, “used to live in </location><location>,” requires a geographic location for the location field.

Next, the answer engine selects one of the candidate meta-templates based on the type of information included in the factual information. In particular, the answer engine selects a candidate meta-template based on the number of triples included in the factual information. Two triples get included in the factual information.

For each triple included in the factual information, the answer engine also selects a template from the candidate phrase templates The answer engine may select the phrase template having the maximum number of fields with constraints that get satisfied by the factual information (eg, the most data-rich template). The answer engine also may perform other heuristics, such as analyzing gender agreement and correct tense of the candidate templates.

The first triple included in the factual information is <woody Allen/hometown/NYC>.” In this example, the first candidate template in the hometown templates is “currently lives in <location>.” The first triple has a location (ie, NYC) that satisfies the </location><location> field constraint. Since the first triple satisfies all of the constraints for the fields in the first template, the answer engine selects the first template from the hometown templates for the first triple.

The second triple included in the factual information is <woody Allen/college/NYU>.” The first candidate template in the college templates is “his alma mater is </college><college>.” The second triple in the factual information provides a college name (ie, NYU) that satisfies the </college<>college> field constraint.

Also, the answer engine may determine that the gender of the entity (Woody Allen) agrees with the gender of the phrase in this template. The answer engine selects the first template from the college templates for the second triple.

The answer engine selects the first template with fields that can get filled by the factual information, and does not perform any additional processing. Alternatively, the answer engine may process each template in the candidate templates and select the template having the largest quantity of fields that can get filled by the factual information.

After selecting the templates, the answer engine then generates a sentence based on the templates. For example, the answer engine may replace the fields in the selected templates with the appropriate data from the factual information. The answer engine may replace the fields in the first selected phrase template (ie, “currently lives in <location>”) with the information from the first triple to generate the phrase “currently lives in New York City.”

The answer engine then replaces the template fields in the selected meta-template (ie, “<entity><template> and &kt;/template><template>”) with the phrases generated from the first and second phrase templates. Thus, the answer engine generates the sentence “Woody Allen currently lives in New York City and his alma mater is New York University.”

The answer engine then transmits an answer to the client device that includes the generated sentence.

The answer may get included in a search results page that includes the sentence and other search results. The search results page also includes a search box showing the original search query (ie, “Where is Woody Allen's hometown and alma mater”). The search results page may then get rendered by the client device.

As getting provided in search results, the sentence could alternatively get transmitted as a transcription that allows the client device to generate speech, or as an audio signal encoding the sentence for rendering at the client device.

An Example Data Graph

The example data graph includes nodes (eg, entities) and edges connecting the nodes (eg, relationships or attributes). Naturally, the example data graph shows only a partial graph–a full graph with a large number of entities and even a limited number of relationships may have billions of triples.

An indexing system may traverse the data graph to obtain factual information as various triples. One example of a triple that may get obtained is the entity “Woody Allen” as the subject (or entity), the relationship “was born” as the predicate (or attribute), and the entity “Dec. 1, 1935” as the object (or value).

Another example of a triple that may be obtained is the entity “Woody Allen” as the subject, the relationship “has type” as the predicate, and the entity “person” as the value. This triple may get used, for example, by the answer engine as described above to select candidate meta-templates.

Another example of a triple that may get obtained is the entity “Woody Allen” as the subject, the relationship “was married to” as the predicate, and the entity “Louise Lasser” as the value.

Note that to obtain this triple, the indexing system must traverse two edges in the data graph, ie, from the “Woody Allen” entity to the “Woody Allen marriages” entity, and then from the “Woody Allen marriages” entity to the “Louise Lasser” entity.

Generating Sentences In Response To Factual Queries

A server (eg, an answer engine) receives an original query that identifies the attributes of an entity. For example, the server may receive a query that identifies multiple attributes of an entity (eg, age, date of birth, place of birth, marriages, etc.).

The server accesses a set of candidate templates for answering the query based on the attributes of the entity. Each candidate template includes fields, wherein each field gets associated with at least one constraint. When multiple attributes get identified in the original query, the server accesses a set of candidate templates for each attribute of the entity. The constraints may include of a type constraint, a temporal constraint, a gender constraint, a relationship constraint, a singular/plural constraint, a unit of measure constraint, and a determinant constraint.

The server then obtains a set of information that answers the query, for example by accessing a graph-based datastore as described above. The set of information that answers the query may be, for example, a set of entity-attribute-value triples. When multiple attributes get identified in the original query, the server obtains a set of information for each attribute (ie, to answer each portion of the original query).

Multiple sets of information (eg, multiple triples) may be responsive to a single attribute. For example, if the attribute is “marriages” or “children,” then multiple triples may get obtained in response to the attribute.

the server selects a template from the set of candidate templates, where the selected template has a maximum number of fields with constraints that may get satisfied by the set of information that answers the query. When multiple attributes get identified in the original query, the server selects a template for each attribute from the appropriate set of candidate templates.

Also, when multiple sets of information get obtained in response to a single attribute, the server may select multiple templates from the same set of candidate templates.

The server then generates a phrase. The phrase may get generated by adding the set of information that answers the query to the fields of the selected template so that the phrase answers the original query. The phrase may get sentenced. Alternatively or in addition, the phrase may be portions of a sentence. When multiple attributes get identified in the original query, the server generates a phrase for each attribute. The server may then combine the phrases to generate a complete sentence.

The server may obtain a sentence template (eg, a meta-template) based on the type of the entity (eg, person or location). The sentence template may include multiple fields for inserting phrases. For example, the server may access a set of candidate meta-templates based on the type of entity, and then select a meta-template from the set based on the number of triples that answer the original query.

The server may then add the generated phrases described with reference to step to the fields of the sentence template to form a sentence.
The server communicates the phrase or sentence to a client device. The client device may then output the phrase to a display or as speech audio. The server transmits an audio signal corresponding to the phrase or sentence to the client device.