Natural language programming (NLP) is an
ontology
Ontology is the philosophical study of existence, being. It is traditionally understood as the subdiscipline of metaphysics focused on the most general features of reality. As one of the most fundamental concepts, being encompasses all of realit ...
-assisted way of
programming in terms of
natural language
A natural language or ordinary language is a language that occurs naturally in a human community by a process of use, repetition, and change. It can take different forms, typically either a spoken language or a sign language. Natural languages ...
sentences, e.g.
English. A structured document with Content, sections and subsections for explanations of sentences forms a NLP document, which is actually a
computer program
A computer program is a sequence or set of instructions in a programming language for a computer to Execution (computing), execute. It is one component of software, which also includes software documentation, documentation and other intangibl ...
. Natural language programming is not to be mixed up with natural language interfacing or voice control where a program is first written and then communicated with through natural language using an interface added on. In NLP the functionality of a program is organised only for the definition of the meaning of sentences. For instance, NLP can be used to represent all the knowledge of an autonomous robot. Having done so, its tasks can be scripted by its users so that the robot can execute them autonomously while keeping to prescribed rules of behaviour as determined by the robot's user. Such robots are called ''transparent robots'' as their reasoning is transparent to users and this develops trust in robots. Natural language use and
natural language user interfaces include
Inform 7, a natural programming language for making interactive fiction,
Shakespeare
William Shakespeare ( 23 April 1564 – 23 April 1616) was an English playwright, poet and actor. He is widely regarded as the greatest writer in the English language and the world's pre-eminent dramatist. He is often called England's natio ...
, an
esoteric
Western esotericism, also known as the Western mystery tradition, is a wide range of loosely related ideas and movements that developed within Western society. These ideas and currents are united since they are largely distinct both from orthod ...
natural programming language in the style of the plays of
William Shakespeare
William Shakespeare ( 23 April 1564 – 23 April 1616) was an English playwright, poet and actor. He is widely regarded as the greatest writer in the English language and the world's pre-eminent dramatist. He is often called England's nation ...
, and
Wolfram Alpha
WolframAlpha ( ) is an answer engine developed by Wolfram Research. It is offered as an online service that answers factual queries by computing answers from externally sourced data.
History
Launch preparations for WolframAlpha began on Ma ...
, a computational knowledge engine, using natural-language input. Some methods for
program synthesis
In computer science, program synthesis is the task to construct a computer program, program that provably correct, provably satisfies a given high-level formal specification. In contrast to program verification, the program is to be constructed rat ...
are based on natural-language programming.
Interpretation
The smallest unit of statement in NLP is a sentence. Each sentence is stated in terms of concepts from the underlying ontology, attributes in that ontology and named objects in
capital letter
Letter case is the distinction between the letters that are in larger uppercase or capitals (more formally ''majuscule'') and smaller lowercase (more formally '' minuscule'') in the written representation of certain languages. The writing system ...
s. In an NLP text every sentence unambiguously
compiles into a
procedure call in the underlying
high-level programming language
A high-level programming language is a programming language with strong Abstraction (computer science), abstraction from the details of the computer. In contrast to low-level programming languages, it may use natural language ''elements'', be ea ...
such as
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementat ...
,
Octave
In music, an octave (: eighth) or perfect octave (sometimes called the diapason) is an interval between two notes, one having twice the frequency of vibration of the other. The octave relationship is a natural phenomenon that has been referr ...
,
SciLab
Scilab is a free and open-source, cross-platform numerical computational package and a high-level, numerically oriented programming language. It can be used for signal processing, statistical analysis, image enhancement, fluid dynamics simul ...
,
Python, etc.
Symbolic languages such as
Wolfram Language
The Wolfram Language ( ) is a proprietary, very high-level multi-paradigm programming language developed by Wolfram Research. It emphasizes symbolic computation, functional programming, and rule-based programming and can employ arbitrary stru ...
are capable of
interpreted processing of queries by sentences. This can allow interactive requests such as that implemented in
Wolfram Alpha
WolframAlpha ( ) is an answer engine developed by Wolfram Research. It is offered as an online service that answers factual queries by computing answers from externally sourced data.
History
Launch preparations for WolframAlpha began on Ma ...
.
Wolfram Alpha computes answers
Tech Crunch, 8 March 2009 The difference between these and NLP is that the latter builds up a single program or a library of routines that are programmed through natural language sentences using an ontology that defines the available data structures in a high level programming language.
An example text from an English language natural language program is as follows:
If U_ is 'smc01-control', then do the following. Define surface weights Alpha as " .5, 0.5.
Initialise matrix Phi as a 'unit matrix'. Define J as the 'inertia matrix' of Spc01. Compute
matrix J2 as the inverse of J. Compute position velocity error Ve and angular velocity error
Oe from dynamical state X, guidance reference Xnow. Define the joint sliding surface G2
from the position velocity error Ve and angular velocity error Oe using the surface weights
Alpha. Compute the smoothed sign function SG2 from the joint sliding surface G2 with sign
threshold 0.01. Compute special dynamical force F from dynamical state X and surface
weights Alpha. Compute control torque T and control force U from matrix J2, surface weights
Alpha, special dynamical force F, smoothed sign function SG2. Finish conditional actions.
that defines a feedback control scheme using a sliding mode control
In control systems, sliding mode control (SMC) is a nonlinear control method that alters the dynamic system, dynamics of a nonlinear system by applying a discontinuous control signal (or more rigorously, a set-valued control signal) that forces th ...
method.
Software paradigm
Natural-language programming is a top-down method of writing software. Its stages are as follows:
* Definition of an ontology
Ontology is the philosophical study of existence, being. It is traditionally understood as the subdiscipline of metaphysics focused on the most general features of reality. As one of the most fundamental concepts, being encompasses all of realit ...
taxonomy of concepts needed to describe tasks in the topic addressed. Each concept and all their attributes are defined in natural-language words. This ontology will define the data structures the NLP can use in sentences.
* Definition of one or more top-level sentences in terms of concepts from the ontology. These sentences are later used to invoke the most important activities in the topic.
* Defining of each of the top-level sentences in terms of a sequence of sentences.
* Defining each of the lower-level sentences in terms of other sentences or by a simple sentence of the form Execute code "...". where ... stands for a code in terms of the associated high-level programming language.
* Repeating the previous step until you have no sentences left undefined. During this process each of sentences can be classified to belong to a section of the document to be produced in HTML or Latex format to form the final natural-language program.
* Testing the meaning of each sentence by executing its code using testing objects.
* Providing a library of procedure calls (in the underlying high-level language) which are needed in the code definitions of some low-level-sentence meanings.
* Providing a title, author data and compiling the sentences into an HTML
Hypertext Markup Language (HTML) is the standard markup language for documents designed to be displayed in a web browser. It defines the content and structure of web content. It is often assisted by technologies such as Cascading Style Sheets ( ...
or LaTeX
Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latices are found in nature, but synthetic latices are common as well.
In nature, latex is found as a wikt:milky, milky fluid, which is present in 10% of all floweri ...
file.
* Publishing the natural-language program as a webpage on the Internet or as a PDF
Portable document format (PDF), standardized as ISO 32000, is a file format developed by Adobe Inc., Adobe in 1992 to present documents, including text formatting and images, in a manner independent of application software, computer hardware, ...
file compiled from the LaTeX document.
Publication value of natural-language programs and documents
A natural-language program is a precise formal
Formal, formality, informal or informality imply the complying with, or not complying with, some set of requirements ( forms, in Ancient Greek). They may refer to:
Dress code and events
* Formal wear, attire for formal events
* Semi-formal atti ...
description of some procedure that its author created. It is human readable and it can also be read by a suitable software agent. For example, a web page in an NLP format can be read by a software personal assistant
A personal assistant, also referred to as personal aide (PA) or personal secretary (PS), is a job title describing a person who assists a specific person with their daily business or personal task. It is a subspecialty of secretarial duties ...
agent to a person and she or he can ask the agent to execute some sentences, i.e. carry out some task or answer a question. There is a ''reader agent'' available for English interpretation of HTML based NLP documents that a person can run on her personal computer
A personal computer, commonly referred to as PC or computer, is a computer designed for individual use. It is typically used for tasks such as Word processor, word processing, web browser, internet browsing, email, multimedia playback, and PC ...
.
Contribution of natural-language programs to machine knowledge
An ontology class is a natural-language program that is not a concept
A concept is an abstract idea that serves as a foundation for more concrete principles, thoughts, and beliefs.
Concepts play an important role in all aspects of cognition. As such, concepts are studied within such disciplines as linguistics, ...
in the sense as humans use concepts. Concepts in an NLP are examples (samples) of generic human concepts. Each sentence in a natural-language program is either (1) stating a relationship in a world model or (2) carries out an action in the environment or (3) carries out a computational procedure or (4) invokes an answering mechanism in response to a question.
A set of NLP sentences, with associated ontology defined, can also be used as a pseudo code that does not provide the details in any underlying high level programming language. In such an application the sentences used become high level abstractions (conceptualisations) of computing procedures that are computer language and machine independent.
AI in natural language programming
Researchers have started to experiment with natural language programming environments that use plain language prompts and then use AI (specifically large language models) to turn natural language into formal code. For example Spatial Pixe
created a natural language programming environment
to turn natural language into P5.js code through OpenAI's API. In 2021 OpenAI developed a natural language programming environment for their programming large language model calle
Codex
See also
* Controlled natural language
Controlled natural languages (CNLs) are subsets of natural languages that are obtained by restricting the grammar and vocabulary in order to reduce or eliminate ambiguity and complexity. Traditionally, controlled languages fall into two major types ...
* Context-free language
In formal language theory, a context-free language (CFL), also called a Chomsky type-2 language, is a language generated by a context-free grammar (CFG).
Context-free languages have many applications in programming languages, in particular, mos ...
* Domain-specific language
A domain-specific language (DSL) is a computer language specialized to a particular application domain. This is in contrast to a general-purpose language (GPL), which is broadly applicable across domains. There are a wide variety of DSLs, ranging ...
(or DSL)
* End-user programming
* Knowledge representation
Knowledge representation (KR) aims to model information in a structured manner to formally represent it as knowledge in knowledge-based systems whereas knowledge representation and reasoning (KRR, KR&R, or KR²) also aims to understand, reason, and ...
* Natural-language processing
* Source-code generation
* Very high-level programming language
Programming languages with English-like syntax
* AppleScript
AppleScript is a scripting language created by Apple Inc. that facilitates automated control of Mac applications. First introduced in System 7, it is currently included in macOS in a package of automation tools. The term ''AppleScript'' may ...
* Attempto Controlled English
* COBOL
COBOL (; an acronym for "common business-oriented language") is a compiled English-like computer programming language designed for business use. It is an imperative, procedural, and, since 2002, object-oriented language. COBOL is primarily ...
* ClearTalk
ClearTalk is a controlled natural language—a kind of a formal language for expressing information that is designed to be both human-readable (being based on English) and easily processed by a computer.
Anyone who can read English can immediat ...
* FLOW-MATIC
FLOW-MATIC, originally known as B-0 (Business Language version 0), was the first English-like data processing language. It was developed for the UNIVAC I at Remington Rand
Remington Rand, Inc. was an early American business machine manufactu ...
* HyperTalk
HyperTalk is a discontinued high-level, procedural programming language created in 1987 by Dan Winkler and used in conjunction with Apple Computer's HyperCard hypermedia program by Bill Atkinson. Because the main target audience of HyperTalk ...
* Inform 7
* JOSS
JOSS (acronym for JOHNNIAC Open Shop System) was one of the first interactive, time-sharing programming languages. It pioneered many features that would become common in languages from the 1960s into the 1980s, including use of line numbers as bo ...
* SenseTalk
SenseTalk is a High-level_programming_language, high-level English-like scripting language in the XTalk family, that supports both Procedural_programming, procedural and Object-oriented_programming, object-oriented paradigms. SenseTalk scripts are ...
* Software AG
Software GmbH, trading as Software AG, is a German multinational software corporation that develops enterprise software for business process management, integration, and big data analytics. Founded in 1969, the company is headquartered in Darmstad ...
* Transcript
* Structured Query Language (or SQL)
* xTalk
HyperTalk is a discontinued high-level, procedural programming, procedural programming language created in 1987 by Dan Winkler (computer scientist), Dan Winkler and used in conjunction with Apple Inc., Apple Computer's HyperCard hypermedia progra ...
Programming languages with other natural language-like vocabulary or syntax
* Non-English-based programming languages
Non-English-based programming languages are programming languages that do not use keywords taken from or inspired by English vocabulary.
Prevalence of English-based programming languages
The use of the English language in the inspiration fo ...
References
Bibliography
;Books:
* ''Natural Language Programming of Agents and Robotic Devices: publishing for agents and humans in sEnglish'' by S M Veres, , London, June 2008.
*
*
*
;Papers at conferences:
*
* ''Sliding mode control of autonomous spacecraft.'' (half written in sEnglish) by S M Veres an N K Lincoln, ''Proc. TAROS’2008, Towards Autonomous Robotic Systems'', Edinburgh, 1–3 September 2008.
*
*
;Program synthesis
In computer science, program synthesis is the task to construct a computer program, program that provably correct, provably satisfies a given high-level formal specification. In contrast to program verification, the program is to be constructed rat ...
from natural language specifications
* Raza, Mohammad, Sumit Gulwani, and Natasa Milic-Frayling.
Compositional Program Synthesis from Natural Language and Examples
" IJCAI. 2015.
* Green, Cordell.
A Summary of the PSI Program Synthesis System
" IJCAI. Vol. 5. 1977.
External links
English Script
(dormant since 2016)
Plain English Programming
Programming language using English sentences in ASCII.
SEMPRE
a toolkit for training semantic parsers
sysbrain.com
sEnglish Editor in C++/ROS for robot programming to develop transparent robots.
wy-lang.org
"Programming Language for the ancient Chinese"
How natural should a natural interface be?
thoughts on how "natural" the Ubiquity interface (dormant since 2009)
Metafor turns English to code
(dormant since 2005)
Computer knowledge representation format, system, methods, and applications
US patent re: hyperlinking to .who/what/where/when/how XML files that embed NL
{{Programming paradigms navbox
Algorithm description languages
Structured English
Computer programming
Natural language processing