SHRDLU

SHRDLU是由特里·威諾格拉德於1968年至1970年在麻省理工學院開發的一種早期的自然語言理解電腦程式。在該程式中，使用者可以與電腦對話，對這種精簡的「積木世界」的內部狀態進行移動物體、命名集合、查詢等操作（積木世界本質上是一個虛擬盒子，內部充滿了不同積木）。

SHRDLU是以Micro Planner和Lisp程式語言在DEC PDP-6電腦和DEC圖形終端上編寫而成。後來在猶他大學的電腦圖形實驗室進行了補充，加入了對SHRDLU「世界」的完整3D渲染。

名稱「SHRDLU」衍生自ETAOIN SHRDLU， ETAOIN SHRDLU是Linotype排字機上字母鍵配置，也就是照字母使用頻率，以降序方式排列的12個字母序列。

## 功能

SHRDLU主要是一種語言解析器，它允許用戶使用英語術語進行互動。使用者指示SHRDLU在「積木世界」中移動各種物體，包含各種基本物體：積木（塊體）、錐體、球體等。SHRDLU的獨特之處在於將四個簡單想法的組合起來，這些想法加總在一起，使得在對「理解力」的模擬上，更具說服力。

其中一個原因是，SHRDLU的世界非常簡單，以致於整個物體和位置的集合可以透過大約50個單詞來描述：名詞如"積木"（block）和"錐體"（cone），動詞如"放置在"（place on）和"移動到"（move to），以及形容詞如"巨大的"（big）和"藍色的"（blue）。這些基本的語言建築模塊的可能組合相當簡單，程式完全有辦法弄懂使用者的意思。

SHRDLU還包括一個基本記憶體來提供語境。人們可以要求SHRDLU「把綠錐放在紅塊上」，然後「把錐子拿下來」；「錐體」會被認為是指剛才說的綠錐。在大多數情況下，當提供了額外的形容詞時，SHRDLU可以透過互動進一步回溯尋找合適的語境。使用者也可以問一些歷史問題，比如「在撿到錐體之前，你有沒有撿過任何東西？」

這種記憶體的附帶效果，也是SHRDLU標准配置的基本規則，即該程式可以回答關於世界上什麼問題是可能的，什麼問題是不可能的。SHRDLU會透過尋找例子推斷出積木可以堆疊，但在嘗試過三角形後，會了解到三角形不能堆疊。「世界」包含了使積木掉落的基本物理機制，而這與語言解析器無關。

最後，SHRDLU還可以記住物體的名稱或它們的排列方式。例如，人們可以說 "尖塔是一個高大的長方形上面的小三角形"；SHRDLU就可以回答積木世界中關於尖塔的問題，並建造新的尖塔。

## 選錄

這是SHRDLU的著名演示：

人：Pick up a big red block.

電腦： OK.

人：Grasp the pyramid.

電腦：I DON'T UNDERSTAND WHICH PYRAMID YOU MEAN.

人：(changing their mind): Find a block which is taller than the one you are holding and put it into the box.

電腦：BY "IT", I ASSUME YOU MEAN THE BLOCK WHICH IS TALLER THAN THE ONE I AM HOLDING.

電腦：OK.

人：What does the box contain?

電腦：THE BLUE PYRAMID AND THE BLUE BLOCK.

人: What is the pyramid supported by?

電腦：THE BOX.

人：How many blocks are not in the box?

電腦：FOUR OF THEM.

人：Is at least one of them narrower than the one which i told you to pick up?

電腦：YES, THE RED CUBE.

人：Is it supported?

電腦：YES, BY THE TABLE.

人：Can the table pick up blocks?

電腦：NO.

人：Can a pyramid be supported by a block?

電腦：YES.

人：Can a pyramid support a pyramid?

電腦：I DON'T KNOW.

人：Stack up two pyramids.

電腦：I CAN'T.

人：Will you please stack up both of the red blocks and either a green cube or a pyramid?

電腦：OK.

人：Which cube is sitting on the table?

電腦：THE LARGE GREEN ONE WHICH SUPPORTS THE RED PYRAMID.

人：Is there a large block behind a pyramid?

電腦：YES, THREE OF THEM: A LARGE RED ONE, A LARGE GREEN CUBE, AND THE BLUE ONE.

人：Put a small one onto the green cube which supports a pyramid.

電腦：OK.

人：Put the littlest pyramid on top of it.

電腦：OK.

人：Does the shortest thing the tallest pyramid's support supports support anything green?

電腦：YES, THE GREEN PYRAMID.

人：What color is it?

