哪种编程语言最像自然语言? [英] What programming language is most like natural language?

查看:548
本文介绍了哪种编程语言最像自然语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在很多情况下,我都不了解这个人在说什么,而当别人不理解我时,我就想到了这个问题.

I got the idea for this question from numerous situations where I don't understand what the person is talking about and when others don't understand me.

因此,智能"解决方案是说一种计算机语言. :)

So, a "smart" solution would be to speak a computer language. :)

我很感兴趣编程语言可以接近(英语)自然语言.当我说接近时,我的意思是不仅要使用单词和句子,而且要能够做"自然语言可以做"的事情,通过做",我的意思是可以(以非常有限的方式)使用它代替自然语言.

I am interested how far a programming language can go to get near to (English) natural language. When I say near, I mean not just to use words and sentences, but to be able to "do" things a natural language can "do" and by "do" I mean that it can be used (in a very limited way) as a replacement for natural language.

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

I know that this is impossible (is it?) but I think that this can be interesting.

推荐答案

有一种称为Inform的编程语言,在其最新的形式Inform 7中,看起来像 lot 一样自然语言.尤其是书面语言.

There is a programming language called Inform that, in its most recent incarnation, Inform 7, looks a lot like natural language...in particular, written language.

Inform是专门用于创建文本冒险游戏的,但是没有内在的理由不能将这些概念扩展到其他领域.

Inform is very specifically for creating text adventure games, but there is no inherent reason that the concepts couldn't be extended into other realms.

这是一小段Inform 7代码,摘自Emily Short的游戏《玻璃》.

Here's a small snippet of Inform 7 code, taken from the game Glass, by Emily Short.

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." 

完整代码可在此处找到.

这是一个简单的小示例……它实际上可以处理令人惊讶的强大构想集.

This is a small simple example...it can actually handle a surprisingly robust set of ideas.

应该指出的是,代码并不是真正的奇怪密码,在这些密码中,结构具有隐藏的含义……此代码或多或少地完成了您所期望的工作.例如:

It should be pointed out that the code isn't really a strange cypher where the constructs have hidden meanings...this code does more or less what you would expect. For example:

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

创建一个恰好是女性的对象,将该对象命名为老太太",并将该对象放置在名为舞台"的房间对象内.然后,创建了两个别名(母亲"和继母",这两个别名都都引用了老太太"对象.

creates an object that happens to be a female person, names that object "old lady", and places that object within the room object called the "Stage". Then two aliases ("mother" and "stepmother" are created that also both reference the "old lady" object.

当然,随着示例变得越来越复杂,跳过的必要步骤也变得更加复杂.英语从其本质上来说就是模棱两可的,而计算机代码绝对不是.因此,我们永远不会获得完美的婚姻".

Of course, as the examples get increasingly complex, the necessary hoops to jump through also become more complex. English is, by its very nature, ambiguous, while computer code is most definitively not. So we'll never get a "perfect marriage".

这篇关于哪种编程语言最像自然语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