gpt4 book ai didi

programming-languages - 什么编程语言最像自然语言?

转载 作者:行者123 更新时间:2023-12-01 23:08:30 28 4
gpt4 key购买 nike

我从很多我不明白对方在说什么以及别人不理解我的情况中得到了这个问题的想法。

因此,“智能”解决方案是使用计算机语言。 :)

我感兴趣的是一种编程语言可以在多大程度上接近(英语)自然语言。当我说接近时,我的意思不仅仅是使用单词和句子,而是能够“做”自然语言可以“做”的事情,而“做”是指它可以被使用(以非常有限的方式)作为自然语言的替代品。

我知道这是不可能的(是吗?),但我认为这可能很有趣。

最佳答案

有一种名为 Inform 的编程语言,其最新版本 Inform 7 看起来非常像自然语言……尤其是书面语言。

Inform 是专门用于创建文本冒险游戏的,但这些概念并没有固有的原因不能扩展到其他领域。

这是 Inform 7 代码的一小段,取自 Emily Short 的 Glass 游戏。

Stage is a room. 

The old lady is a woman in the Stage. Understand "mother" or
"stepmother" as the old lady. The old lady is active. The description
of the lady is "She looks plucked: thin neck with folds of skin
exposed, nose beaky, lips white. Perhaps when her fortunes are mended
her cosmetics too will improve."

The Prince is a man in the Stage. The description of the prince is
"He's tolerably attractive, in his flightless way. It's hard not to
pity him a little." The prince carries a glass slipper. The glass
slipper is wearable. Understand "shoe" or "heel" or "toe" or "foot"
as the slipper. The description of the slipper is "It is very small
for an adult woman's foot."

完整代码可见here .

这是一个简单的小例子......它实际上可以处理一组令人惊讶的强大想法。

应该指出的是,该代码实际上并不是一个奇怪的密码,其中的构造具有隐藏的含义......该代码或多或少地执行了您所期望的操作。例如:

The old lady is a woman in the Stage. Understand "mother" or 
"stepmother" as the old lady.

创建一个恰好是女性的对象,将该对象命名为“老太太”,并将该对象放置在称为“舞台”的房间对象中。然后创建两个别名(“母亲”和“继母”),它们也都引用“老太太”对象。

当然,随着示例变得越来越复杂,需要跨越的障碍也变得更加复杂。英语本质上是模棱两可的,而计算机代码则绝对不是。所以我们永远不会有“完美的婚姻”。

关于programming-languages - 什么编程语言最像自然语言?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/491971/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com