1- Python. Python is considered the Swiss Army Knife of programming because of its versatility. It's also one of the most beginner-friendly languages with its language that mirrors humans and consistent syntax. Python also comes with lots of packages using which code reusability can be done.
Natural language is the language spoken by people, while programming language is intended for machines. Both languages contain important similarities, such as the differentiation they make between syntax and semantics, their purpose to communicate and the existence of a basic composition.
Python is a high-level programing language. This means that it's closer to human language and further from machine language. The advantage of this is that it's easy to read and simple to implement.
Due to its straightforward structure and text processing tools like NTLK and SpaCy, Python is a top-choice programming language for natural language processing. Python also boasts exceptional documentation and community support and integrates easily with other programming languages.
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 is very specifically for creating text adventure games, but there is no inherent reason that the concepts couldn't be extended into other realms.
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."
Complete code can be found here.
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".
Depends on what circles you roll in, but LOLCODE could be considered like natural language ;)
Example loop:
HAI
CAN HAS STDIO?
I HAS A VAR
IM IN YR LOOP
UP VAR!!1
VISIBLE VAR
IZ VAR BIGGER THAN 10? KTHXBYE
IM OUTTA YR LOOP
KTHXBYE
On a serious note, VB is a pretty natural language. It's easy for non-programmer types to learn, so the syntax must be pretty easy to understand.
The language Richard Pryor used to transfer millions of dollars with in Superman III was very close:
> TRANSFER $1,000,000 DOLLARS TO WEBSTER'S ACCOUNT.... NOW
;-)
EDIT: characters corrected ;-)
COBOL reads a lot like English
000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLOWORLD.
000300
000400*
000500 ENVIRONMENT DIVISION.
000600 CONFIGURATION SECTION.
000700 SOURCE-COMPUTER. RM-COBOL.
000800 OBJECT-COMPUTER. RM-COBOL.
000900
001000 DATA DIVISION.
001100 FILE SECTION.
001200
100000 PROCEDURE DIVISION.
100100
100200 MAIN-LOGIC SECTION.
100300 BEGIN.
100400 DISPLAY " " LINE 1 POSITION 1 ERASE EOS.
100500 DISPLAY "Hello world!" LINE 15 POSITION 10.
100600 STOP RUN.
100700 MAIN-LOGIC-EXIT.
100800 EXIT.
source
Lisp (of course (if you know what I mean (LOL)))
Good 'ol AppleScript touts its likeness to english as one of its strengths. However, it's not very fun to work with.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With