CN106250159B - Mixed programming method using natural language - Google Patents

Mixed programming method using natural language Download PDF

Info

Publication number
CN106250159B
CN106250159B CN201610631212.9A CN201610631212A CN106250159B CN 106250159 B CN106250159 B CN 106250159B CN 201610631212 A CN201610631212 A CN 201610631212A CN 106250159 B CN106250159 B CN 106250159B
Authority
CN
China
Prior art keywords
function
natural language
programming
text
hybrid
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610631212.9A
Other languages
Chinese (zh)
Other versions
CN106250159A (en
Inventor
李文广
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Weiwo Technology Co ltd
Original Assignee
Shenzhen Weiwo Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Weiwo Technology Co ltd filed Critical Shenzhen Weiwo Technology Co ltd
Priority to CN201610631212.9A priority Critical patent/CN106250159B/en
Publication of CN106250159A publication Critical patent/CN106250159A/en
Application granted granted Critical
Publication of CN106250159B publication Critical patent/CN106250159B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms

Abstract

The invention discloses a hybrid programming method using natural language. The hybrid programming method using a natural language includes the steps of: acquiring a natural language mixed text; acquiring a function of a programming language according to a first minimum unit of each line of the natural language mixed text; matching the parameters of the function according to the subsequent text of the minimum unit; functions not implemented by the programming language are executed using different programming languages using protocol interfaces or socket calls; and returning an execution result. The invention can reduce the programming difficulty, improve the programming efficiency and promote the realization of data sharing, is particularly suitable for realizing VR (virtual reality), AR (augmented reality) and MR (mixed reality), and enables common people to construct a virtual world which the common people want.

Description

Mixed programming method using natural language
Technical Field
The invention relates to the fields of virtual reality, augmented reality, mixed reality and artificial intelligence, in particular to a mixed programming method utilizing natural language.
Background
In popular programming tools, most of the languages are high-level languages which can be compiled into machine languages, but not natural languages used by people, such as C #, JavaScript, VB, C + +, PASCAL, JAVA and the like, the syntax of the languages is gradually developed from machine language "→" assembly language "→" high-level language ", and foreign companies have tried to be programmed with natural languages, but finally fail to finish, and the reason is not three points, namely, resistance to thinking from traditional programming languages; secondly, various conflicts are generated due to different nationalities, languages, cultures and traditions, and thirdly, the technical realization is more complex and difficult.
The existing programming needs a fixed programming environment, format and symbols, the formats and symbols of different programming languages are different, so that the common human programming is very difficult, and codes among different languages cannot be used universally. Moreover, programming habits of each person are different, function names and the like are customized according to personal preferences, and codes among different programmers are difficult to share.
Disclosure of Invention
The invention aims to provide a mixed programming method using natural language, which reduces the programming difficulty and improves the programming efficiency.
The purpose of the invention is realized by the following technical scheme:
a hybrid programming method using a natural language, comprising the steps of:
acquiring a natural language mixed text;
acquiring a function of a programming language according to a first minimum unit of each line of the natural language mixed text;
matching the parameters of the function according to the subsequent text of the minimum unit;
functions not implemented by the programming language are executed using different programming languages using protocol interfaces or socket calls;
and returning an execution result.
Further, when the programming language is javascript; only one parameter is needed, and the data type of the parameter is a character string type; when the parameter is an integer type, a parseInt function conversion is used, and when the parameter is a floating point type, a parseFloat conversion is used; when the parameter is an object, function or array type, dynamic conversion is performed by eval; when the programming language is C #, int.parse () function conversion is used, and when the argument is a floating point type, float.parse () conversion is used.
Furthermore, a priority function is arranged in the function, and when the function is operated, the priority function is preferentially executed according to the content of the parameter.
Further, if the natural language mixed text is greater than or equal to two lines, if the first word of the first line represents pure natural language, the first words of the other lines all represent function functions; otherwise, the contents of the other lines are treated as mixed code.
Furthermore, if the natural language mixed text is more than or equal to two lines and contains special symbols which cannot be used by the parameters, the special symbols are replaced by descriptive characters to serve as the parameters, and the original special symbols are replaced when the function is executed.
Furthermore, when the input natural language mixed text adopts the table-shaped characters, the minimum unit is one character; when the input natural language mixed text adopts pinyin characters, the minimum unit is a word.
Further, when the natural mixed text has only one word which has the same name of the webapp or the virtual reality application and does not belong to the core function, the same name of the webapp or the virtual reality application is called.
Further, when the function corresponding to the natural language mixed text is renamed, the following default priority is performed: executing the function written by the user; executing a function written by an official party, executing a function written by a friend, and executing a function written by a stranger; if the configuration priority exists, judging according to the configuration priority; and if the same group also has the same function, executing according to the function specified in the configuration, otherwise executing according to the latest update.
Furthermore, different programming languages call a function or an application corresponding to the natural language mixed text through a protocol interface or a socket to obtain a result or execute a function.
Furthermore, a function or an application corresponding to the natural language mixed text is called through a social platform to obtain a result or execute a function.
The invention takes the first minimum unit of each line of the natural language mixed text as a function, takes other words as parameters, and then calls the relevant programming language to execute by utilizing an interface or a socket, thereby realizing the effective mapping of the natural language and the programming language and leading the natural language to be identified and operated by a machine. The natural language mixed text is easy to understand, a programmer is not required to know the requirements of functions, grammars and symbols of various programming languages, the programming threshold is greatly reduced, and common people can realize complex programming through simple practice. The invention gets rid of the limitation of specific programming language and operation platform, and has higher universality. With the increase of the number of users and the accumulation of the number of programming, more and more functions become ready-made function functions, and the programming can be directly called, so that the programming efficiency is higher and higher.
Drawings
FIG. 1 is a schematic diagram of a hybrid programming method using natural language according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of natural language hybrid programming using social software according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an application of an embodiment of the present invention in virtual reality;
FIG. 4 is a schematic diagram of a natural language hybrid programming method based on a data table according to an embodiment of the present invention;
FIG. 5 is a diagram illustrating a method for sharing intelligence based on a data table according to an embodiment of the present invention;
FIG. 6 is a diagram of a natural language hybrid programming method based on a post-implementation of an embodiment of the present invention;
FIG. 7 is a diagram illustrating an example of a hybrid programming method based on natural language according to an embodiment of the present invention.
Detailed Description
As shown in fig. 1, the present invention discloses a hybrid programming method using natural language, comprising the steps of:
s11, acquiring a natural language mixed text;
s12, acquiring a function of the programming language according to the first minimum unit of each line of the natural language mixed text;
s13, matching the parameters of the function according to the subsequent text of the minimum unit;
s14, the function which is not realized by the programming language is executed by calling different programming languages by using a protocol interface or a socket;
and S15, returning the execution result.
The protocol interfaces include, but are not limited to, ajax and http protocols; the sockets include, but are not limited to, sockets and websockets.
ajax, or "Asynchronous Javascript And XML," refers to a web page development technique for creating interactive web applications. It is a technique for creating a fast dynamic web page. The ajax can enable asynchronous updates of the web page by exchanging a small amount of data with the server in the background. This means that certain parts of the web page can be updated without reloading the entire web page.
The http Protocol (HyperText Transfer Protocol) is a Transfer Protocol for transferring HyperText from a WWW server to a local browser. It can make the browser more efficient, make the network transmission reduce. It not only ensures that a computer transmits a hypertext document correctly and quickly, but also determines which part of the transmitted document and which part of the content is displayed first (e.g., text before graphics), etc. http is an application-layer communication protocol between a client browser or other program and a Web server. Hypertext information is stored in Web servers on the Internet, and clients need to transmit the hypertext information to be accessed through an http protocol. http contains commands and transmission information, and can be used for Web access and communication between other Internet/intranet application systems, so that integration of various application resource hypermedia access is realized.
Socket's english primitive is "hole" or "Socket". The latter meaning is taken as the process communication mechanism of the BSD UNIX. Also commonly referred to as a "socket," which describes an IP address and port, is a handle to a communication chain that may be used to implement communications between different virtual machines or different computers. A host computer on the Internet typically runs a plurality of service software, providing several services simultaneously. Each service opens a Socket and binds to a port, with different ports corresponding to different services.
WebSocket is a socket based on HTML 5. It enables full-duplex communication (full-duplex) between the browser and the server. In the process of realizing the websocket connection, a websocket connection request needs to be sent out through a browser, then a server sends out a response, the process is generally called as handshake, and then a fast channel is formed between the browser and the server. The two can directly transmit data to each other.
The invention takes the first minimum unit of each line of the natural language mixed text as a function, takes other words as parameters, and then calls the relevant programming language to execute by utilizing an interface or a socket, thereby realizing the effective mapping of the natural language and the programming language and leading the natural language to be identified and operated by a machine. The natural language mixed text is easy to understand, a programmer is not required to know the requirements of functions, grammars and symbols of various programming languages, the programming threshold is greatly reduced, and common people can realize complex programming through simple practice. The invention gets rid of the limitation of specific programming language and operation platform, and has higher universality. With the increase of the number of users and the accumulation of the number of programming, more and more functions become ready-made function functions, and the programming can be directly called, so that the programming efficiency is higher and higher.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations as a sequential process, many of the operations can be performed in parallel, concurrently, or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The technical scheme of the invention can be widely applied to virtual reality, augmented reality, mixed reality, AI (artificial intelligence), mobile intelligent terminals (such as smart phones, tablet computers, wearable devices or smart glasses), computers, robots, smart home devices or intelligent industrial control devices and the like, can execute preset processing procedures such as numerical calculation and/or logic calculation and the like by running preset programs or instructions, and can comprise a processor and a memory, wherein the processor executes a memory instruction prestored in the memory to execute the preset processing procedures, or hardware such as ASIC (application specific integrated circuit), FPGA (field programmable gate array), DSP (digital signal processor) and the like executes the preset processing procedures, or the combination of the two is realized. Computer devices include, but are not limited to, servers, personal computers, laptops, tablets, smart phones, and the like.
Network devices include, but are not limited to, a single network server, a server group of multiple network servers, or a Cloud of numerous computers or network servers based on Cloud Computing (Cloud Computing), which is one type of distributed Computing, a super virtual computer consisting of a collection of loosely coupled computers. Wherein the computer device can be operated alone to implement the invention, or can be accessed to a network and implement the invention through interoperation with other computer devices in the network. The network in which the computer device is located includes, but is not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a VPN network, and the like.
It should be noted that the user equipment, the network device, the network, etc. are only examples, and other existing or future computer devices or networks may also be included in the scope of the present invention, and are included by reference.
The methods discussed below, some of which are illustrated by flow diagrams, may be implemented by hardware, software, firmware, middleware, microcode, hardware description languages, or any combination thereof. When implemented in software, firmware, middleware or microcode, the program code or code segments to perform the necessary tasks may be stored in a machine or computer readable medium such as a storage medium. The processor(s) may perform the necessary tasks.
Specific structural and functional details disclosed herein are merely representative and are provided for purposes of describing example embodiments of the present invention. The present invention may, however, be embodied in many alternate forms and should not be construed as limited to only the embodiments set forth herein.
It will be understood that, although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element may be termed a second element, and, similarly, a second element may be termed a first element, without departing from the scope of example embodiments. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. In contrast, when an element is referred to as being "directly connected" or "directly coupled" to another element, there are no intervening elements present. Other words used to describe the relationship between elements (e.g., "between" versus "directly between", "adjacent" versus "directly adjacent to", etc.) should be interpreted in a similar manner.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used herein, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be noted that, in some alternative implementations, the functions/acts noted may occur out of the order noted in the figures. For example, two figures shown in succession may, in fact, be executed substantially concurrently, or the figures may sometimes be executed in the reverse order, depending upon the functionality/acts involved.
The invention is further described with reference to the drawings and the preferred embodiments.
The "natural language mixed text" referred to in the present invention should be understood from a broad perspective, and represents a text conforming to the general narrative of ordinary people, and may be natural language, programming language, mixed use, expression form not limited to characters, and mixed speech and image. The use of speech alone is also feasible because speech can ultimately be converted to a text language by well-known speech recognition techniques. The image itself may be a parameter and thus also a part of the natural language mixed text.
The natural language mixed text is not limited to chinese, and any language such as english, japanese, korean, german, french, and the like may be used. The specific languages are different, and the corresponding "minimum units" are different, and for convenience of explanation, the following description will be given by taking chinese as an example, and the corresponding minimum units are single chinese characters. If the pinyin characters are adopted, the minimum unit is a word.
Since the programming languages of the specific operating computer devices are different, the content features can be extracted from the input content for identifying the content type. For example, http stands for web page, html, function, php stands for execution environment, html, javascript, php respectively, and so on.
The natural language mixed text may be a single line or a plurality of lines. For a single line of natural language mixed text, the corresponding function can be obtained according to the first minimum unit of the first line, the following texts are unified as parameters, then the interface or the socket is used for calling the relevant programming language to execute, and the execution result is returned.
If the natural language mixed text has a plurality of lines, besides the first word of the first line, it also needs to judge whether the first word of the following line is also a function, if the whole natural language mixed text includes a plurality of function functions, the execution sequence is automatically selected according to the logic relation of the whole context. For example, when a programmer wants to present a slide, the first line of text "shows" the function of the slide design concerned, and the natural language mixed text of the subsequent lines represents the content to be presented in the slide. For another example, if there is a "first" word (i.e., a priority function) representing a priority to be performed, except for the first line, then the next line will also be performed with a priority.
If the first word of the first line represents pure natural language, the first words of other lines represent function functions; otherwise, the contents of the other lines are treated as mixed code.
When the natural mixed text only has one word, the word has the same name of the webapp or the virtual reality application and does not belong to the core function, the webapp or the virtual reality application (the webpage application) with a specific function is opened, and various application software with the same function on the market can be available. For example, when a user wants to watch a wilderness hunter, the computer can directly open the movie of the wilderness hunter for the user to watch only by inputting 'watching the wilderness hunter', and the user does not need to consider 'storm video' or PPTV to watch the movie, thereby realizing the purposes of removing application, habit and brand, and really realizing 'what you think is what you get'. A few words will correspond to core function functions, such as "save" children, which represent stored function functions, rather than stored webapp or virtual reality applications.
The concept of the invention can lead different programming languages to have a set of unified standard for understanding the natural language; and replacing codes of the target language (such as JS or PHP, replacing the codes into target source codes and then executing the target codes through eval) through the regular expression according to different content types, and realizing cross-platform operation. Therefore, the natural language mixed text of the present invention can be input by means of text, voice or gestures; the natural language mixed text is operated through a mobile intelligent terminal, a computer, AI (artificial intelligence), virtual reality, augmented reality, mixed reality, a robot, VR (virtual reality), AR (augmented reality), MR (mixed reality), intelligent household equipment or intelligent industrial control equipment; uploading the natural language mixed text to a cloud end or a local server, and automatically matching executable codes by the cloud end or the local server; the mobile intelligent terminal comprises but is not limited to a smart phone, a tablet computer, a wearable device or smart glasses. And uploading the natural language mixed text to a cloud end or a local server, and automatically matching the executable code by the cloud end or the local server.
With the increase of developers based on the concept of the invention, a plurality of function functions corresponding to the same Chinese character are possible, and the most appropriate function can be called according to the preset rule at the moment, such as the sequence of creation time, the use frequency, the favorable rating and the like.
When the natural language mixed text is more than or equal to two lines and contains special symbols which cannot be used by the parameters, the special symbols are replaced by descriptive characters to serve as the parameters, and the original special symbols are replaced when the function is executed. The syntax of the programming language recognizable by the machine is different from that of the natural language, for example, the carriage return symbol in the programming language represents another line of execution instructions, but the carriage return symbol in the natural language is mostly used for typesetting, so that preprocessing is required before the execution of the natural language mixed text, and special symbols (such as the carriage return symbol) which cannot be recognized by the programming language are converted into sentences which can be used as parameters, for example, the carriage return symbol is replaced by 'broad line'. So that the text of the upper and lower lines can be recognized by the programming language as a whole.
In addition, the programming language generally requires that the parameters need to be separated, but except that the first character is a function, the invention processes the subsequent unification as a character string parameter, namely, the parameter is only one, and the data type of the parameter is a character string type; when the programming language is javascript; only one parameter is needed, and the data type of the parameter is a character string type; when the parameter is an integer type, a parseInt function conversion is used, and when the parameter is a floating point type, a parseFloat conversion is used; when the parameter is an object, function or array type, dynamic conversion is performed by eval; when the programming language is C #, int.parse () function conversion is used, and when the argument is a floating point type, float.parse () conversion is used. When the function runs, different parameters are automatically segmented through the content in the character string, such as commas and commas, so that the programming is more flexible, ordinary programmers can automatically process the parameters without considering the problem of parameter separation, and the symbol application is reduced as much as possible during the input, so that the programming process is closer to daily expression, and the programming difficulty is further reduced.
When the function corresponding to the natural language mixed text is renamed, executing according to the following default priority: executing the function written by the user; executing a function written by an official party, executing a function written by a friend, and executing a function written by a stranger; if the configuration priority exists, judging according to the configuration priority; and if the same group also has the same function, executing according to the function specified in the configuration, otherwise executing according to the latest update.
The method and the device can input the natural language mixed text based on the social platform, and call the functional function or application corresponding to the natural language mixed text through the social platform to obtain the result or execute the function. In addition, the invention needs cluster intelligence to be developed, the more people developed the platform, the better the platform is, the more people developed the platform can, the better the platform can be, and the communication and programming experience and the release requirements of the user can be realized through the interaction attribute of the social platform, and the circulation of various function functions and parameters written by the user can be realized. Referring to fig. 2, the specific process of the present invention is further generated in conjunction with a social platform:
s21, acquiring the identity information of the user;
s22, feeding back the editing interface of the social platform to the user;
s23, acquiring a natural language mixed text input by a user;
s24, preprocessing the natural language mixed text;
s25, judging the language of the natural language mixed text;
s26, judging the content type of the natural language mixed text;
s27, calling a programming language to execute;
and S28, returning the execution result.
More specifically, the step of invoking the programming language is performed by first distinguishing whether the natural language mixed text is a single line or multiple lines. If the natural language mixed text is a single line, directly calling the related programming language to execute by using an interface or a socket; returning an execution result; if the natural language mixed text is more than or equal to two lines, when the programming language is javascript; the data type of the parameter is a character string type; when the parameter is an integer type, a parseInt function conversion is used, and when the parameter is a floating point type, a parseFloat conversion is used; when the parameter is an object, function or array type, dynamic conversion is performed by eval; when the programming language is C #, int.parse () function conversion is used, and when the argument is a floating point type, float.parse () conversion is used. When the first minimum unit of other lines except the first line of the natural language mixed text represents a function and accords with a preset rule, the function is preferentially executed; and returning an execution result.
Optionally, different programming languages call a function or application corresponding to the natural language mixed text through a protocol interface or a socket to obtain a result or execute a function. For example, the http protocol is used, and the browser is almost an application used by each internet name at high frequency, so that the http protocol is also a very desirable way to call functions and applications. Specifically, the developer opens an interface, and the user can obtain a result or execute a function by inputting a certain website in the browser and combining a natural language mixed text behind the website. Com, develops the function of the user's pop-up window and opens to the outside, then the user enters "diywebapp. ", the current browser will pop up, displaying" hello | in! ".
The inventive concept is further illustrated below by means of some specific examples. For example, a user wants to watch a certain movie and inputs 'i want to watch a wilderness hunter', in the prior art, semantic analysis needs to be performed based on the whole text, the intention of the user is judged, then a function which is most matched with the text is called to execute, the algorithm is very complex, and the complexity is higher along with the increase of the length of the text. More importantly, the implementation mode based on semantic analysis is only suitable for the recognition of single-line characters, simple program calling is carried out, and the purpose of programming cannot be realized through multiple lines of characters. By adopting the scheme of the invention, a user only needs to say that the user looks at the wilderness hunter, the first word "look" is a function and can be directly called, the wilderness hunter is a parameter and can be executed by directly substituting the parameter into the function of "look", the whole implementation process is simple and direct, and high-depth programming knowledge is not needed. The invention can realize the intention of the user without semantic analysis, assuming that the concept of the invention is adopted, the user inputs the 'I want to see the wilderness hunter'. Firstly, the 'I' is used as a function name, the 'wanted wilderness hunter' is used as a parameter name, and in the judgment parameter in the 'I' function, the 'wanted' is also a function, so that the 'wanted' function is further called from the 'I' function, the 'seen wilderness hunter' is used as the parameter name, and similarly, the 'seen' is also a function, then the 'seen' function is called from the 'wanted' function, and then the 'wilderness hunter' is used as a parameter to find and can be directly executed, so that the finally executed function is still the 'seen' function, and the effect wanted by the user is achieved.
The invention is also illustrated based on the implementation of programming on multiple lines of text. Such as modifying an ancient poem. Original ancient poems:
the color of the remote mountain is that the remote mountain,
the near-audible water is silent.
The flower of the spring is removed and the spring is still,
birds are not frightened.
Editing the ancient poems, wherein the texts input by the user are as follows:
changing mountains into printers
Flower of Chinese Thorowax
Front "Picture" Wangwei
In 2016, 3 months and 15 days
The effect produced after the operation is as follows:
"Picture" Wangwei
The long-distance view printer is colored,
the near-audible water is silent.
The part of the Chinese herbal medicine is recovered in spring,
birds are not frightened.
2016 (3 months) and 15 days
It can be seen that the computer can execute the commands one by one to realize the programming effect only by extracting the requirements of the user one by one. The programming language is closer to the natural language, and the user is not required to use a complex programming language.
The programming has not only a sequential structure but also a loop and judgment structure, each of which is illustrated in a row.
E.g. now not more than 12 o' clock
Spring good morning
If the current time exceeds 12 points
Play good afternoon
The execution condition is as follows: if function judgment time is lower than 12 points, popping up a dialog box by a function, and displaying good morning; if 12 o' clock is exceeded, the "pop function pops up the dialog box, displaying" good afternoon ". In this example, the "e.g." function represents the programming concept with a judgment structure, and the programming of the judgment structure can be realized by the present invention.
The technical scheme of the invention is used for realizing the multiplication pithy formula. For example, to calculate the multiplication pithy formula of 6, the user directly inputs "multiply 6", and the "multiply" function can be called automatically, and then 6 is substituted into the function as a parameter, and the operation result is output: "6X 6 ═ 36; 6X7 ═ 42; 6X8 ═ 48; and 54' for 6X 9.
The natural language mixed text has only one parameter, but a plurality of parameters are needed when the actual programming language is executed, so that the parameters of the natural language mixed text need to be preprocessed and divided into a plurality of sub-parameters which can be realized by the programming language. In addition, the same function and parameters are different, and the corresponding functions may be completely different. An example of an "add" function is illustrated.
Assuming that a user inputs natural language mixed text 'add 1, 2' which means addition, and '1, 2' is taken as a whole as a parameter, the 'add' function executes a corresponding sub-function of the addition. When the method is executed, the 'adding' function automatically splits the parameter into two sub-parameters '1' and '2' according to the 'symbol' in the parameter, so that the programming language can recognize the sub-parameters and obtain the operation result of 1+ 2-3.
However, if the user inputs the natural language mixed text "add segmentation", then "add" is not meant as an addition, but rather to add content. At this time, another corresponding sub-function is called in the adding function, and the adding and dividing effect is achieved.
The technical scheme of the invention is particularly suitable for the field of virtual reality, the virtual reality scene can break through the limitation of various physical laws of the real world, and developers are allowed to freely construct a vivid and dreamlike world to really realize the instant expression. For example, inputting "cattle" and "duck", the models of "cattle" and "duck" can be presented. In the virtual reality world, a first person represents the role of the first person, the role moves forwards when the first person inputs 'move', the role flies when the first person inputs 'fly', the role flies, the physical limitation is broken, and a plurality of commands are bound to the role of the first person by default.
Fig. 3 is an application of the virtual reality in the teaching field, a spacious classroom is built through natural language hybrid programming, the scene in the classroom can be changed at will, when a child says 'cat' to a microphone, a cat can be suspended on a platform in the middle of the classroom, the cat can rotate 360 degrees on the platform, and the child can know the animal 'cat' in all directions. Alternatively, the same effect can be achieved by directly inputting "cat" with a keyboard. Natural language expression has certain randomness, and in a real life scene, the expression is not strict enough, and the logic is problematic and cannot be executed. However, in the virtual reality space, the rules can be set arbitrarily by people, and various physical rule limitations of the real world do not need to be satisfied, so the method is particularly suitable for the natural language hybrid programming method of the invention.
[ broad example ]
As another embodiment of the present invention, the present embodiment discloses a natural language hybrid programming method based on a data table, specifically, including the steps of:
establishing a broad table;
storing natural language text in the data into a first field of a broad table;
the field number of the broad table is fixed and unchanged, and the field name is fixed and unchanged; except the field representing the unique number of each record, the data format of other fields is a character string type; the data comprises natural language mixed text; the first smallest unit of the natural language mixed text represents a function, and the subsequent text of the smallest unit represents a parameter.
More specifically, the field name is named by the minimum unit of word or word, the field is set according to the data content, the data structure, the data label, the data type, the data interaction, the data attribute and the data ownership, and the total number of twenty-six fields, and since the number of English letters is just 26, the field name can be replaced by 26 letters for the sake of simplicity and can be well known by people of different languages. Specific examples are as follows:
Figure BDA0001069421570000131
Figure BDA0001069421570000141
referring to FIG. 4, the broad aspects of the present invention are particularly applicable to the aforementioned hybrid programming using natural language. The specific implementation method is as follows:
s41, acquiring a natural language mixed text;
s42, storing the natural language text in the data into a first field of the broad table;
s43, acquiring a function of the programming language from a broad table or a local file according to the first minimum unit of each line of the natural language mixed text as a function name;
s44, acquiring parameters of the function from a broad table or a local file according to the subsequent text of the minimum unit;
s45, the function which is not realized by the programming language is executed by calling different programming languages by using a protocol interface or a socket;
and S46, returning the execution result.
Therefore, the function corresponding to the head of each line of the natural language mixed text can be stored in a broad table and can also be stored in a local file; accordingly, the parameters of the function can be stored in a wide table or a local file. From the idea of natural language hybrid programming, when the security and confidentiality performance of the watch meets the requirements, the function and the parameter are preferably stored in the watch, and the purposes of gathering intelligence and practicing the world identity are really achieved.
As exemplified in the manner in which the text length is calculated.
The text to be calculated is stored in the record with the "number" of the broad table being 203, and the contents of other fields of the record are: "family" 10774, "chapter" is special, "section" is words, "subject" is drawing, "words" content is:
painting
Color for long-distance mountain
Soundless for near-listening to water
Removing flowers and returning to the original place in spring
The bird is not frightened
And the function for calculating the text length is stored in the record with the "number" of 2914 in the table, and the contents of other fields of the record are as follows: "family" 10774, "chapter" special, "section" wide, "title" long, the function of calculating the text length is stored in the "wide" field:
Figure BDA0001069421570000151
now, in a record of which the "number" is 2915, the user creates a new record in the spreadsheet, the "user" is 10774, the "chapter" is special, the "section" is an example, the "topic" is long, and the natural language mixed text is input into the "wide" field:
number 203
Long and long
Direct execution, will automatically return the result: 33.
it can be seen that the user does not need to know the specific programming language, and he (she) only needs to know where the parameter exists (number 203), and then directly uses the unique Chinese character 'long' representing the function to achieve the purpose of automatically calculating the text length.
Because the data structure of the broad table is simple, the broad table can be realized without the support of the existing database. The data types of the broad table are character strings except for the unique number, and the user does not need to plan and increase or decrease the fields again. The unified field number and data type are beneficial to intercommunication and interconnection among data, communication is consistent, and realization of virtual reality, augmented reality and mixed reality is facilitated. The method is beneficial to independent work and seed, convenient for realizing full stack, and convenient for natural language programming and modularized SQL query. The method is beneficial to sharing intelligence and realizing social programming, teaching and data fusion of the mobile phone. The spreadsheet realizes data and code integration, is beneficial to transformation of nosql and records like excel. It has structure (chapter, section, question) and group chat type creation, and every record can be priced. And based on natural language mixed programming, the expression is code, and one record contains all elements required by operation when the operation type propagation is carried out. The broad tables do not need to be linked and related, the relational database needs to be built in a library and a table is built in the library, the field names and the number of each table are different, data association is carried out between the tables, and the data structure is very complex.
As another embodiment of the present invention, the present embodiment further discloses a method for sharing intelligence based on data table,
acquiring data input by a user;
acquiring identity information of a user social platform;
acquiring data input by a user;
storing the data in a wide table;
judging the sharing range according to the first minimum unit of the storage content of the designated field of the wide table, and judging whether to share according to other words behind the first minimum unit;
the field number of the broad table is fixed, and the field name is fixed; the data format of the other fields, except for the field representing the unique number of each record, is a string type.
Referring to fig. 5, in combination with the aforementioned natural language hybrid programming method, intelligent sharing can be achieved, so that each user can directly call the function and parameter of other users to run without secondary modification and processing. In particular, the data comprises natural language mixed text;
s51, the user acquires the natural language mixed text in the sharing state;
s52, acquiring a function of the programming language from a broad table or a local file according to the first minimum unit of each line of the natural language mixed text as a function name;
s53, acquiring parameters of the function from the broad table according to the subsequent text of the minimum unit;
s54, the function which is not realized by the programming language is executed by calling different programming languages by using a protocol interface or a socket;
and S55, returning the execution result.
Because the data is stored on the basis of the broad-list, as the data accumulated in the broad-list by the user is more and more, the computer can read the user more and more, which is equivalent to that the user gradually copies himself in the network world. Therefore, the natural language mixed text calls a plurality of pieces of data in a shared state during running, and the purpose of thinking can be achieved.
Such as: the 'text' field of the broad list of a certain user often stores related products and reports of apple company; but the user does not find that the user has the mobile phone product which has purchased the apple in the broad list, then the shopping record of the user is checked from the broad list, and if the purchasing ability of the user is relatively weak, the computer can judge that the user likes the apple mobile phone, but is shy in the pocket and cannot consume the apple mobile phone. Waiting for a certain day, a certain e-commerce issues the latest discount information of the apple mobile phone in the 'text' field of the broad list; at which point it may be automatically pushed to the user. As the data of the broad table is richer, the pushed information and the time are more matched. Further, assuming that the information of the user's payroll is also in the schedule, the discount information can be pushed to the user even on the day of payroll issuance. All this is based on all data being stored in the table, and everyone's table is the same, and there is no obstacle to the flow between data at all. In addition, based on a programming mode of a wide language, the programming threshold is reduced, each user can participate in the mining and utilization of data, functional functions meeting various requirements are compiled and shared with each other, the internet is more and more intelligent, and sharing intelligence is really realized.
Certainly, in order to protect privacy, users can set shared content and range independently, shared intelligence is generally realized in the same group, and the same group can represent a product, an interest group and the like, so people in the same group often have the same target and interest and have the basis of common communication. In this embodiment, the first word of "wide" in the broad table is used for identification, for example, "common" indicates that all people in the same group can see the word; "shared" represents a designated person sharing within the same group. And another kind of information can be actively pushed, for example, by analyzing a broad list, if two different users like watching the same type of movie, the records can be actively pushed to the other side, and the two sides of the odor engagement can communicate with each other. The active pushing range is also settable, and the recognition can be performed through the first character of 'wide', for example, 'pushing' is actively pushed to all matched users; the sending is actively pushed to be shared with the matched appointed person, and the appointed person generally refers to a friend or a person in the same working group.
As another embodiment of the invention, the invention also discloses a mixed programming method based on the natural language realized later. Due to the adoption of the scheme of natural language mixed programming, broad list and shared intelligence, the demand which cannot be realized temporarily can be realized in a lagging way.
Referring to fig. 6, the post-implementation natural language based hybrid programming method specifically includes the following steps:
s61, acquiring a natural language mixed text input by a demand side;
s62, inquiring a broad table when the local function cannot be executed, if the executable function or parameter cannot be found, inquiring whether a demand party needs to realize the function after the demand party requests, if so, saving the natural language mixed text as a first record, and pushing the first record to potential processing parties in the same group;
s63, acquiring the function or parameter provided by the processor and feeding back to the demander, and storing the function or parameter as a second record;
acquiring a corresponding function by the first minimum unit of each line of the natural language mixed text; the subsequent text of the minimum unit corresponds to the parameter of the function; the field number of the wide table is fixed, and the data format of other fields except the field representing the unique number of each record is a character string format.
Optionally, the proposed function or parameter of the demand and feedback may be recorded in the same record, or may be stored in different records. Because the natural language mixed programming is adopted, the feedback function and parameters can be directly operated, which is completely different from the common development group shared code, and the common developers can not solve the problems and also seek help. However, the other party only feeds back the code, needs to embed the code into the code of the other party and can execute the code by utilizing a specific programming environment, and because the habits of each programmer are different, the other party cannot be directly used even if the same programming language is adopted, and the other party needs to modify the code for the second time to be matched with the existing code.
Because the unified broad-list is adopted to store the natural language mixed text, the function and the parameter, the matching and the circulation of the data are very convenient. For example, the natural language mixed text written by the demand side includes a keyword 'html 5', the natural language mixed text is stored in the 'wide' field of the wide table, and then the wide table of other users is searched, and if the 'wide' field of the user wide table has a large amount of html5 codes, the user is a potential processing side.
Of course, if the demander has a definite object to help, it can also be sent directly to the demander. In addition, the sending object can also control the authority, and with reference to the aforementioned implementation mode of sharing intelligence, the pushing range can be controlled according to the content of a specific field, so that all users or a specified user can be helped.
When there are a plurality of function functions or parameters to be fed back, they may be stored in one or all of the tables, but only one is actually executed, and there are a plurality of rules to be selected, such as the one that performs the first feedback, the one that has the highest rating, the one that performs the friend preferentially, and so on.
Each record of the broad list has a unique number, so that when the demand side runs the self-stored natural language mixed text, the feedback function or parameter can be called by calling the unique number.
Therefore, the first line of the natural language mixed text comprises the number, and when the program is executed, a corresponding record is found from the broad table according to the number; and then calling a corresponding function from the broad table according to the first minimum unit of the second line of the natural language mixed text, and processing the content of the corresponding record according to the subsequent text of the minimum unit. Based on the embodiment of the natural language hybrid programming, only one parameter is provided, and the data type of the parameter is a character string; when executed, the character string is automatically divided into a plurality of sub-parameters which can be identified by the programming language.
In the later implementation, the demander can select to push the first record to a specific range of potential processors by setting the content of the characteristic field of the broad table, and similarly, the processor editing to generate the second record can also feed back the second record to the demander and other related people in the same way.
For example, when the demander is confirmed and implemented, the first minimum unit of the storage content of the first record designated field is set as a preset first word (required), the record is sent to all people in the same group; and when the first minimum unit of the storage content of the designated field of the second record generated by the potential processing party is set as a preset second word (supply), returning the second record to the corresponding requiring party.
When the demander is realized after confirmation, when the first minimum unit of the storage content of the designated field of the first record is set as a preset third word (ask), the record is sent to the friends in the same group; and when the first minimum unit of the storage content of the specified field of the second record generated by the potential processor is set as a preset fourth word (for supply), returning the second record to the corresponding friend.
When the functional function or parameter provided by the processing party is fed back to the demand party, the demand party is reminded whether to allow the demand party, and the operation result is stored as a second record after meeting the preset.
And triggering the function with the same name according to the second word of the storage content of the specified field of the second record, and feeding back the execution result to the demander by the function.
The concept of the present invention based on natural language hybrid programming further arises from the above embodiments, as shown in fig. 7. The tourists log in the social platforms of the tourists, such as 'virtual me', VR social platforms and the like. Then choose to join a "swarm" that represents a virtual reality application or game. The user edits or opens a code of a certain "number" (i.e. a natural language mixed code) in the group, and enters pre-execution.
For a single line of codes, the first word is taken as a function, other words are taken as parameters, eval is dynamically executed, the parameters are segmented, and then data type conversion is carried out to obtain real parameters which are real and can be identified by a machine. Entering a function calling stage after the data type conversion, and sequentially judging the following conditions: is the function present? Is there a function to be executed preferentially? Is the function renamed? Is it directly executable with javascript or C #? If the function does not exist, it is performed with reference to the post-implementation embodiment described above. If the Java script or C # can not be directly executed, the execution is carried out through an interface or a socket, a database interface is connected, and the interface is fed back to the virtual reality interface, the augmented reality interface or the mixed reality interface according to the selection of the interfaces or sockets of different programming languages.
For multi-line codes, preprocessing is needed and the codes are executed integrally by javascript or C #. If the function can not be executed according to the whole, the function is divided by a line feed character or a stop character, and the function is executed line by line and finally fed back to an interface of AI virtual reality, augmented reality or mixed reality.
And outputting a return result by the interface of the virtual reality, the augmented reality or the mixed reality, entering a standby processing stage, executing other functional interfaces or generating a result by the VR virtual reality processing interface, the AR augmented reality processing interface, the MR mixed reality processing interface and the RR remote reality processing interface, and finishing the operation.
If the code has only one word, a single word function or an application or game corresponding to the word is executed.
The aforementioned embodiment can be referred to by the smart sharing of the broad-form, and the broad-form is connected to the database interface.
The foregoing is a more detailed description of the invention in connection with specific preferred embodiments and it is not intended that the invention be limited to these specific details. For those skilled in the art to which the invention pertains, several simple deductions or substitutions can be made without departing from the spirit of the invention, and all shall be considered as belonging to the protection scope of the invention.

Claims (7)

1. A hybrid programming method using natural language, comprising the steps of:
acquiring a natural language mixed text;
acquiring a function of a programming language according to a first minimum unit of each line of the natural language mixed text;
matching the parameters of the function according to the subsequent text of the minimum unit;
functions not implemented by the programming language are executed using different programming languages using protocol interfaces or socket calls; returning an execution result;
if the natural language mixed text is a single line; acquiring a corresponding function according to the first minimum unit of the first line, and uniformly taking the following texts as parameters; if the natural language mixed text has a plurality of lines, judging whether the first character of the first line and the first character of the following line are also function functions, and automatically selecting the execution sequence according to the logic relation of the whole context when the whole natural language mixed text comprises a plurality of function functions;
when the natural language mixed text is more than or equal to two lines and contains special symbols which cannot be used by the parameters, replacing the special symbols with descriptive characters as the parameters, and replacing the original special symbols when the function is executed;
if the first word of the first line represents pure natural language, the first words of other lines represent function functions; otherwise, the contents of other lines are used as mixed codes;
only one parameter is needed, and when the programming language is javascript; the data type of the parameter is a character string type; when the parameter is an integer type, a parseInt function conversion is used, and when the parameter is a floating point type, a parseFloat conversion is used; when the parameter is an object, function or array type, dynamic conversion is performed by eval; when the programming language is C #, converting by using an int.Parse () function, and when the parameter is a floating point type, converting by using a float.Parse ();
replacing the regular expression with a code of a target language according to different content types to realize cross-platform operation;
storing the natural language text into a field of a broad table; the field number of the broad table is fixed and unchanged, and the field name is fixed and unchanged; except the field representing the unique number of each record, the data format of other fields is a character string type; the field names are named by the words or words of the minimum unit, and the fields are set according to data content, data structures, data labels, data types, data interaction, data attributes and data ownership, and the total number of the fields is twenty-six.
2. The hybrid programming method using natural language according to claim 1, wherein a priority function is provided in the function, and the priority function is preferentially executed according to contents of the parameter when the function is executed.
3. The hybrid programming method using natural language according to claim 1, wherein when the input natural language hybrid text adopts a tabular character, the minimum unit is one word; when the input natural language mixed text adopts pinyin characters, the minimum unit is a word.
4. The hybrid programming method using natural language of claim 1, wherein when the natural hybrid text has only one word having a same name of the webapp or the virtual reality application and not belonging to the core function, the same name of the webapp or the virtual reality application is called.
5. The hybrid programming method using natural language according to claim 1, wherein when the function corresponding to the natural language hybrid text is renamed, the method is performed according to the following default priority: executing the function written by the user; executing a function written by an official party, executing a function written by a friend, and executing a function written by a stranger; if the configuration priority exists, judging according to the configuration priority; and if the same group also has the same function, executing according to the function specified in the configuration, otherwise executing according to the latest update.
6. The hybrid programming method using natural language according to claim 1, wherein different programming languages call a function or an application corresponding to the natural language hybrid text through a protocol interface or a socket to obtain a result or execute a function.
7. The hybrid programming method using natural language according to claim 1, wherein a result or an execution function is obtained by calling a function or an application corresponding to the natural language hybrid text through a social platform.
CN201610631212.9A 2016-08-04 2016-08-04 Mixed programming method using natural language Active CN106250159B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610631212.9A CN106250159B (en) 2016-08-04 2016-08-04 Mixed programming method using natural language

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610631212.9A CN106250159B (en) 2016-08-04 2016-08-04 Mixed programming method using natural language

Publications (2)

Publication Number Publication Date
CN106250159A CN106250159A (en) 2016-12-21
CN106250159B true CN106250159B (en) 2020-12-22

Family

ID=58077554

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610631212.9A Active CN106250159B (en) 2016-08-04 2016-08-04 Mixed programming method using natural language

Country Status (1)

Country Link
CN (1) CN106250159B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108255914B (en) * 2017-09-05 2022-04-22 深圳壹账通智能科技有限公司 Webpage generation method and application server
CN108628607B (en) * 2018-03-16 2021-10-26 广州市金度信息科技有限公司 Method, system and storage medium for assisting software development based on artificial intelligence
CN108681426B (en) * 2018-05-25 2020-08-11 第四范式(北京)技术有限公司 Method and system for performing feature processing on data
US11681873B2 (en) * 2019-09-11 2023-06-20 International Business Machines Corporation Creating an executable process from a text description written in a natural language
CN112068811B (en) * 2020-08-31 2022-09-23 北京知元创通信息技术有限公司 Software construction method for manufacturing engineering knowledge application
TWI822602B (en) * 2023-02-24 2023-11-11 呂英璋 Web page editing system and method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1889043A (en) * 2006-07-17 2007-01-03 大连大有吴涛易语言软件开发有限公司 Method for using human natural language in computer programing
CN102707948A (en) * 2012-04-26 2012-10-03 华亚微电子(上海)有限公司 Source code generation method
CN103645931A (en) * 2013-12-25 2014-03-19 盛杰 Method and device for code conversion
CN104992461A (en) * 2015-06-29 2015-10-21 北京奇虎科技有限公司 Fast animation scene construction method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7761858B2 (en) * 2004-04-23 2010-07-20 Microsoft Corporation Semantic programming language

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1889043A (en) * 2006-07-17 2007-01-03 大连大有吴涛易语言软件开发有限公司 Method for using human natural language in computer programing
CN102707948A (en) * 2012-04-26 2012-10-03 华亚微电子(上海)有限公司 Source code generation method
CN103645931A (en) * 2013-12-25 2014-03-19 盛杰 Method and device for code conversion
CN104992461A (en) * 2015-06-29 2015-10-21 北京奇虎科技有限公司 Fast animation scene construction method and device

Also Published As

Publication number Publication date
CN106250159A (en) 2016-12-21

Similar Documents

Publication Publication Date Title
CN106250159B (en) Mixed programming method using natural language
US11392755B2 (en) Methods and systems for cloud access
US9116706B2 (en) Yunten's web application methodology and web programming language (YWAM and WPL)
US8073857B2 (en) Semantics-based data transformation over a wire in mashups
US20200334740A1 (en) System and method for a hybrid conversational and graphical user interface
CN105956082A (en) Real-time data processing and storage system
CN106293727B (en) Data table-based intelligent sharing method
CN106293725B (en) Natural language hybrid programming method based on post-realization
US20210073254A1 (en) Search-based natural language intent determination
Bell et al. Microblogging as a mechanism for human–robot interaction
CN109840267B (en) Data ETL system and method
CN109063059B (en) Behavior log processing method and device and electronic equipment
US20230126821A1 (en) Systems, devices and methods for the dynamic generation of dialog-based interactive content
US11057320B2 (en) Operation for multiple chat bots operation in organization
Zosimov et al. Complex internet data management system
CN106250161A (en) A kind of natural language hybrid programming method based on tables of data
Machiraju et al. Natural language processing
Pritchard et al. Executing Practices
WO2020150009A1 (en) Profile data store automation via bots
Han et al. Study on the context awareness that the order search system in a distributed computing environment
CA3215791A1 (en) System and method for rendering a virtual model-based interaction
TWM548342U (en) System for conducting dialogues
TWI646528B (en) System for conducting dialogues
US20190278435A1 (en) Polymorphic smart context-aware lists
Sharma et al. Design & Development of Portfolio Website

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant