Natural-language programming: Difference between revisions
→External links: added content Tags: Mobile edit Mobile web edit |
m Grammar |
||
(41 intermediate revisions by 31 users not shown) | |||
Line 1: | Line 1: | ||
{{Short description|Language-oriented programming paradigm}} |
|||
{{ |
{{Distinguish|neuro-linguistic programming|literate programming|natural language processing}} |
||
{{Use dmy dates|date=July 2015}} |
{{Use dmy dates|date=July 2015}} |
||
{{multiple issues| |
{{multiple issues| |
||
{{More footnotes|date=December 2014}} |
{{More footnotes|date=December 2014}} |
||
{{Original research|date=December 2014}} |
{{Original research|date=December 2014}} |
||
{{update|date=April 2023}} |
|||
}} |
}} |
||
'''Natural-language programming''' ('''NLP''') is an [[ontology (information science)|ontology]]-assisted way of [[programming language|programming]] in terms of [[natural language|natural-language]] sentences, e.g. [[English language|English]].<ref> |
'''Natural-language programming''' ('''NLP''') is an [[ontology (information science)|ontology]]-assisted way of [[programming language|programming]] in terms of [[natural language|natural-language]] sentences, e.g. [[English language|English]].<ref>{{cite journal|doi=10.1147/sj.202.0184|title=Natural language programming: Styles, strategies, and contrasts|journal=IBM Systems Journal|volume=20|issue=2|pages=184–215|year=1981|last1=Miller|first1=L. A.}}</ref> A structured document with Content, sections and subsections for explanations of sentences forms a NLP document, which is actually a [[computer program]]. 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'' <ref>Development of reliable and trustworthy robots. "[http://www.transparentrobots.org transparent robots]" }</ref> as their reasoning is transparent to users and this develops trust in robots. Natural language use and [[natural language user interface|natural-language user interface]]s include [[Inform#Inform 7|Inform 7]], a natural programming language for making interactive fiction, [[Shakespeare (programming language)|Shakespeare]], an [[Esoteric programming language|esoteric]] natural programming language in the style of the plays of [[William Shakespeare]], and [[Wolfram Alpha]], a computational knowledge engine, using natural-language input.{{citation needed|date=November 2018}} Some methods for [[program synthesis]] are based on natural-language programming.<ref>Desai, Aditya, et al. "[https://arxiv.org/abs/1509.00413 Program synthesis using natural language]." Proceedings of the 38th International Conference on Software Engineering. ACM, 2016.</ref> |
||
==Interpretation== |
==Interpretation== |
||
Line 14: | Line 16: | ||
</ref><ref>[https://techcrunch.com/2009/03/08/wolfram-alpha-computes-answers-to-factual-questions-this-is-going-to-be-big/ Wolfram Alpha computes answers] Tech Crunch, 8 March 2009</ref> 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. |
</ref><ref>[https://techcrunch.com/2009/03/08/wolfram-alpha-computes-answers-to-factual-questions-this-is-going-to-be-big/ Wolfram Alpha computes answers] Tech Crunch, 8 March 2009</ref> 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 |
An example text from an English language natural-language program is as follows: |
||
<blockquote> |
<blockquote> |
||
Line 40: | Line 42: | ||
* Testing the meaning of each sentence by executing its code using testing objects. |
* 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 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]] or [[ |
* Providing a title, author data and compiling the sentences into an [[HTML]] or [[LaTeX]] file. |
||
* Publishing the natural-language program as a webpage on the Internet or as a [[PDF]] file compiled from the |
* Publishing the natural-language program as a webpage on the Internet or as a [[PDF]] file compiled from the LaTeX document. |
||
==Publication value of natural-language programs and documents== |
==Publication value of natural-language programs and documents== |
||
Line 47: | Line 49: | ||
==Contribution of natural-language programs to machine knowledge== |
==Contribution of natural-language programs to machine knowledge== |
||
An ontology class |
An ontology class is a natural-language program that is not a [[concept]] 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. |
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 Pixel [https://www.youtube.com/watch?v=Uaos-g1TBKU&ab%20channel=spatialpixel 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 called [https://openai.com/blog/openai-codex Codex]. |
|||
==See also== |
==See also== |
||
Line 72: | Line 77: | ||
* [[Inform 7]] |
* [[Inform 7]] |
||
* [[JOSS]] |
* [[JOSS]] |
||
* [[SenseTalk]] |
|||
* [[Plain English Programming]] |
|||
* [[Software AG]] |
* [[Software AG]] |
||
* [[Transcript (programming language)|Transcript]] |
* [[Transcript (programming language)|Transcript]] |
||
Line 84: | Line 89: | ||
;Books: |
;Books: |
||
* ''Natural Language Programming of Agents and Robotic Devices: publishing for agents and humans in sEnglish''<!-- not a typo; short for "system English"--> by S M Veres, {{ISBN|978-0-9558417-0-5}}, London, June 2008. |
* ''Natural Language Programming of Agents and Robotic Devices: publishing for agents and humans in sEnglish''<!-- not a typo; short for "system English"--> by S M Veres, {{ISBN|978-0-9558417-0-5}}, London, June 2008. |
||
*{{cite book |doi=10.1007/bfb0014656 |chapter=On the foolishness of "natural language programming" |chapter-url=https://www.cs.utexas.edu/users/EWD/transcriptions/EWD06xx/EWD667.html |title=Program Construction |volume=69 |pages=51–53 |series=Lecture Notes in Computer Science |year=1979 |last1=Dijkstra |first1=Edsger W. |isbn=3-540-09251-X}} |
|||
* [http://www.personal.psu.edu/xvl5190/misc/paper/book2018pieframework.pdf ''From Natural Language to Programming Language''] by Liu, X. and Wu, D. In Innovative Methods, User-Friendly Tools, Coding, and Design Approaches in People-Oriented Programming (pp. 110–130). IGI Global. |
|||
*{{cite book|doi=10.1007/1-4020-5386-x_20|chapter=Feasibility Studies for Programming in Natural Language|title=End User Development|volume=9|pages=[https://archive.org/details/enduserdevelopme0000unse/page/459 459–473]|series=Human-Computer Interaction Series|year=2006|last1=Lieberman|first1=Henry|last2=Liu|first2=Hugo|isbn=978-1-4020-4220-1|chapter-url=https://archive.org/details/enduserdevelopme0000unse/page/459}} |
|||
*Dijkstra, E.W., 1979. On the foolishness of "natural language programming". In Program construction (pp. 51-53). Springer, Berlin, Heidelberg. |
|||
⚫ | |||
*Lieberman, H. and Liu, H., 2006. Feasibility studies for programming in natural language. In End User Development (pp. 459-473). Springer, Dordrecht. |
|||
⚫ | |||
;Papers at conferences: |
;Papers at conferences: |
||
* |
* {{cite book|doi=10.2316/p.2010.674-122|chapter=Documents for Intelligent Agents in English|title=Artificial Intelligence and Applications|year=2010|last1=Veres|first1=S.M.|last2=Molnar|first2=L.|isbn=978-0-88986-817-5}} |
||
* ''Sliding mode control of autonomous spacecraft.'' (half written in sEnglish<!-- seems neither a typo; for "system English", see above-->) by S M Veres an N K Lincoln, ''Proc. TAROS’2008, Towards Autonomous Robotic Systems'', Edinburgh, 1–3 September 2008. |
* ''Sliding mode control of autonomous spacecraft.'' (half written in sEnglish<!-- seems neither a typo; for "system English", see above-->) by S M Veres an N K Lincoln, ''Proc. TAROS’2008, Towards Autonomous Robotic Systems'', Edinburgh, 1–3 September 2008. |
||
* |
* {{cite book|doi=10.1007/978-3-642-04025-2_1|chapter=Mission Capable Autonomous Control Systems in the Oceans, in the Air and in Space|title=Brain-Inspired Information Technology|volume=266|pages=1–10|series=Studies in Computational Intelligence|year=2010|last1=Veres|first1=Sandor M.|isbn=978-3-642-04024-5}} |
||
* {{cite journal|doi=10.1145/3109481|title=A Survey of Naturalistic Programming Technologies|journal=ACM Computing Surveys|volume=50|issue=5|pages=1–35|year=2017|last1=Pulido-Prieto|first1=Oscar|last2=Juárez-Martínez|first2=Ulises|s2cid=2078759}} |
|||
* ''Programming Spatial Algorithms in Natural Language'', by Boris Galitsky, Daniel Usikov, in the AAAI Workshop on Spatial and Temporal Reasoning 2008, AAAI Technical report, https://www.aaai.org/Library/Workshops/ws08-11.php. |
|||
* Oscar Pulido-Prieto and Ulises Juárez-Martínez. 2017. A Survey of Naturalistic Programming Technologies. ACM Comput. Surv.50, 5, Article 70 (September 2017), 35 pages. https://doi.org/10.1145/3109481 |
|||
;[[Program synthesis]] from natural language specifications |
;[[Program synthesis]] from natural language specifications |
||
Line 100: | Line 103: | ||
==External links== |
==External links== |
||
* [https://github.com/pannous/english-script/ English Script] |
* [https://github.com/pannous/english-script/ English Script] (dormant since 2016) |
||
* [https://OsmosianPlainEnglishProgramming.blog/ Plain English Programming] Programming language using English sentences in ASCII. |
|||
* [http://www-nlp.stanford.edu/software/sempre/ SEMPRE] |
* [http://www-nlp.stanford.edu/software/sempre/ SEMPRE] {{snd}} a toolkit for training semantic parsers |
||
* [https://web.archive.org/web/20141222025810/http://system-english.com/ sEnglish]<!--|language=Japanese currently -->{{snd}} explaining "system English" |
|||
* [http://sysbrain. |
* [http://sysbrain.com sysbrain.com] {{snd}} sEnglish Editor in C++/ROS for robot programming to develop transparent robots. |
||
* [https://mitcho.com/blog/projects/how-natural-should-a-natural-interface-be/ How natural should a natural interface be?]{{snd}} thoughts on how "natural" the [[Ubiquity (Firefox)|Ubiquity]] interface |
* [https://wy-lang.org wy-lang.org] {{snd}} "Programming Language for the ancient Chinese" |
||
* [https://mitcho.com/blog/projects/how-natural-should-a-natural-interface-be/ How natural should a natural interface be?]{{snd}} thoughts on how "natural" the [[Ubiquity (Firefox)|Ubiquity]] interface (dormant since 2009) |
|||
* [http://www.trnmag.com/Stories/2005/032305/Tool_turns_English_to_code_032305.html |
* [http://www.trnmag.com/Stories/2005/032305/Tool_turns_English_to_code_032305.html Metafor turns English to code] (dormant since 2005) |
||
* [https:// |
* [https://patents.google.com/patent/US7860815 Computer knowledge representation format, system, methods, and applications]{{snd}} US patent re: hyperlinking to .who/what/where/when/how XML files that embed NL |
||
* |
|||
[www.osmosian.com The Osmosian Order of Plain English Programming] |
|||
{{Programming paradigms navbox}} |
|||
[[Category:Algorithm description languages]] |
[[Category:Algorithm description languages]] |
Latest revision as of 08:16, 14 October 2024
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
|
Natural-language programming (NLP) is an ontology-assisted way of programming in terms of natural-language sentences, e.g. English.[1] A structured document with Content, sections and subsections for explanations of sentences forms a NLP document, which is actually a computer program. 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 [2] 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, an esoteric natural programming language in the style of the plays of William Shakespeare, and Wolfram Alpha, a computational knowledge engine, using natural-language input.[citation needed] Some methods for program synthesis are based on natural-language programming.[3]
Interpretation
[edit]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 MATLAB, Octave, SciLab, Python, etc.
Symbolic languages such as Wolfram Language are capable of interpreted processing of queries by sentences. This can allow interactive requests such as that implemented in Wolfram Alpha.[4][5] 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 "[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.
Software paradigm
[edit]Natural-language programming is a top-down method of writing software. Its stages are as follows:
- Definition of an ontology – 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 or LaTeX file.
- Publishing the natural-language program as a webpage on the Internet or as a PDF file compiled from the LaTeX document.
Publication value of natural-language programs and documents
[edit]A natural-language program is a precise formal 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 .
Contribution of natural-language programs to machine knowledge
[edit]An ontology class is a natural-language program that is not a concept 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
[edit]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 Pixel 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 called Codex.
See also
[edit]- Controlled natural language
- Context-free language
- Domain-specific language (or DSL)
- End-user programming
- Knowledge representation
- Natural-language processing
- Source-code generation
- Very high-level programming language
- Programming languages with English-like syntax
- AppleScript
- Attempto Controlled English
- COBOL
- ClearTalk
- FLOW-MATIC
- HyperTalk
- Inform 7
- JOSS
- SenseTalk
- Software AG
- Transcript
- Structured Query Language (or SQL)
- xTalk
References
[edit]- ^ Miller, L. A. (1981). "Natural language programming: Styles, strategies, and contrasts". IBM Systems Journal. 20 (2): 184–215. doi:10.1147/sj.202.0184.
- ^ Development of reliable and trustworthy robots. "transparent robots" }
- ^ Desai, Aditya, et al. "Program synthesis using natural language." Proceedings of the 38th International Conference on Software Engineering. ACM, 2016.
- ^ Wolfram Alpha – how it works (part 2) Computer Weekly, 4 June 2009
- ^ Wolfram Alpha computes answers Tech Crunch, 8 March 2009
Bibliography
[edit]- Books
- Natural Language Programming of Agents and Robotic Devices: publishing for agents and humans in sEnglish by S M Veres, ISBN 978-0-9558417-0-5, London, June 2008.
- Dijkstra, Edsger W. (1979). "On the foolishness of "natural language programming"". Program Construction. Lecture Notes in Computer Science. Vol. 69. pp. 51–53. doi:10.1007/bfb0014656. ISBN 3-540-09251-X.
- Lieberman, Henry; Liu, Hugo (2006). "Feasibility Studies for Programming in Natural Language". End User Development. Human-Computer Interaction Series. Vol. 9. pp. 459–473. doi:10.1007/1-4020-5386-x_20. ISBN 978-1-4020-4220-1.
- Halpern, Mark (1990). "Natural Language and Redundancy in Programming". Binding Time: Six Studies in Programming Technology & Milieu. Ablex series in computational science. Intellect Books. ISBN 9780893916916.
- Papers at conferences
- Veres, S.M.; Molnar, L. (2010). "Documents for Intelligent Agents in English". Artificial Intelligence and Applications. doi:10.2316/p.2010.674-122. ISBN 978-0-88986-817-5.
- 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.
- Veres, Sandor M. (2010). "Mission Capable Autonomous Control Systems in the Oceans, in the Air and in Space". Brain-Inspired Information Technology. Studies in Computational Intelligence. Vol. 266. pp. 1–10. doi:10.1007/978-3-642-04025-2_1. ISBN 978-3-642-04024-5.
- Pulido-Prieto, Oscar; Juárez-Martínez, Ulises (2017). "A Survey of Naturalistic Programming Technologies". ACM Computing Surveys. 50 (5): 1–35. doi:10.1145/3109481. S2CID 2078759.
- Program synthesis 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
[edit]- 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