電腦：BY "IT", I ASSUME YOU MEAN THE SHORTEST THING THE TALLEST PYRAMID'S SUPPORT SUPPORTS.

電腦：RED

人：How many things are on top of green cubes?

電腦：I'M NOT SURE WHAT YOU MEAN BY "ON TOP OF "IN THE PHRASE "ON TOP OF GREEN CUBES " .

DO YOU MEAN:

1 - DIRECTLY ON THE SURFACE

2 - ANWHERE ON TOP OF ?

人：2

電腦：THREE OF THEM.

人：Had you touched any pyramid before you put the green one on the little cube?

電腦：YES, THE GREEN ONE.

人：When did you pick it up?

電腦：WHILE I WAS STACKING UP THE RED CUBE, A LARGE RED BLOCK AND A LARGE GREEN CUBE.

人：Why?

電腦：TO GET RID OF IT.

人：Why did you do that?

電腦：TO CLEAN OFF THE RED CUBE.

人：Why did you clear off that cube?

電腦：TO PUT IT ON A LARGE GREEN CUBE.

人：Why did you do that?

電腦: TO STACK UP THE RED CUBE , A LARGE RED BLOCK AND A LARGE GREEN CUBE.

人：Why did you do that?

電腦：BECAUSE YOU ASKED ME TO.

人：How did you do it?

- 電腦：BY PUTTING A LARGE RED BLOCK ON THE TABLE
- THEN LETTING GO OF IT
- THEN PUTTING A LARGE GREEN CUBE ON IT
- THEN LETTING GO OF THAT CUBE
- THEN PUTTING THE RED CUBE ON THAT CUBE; THEN LETTING GO OF THAT CUBE.

人：How many objects did you touch while you were doing it?

電腦：FOUR OF THEM.

人：What did the red cube support before you started to clean it off?

電腦：THE GREEN PYRAMID.

人：There were five blocks to the left of the box then.

電腦：NO, ONLY FOUR OF THEM: THE RED CUBE, TWO LARGE GREEN CUBES AND A LARGE RED BLOCK.

人：Put the blue pyramid on the block in the box.

電腦：OK.

人：Is there anything which is bigger than every pyramid but is not as wide as the thing that supports it?

電腦：YES, THE BLUE BLOCK.

人：Does a steeple

電腦 (interrupting)：SORRY, I DON'T KNOW THE WORD "STEEPLE".

人：A "steeple" is a stack which contains two green cubes and a pyramid.

電腦：I UNDERSTAND.

人：Are there any steeples now?

電腦：NO.

人：Build one.

電腦：OK.

人：Call the biggest block "superblock".

電腦：OK.

人：Have you picked superblock up since we began?

電腦：YES.

人：Why did you drop it?

電腦：BY "IT", I ASSUME YOU MEAN THE SUPERBLOCK.

I CAN'T EXPLAIN A NON-EXISTENT EVENT.

人：Is there anything to the right of the red pyramid?

電腦：YES, FOUR THINGS: THE BOX , THE RED CUBE, THE BLUE PYRAMID AND THE BLOCK NAMED SUPERBLOCK

人：Thank you.

電腦：YOU'RE WELCOME!

## 影響

SHRDLU被認為是人工智慧一次極其成功的演示。這導致其他AI研究人員過分樂觀，但後來的系統試圖處理現實中的更具模糊性和複雜性的情況時，這種樂觀情緒很快就消失了。後續與SHRDLU同型的工作（例如Cyc）則傾向於專注為程式提供更加豐富的資訊，藉此從中獲得結論。

儘管不是有意為之，但是SHRDLU被認為是文字冒險遊戲第一個已知的正式實例，這是因為使用者能夠以簡單的指令在虛擬環境中移動物體來進行互動，儘管缺乏了常見於文字冒險遊戲中特有的故事敘述。1976-1977年的遊戲《巨洞冒險》被廣泛認為是文字冒險遊戲的第一個真正作品。

## 參考文獻

- Terry Winograd, "Procedures as a Representation for Data in a Computer Program for Understanding Natural Language", MIT AI Technical Report 235, February 1971
- Understanding Natural Language by T. Winograd, Academic Press, 1972

## 外部連結

- SHRDLU – Terry Winograd's SHRDLU page, includes source code
- SHRDLU resurrection – re-written versions of SHRDLU, including a Java3D version

## 基本資料

- 類型：自然語言理解
- 平台：DEC
- 作業系統：PDP-6
- 程式語言：Micro Planner, LISP
- 發行日期：1968
- 作者：特里·威諾格拉德