Natural language programming
Encyclopedia
Natural language programming - NLP - is an ontology
-assisted way of programming in terms of natural language
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
.
An example of natural language programming is in sEnglish that is short for "system English".
, Octave
, SciLab
, Python
, etc.
Symbolic languages such as Mathematica
are capable of interpreted
processing of queries by sentences. This can allow interactive requests such as that implemented in Wolfram Alpha
(see external links). 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 NLP program (in sEnglish) is as follows:
If U_ is 'smc01-control', then do the following. Define surface weights Alpha as "[0.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
method. This entry describes NLP in its general form, without being specific about the underlying high level programming language.
The following are discussed:
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
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
.
in the sense as humans use concepts. Concepts in an NLP are examples (samples) of generic human concepts. Each sentence in an NLP 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) or 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.
Ontology
Ontology is the philosophical study of the nature of being, existence or reality as such, as well as the basic categories of being and their relations...
-assisted way of programming in terms of natural language
Natural language
In the philosophy of language, a natural language is any language which arises in an unpremeditated fashion as the result of the innate facility for language possessed by the human intellect. A natural language is typically used for communication, and may be spoken, signed, or written...
sentences, e.g. English
English language
English is a West Germanic language that arose in the Anglo-Saxon kingdoms of England and spread into what was to become south-east Scotland under the influence of the Anglian medieval kingdom of Northumbria...
. A structured document with Content, sections and subsections for explanations of sentences forms a NLP document, which is actually a computer program
Computer program
A computer program is a sequence of instructions written to perform a specified task with a computer. A computer requires programs to function, typically executing the program's instructions in a central processor. The program has an executable form that the computer can use directly to execute...
.
An example of natural language programming is in sEnglish that is short for "system English".
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 letters. In an NLP text every sentence unambiguously compiles into a procedure call in the underlying high level programming language such as MATLABMATLAB
MATLAB is a numerical computing environment and fourth-generation programming language. Developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages,...
, Octave
GNU Octave
GNU Octave is a high-level language, primarily intended for numerical computations. It provides a convenient command-line interface for solving linear and nonlinear problems numerically, and for performing other numerical experiments using a language that is mostly compatible with MATLAB...
, SciLab
Scilab
Scilab is an open source, cross-platform numerical computational package and a high-level, numerically oriented programming language. Itcan be used for signal processing, statistical analysis, image enhancement, fluid dynamics simulations, numerical optimization, and modeling and simulation of...
, Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...
, etc.
Symbolic languages such as Mathematica
Mathematica
Mathematica is a computational software program used in scientific, engineering, and mathematical fields and other areas of technical computing...
are capable of interpreted
Interpreted language
Interpreted language is a programming language in which programs are 'indirectly' executed by an interpreter program. This can be contrasted with a compiled language which is converted into machine code and then 'directly' executed by the host CPU...
processing of queries by sentences. This can allow interactive requests such as that implemented in Wolfram Alpha
Wolfram Alpha
Wolfram Alpha is an answer-engine developed by Wolfram Research. It is an online service that answers factual queries directly by computing the answer from structured data, rather than providing a list of documents or web pages that might contain the answer as a search engine might...
(see external links). 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 NLP program (in sEnglish) is as follows:
If U_ is 'smc01-control', then do the following. Define surface weights Alpha as "[0.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
Sliding mode control
In control theory, sliding mode control, or SMC, is a nonlinear control method that alters the dynamics of a nonlinear system by application of a discontinuous control signal that forces the system to "slide" along a cross-section of the system's normal behavior. The state-feedback control law is...
method. This entry describes NLP in its general form, without being specific about the underlying high level programming language.
The following are discussed:
Why does one write NLPs ?
Natural language programs use sentences, sections, subsections, ontology description sections, references and meta data on the author, similarly to an ordinary document. Hence NLPs are similar in appearance to administrative or technical manuals, engineering or science publications, and can be used as such. The added advantage is, relative to ordinary documents, that NLP documents can also be interpreted by suitable software agents that control machines.What is the software paradigm of NLP ?
Natural language programming is a top down method of writing software. Its stages are as follows:- Definition of an ontologyOntologyOntology is the philosophical study of the nature of being, existence or reality as such, as well as the basic categories of being and their relations...
- 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 NLP 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 HTMLHTMLHyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....
or LaTexLaTeXLaTeX is a document markup language and document preparation system for the TeX typesetting program. Within the typesetting system, its name is styled as . The term LaTeX refers only to the language in which documents are written, not to the editor used to write those documents. In order to...
file. - Publishing the NLP program as a webpage on the Internet or as a PDF file compiled from the LaTex document.
What is the publication value of an NLP program and document ?
An NLP program is a precise formalFormal system
In formal logic, a formal system consists of a formal language and a set of inference rules, used to derive an expression from one or more other premises that are antecedently supposed or derived . The axioms and rules may be called a deductive apparatus...
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
Personal assistant
A personal assistant or personal aide is someone who assists in daily business or personal tasks. It is common in design to have a PDA, or personal design assistant....
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
Personal computer
A personal computer is any general-purpose computer whose size, capabilities, and original sales price make it useful for individuals, and which is intended to be operated directly by an end-user with no intervening computer operator...
.
What is the contribution of NLP programs to machine knowledge ?
An ontology class in a natural language program that is not a conceptConcept
The word concept is used in ordinary language as well as in almost all academic disciplines. Particularly in philosophy, psychology and cognitive sciences the term is much used and much discussed. WordNet defines concept: "conception, construct ". However, the meaning of the term concept is much...
in the sense as humans use concepts. Concepts in an NLP are examples (samples) of generic human concepts. Each sentence in an NLP 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) or 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.
Natural languages and interfaces
- Supernova programming language, scripting language presents the concept of programming with direct Fiction Description using Clear subset of pure Human Language.
External links
- system-english
- sysbrain.org
- How Natural Should a Natural Interface Be - thoughts on how "natural" the UbiquityUbiquity (Firefox)Ubiquity, an add-on for Mozilla Firefox, is an abandonware collection of quick and easy natural-language-derived commands that act as mashups of web services, thus allowing users to get information and relate it to current and other webpages...
interface should attempt to be - Tool turns English to code
- Wolfram Alpha - how it works Computer Weekly, 4 June 2009
- Wolfram Alpha computes answers Tech Crunch, 8 Mar, 2009