WO2023206267A1 - 调整自然语言语句的方法、装置及存储介质 - Google Patents

调整自然语言语句的方法、装置及存储介质 Download PDF

Info

Publication number
WO2023206267A1
WO2023206267A1 PCT/CN2022/090003 CN2022090003W WO2023206267A1 WO 2023206267 A1 WO2023206267 A1 WO 2023206267A1 CN 2022090003 W CN2022090003 W CN 2022090003W WO 2023206267 A1 WO2023206267 A1 WO 2023206267A1
Authority
WO
WIPO (PCT)
Prior art keywords
natural language
placeholder
sentence
preposition
predicate
Prior art date
Application number
PCT/CN2022/090003
Other languages
English (en)
French (fr)
Inventor
周振华
Original Assignee
西门子股份公司
西门子(中国)有限公司
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 西门子股份公司, 西门子(中国)有限公司 filed Critical 西门子股份公司
Priority to PCT/CN2022/090003 priority Critical patent/WO2023206267A1/zh
Publication of WO2023206267A1 publication Critical patent/WO2023206267A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis

Definitions

  • the embodiments of the present application relate to the technical field of natural language processing, and in particular, to a method, device and storage medium for adjusting natural language sentences.
  • adding a preposition to the natural language sentence includes: occupying the natural language sentence
  • the fourth sentence component of the complement placeholder in is determined to be the first complement in the natural language sentence, wherein the first complement is determined based on user input; before the first complement, a third preposition is added .
  • adding a preposition to the natural language sentence includes: occupying the natural language sentence
  • the fifth sentence component of the complement placeholder in is determined as the second complement in the natural language sentence, and the second complement is determined based on the output data of the business operation, wherein the business operation is based on occupying the
  • the predicate of the predicate placeholder in a natural language sentence is determined; before the second complement, a fourth preposition is added. It can be seen that prepositions can be added to complements determined based on the output data of business operations.
  • prepositions can be added to various types of adverbials, which is more in line with natural language habits.
  • the method further includes: moving the placeholder in the natural language sentence based on a user trigger instruction; determining the updated position of the placeholder in the natural language sentence; based on the placeholder The type attribute and the updated position of the placeholder in the natural language statement, and the preposition is updated in the natural language statement.
  • the method further includes: converting the natural language statement into a low-code representation describing the workflow; parsing the low-code representation to obtain the workflow represented in the form of a node link assembly; and assembling the node link.
  • the workflow represented by the form is compiled and downloaded to the runtime of the main controller of the corresponding work unit to execute the workflow.
  • an embodiment of the present invention provides a device for adjusting natural language sentences.
  • the device includes: a receiving module, configured to receive a natural language sentence containing a placeholder, the placeholder containing a type attribute, and the placeholder occupies sentence components matching the type attribute; a determining module, used to Determine the position of the placeholder in the natural language sentence; add a module for based on the type attribute of the placeholder and the position of the placeholder in the natural language sentence, in the natural language sentence Add prepositions to language sentences.
  • the adding module is configured to determine the first sentence component that occupies the subject placeholder in the natural language sentence as the subject in the natural language sentence; to determine the first sentence component that occupies the subject placeholder in the natural language sentence.
  • the second sentence component of the predicate placeholder in is determined to be the predicate in the natural language sentence;
  • the third sentence component occupying the object placeholder in the natural language sentence is determined to be the predicate in the natural language sentence.
  • the adding module is configured to determine the fourth sentence component occupying a complement placeholder in the natural language sentence as the first complement in the natural language sentence, wherein the first The complement is determined based on user input; before the first complement, a third preposition is added.
  • the natural language sentences are adapted to describe workflows that represent resources in units of work performing business operations.
  • an embodiment of the present invention provides a computer-readable medium, characterized in that computer-readable instructions are stored on the computer-readable medium, and when executed by a processor, the computer-readable instructions cause the The processor performs the steps in the method of adjusting a natural language statement as described in any one of the above.
  • embodiments of the present invention provide a computer program product that is tangibly stored on a computer-readable medium and includes computer-readable instructions that, when executed, cause at least one The processor performs the steps in the method of adjusting a natural language statement as described in any one of the above.
  • Figure 1 is an exemplary flow chart of a method for adjusting natural language sentences provided by an embodiment of the present application.
  • FIG. 2B is a schematic diagram of interaction based on a language element library provided by an embodiment of the present application.
  • FIG. 2E is an exemplary schematic diagram of automatically adjusting word order according to an embodiment of the present application.
  • FIG. 2F is an exemplary schematic diagram of the overall process of semantic editing according to the embodiment of the present application.
  • Figure 3 is an application scenario diagram of the method for adjusting natural language sentences provided by the embodiment of the present application in the field of industrial automation.
  • Figure 5 is an exemplary structural diagram of a device for adjusting natural language sentences provided by various embodiments of the present application.
  • the term "includes” and variations thereof represent an open term meaning “including, but not limited to.”
  • the term “based on” means “based at least in part on.”
  • the terms “one embodiment” and “an embodiment” mean “at least one embodiment.”
  • the term “another embodiment” means “at least one other embodiment”.
  • the terms “first”, “second”, etc. may refer to different or the same object. Other definitions may be included below, whether explicit or implicit. The definition of a term is consistent throughout this specification unless the context clearly dictates otherwise.
  • the embodiment of the present invention proposes a method for adjusting a natural language sentence, by automatically adding prepositions to the natural language sentence determined based on the placeholder filling operation, so as to improve the readability and accuracy of the natural language sentence.
  • the "preposition” is a vocabulary or affix used to express the grammatical function of a word in grammar. Generally used in front of pronouns or noun phrases, and combined with these words to form a preposition structure to express place, time, state, manner, reason, purpose, comparison object, etc.
  • prepositions can include: (1) expressing time and place: from, since, since, at, hit, to, in, when, towards, toward, along, along, with, etc.; (2), Expression methods: according to, according to, according to, according to, based on, through, through, based on, with, by, etc.; (3) Expression of purpose: for, for, for, etc.; (4), Expressing reasons: cause, due to, because, only, etc.; (5) Expressing objects, content: to, for, to, towards, with, with, with, giving, about, etc.; (6) Expressing exclusion : except, besides, remove, unless, etc.; (7), express passive: be, call, let, give, make, etc.; (8), express comparison: than, and, and, as, with, etc. etc.; (9) Indicates identity: as, etc.
  • Figure 1 is an exemplary flow chart of a method for adjusting natural language sentences provided by an embodiment of the present application. As shown in Figure 1, the method 100 includes:
  • Step 101 Receive or obtain a natural language sentence containing a placeholder, the placeholder contains a type attribute, and the placeholder occupies sentence components that match the type attribute.
  • Step 102 Determine the position of the placeholder in the natural language sentence.
  • Step 103 Add a preposition to the natural language statement based on the type attribute of the placeholder and the position of the placeholder in the natural language statement.
  • receiving or acquiring a natural language sentence containing a placeholder in step 101 may be receiving or acquiring, for example, a natural language sentence, a natural language sentence, or a chapter-level input through a natural language compilation tool.
  • natural language sentences Preferably, the natural language compilation tool can provide a manual interactive interface containing a variety of placeholders.
  • the natural language compilation tool receives user drag operations through a manual interactive interface to select placeholders corresponding to sentence components and move the placeholders to their positions in the natural language statement.
  • the natural language compilation tool can also select from the lexicon or directly provide user input via a human interactive interface to determine the corresponding sentence components occupying the placeholders.
  • receiving a natural language sentence containing a placeholder in step 101 may further include: receiving a natural language sentence containing a placeholder generated based on a deep learning algorithm from an artificial neural network.
  • step 103 specifically includes: determining the first sentence component occupying the subject placeholder in the natural language sentence as the subject in the natural language sentence; determining the first sentence component occupying the predicate placeholder in the natural language sentence.
  • the second sentence component is determined as the predicate in the natural language sentence; the third sentence component occupying the object placeholder in the natural language sentence is determined as the object in the natural language sentence.
  • the object When the object is between the subject and the predicate, add the first preposition corresponding to the active voice (for example, "put") between the object and the subject; when the object is before the subject and the predicate, add the first preposition corresponding to the active voice between the object and the subject.
  • the second preposition of passive voice for example, being).
  • step 103 specifically includes: determining the fourth sentence component occupying the complement placeholder in the natural language sentence as the first complement in the natural language sentence, where the first complement is determined based on user input; Before the first complement, add a third preposition (for example, from or to).
  • step 103 specifically includes: determining the fifth sentence component occupying the complement placeholder in the natural language sentence as the second complement in the natural language sentence, and the second complement is determined based on the output data of the business operation. , where the business operation is determined based on a predicate occupying a predicate placeholder in a natural language statement; before the second complement, a fourth preposition (e.g., from or to) is added.
  • a fourth preposition e.g., from or to
  • the third preposition is a preposition adapted to the starting object (for example, from); wherein, when the first complement is the ending object of the business operation, the third preposition is A preposition is a preposition that is suitable for the ending object (for example, to).
  • step 103 specifically includes: determining the sixth sentence component occupying the adverbial placeholder in the natural language sentence as the adverbial in the natural language sentence, and the adverbial is based on the input of the business operation. Data-determined, where the business operation is determined based on the predicate occupying the predicate placeholder in the natural language statement; before the adverbial, add a fifth preposition (for example, to).
  • a change instruction for changing the automatically generated preposition for example, a touch instruction for automatically generated prepositions in the interface
  • display the preposition library in response to the change instruction, so that the user can select the changed preposition to replace the automatically generated preposition, and Use this change to preposition replacement to automatically generate prepositions. It can be seen that prepositions can be automatically generated based on user instruction modifications, thereby further improving readability.
  • the method 100 further includes: moving the placeholder in the natural language sentence based on the user trigger instruction; determining the updated position of the placeholder in the natural language sentence; based on the placeholder The updated position of type attributes and placeholders in natural language sentences, and the update of prepositions in natural language sentences.
  • the method 100 further includes: adapting natural language sentences to describe one or more workflows, and the workflows represent resources in a work cell (Work cell) performing business operations.
  • the method 100 for adjusting natural language statements further includes: converting the natural language statements into a low-code representation describing the workflow; parsing the low-code representation to obtain a workflow represented in the form of a node link assembly; linking the nodes The workflow represented in assembly form is compiled and downloaded to the runtime of the main controller of the corresponding work unit to execute the workflow.
  • a method of using semantic language elements to describe a workflow such as an information technology (Information Technology) IT/operation technology (OT) process
  • semantics Language elements can be drawn from a predetermined library of phrases.
  • SOP semantic standardized operating program
  • the embodiments of the present invention expand the definition of semantic language elements and provide support for low-code necessary components such as behavior tree logic, semantic expressions, exceptions, key points, annotations, drawings, videos, and index tags.
  • the method of generating natural language statements describing the workflow includes:
  • the language element library contains several types of placeholders.
  • various types of placeholders are listed in the language element library on the human-computer interaction interface in the form of icons.
  • the placeholders contain respective type attributes, and each placeholder is adapted to be occupied by sentence components matching that type attribute.
  • the sentence components of modern Chinese usually include subject, predicate, object, verb, attributive, adverbial, complement, center, etc. Therefore, the Chinese language element library can include: subject placeholder, predicate placeholder, object placeholder, verb placeholder, attributive placeholder, adverbial placeholder, complement placeholder and head word placeholder. characters, etc.
  • the sentence components of an English sentence usually include subject, predicate, object, predicate, attributive, adverbial, complement and appositive.
  • the English language element library can include: subject placeholder, predicate placeholder, object placeholder, predicate placeholder, attributive placeholder, adverbial placeholder, complement placeholder and appositive Placeholders, etc.
  • similar placeholders can also be set according to language habits and grammar.
  • the user can first select the subject placeholder from the language element library through, for example, a human-computer interaction interface, and drag the subject placeholder to the natural language sentence editing interface to determine the subject placeholder.
  • Step 2 Determine the subject occupying the subject placeholder from the subject vocabulary associated with the subject placeholder, and the subject corresponds to the resource.
  • the processes of different work units The process is different.
  • these subjects may be, for example, a specific physical device, a person, or other virtualized noun resources.
  • the embodiments of the present invention can collectively refer to these physical equipment, personnel, virtualized noun resources, etc. as resources.
  • These resources usually refer to various operating entities that can execute workflows on site.
  • the resource that is the main body of the operation can be used as a common configuration parameter of the function block node, and the corresponding resource configuration can be performed on the required function block node when creating the behavior tree; or, when creating the function block node, it can be the function block node.
  • the block node is configured with resources as the main body of the operation, so that when creating a behavior tree, there is no need to configure resources for the required function block nodes. Or, in order to facilitate the management of resources, these resources can also be represented in the form of resource nodes, and these resource nodes can be stored in the form of resource knowledge graphs.
  • the resource knowledge graph includes: each resource node, and connections representing relationships between resource nodes.
  • the subject lexicon associated with the subject placeholder can be displayed in a new pop-up window of the natural language sentence editing interface, and the subject occupying the subject placeholder is determined from the subject lexicon based on the user's selection, that is, the subject in the work unit is determined H.
  • the subject vocabulary library can also be displayed in the natural language sentence editing interface through a drop-down menu.
  • the user can select the predicate placeholder from the language element library and drag the predicate placeholder to the natural language statement editing interface to determine the predicate placeholder.
  • the predicate placeholder can be dragged behind the subject placeholder or in front of the subject placeholder.
  • the predicate placeholder can be automatically adjusted to behind the subject placeholder to conform to language habits.
  • Step 4 Determine the predicate occupying the predicate placeholder from the predicate lexicon associated with the subject, and the predicate corresponds to the business operation of the resource.
  • the generated natural language statements indicate that resources perform business operations, and therefore can be converted into low-code representations that describe workflows. Therefore, the embodiment of the present invention is based on the operation of placeholders and lexicon, and can conveniently use semantic language elements to describe the workflow as natural language statements. People without programming knowledge can use natural language statements to conveniently describe the workflow. Reduces the difficulty of workflow implementation. Moreover, natural language statements can be converted into low-code representations that can be recognized by the underlying device, further enriching the way workflow is implemented.
  • the method of generating a natural language statement describing a workflow further includes: determining logical placeholders and semantic expression placeholders based on the tenth selection operation for the language element library; determining occupation from user input Logical keywords of the logical placeholders and semantic expressions occupying the semantic expression placeholders; determining logical execution branches based on the logical keywords and semantic expressions; determining natural language statements corresponding to each logical execution branch.
  • the logical keyword can be the logical keyword in conditional judgment (If-Then-Else), or it can be compound logic (such as Switch-Case-Default, Fallback or Guard), etc. Calculate the logical value corresponding to the semantic expression (usually true or false), and use the logic determined by the logical keyword to select the preset logical execution branch corresponding to the logical value.
  • the method of generating a natural language statement describing a workflow further includes: generating a label for the natural language statement based on the execution order of the natural language statement.
  • tags can be used to represent the sequence number of a natural language sentence.
  • labels can be displayed at the beginning or end of a natural language statement, etc., to identify the execution order of the natural language statement.
  • the method of generating a natural language statement describing a workflow further includes: determining key point placeholders based on a twelfth selection operation for the language element library; determining occupying key point placeholders from user input keypoint; where the low-code representation contains a control corresponding to the keypoint, where when the control is triggered, the next keypoint in the workflow of the keypoint is executed.
  • the embodiment of the present invention also expands the definition of semantic elements to provide support for low-code necessary components such as behavior tree logic, semantic expressions, exceptions, key points, annotations, drawings, videos, and indexes.
  • the method of generating a natural language statement describing a workflow further includes: receiving a change request for an occupied subject placeholder in the natural language statement; based on the change request, displaying the subject vocabulary, especially automatically display the subject lexicon; the user can thereby determine from the subject lexicon an updated subject occupying the subject placeholder, the updated subject corresponding to the updated resource; display (e.g., automatically) the predicate associated with the updated subject Lexicon; determine the updated predicate that updates occupy the predicate placeholder from the predicate lexicon associated with the updated subject (e.g., the user selects the updated predicate from the predicate lexicon associated with the updated subject), and the updated predicate corresponds to the update Business operations on post-resources; update (e.g., automatically update) a natural language statement based on the subject placeholder occupied by the update and the predicate placeholder occupied by the update.
  • the subject can be conveniently changed to change the resources in the
  • the method of generating a natural language statement describing a workflow further includes: receiving a change request for an occupied predicate placeholder in the natural language statement; based on the change request, displaying (for example, automatically displaying) The predicate lexicon associated with the subject; determine the updated predicate that occupies the predicate placeholder from the predicate lexicon (for example, the user selects the updated predicate from the predicate lexicon), and the updated predicate corresponds to the updated business operation of the resource;
  • the natural language statement is updated (eg, automatically updated) based on the occupied subject placeholders and the updated occupied predicate placeholders. It can be seen that in the embodiment of the present invention, the predicate can be conveniently changed to change the business operations in the workflow.
  • embodiments of the present application also provide a method for converting natural language sentences.
  • the natural language statement determined based on the above method can be converted into a Function Block Typed Diagram (FBTD). Conversion methods include:
  • Step 2 Determine a second mapping relationship between the predicate in the natural language statement and the function block name of the function block, where the predicate corresponds to the business operation of the resource.
  • Step 3 Based on the first mapping relationship and the second mapping relationship, convert the natural language statement into a function block, or convert the function block into a natural language statement, where the function block is presented in a function block type diagram, and the function block is adapted to describe the work Flow, workflow represents resources performing business operations.
  • FIG. 2A exemplarily shows an exemplary schematic diagram describing the workflow in the low-code architecture provided according to the embodiment of the present application in a no-code manner according to the embodiment of the present application.
  • this architecture all exchange artifacts use a standardized common runtime engineering exchange format whose metadata is easy to track and manage.
  • the universal runtime engineering exchange model 304 includes a low-code platform logic library 307 (for example, it can be a behavior tree logic library), resource library 308, function block library 309, custom vocabulary library 310, bill of materials (BOM) 311, General language expansion vocabulary library 312 and key point library 313.
  • Logic library 307 provides logic for occupying logical placeholders 405 , semantic expressions for occupying semantic expression placeholders 407 , and exception types for occupying exception placeholders 408 .
  • Keypoint library 313 provides keypoints for occupying keypoint placeholders 409.
  • Resource library 308 provides resources for occupying subject placeholder 401.
  • Function block library 309 provides business operations for occupying predicate placeholders 402 and provides input data for business operations occupying adverbial placeholders 403 .
  • the bill of materials 311 provides an object for occupying the object placeholder 404, an attributive for occupying the attributive placeholder 412, and a complement for occupying the complement placeholder 413.
  • Universal language expansion lexicon 312 provides prepositions that are automatically inserted into natural language sentences.
  • natural language sentences can be generated and edited. You can also use the code-free semantic SOP editor to generate SOPs in natural language. Moreover, the generated natural language statements (including SOP) can be converted into low-code behavior trees/FBTD305, in which function block nodes are presented in the form of label graphs in low-code behavior trees; in low-code FBTD, function block nodes are presented in the form of type graphs Function block nodes are presented in the form of .
  • the interpreter driver runtime 306 can be used to parse the behavior tree/FBTD 305 represented by the low code, obtain the workflow expressed in the form of node link assembly, and compile and download the workflow expressed in the form of node link assembly to the corresponding work unit on the runtime of the main controller to execute the workflow.
  • the behavior tree/FBTD305 can be stored in a Markup markup language such as Extensible Markup Language (XML), and can be verified by the XML Schema (XSD) prototype to verify that the XML format of the behavior tree/FBTD305 is correct.
  • XML Extensible Markup Language
  • XSD XML Schema
  • the embodiment of the present invention also proposes a natural language sentence conversion method, which can convert the natural language sentence determined based on the above method (for example, a natural language sentence generated without adding prepositions, or a natural language sentence that has added prepositions) Convert to FBTD.
  • the OT domain usually refers to operational technology (OT), which integrates hardware and software to detect or trigger changes in processes or events in an enterprise by directly monitoring and/or controlling physical equipment (called OT devices).
  • OT uses computers to monitor or change the physical status of industrial control systems (ICS).
  • industrial control systems are computer-based facilities, systems and equipment used to remotely monitor and/or control key industrial processes and realize physical functions.
  • ICS industrial control systems
  • OT is used to distinguish industrial control systems from traditional information technology (IT) systems in terms of technical implementation and functionality.
  • IT information technology
  • FIG. 2B is a schematic diagram of interaction based on a language element library provided by an embodiment of the present application.
  • the user drags any placeholder from the language element library 400 to the natural language sentence editing interface.
  • the user first drags in the subject placeholder 401, and a label 417 of the natural language sentence is automatically generated.
  • the subject lexicon 418 may be automatically displayed or displayed based on user triggering to facilitate the user to select the subject occupying the subject placeholder 401 from the subject lexicon 418 . Assume that the user selects "Robot 3", then "Robot 3" occupies the subject placeholder 401, and obtains the natural language sentence 419 after the subject is determined.
  • the user drags the predicate placeholder 402 from the language element library 400 to "Robot 3" in the natural language sentence 419 after determining the subject, and obtains the natural language sentence 420 after dragging the predicate placeholder.
  • the predicate thesaurus 421 associated with "Robot 3” ie, the business operations that "Robot 3” can perform
  • “Linear Movement” occupies the predicate placeholder 402, and obtains the natural language sentence 422 after determining the predicate: "Robot 3 moves linearly”.
  • the user can click "Robot 3" to display the subject vocabulary library 418 again, thereby facilitating the user to change the subject.
  • the user can click "Linear Move” to display the predicate dictionary 421 again, thereby facilitating the user to change the predicate.
  • FIG. 2C is a schematic diagram of the universal language word order template of the SOP provided by the embodiment of the present application.
  • the template 431 includes a plurality of natural language statements determined based on the interactive process shown in FIG. 2B , and each natural language statement has a label to distinguish the respective execution order. Natural language statements containing all execution sequences can be combined into a complete SOP.
  • label E1 represents exception handling. This exception handling is used to automatically handle exceptions during the execution of the natural language statement corresponding to tag 2.
  • the exception handling process includes the natural language statement labeled E1.1 and the natural language statement labeled E1.2.
  • Figure 2D is a schematic structural diagram of automatically generating prepositions according to an embodiment of the present application.
  • the language-specific grammar 436 determines to use a Chinese semantic vocabulary 437 containing Chinese prepositions (eg, when, from, to, f be, ba, for, in, with, to, by, etc.) or English prepositions (eg, from , in, at, for, on, into, by, when, etc.)) English semantic vocabulary 438.
  • the rule-based linking engine 432 parses the SOP template 431 .
  • the link engine 432 automatically analyzes placeholders at different positions in the SOP template 431 to automatically generate prepositions 433 included in the determined vocabulary (Chinese semantic vocabulary 437 or English semantic vocabulary 438).
  • the preposition 433 includes a preposition 434 and a postposition 435 .
  • a prepositional structure can be used to generate a preposition before the complement, such as "to the detection station”.
  • the linking engine 432 analyzes the adverbial
  • the interpositional structure may be used to generate a preposition before the adverbial, such as "with 450N torque".
  • a preposition-object structure may be used to generate a preposition before the object, such as "put the circuit board on”.
  • the link engine 432 analyzes the preposition of the object (for example, the user drags the object placeholder to the beginning of the sentence)
  • the object-preposition structure can be used to generate a preposition after the object, such as "circuit board quilt”.
  • Step 1 Execute subject placeholder drag-in processing 750. Among them: drag the subject placeholder 401 from the language element library to the natural language statement editing interface. Furthermore, a label 415 is generated at a fixed position (eg, at the beginning of a sentence).
  • Step 3 Execute determination predicate processing 752. Among them: display the predicate library associated with "Robot 1".
  • the predicate library associated with "Robot 1” contains all business operations that "Robot 1" can perform.
  • the user selects and drags the business operation occupying the predicate placeholder 402 from the predicate library associated with "Robot 1". For example, the predicate dragged out is: grab and place.
  • Step 4 Execute object placeholder dragging and first preposition generation processing 753.
  • the position of the object placeholder 404 may not be fixed.
  • a preposition related to the object is automatically generated.
  • the overall semantics corresponding to each preposition remains the same. For example, when the object placeholder 404 is located behind the subject and the predicate, no preposition is generated; when the object placeholder 404 is located between the subject and the predicate, the preposition "ba" is generated between the object placeholder 404 and the subject. ; When the object placeholder 404 is located before the subject, the preposition "being" is generated between the object placeholder 404 and the subject.
  • Step 5 Execute determination object processing 754.
  • the capture object can be determined to be the circuit board based on the bill of materials, and the circuit board can be determined as the object filling the object placeholder 404.
  • Step 6 Execute the process of dragging in the adverbial placeholder, determining the adverbial, and generating the second preposition 755.
  • the input data of the business operation or the user input can be used to determine the adverbial to fill the adverbial placeholder and generate the preposition related to the adverbial.
  • the input data of the business operation "grab and place” contains two parameters: speed and acceleration
  • specific values of speed and acceleration can be provided based on user input (assuming that the speed is 50m/s and the acceleration is 120m/s 2 )
  • the adverbial includes "50m/s speed” and "120m/s 2 acceleration”, and their respective prepositions "to” are generated before the adverbial.
  • Step 7 Execute the process of dragging in the complement placeholder, determining the complement and generating the second preposition 756.
  • output data from business operations or user input can be used to determine complements that populate complement placeholders and generate prepositions related to the complements.
  • the complement includes “inspection table” and “pallet A” , and generate the preposition "from” corresponding to the starting point object before “inspection table”, and generate the preposition "to” corresponding to the end point object before “pallet A”.
  • Step 8 Execute attributive placeholder dragging and attributive determination processing 757. Among them: drag one or more attributive placeholders from the language element library to the natural language sentence editing interface (usually dragging before the noun to qualify the noun). Furthermore, you can use a bill of materials or user input to determine the attributes that populate the attribute placeholders.
  • Step 9 Execute word order adjustment processing 758.
  • Figure 3 is an application scenario diagram of the method for adjusting natural language sentences provided by the embodiment of the present application in the field of industrial automation.
  • the low-code development tool 10 generates natural language sentences describing the OT domain workflow after the user selects, drags and fills the placeholders in the language element library. Moreover, the low-code development tool 10 automatically adds prepositions to the natural language statement based on the type attribute of the placeholder and the position of the placeholder in the natural language statement, thereby adjusting the natural language statement to facilitate user understanding.
  • the OT domain workflow defines the operations to be performed by the production line as a work unit as shown on the right side of Figure 3.
  • the low-code development tool 10 converts the natural language statement into a behavior tree corresponding to the OT domain workflow.
  • the behavior tree is published to the runtime 30 so that the runtime 30 can control and complete the production line operation of the work unit; at the same time, the corresponding microservice can be generated by the microservice generator 20 based on the behavior tree and registered in the knowledge center 200, so that the IT domain
  • the code development tool 301 can call the corresponding microservice through the knowledge center 200.
  • Users can select placeholders, drag placeholders, or enter content in the placeholders to edit natural language sentences in the GUI in the lower left corner of Figure 3.
  • the work unit here is a production line, which includes machines, conveyor belts, robotic arms, people, PLC, AGB, etc.
  • the code development tool 301 in the IT domain can also be located on the same hardware device as the low-code development tool 10, such as the same computer.
  • FIG 4 is an exemplary structural diagram of a device for adjusting natural language sentences provided by various embodiments of the present application.
  • the device 700 for adjusting natural language sentences includes: a receiving module 701 for receiving natural language sentences containing placeholders, where the placeholders contain type attributes, and the placeholders occupy sentence components that match the type attributes; a determining module 702 for To determine the position of the placeholder in the natural language sentence; the adding module 703 is used to add a preposition to the natural language sentence based on the type attribute of the placeholder and the position of the placeholder in the natural language sentence.
  • the adding module 703 is configured to determine the first sentence component occupying the subject placeholder in the natural language sentence as the subject in the natural language sentence; to determine the first sentence component occupying the predicate placeholder in the natural language sentence.
  • the second sentence component is determined as the predicate in the natural language statement;
  • the third sentence component that occupies the object placeholder in the natural language statement is determined as the object in the natural language statement; when the object is located between the subject and the predicate, Add the first preposition between the object and the subject; when the object is before the subject and the predicate, add the second preposition between the object and the subject.
  • the adding module 703 is configured to determine the fourth sentence component occupying the complement placeholder in the natural language sentence as the first complement in the natural language sentence, wherein the first complement is determined based on the user input ;Add a third preposition before the first complement.
  • the adding module 703 is configured to determine the fifth sentence component occupying the complement placeholder in the natural language sentence as the second complement in the natural language sentence, and the second complement is based on the output data of the business operation. Determined, where the business operation is determined based on a predicate occupying a predicate placeholder in a natural language statement; before the second complement, a fourth preposition is added.
  • the adding module 703 is configured to determine the sixth sentence component occupying the adverbial placeholder in the natural language sentence as the adverbial in the natural language sentence, and the adverbial is determined based on the input data of the business operation, wherein The business operation is determined based on the predicate occupying the predicate placeholder in the natural language statement; before the adverbial, a fifth preposition is added.
  • an update module 704 is also included, which is used to move the placeholder in the natural language sentence based on the user trigger instruction; determine the update position of the placeholder in the natural language sentence; and based on the type attribute and occupancy of the placeholder.
  • the position of the position symbol is updated in the natural language sentence, and the preposition is updated in the natural language sentence.
  • natural language sentences are adapted to describe workflows that represent resources in units of work performing business operations.
  • it also includes an execution module 705, which is used to convert natural language statements into low-code representations describing workflows; parse the low-code representations to obtain workflows represented in node link assembly form; convert the node link assembly form
  • the represented workflow is compiled and downloaded to the runtime of the corresponding work unit's main controller to execute the workflow.
  • FIG. 5 is an exemplary structural diagram of a device for adjusting natural language sentences with a memory-processor architecture provided by various embodiments of the present application.
  • the device 500 for adjusting natural language sentences includes: at least one memory 501 and at least one processor 502.
  • At least one processor 502 is configured to call a computer program stored in at least one memory 501 to execute the method of adjusting natural language sentences described in the embodiments of this application.
  • a system or device equipped with a storage medium may be provided, on which computer readable codes for implementing the functions of any one of the above embodiments are stored, and the computer (or CPU or MPU) reads and executes computer readable code stored in the storage medium.
  • the computer or CPU or MPU
  • some or all of the actual operations can also be completed by an operating system operating on the computer based on instructions based on computer readable codes.
  • the computer-readable code read from the storage medium can also be written into a memory provided in an expansion board inserted into the computer or into a memory provided in an expansion unit connected to the computer, and then the computer-readable code based on the computer-readable code can be written.
  • Examples of computer-readable media include but are not limited to floppy disks, CD-ROMs, magnetic disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW , DVD+RW), memory chips, ROM, RAM, ASICs, configured processors, all-optical media, all tape or other magnetic media, or any other media from which a computer processor can read instructions.
  • various other forms of computer-readable media may be used to send or carry instructions to a computer, including routers, private or public networks, or other wired and wireless transmission devices or channels, such as may be downloaded from a server computer or the cloud by a communications network Computer readable instructions.
  • Instructions can include code in any computer programming language, including C, C++, C++, Visual Basic, Java, and JavaScript.
  • the execution order of each step is not fixed and can be adjusted as needed.
  • the system structure described in the above embodiments may be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or may be implemented by multiple Some components in separate devices are implemented together.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

一种调整自然语言语句的方法(100)、装置及存储介质。方法(100)包括:步骤101:接收包含占位符的自然语言语句,占位符包含类型属性,占位符中占据有匹配类型属性的句子成分;步骤102:确定占位符在自然语言语句中的位置;步骤103:基于占位符的类型属性以及占位符在自然语言语句中的位置,在自然语言语句中添加介词。通过占位符在自然语言语句中自动添加介词,可以提高自然语言语句的可读性和准确度。另外,当自然语言语句中的词序发生调整时,介词相应自动更新,保证了语句的可读性和准确度。

Description

调整自然语言语句的方法、装置及存储介质 技术领域
本申请实施例涉及自然语言处理技术领域,尤其涉及一种调整自然语言语句的方法、装置及存储介质。
背景技术
自然语言生成(Natural Language Generation,NLG)是人工智能和计算语言学的分支,相应的语言生成系统是基于语言信息处理的计算机模型,其工作过程与自然语言分析相反,是从抽象的概念层次开始,通过选择并执行一定的语义和语法规则来生成文本。自然语言生成技术利用人工智能和语言学的方法来自动地生成可理解的自然语言文本。自然语言生成技术降低了人类和计算机之间沟通的难度,被广泛应用于机器新闻写作、聊天机器人、等领域,已经成为人工智能的研究热点之一。
目前,如何提高生成的自然语言语句的可读性和准确度,是尚待解决的技术问题。
发明内容
本申请实施例提供一种调整自然语言语句的方法、装置及存储介质。
第一方面,本发明实施方式提出一种调整自然语言语句的方法。该方法包括:
接收包含占位符的自然语言语句,所述占位符包含类型属性,所述占位符中占据有匹配所述类型属性的句子成分;
确定所述占位符在所述自然语言语句中的位置;
基于所述占位符的类型属性以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词。
因此,本发明实施方式通过占位符的类型属性以及占位符在自然语言语句中的位置,在自然语言语句中添加介词,可以提高自然语言语句的可读性和准确度。
在一个实施方式中,所述基于所述占位符的类型以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词包括:将占据所述自然语言语句中的主语占位符的第一句子成分,确定为所述自然语言语句中的主语;将占据所述自然语言语句中的谓语占位符的第二句子成分,确定为所述自然语言语句中的谓语;将占据所述自然语言语句中的宾语占位符的第三句子成分,确定为所述自然语言语句中的宾语;当所述宾语位于所述主语与谓 语之间时,在所述宾语与所述主语之间添加第一介词;当所述宾语位于所述主语与谓语之前时,在所述宾语与所述主语之间添加第二介词。可见,可以针对宾语位置添加不同类型的介词,更加符合自然语言习惯。
在一个实施方式中,所述基于所述占位符的类型以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词包括:将占据所述自然语言语句中的补语占位符的第四句子成分,确定为所述自然语言语句中的第一补语,其中所述第一补语是基于用户输入确定的;在所述第一补语之前,添加第三介词。可见,可以针对基于用户输入确定的补语添加介词。
在一个实施方式中,所述基于所述占位符的类型以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词包括:将占据所述自然语言语句中的补语占位符的第五句子成分,确定为所述自然语言语句中的第二补语,所述第二补语是基于业务操作的输出数据确定的,其中所述业务操作是基于占据所述自然语言语句中的谓语占位符的谓语确定的;在所述第二补语之前,添加第四介词。可见,可以针对基于业务操作的输出数据确定的补语添加介词。
在一个实施方式中,所述基于所述占位符的类型以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词包括:将占据所述自然语言语句中的状语占位符的第六句子成分,确定为所述自然语言语句中的状语,所述状语是基于业务操作的输入数据确定的,其中所述业务操作是基于占据所述自然语言语句中的谓语占位符的谓语确定的;在所述状语之前,添加第五介词。
可见,可以针对多种类型的状语添加介词,更加符合自然语言习惯。
在一个实施方式中,还包括:基于用户触发指令,在所述自然语言语句中移动所述占位符;确定所述占位符在所述自然语言语句中的更新位置;基于所述占位符的类型属性以及所述占位符在所述自然语言语句中的更新位置,在所述自然语言语句中更新介词。
可见,当自然语言语句的占位符发送移动时,介词获得更新,从而保证了语句的可读性和准确度。
在一个实施方式中,所述自然语言语句适配于描述工作流,所述工作流表征工作单元中的资源执行业务操作。
因此,可以针对描述工作流的自然语言语句添加介词,从而提高工作流的执行效率。
在一个实施方式中,还包括:将所述自然语言语句转换为描述所述工作流的低代码表示;解析所述低代码表示,得到以节点链接汇编形式表示的工作流;将该节点链接汇编形式表示的工作流编译并下载到对应的工作单元的主控制器的运行时上,以执行所述工作流。
因此,将描述工作流的自然语言语句转换为可以执行工作流的低代码表示,提高了工作流处理效率。
第二方面,本发明实施方式提出一种调整自然语言语句的装置。该装置包括:接收模块,用于接收包含占位符的自然语言语句,所述占位符包含类型属性,所述占位符中占据有匹配所述类型属性的句子成分;确定模块,用于确定所述占位符在所述自然语言语句中的位置;添加模块,用于基于所述占位符的类型属性以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词。
在一个实施方式中,所述添加模块,用于将占据所述自然语言语句中的主语占位符的第一句子成分,确定为所述自然语言语句中的主语;将占据所述自然语言语句中的谓语占位符的第二句子成分,确定为所述自然语言语句中的谓语;将占据所述自然语言语句中的宾语占位符的第三句子成分,确定为所述自然语言语句中的宾语;当所述宾语位于所述主语与谓语之间时,在所述宾语与所述主语之间添加第一介词;当所述宾语位于所述主语与谓语之前时,在所述宾语与所述主语之间添加第二介词。
在一个实施方式中,所述添加模块,用于将占据所述自然语言语句中的补语占位符的第四句子成分,确定为所述自然语言语句中的第一补语,其中所述第一补语是基于用户输入确定的;在所述第一补语之前,添加第三介词。
在一个实施方式中,所述添加模块,用于将占据所述自然语言语句中的补语占位符的第五句子成分,确定为所述自然语言语句中的第二补语,所述第二补语是基于业务操作的输出数据确定的,其中所述业务操作是基于占据所述自然语言语句中的谓语占位符的谓语确定的;在所述第二补语之前,添加第四介词。
在一个实施方式中,所述添加模块,用于将占据所述自然语言语句中的状语占位符的第六句子成分,确定为所述自然语言语句中的状语,所述状语是基于业务操作的输入数据确定的,其中所述业务操作是基于占据所述自然语言语句中的谓语占位符的谓语确定的;在所述状语之前,添加第五介词。
在一个实施方式中,还包括更新模块,用于基于用户触发指令,在所述自然语言语句中移动所述占位符;确定所述占位符在所述自然语言语句中的更新位置;基于所述占位符的类型属性以及所述占位符在所述自然语言语句中的更新位置,在所述自然语言语句中更新介词。
在一个实施方式中,所述自然语言语句适配于描述工作流,所述工作流表征工作单元中的资源执行业务操作。
在一个实施方式中,还包括执行模块,用于将所述自然语言语句转换为描述所述工作流的低代码表示;解析所述低代码表示,得到以节点链接汇编形式表示的工作流;将该节点 链接汇编形式表示的工作流编译并下载到对应的工作单元的主控制器的运行时上,以执行所述工作流。
第三方面,本发明实施方式提出一种调整自然语言语句的装置,包括:至少一个存储器,被配置为存储计算机可读代码;至少一个处理器,被配置为调用所述计算机可读代码,执行如上任一种所述的调整自然语言语句的方法中的步骤。
第四方面,本发明实施方式提出一种计算机可读介质,其特征在于,所述计算机可读介质上存储有计算机可读指令,所述计算机可读指令在被处理器执行时,使所述处理器执行如上任一种所述的调整自然语言语句的方法中的步骤。
第五方面,本发明实施方式提出一种计算机程序产品,所述计算机程序产品被有形地存储在计算机可读介质上并且包括计算机可读指令,所述计算机可读指令在被执行时使至少一个处理器执行如上任一种所述的调整自然语言语句的方法中的步骤。
附图说明
图1为本申请实施例提供的调整自然语言语句的方法的示范性流程图。
图2A示例性地显示了依据本申请实施例的无代码方式,在依据本申请实施例提供的低代码架构中对工作流进行描述的示范性示意图。
图2B为本申请实施例提供的基于语言元素库的交互示意图。
图2C为本申请实施例提供的标准化作业程序(SOP)的通用语言词序模板示意图。
图2D为本申请实施例自动调整词序位置的架构示意图。
图2E为本申请实施例自动调整词序的示范性示意图。
图2F为本申请实施例的语义编辑整体过程的示范性示意图。
图3为本申请实施例提供的调整自然语言语句的方法,在工业自动化领域的应用场景图。
图4为本申请各实施例提供的调整自然语言语句的装置的示范性结构图。
图5为本申请各实施例提供的调整自然语言语句的装置的示范性结构图。
其中,附图标记如下:
Figure PCTCN2022090003-appb-000001
Figure PCTCN2022090003-appb-000002
Figure PCTCN2022090003-appb-000003
Figure PCTCN2022090003-appb-000004
具体实施方式
现在将参考示例实施方式讨论本文描述的主题。应该理解,讨论这些实施方式只是为了使得本领域技术人员能够更好地理解从而实现本文描述的主题,并非是对权利要求书中所阐述的保护范围、适用性或者示例的限制。可以在不脱离本申请实施例内容的保护范围的情况下,对所讨论的元素的功能和排列进行改变。各个示例可以根据需要,省略、替代或者添加各种过程或组件。例如,所描述的方法可以按照与所描述的顺序不同的顺序来执行,以及各个步骤可以被添加、省略或者组合。另外,相对一些示例所描述的特征在其它例子中也可以进行组合。
如本文中使用的,术语“包括”及其变型表示开放的术语,含义是“包括但不限于”。术语“基于”表示“至少部分地基于”。术语“一个实施例”和“一实施例”表示“至少一个实施例”。术语“另一个实施例”表示“至少一个其他实施例”。术语“第一”、“第二”等可以指代不同的或相同的对象。下面可以包括其他的定义,无论是明确的还是隐含的。除非上下文中明确地指明,否则一个术语的定义在整个说明书中是一致的。
目前,已经出现采用机器学习或深度学习等人工智能方式生成自然语言语句的处理方式。申请人发现:人工智能生成方式需要占用大量的计算资源,而且操作复杂度高,经常不适用于对计算资源和操作复杂度敏感的应用场景(比如工业现场)。另外,如何在不显著占用计算资源的前提下,保证自然语言语句的可读性和准确度,也是一项难题。
本发明实施方式提出了一种调整自然语言语句的方法,通过在基于占位符填充操作确定出的自然语言语句中自动添加介词,以提高自然语言语句的可读性和准确度。
其中,此处的“介词”在语法里是用来表现一个字的文法功能的词汇或字缀。一般用在代词或名词性质的短语前面,和这些词合起来组成介词结构,以表示处所、时间、状态、方式、原因、目的、比较对象等的词。
比如,介词可以包括:(1)表示时间,处所:从、自、自从、于、打、往、在、当、朝、 向、顺着、沿着、随着,等等;(2)、表示方式:按、照、按照、依、依照、本着、经过、通过、根据、以、凭,等等;(3)、表示目的:为、为了、为着,等等;(4)、表示原因:因、由于、因为、只有,等等;(5)、表示对象,内容:对、对于、把、向、跟、与、同、给、关于,等等;(6)、表示排除:除、除了、除去、除非,等等;(7)、表示被动:被、叫、让、给、使,等等;(8)、表示比较:比、和、与、如同、同,等等;(9)表示身份:作为,等。
图1为本申请实施例提供的调整自然语言语句的方法的示范性流程图。如图1所示,该方法100包括:
步骤101:接收或者获取包含占位符的自然语言语句,占位符包含类型属性,占位符中占据有匹配类型属性的句子成分。
步骤102:确定占位符在自然语言语句中的位置。
步骤103:基于占位符的类型属性以及占位符在自然语言语句中的位置,在自然语言语句中添加介词。
其中,在一个实施方式中,步骤101中的接收或者获取包含占位符的自然语言语句,可以是接收或者获取例如通过一个自然语言编译工具输入的一个自然语言语句、一段自然语言语句或者篇章级的自然语言语句。优选地,该自然语言编译工具可以提供包含多种占位符的人工交互界面。自然语言编译工具经由人工交互界面接收用户拖拽操作,以选定对应于句子成分的占位符和移动占位符在自然语言语句中的位置。而且,自然语言编译工具还可以经由人工交互界面从词库中选择或直接提供用户输入,以确定占据占位符的相应句子成分。
在一个实施方式中,步骤101中的接收包含占位符的自然语言语句还可以包括:从人工神经网络接收基于深度学习算法所生成的、包含占位符的自然语言语句。
以上示范性描述了接收包含占位符的自然语言语句的具体实施方式,本领域技术人员可以意识到,这种描述仅是示范性的,并不用于限定本发明实施方式的保护范围。
在一个实施方式中,步骤103具体包括:将占据自然语言语句中的主语占位符的第一句子成分,确定为自然语言语句中的主语;将占据自然语言语句中的谓语占位符的第二句子成分,确定为自然语言语句中的谓语;将占据自然语言语句中的宾语占位符的第三句子成分,确定为自然语言语句中的宾语。
当宾语位于主语与谓语之间时,在宾语与主语之间添加对应于主动语态的第一介词(比如,把);当宾语位于主语与谓语之前时,在宾语与主语之间添加对应于被动语态的第二介词(比如,被)。
在一个实施方式中,步骤103具体包括:将占据自然语言语句中的补语占位符的第四句子成分,确定为自然语言语句中的第一补语,其中第一补语是基于用户输入确定的;在第一 补语之前,添加第三介词(比如,从或到)。
在一个实施方式中,步骤103具体包括:将占据自然语言语句中的补语占位符的第五句子成分,确定为自然语言语句中的第二补语,第二补语是基于业务操作的输出数据确定的,其中业务操作是基于占据自然语言语句中的谓语占位符的谓语确定的;在第二补语之前,添加第四介词(比如,从或到)。
其中,当于第一补语是业务操作的起始对象时,第三介词为适配于起始对象的介词(比如,从);其中,当第一补语是业务操作的结束对象时,第三介词为适配于结束对象的介词(比如,到)。
在一个实施方式中,在一个实施方式中,步骤103具体包括:将占据自然语言语句中的状语占位符的第六句子成分,确定为自然语言语句中的状语,状语是基于业务操作的输入数据确定的,其中业务操作是基于占据自然语言语句中的谓语占位符的谓语确定的;在状语之前,添加第五介词(比如,以)。
优选地,接收用于变更自动生成介词的变更指令(比如,针对界面中的自动生成介词的触摸指令),响应于该变更指令展示介词库,以由用户选择替换自动生成介词的变更介词,并利用该变更介词替换自动生成介词。可见,能够基于用户指令修改自动生成介词,从而进一步提高可读性。
在一个实施方式中,在一个实施方式中,该方法100还包括:基于用户触发指令,在自然语言语句中移动占位符;确定占位符在自然语言语句中的更新位置;基于占位符的类型属性以及占位符在自然语言语句中的更新位置,在自然语言语句中更新介词。
在一个实施方式中,该方法100还包括:自然语言语句适配于描述一个或多个工作流,工作流表征工作单元(Work cell)中的资源执行业务操作。在一个实施方式中,调整自然语言语句的方法100还包括:将自然语言语句转换为描述工作流的低代码表示;解析低代码表示,得到以节点链接汇编形式表示的工作流;将该节点链接汇编形式表示的工作流编译并下载到对应的工作单元的主控制器的运行时上,以执行工作流。
在本发明实施方式中,还提供了一种使用语义语言元素将工作流(比如信息技术(Information Technology)IT/操作技术(Operation Technology,OT)的过程)描述为自然语言语句的方法,这些语义语言元素可以来自于预定的措辞库。利用本发明实施方式的自然语言语句生成方法,能够为低代码平台输入语义标准化作业程序(SOP)或更通用的本地语言,并最终在运行时执行对应的低代码工作流。相应地,本发明实施方式扩展了语义语言元素的定义,为行为树逻辑、语义表达式、异常、关键点、注释、附图、视频和索引标记等低代码必要组件提供了支持。因此,语义无代码和低代码(比如:功能块类型图(FBTD)和物联网 行为树)之间的双向转换成为可能。本申请实施例提供了一种生成描述工作流的自然语言语句的方法。可以针对本申请实施例提出的、生成描述工作流的自然语言语句,应用图1所示的调整自然语言语句方法进行调整。
具体地,生成描述工作流的自然语言语句的方法包括:
步骤1:基于针对语言元素库的第一选择操作,确定主语占位符。
在这里,语言元素库中包含多种类型的占位符。比如,多种类型的占位符以图标的形式,被列举在人机交互界面上的语言元素库中。占位符分别包含各自的类型属性,每个占位符适配于被匹配该类型属性的句子成分所占据。
比如,现代汉语的句子成分通常包括主语、谓语、宾语、动语、定语、状语、补语和中心语,等等。因此,汉语的语言元素库中可以包含:主语占位符、谓语占位符、宾语占位符、动语占位符、定语占位符、状语占位符,补语占位符和中心语占位符,等等。类似地,英语句子的句子成分通常包括主语、谓语、宾语、表语、定语、状语、补语和同位语。相应地,英语的语言元素库中可以包含:主语占位符、谓语占位符、宾语占位符、表语占位符、定语占位符、状语占位符、补语占位符和同位语占位符,等等。针对其他的语种或者本地语言,也可以根据语言习惯和语法设置类似的占位符。
在具体应用时,用户可以通过例如一个人机交互界面从语言元素库中首先选定主语占位符,并将主语占位符拖动到自然语言语句编辑界面中,从而确定主语占位符。
步骤2:从关联主语占位符的主语词库中确定占据主语占位符的主语,主语对应于资源。
比如,资源可以为依据本发明的工作单元中的资源,也可以是其他类型的低代码平台中的资源库中的资源。其中:工作单元可以为能够实现一个相对完整和独立的控制流程和操作的系统或设备等资源的组合。以工作单元为基本单位进行工作流创建,更符合工业控制的特点,可提高开发的集成度,并降低开发的复杂度。例如,以工业技术领域为例,工作单元可以根据实际的工业场景定义。比如:可以定义一个工序对应一个工作单元,或者也可以定义工序中的一个工站为一个工作单元,又或者也可以定义工站中的一个工位对应一个工作单元等,不同的工作单元的工艺流程不同。
考虑到业务操作可能由不同的主体执行,这些主体例如可以是具体的某个物理设备,也可以是某个人员,还可能是其它的虚拟化名词资源。为描述方便,本发明实施方式可以将这些物理设备、人员、虚拟化名词资源等统称为资源,这些资源通常指现场能够执行工作流的各操作主体。具体实现时,可将作为操作主体的资源作为功能块节点的一个普通配置参数,在创建行为树时对所需的功能块节点进行相应的资源配置;或者,在创建功能块节点时就为功能块节点配置好作为操作主体的资源,这样创建行为树时便无需再对所需的功能块节点进 行资源配置。又或者,为了方便对资源的管理,这些资源也可以资源节点的形式表示,且这些资源节点可以资源知识图谱的形式进行存储。所述资源知识图谱包括:各个资源节点,以及表示资源节点间关系的连线。
在这里,可以在自然语言语句编辑界面的新弹开窗口中展示关联主语占位符的主语词库,并基于用户选择从主语词库中确定占据主语占位符的主语,即确定工作单元中的资源。可选地,还可以通过下拉菜单方式,在自然语言语句编辑界面中展示主语词库
步骤3:基于针对语言元素库的第二选择操作,确定谓语占位符。
类似地,用户可以从语言元素库中选定谓语占位符,并将谓语占位符拖动到自然语言语句编辑界面中,从而确定谓语占位符。其中,基于用户的拖拽位置不同,谓语占位符可以被拖拽到主语占位符的后面,也可以被拖拽到主语占位符的前面。当谓语占位符被拖拽到主语占位符的前面时,可以自动将谓语占位符调整到主语占位符的后面,以符合语言习惯。
步骤4:从关联主语的谓语词库中确定占据谓语占位符的谓语,谓语对应于资源的业务操作。
在这里,可以在自然语言语句编辑界面的新弹开窗口中展示关联主语的谓语词库,并基于用户选择从谓语词库中确定占据谓语占位符的谓语,即确定资源能够执行的业务操作。可选地,还可以通过自然语言语句编辑界面中的下拉菜单方式展示谓语词库。
步骤5:基于被占据的主语占位符和被占据的谓语占位符,生成自然语言语句,其中自然语言语句适配于被转换为描述工作流的低代码表示,其中工作流表征资源执行业务操作。
优选地,在生成的自然语言语句中,各种类型的占位符不具有可视效果,仅在占位符的相应位置处展示占据占位符的句子成分。
可见,生成的自然语言语句中指示了资源执行业务操作,因此能够被转换为描述工作流的低代码表示。因此,本发明实施方式基于针对占位符和词库的操作,可以便利地使用语义语言元素将工作流描述为自然语言语句,不具备编程知识的人员可以利用自然语言语句便利地描述工作流,降低了工作流的实现难度。而且,自然语言语句可以被转换为底层设备能够识别的低代码表示,进一步丰富了工作流的实现方式。
在一个实施方式中,该生成描述工作流的自然语言语句的方法还包括下列中的至少一个:(1)、基于针对语言元素库的第三选择操作,确定宾语占位符;从关联业务操作的物料清单中确定占据宾语占位符的宾语,其中宾语作为业务操作的执行目标;(2)、基于针对语言元素库的第四选择操作,确定状语占位符;基于业务操作的输入数据,确定占据状语占位符的状语;(3)、基于针对语言元素库的第五选择操作,确定补语占位符;从关联业务操作的物料清单中确定占据补语占位符的补语,其中补语作为业务操作的补充描述;(4)、基于针对语言元 素库的第六选择操作,确定定语占位符;从用户输入或关联业务操作的物料清单中确定占据定语占位符的定语,其中定语作为主语或宾语的限定描述;(5)、基于针对语言元素库的第七选择操作,确定注释占位符;从用户输入中确定占据注释占位符的注释;(6)、基于针对语言元素库的第八选择操作,确定附图占位符;从用户输入中确定占据附图占位符的附图;(7)、基于针对语言元素库的第九选择操作,确定视频占位符;从用户输入中确定占据视频占位符的视频。
在一个实施方式中,该生成描述工作流的自然语言语句的方法还包括:基于针对语言元素库的第十选择操作,确定逻辑占位符和语义表达式占位符;从用户输入中确定占据逻辑占位符的逻辑关键字以及占据语义表达式占位符的语义表达式;基于逻辑关键字和语义表达式确定逻辑执行分支;确定对应于每个逻辑执行分支的自然语言语句。比如,逻辑关键字可以为是否条件判断中的逻辑关键字(If-Then-Else),也可以是复合逻辑(比如Switch-Case-Default、Fallback或Guard)等。计算出语义表达式对应的逻辑值(通常为真或假),并利用逻辑关键字确定的逻辑,选择预先设定的、对应于逻辑值的逻辑执行分支。
在一个实施方式中,该生成描述工作流的自然语言语句的方法还包括:基于自然语言语句的执行顺序,生成自然语言语句的标签。在本发明实施方式中,标签可以用于表征自然语言语句的顺序序号。比如,标签可以展示在自然语言语句的句首或句尾,等等,以用于标识该自然语言语句的执行顺序。
在一个实施方式中,该生成描述工作流的自然语言语句的方法还包括:基于针对语言元素库的第十一选择操作,确定异常占位符;从用户输入中确定对应于异常占位符的标签;从对应于异常占位符的异常库中选择异常类型;确定在标签的自然语言语句的执行过程中发生异常类型时的异常执行分支;确定对应于异常执行分支的自然语言语句。比如,异常类型包括过热和过压。相应的,异常执行分支包括发生过热时的异常处理过程以及发生过压的异常处理过程。
在一个实施方式中,该生成描述工作流的自然语言语句的方法还包括:基于针对语言元素库的第十二选择操作,确定关键点占位符;从用户输入中确定占据关键点占位符的关键点;其中低代码表示包含对应于关键点的控件,其中当控件被触发时,执行关键点在工作流中的下一个关键点。
因此,本发明实施方式还扩展了语义元素的定义,为行为树逻辑、语义表达式、异常、关键点、注释、附图、视频和索引等低代码必要组件提供支持。
在一个实施方式中,该生成描述工作流的自然语言语句的方法还包括:接收针对自然语言语句中、被占据的主语占位符的变更请求;基于变更请求,展示主语词库,特别是自动地 展示该主语词库;用户可以就此从主语词库中确定更新占据主语占位符的更新后主语,更新后主语对应于更新后资源;展示(比如,自动地展示)关联更新后主语的谓语词库;从关联更新后主语的谓语词库中确定更新占据谓语占位符的更新后谓语(比如,用户从关联更新后主语的谓语词库中选择更新后谓语),更新后谓语对应于更新后资源的业务操作;基于被更新占据的主语占位符和被更新占据的谓语占位符,更新(比如,自动地更新)自然语言语句。可见,本发明实施方式中,可以便利地变更主语以改变工作流中的资源。
在一个实施方式中,该生成描述工作流的自然语言语句的方法还包括:接收针对自然语言语句中、被占据的谓语占位符的变更请求;基于变更请求,展示(比如,自动地展示)关联主语的谓语词库;从谓语词库中确定更新占据谓语占位符的更新后谓语(比如,用户从谓语词库中选择更新后谓语),更新后谓语对应于资源的更新后业务操作;基于被占据的主语占位符和被更新占据的谓语占位符,更新(比如,自动地更新)自然语言语句。可见,本发明实施方式中,可以便利地变更谓语以改变工作流中的业务操作。
另外,本申请实施例还提供自然语言语句的转换方法。可以将基于上述方式确定的自然语言语句转换为功能块类型图(Function Block Typed Diagram,FBTD)。转换方法包括:
步骤1:确定自然语言语句中的主语与功能块的功能块头之间的第一映射关系,其中主语对应于工作单元中的资源。
步骤2:确定自然语言语句中的谓语与功能块的功能块名称之间的第二映射关系,其中谓语对应于资源的业务操作。
步骤3:基于第一映射关系和第二映射关系,将自然语言语句转换为功能块,或将功能块转换为自然语言语句,其中功能块以功能块类型图呈现,功能块适配于描述工作流,工作流表征资源执行业务操作。
下面以低代码架构中的自然语言语句为例,对本发明实施方式的调整自然语言语句的过程进行示范性说明。
图2A示例性地显示了依据本申请实施例的无代码方式,在依据本申请实施例提供的低代码架构中对工作流进行描述的示范性示意图。在该架构中,所有交换工件均采用标准化的通用运行时工程交换格式,通用运行时工程交换格式的元数据易于跟踪和管理。
通用运行时工程交换模型304包含一个低代码平台的逻辑库307(例如其可以是一个行为树逻辑库)、资源库308、功能块库309、自定义词库310、物料清单(BOM)311、通用语言扩展词库312和关键点库313。逻辑库307提供用于占据逻辑占位符405的逻辑、用于占据语义表达式占位符407的语义表达式以及用于占据异常占位占位符408的异常类型。关键点库313提供用于占据关键点占位符409的关键点。资源库308提供用于占据主语占位符401 的资源。功能块库309提供用于占据谓语占位符402的业务操作,以及提供用于占据状语占位符403的业务操作的输入数据。物料清单311提供用于占据宾语占位符404的宾语、用于占据定语占位符412的定语以及用于占据补语占位符413的补语。通用语言扩展词库312提供自动被插入到自然语言语句中的介词。
通过本申请实施方式的、实施上述生成和调整自然语言语句的方法的无代码通用语言编辑器302,可以生成和编辑自然语言语句。还可以利用无代码语义SOP编辑器生成自然语言形式的SOP。而且,生成的自然语言语句(包括SOP)可以被转换为低代码的行为树/FBTD305,其中低代码的行为树中,以标签图的形式呈现功能块节点;低代码的FBTD中,以类型图的形式呈现功能块节点。然后,可以利用解释器驱动运行时306解析低代码表示的行为树/FBTD305,得到以节点链接汇编形式表示的工作流,并将该节点链接汇编形式表示的工作流编译并下载到对应的工作单元的主控制器的运行时上,以执行工作流。比如,行为树/FBTD305可以Markup标记语言例如可扩展标记语言(XML)来存储,并且可被XML Schema(XSD)原型来校验,以验证该行为树/FBTD305的XML格式是正确的。解释器驱动运行时306对行为树/FBTD305进行解析后,可得到以节点链接汇编的形式表示的工作流,之后将该工作流编译并下载到对应的工作单元的主控制器的运行时上,以执行工作流。本发明实施方式还提出了一种自然语言语句的转换方法,可以将基于上述方式确定的自然语言语句(比如,生成而没有被添加介词的自然语言语句,或已被添加介词的自然语言语句)转换为FBTD。该方法包括:步骤(1):确定自然语言语句中的主语与功能块的功能块头之间的第一映射关系,其中主语对应于资源;步骤(2):确定自然语言语句中的谓语与功能块的功能块名称之间的第二映射关系,其中谓语对应于资源的业务操作;步骤(3):基于第一映射关系和第二映射关系,将自然语言语句转换为功能块,或将功能块转换为自然语言语句,其中功能块以功能块类型图呈现,功能块适配于描述工作流,工作流表征资源执行业务操作。可见,在转换过程中,无视介词的存在。
以上示范性描述了自然语言语句转换为FBTD的具体过程,本领域技术人员可以意识到,这仅是示范性的,并不用于限定本发明实施方式的保护范围。而且,将自然语言语句转换为FBTD后,还可以将FBTD再转换为行为树,本发明实施方式对此并无限定。
OT域通常指运营技术(Operational Technology,OT),其集合了硬件和软件,通过直接地监视和/或控制物理设备(称为OT设备),检测或触发企业中过程的变化或发生的事件。OT利用计算机监视或改变诸如工业控制系统(Industrial Control System,ICS)的物理状态。其中,工业控制系统是基于计算机实现的设施、系统和设备,用于远程监视和/或控制关键的工业过程,实现物理功能。“OT”这个词的叫法用于将工业控制系统和传统的信息技术 (Information Technology,IT)系统在技术实现和功能上加以区分。目前,市场上存在诸多IT低代码开发工具或平台。其中,部分工具针对物联网的使用场景,面向有经验的IT工程师,而OT工程师和初级IT工程师则难以理解其范式。而部分工具更适用于IT域低代码开发的使用场景,不能很好地适用于OT域。本实施例中的上述描述工作流的自然语言语句生成方法可以用于OT域,作为一种OT域无代码开发方法。相应地,工作流可以为OT域工作流;工作单元可以为OT域内的工作单元;OT设备可包括但不限于:物联网(Internet of Things,IoT)设备、可编程逻辑控制器(Programmable Logic Controller,PLC)、机器人(Robotics)、人工过程(Manual Process)、工控机(Industrial Personal Computer,IPC)等。
另外,本申请实施例中,考虑到目前IT域、OT域融合在企业数字化转型过程中变得日趋重要。为了将IT域、OT域融合为ITOT系统,目前一个亟待解决的问题是企业如何采用易于理解、而不是IT域编程的方式来收集OT域的数据并控制OT域过程。因此,本实施例中的上述描述工作流的自然语言语句生成方法,还可以用于ITOT系统,作为一种可与IT域融合的OT域无代码开发方法。
图2B为本申请实施例提供的基于语言元素库的交互示意图。
在图2B中,展示语言元素库400。语言元素库400中包含主语占位符401、谓语占位符402、状语占位符403、宾语占位符404、逻辑占位符405、注释占位符406、语义表达式占位符407、异常占位符408、关键点占位符409、附图占位符410、视频占位符411、定语占位符412和补语占位符413。交互过程还包含自动生成标签处理415和自动生成介词处理416。自动生成介词处理416可以为自然语言语句生成介词,以提高可读性。自动生成标签处理415为基于自然语言语句的执行顺序,为自然语言语句自动生成标签417,在本实施例中,该标签417为序号标签。
用户从语言元素库400中拖动任意占位符到自然语言语句编辑界面中。如图2B所示,用户首先拖入主语占位符401,并自动生成自然语言语句的标签417。此时,可以自动展示或基于用户触发展示主语词库418,以方便用户从主语词库418中选择占据主语占位符401的主语。假定用户选中了“机器人3”,则“机器人3”占据主语占位符401,得到确定主语后的自然语言语句419。然后,用户将谓语占位符402从语言元素库400中拖入到确定主语后的自然语言语句419中的、“机器人3”之后,得到拖入谓语占位符后的自然语言语句420。展示关联“机器人3”的谓语词库421(即“机器人3”可以执行的业务操作),以由用户从谓语词库421中选择占据谓语占位符402的谓语。假定用户选中“线性移动”,则“线性移动”占据谓语占位符402,得到确定谓语后的自然语言语句422:“机器人3线性移动”。
此时,用户可以点击“机器人3”以再次展示主语词库418,从而便于用户更改主语。相 应地,用户可以点击“线性移动”以再次展示谓语词库421,从而便于用户更改谓语。
可以基于本发明实施方式建立SOP的通用语言词序模板。图2C为本申请实施例提供的SOP的通用语言词序模板示意图。该模板431包括基于图2B所示的交互过程确定的多个自然语言语句,每个自然语言语句都具有标签以区分各自的执行顺序。包含全部执行顺序的自然语言语句,可以组合为完整的SOP。在图2C中,标签E1表示异常处理。该异常处理用于对标签2所对应的自然语言语句的执行过程中的异常,自动执行处理。异常处理过程包含标签为E1.1的自然语言语句和标签为E1.2的自然语言语句。
图2D为本申请实施例自动生成介词的架构示意图。在图2D中,以SOP模板431为例描述自动生成介词的过程。语言特定语法436确定采用包含中文介词(比如,当、从、到、f被、把、为、在、用、对、由,等等)的中文语义词库437或包含英文介词(比如,from、in、at、for、on、into、by、when,等等))的英文语义词库438。基于规则的链接引擎432对SOP模板431进行解析。链接引擎432自动分析SOP模板431中不同位置处的占位符,以自动生成包含在被确定的词库(中文语义词库437或英文语义词库438)中的介词433。介词433包括前置介词434和后轴介词435。其中,当链接引擎432分析出补语时,可以采用介补结构,以在补语之前生成介词,比如“到检测台”。当链接引擎432分析出状语时,可以采用介状结构,以在状语之前生成介词,比如“以450N扭矩”。当链接引擎432分析出宾语时,可以采用介宾结构,以在宾语之前生成介词,比如“将电路板”。当链接引擎432分析出宾语前置(比如,用户将宾语占位符拖动到句首)时,可以采用宾介结构,以在宾语之后生成介词,比如“电路板被”。
图2E为本申请实施例自动生成介词的示范性示意图。在图2E中,对于第一个标签为1.1的自然语言语句,通过占位符的占据操作可以得到:“员工力矩扳手450扭矩拧紧螺丝电路板”。通过分析占位符的类型和位置,可以在“员工”和“力矩扳手”之间自动生成介词“用”、“力矩扳手”和“450扭矩”之间自动生成介词“以”、“螺丝”和“电路板”之间自动生成介词“到”。用户可以基于个人习惯移动占位符,以改变占位符的位置。相应地,基于占位符的更新位置更新介词。在图2E中,标签为1.1的四个自然语言语句具有相同的含义,可以被转换为相同的低代码表示。在特定情况下,可以执行补语转换为主语的处理450。在补语转换为主语的处理450中,当完成自动化升级时,补语可以转换为主语。例如,当机器人取代人类时,末端执行器(例如,力矩扳手可以在没有人类帮助的情况下执行动作),因此力矩扳手将作为控制器本身的主体,从而称为主语。此时,删除原始的主语(“员工1”)以及该被转换为主语的补语之前的介词(即“用”)。
图2F为本申请实施例的语义编辑整体过程的示范性示意图。语义编辑整体过程包括:
第一步:执行主语占位符拖入处理750。其中:从语言元素库中拖拽主语占位符401到自然语言语句编辑界面。而且,在固定位置处(比如,句首)生成标签415。
第二步:执行确定主语及谓语占位符拖入处理751。其中:展示包含各个资源的主语库,以供用户从主语库中选择并拖拽出占据主语占位符401的主语(资源)。比如,从包含大量资源的主语库中拖拽出作为主语的“机器人1”。接着,从语言元素库中拖拽出谓语占位符402(通常拖拽到主语的后面)。
第三步:执行确定谓语处理752。其中:展示关联于“机器人1”的谓语库,关联于“机器人1”的谓语库中包含“机器人1”能够执行的全部业务操作。用户从关联于“机器人1”的谓语库中,选择并拖拽出占据谓语占位符402的业务操作。比如,拖拽出的谓语为:抓取并放置。
第四步:执行宾语占位符拖入及第一介词生成处理753。其中:从语言元素库中拖拽出宾语占位符404到自然语言语句编辑界面中。基于用户的拖拽操作,宾语占位符404的位置可以并不固定。而且,取决于宾语占位符404的位置,自动生成与宾语相关的介词。此时,对应于各个介词的整体语义保持相同。比如,当宾语占位符404位于主语和谓语的后面时,不生成介词;当宾语占位符404位于主语和谓语之间时,在宾语占位符404与主语之间,生成介词“把”;当宾语占位符404位于主语之前时,在宾语占位符404与主语之间,生成介词“被”。
第五步:执行确定宾语处理754。其中:可以基于物料清单确定抓取对象为电路板,将电路板确定为填充宾语占位符404的宾语。
第六步:执行状语占位符拖入、确定状语及第二介词生成处理755。其中:从语言元素库中拖拽出一或多个状语占位符到自然语言语句编辑界面中。而且,可以利用业务操作的输入数据或用户输入确定填充状语占位符的状语,并生成与状语相关的介词。比如,假定业务操作“抓取并放置”的输入数据包含速度和加速度这两个参数,可以基于用户输入提供速度和加速度的具体值(假定速度为50m/s,加斯度为120m/s 2),则状语包括“50m/s速度”和“120m/s 2加速度”,并分别在状语之前生成各自的介词“以”。
第七步:执行补语占位符拖入、确定补语及第二介词生成处理756。其中:从语言元素库中拖拽出一或多个补语占位符到自然语言语句编辑界面中(比如,句尾)。而且,可以利用业务操作的输出数据或用户输入确定填充补语占位符的补语,并生成与补语相关的介词。比如,假定用户输入中包含作为业务操作(比如“抓取并放置”)的起始点对象的“检测台”以及结束点对象的“托盘A”,则补语包括“检测台”和“托盘A”,并在“检测台”之前生成 对应于起始点对象的介词“从”,在“托盘A”之前生成对应于结束点对象的介词“到”。
第八步:执行定语占位符拖入及定语确定处理757。其中:从语言元素库中拖拽出一或多个定语占位符到自然语言语句编辑界面中(通常拖拽到名词之前以限定名词)。而且,可以利用物料清单或用户输入确定填充定语占位符的定语。
第九步:执行语序调整处理758。此时,可以拖动各个占位符,并基于更新后的占位符位置调整自动生成的介词。比如,当宾语被前置以形成被动语态时,通过添加介词“被”使得句子更加通顺。
图3为本申请实施例提供的调整自然语言语句的方法,在工业自动化领域的应用场景图。
在图3中,低代码开发工具10在用户针对语言元素库中的占位符的选择操作、占位符的拖拽操作以及填充操作后,生成描述OT域工作流的自然语言语句。而且,低代码开发工具10基于占位符的类型属性以及占位符在自然语言语句中的位置,在自然语言语句中自动添加介词,从而调整自然语言语句,以便于用户理解。OT域工作流定义如图3右侧所示的作为一个工作单元的生产线要执行的操作。低代码开发工具10将该自然语言语句转换为对应OT域工作流的行为树。行为树发布到运行时30,以便由运行时30控制完成工作单元的生产线操作;同时可基于该行为树由微服务生成器20生成对应的微服务并注册到知识中台200,这样IT域的代码开发工具301便可通过知识中台200调用对应的微服务。
用户可在如图3左下角GUI中选择占位符、拖拽占位符或在占位符中输入内容以编辑自然语言语句。比如:首先通过知识中台200从数据库&服务器处获取所需的数据(比如:工件加工参数),控制整个工作单元的运行。这里的工作单元为一个生产线,生产线上包括机器、传送带、机械臂、人、PLC、AGB等。具体实现时,IT域的代码开发工具301也可和低代码开发工具10位于同一硬件设备上,例如同一台电脑上。
以上以工业自动化领域为例,对调整自然语言语句的应用场景进行示范性描述。本领域技术人员可以意识到,此处描述仅是示范性的,并不用于限定本发明实施方式的保护范围。
图4为本申请各实施例提供的调整自然语言语句的装置的示范性结构图。调整自然语言语句的装置700包括:接收模块701,用于接收包含占位符的自然语言语句,占位符包含类型属性,占位符中占据有匹配类型属性的句子成分;确定模块702,用于确定占位符在自然语言语句中的位置;添加模块703,用于基于占位符的类型属性以及占位符在自然语言语句中的位置,在自然语言语句中添加介词。
在一个实施方式中,添加模块703,用于将占据自然语言语句中的主语占位符的第一句子成分,确定为自然语言语句中的主语;将占据自然语言语句中的谓语占位符的第二句子成分,确定为自然语言语句中的谓语;将占据自然语言语句中的宾语占位符的第三句子成分, 确定为自然语言语句中的宾语;当宾语位于主语与谓语之间时,在宾语与主语之间添加第一介词;当宾语位于主语与谓语之前时,在宾语与主语之间添加第二介词。
在一个实施方式中,添加模块703,用于将占据自然语言语句中的补语占位符的第四句子成分,确定为自然语言语句中的第一补语,其中第一补语是基于用户输入确定的;在第一补语之前,添加第三介词。
在一个实施方式中,添加模块703,用于将占据自然语言语句中的补语占位符的第五句子成分,确定为自然语言语句中的第二补语,第二补语是基于业务操作的输出数据确定的,其中业务操作是基于占据自然语言语句中的谓语占位符的谓语确定的;在第二补语之前,添加第四介词。
在一个实施方式中,添加模块703,用于将占据自然语言语句中的状语占位符的第六句子成分,确定为自然语言语句中的状语,状语是基于业务操作的输入数据确定的,其中业务操作是基于占据自然语言语句中的谓语占位符的谓语确定的;在状语之前,添加第五介词。
在一个实施方式中,还包括更新模块704,用于基于用户触发指令,在自然语言语句中移动占位符;确定占位符在自然语言语句中的更新位置;基于占位符的类型属性以及占位符在自然语言语句中的更新位置,在自然语言语句中更新介词。
在一个实施方式中,自然语言语句适配于描述工作流,工作流表征工作单元中的资源执行业务操作。在一个实施方式中,还包括执行模块705,用于将自然语言语句转换为描述工作流的低代码表示;解析低代码表示,得到以节点链接汇编形式表示的工作流;将该节点链接汇编形式表示的工作流编译并下载到对应的工作单元的主控制器的运行时上,以执行工作流。
图5为本申请各实施例提供的具有存储器-处理器架构的、调整自然语言语句的装置的示范性结构图。调整自然语言语句的装置500包括:至少一个存储器501和至少一个处理器502。至少一个处理器502用于调用至少一个存储器501中存储的计算机程序,执行本申请实施例中所述的调整自然语言语句的方法。
具体地,可以提供配有存储介质的系统或者装置,在该存储介质上存储着实现上述实施例中任一实施方式的功能的计算机可读代码,且使该系统或者装置的计算机(或CPU或MPU)读出并执行存储在存储介质中的计算机可读代码。此外,还可以通过基于计算机可读代码的指令使计算机上操作的操作系统等来完成部分或者全部的实际操作。还可以将从存储介质读出的计算机可读代码写到插入计算机内的扩展板中所设置的存储器中或者写到与计算机相连接的扩展单元中设置的存储器中,随后基于计算机可读代码的指令使安装在扩展板或者扩展单元上的CPU等来执行部分和全部实际操作,从而实现上述实施方式中任一实施方式的功能。 本实施例中,计算机可读介质的实施例包括但不限于软盘、CD-ROM、磁盘、光盘(如CD-ROM、CD-R、CD-RW、DVD-ROM、DVD-RAM、DVD-RW、DVD+RW)、存储器芯片、ROM、RAM、ASIC、配置的处理器、全光介质、所有磁带或其他磁性介质,或计算机处理器可以从中读取指令的任何其他介质。此外,各种其它形式的计算机可读介质可以向计算机发送或携带指令,包括路由器、专用或公用网络、或其它有线和无线传输设备或信道,例如可以由通信网络从服务器计算机上或云上下载计算机可读指令。指令可以包括任何计算机编程语言的代码,包括C、C++、C语言、Visual Basic、java和JavaScript。
需要说明的是,上述各流程和各系统结构图中不是所有的步骤和模块都是必须的,可以根据实际的需要忽略某些步骤或模块。各步骤的执行顺序不是固定的,可以根据需要进行调整。上述各实施例中描述的系统结构可以是物理结构,也可以是逻辑结构,即,有些模块可能由同一物理实体实现,或者,有些模块可能分由多个物理实体实现,或者,可以由多个独立设备中的某些部件共同实现。
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (19)

  1. 调整自然语言语句的方法(100),其特征在于,包括:
    接收或获取包含占位符的自然语言语句,所述占位符包含类型属性,所述占位符中占据有匹配所述类型属性的句子成分(101);
    确定所述占位符在所述自然语言语句中的位置(102);
    基于所述占位符的类型属性以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词(103)。
  2. 根据权利要求1所述的调整自然语言语句的方法(100),其特征在于,
    所述基于所述占位符的类型以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词(103)包括:
    将占据所述自然语言语句中的主语占位符的第一句子成分,确定为所述自然语言语句中的主语;
    将占据所述自然语言语句中的谓语占位符的第二句子成分,确定为所述自然语言语句中的谓语;
    将占据所述自然语言语句中的宾语占位符的第三句子成分,确定为所述自然语言语句中的宾语;
    当所述宾语位于所述主语与谓语之间时,在所述宾语与所述主语之间添加第一介词;
    当所述宾语位于所述主语与谓语之前时,在所述宾语与所述主语之间添加第二介词。
  3. 根据权利要求1或2所述的调整自然语言语句的方法(100),其特征在于,
    所述基于所述占位符的类型以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词(103)包括:
    将占据所述自然语言语句中的补语占位符的第四句子成分,确定为所述自然语言语句中的第一补语,其中所述第一补语是基于用户输入确定的;
    在所述第一补语之前,添加第三介词。
  4. 根据权利要求1至3中任意一项所述的调整自然语言语句的方法(100),其特征在于,
    所述基于所述占位符的类型以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词(103)包括:
    将占据所述自然语言语句中的补语占位符的第五句子成分,确定为所述自然语言语句中的第二补语,所述第二补语是基于业务操作的输出数据确定的,其中所述业务操作是基于占据所述自然语言语句中的谓语占位符的谓语确定的;
    在所述第二补语之前,添加第四介词。
  5. 根据权利要求1至3中任意一项所述的调整自然语言语句的方法(100),其特征在于,
    所述基于所述占位符的类型以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词(103)包括:
    将占据所述自然语言语句中的状语占位符的第六句子成分,确定为所述自然语言语句中的状语,所述状语是基于业务操作的输入数据确定的,其中所述业务操作是基于占据所述自然语言语句中的谓语占位符的谓语确定的;
    在所述状语之前,添加第五介词。
  6. 根据权利要求1-5中任一项所述的调整自然语言语句的方法(100),其特征在于,还包括:
    基于用户触发指令,在所述自然语言语句中移动所述占位符;
    确定所述占位符在所述自然语言语句中的更新位置;
    基于所述占位符的类型属性以及所述占位符在所述自然语言语句中的更新位置,在所述自然语言语句中更新介词。
  7. 根据权利要求1-6中任一项所述的调整自然语言语句的方法(100),其特征在于,所述自然语言语句适配于描述工作流,所述工作流表征工作单元中的资源执行业务操作。
  8. 根据权利要求7所述的调整自然语言语句的方法(100),其特征在于,还包括:
    将所述自然语言语句转换为描述所述工作流的低代码表示;
    解析所述低代码表示,得到以节点链接汇编形式表示的工作流;
    将该节点链接汇编形式表示的工作流编译并下载到对应的工作单元的主控制器的运行时上,以执行所述工作流。
  9. 调整自然语言语句的装置(700),其特征在于,包括:
    接收模块(701),用于接收包含占位符的自然语言语句,所述占位符包含类型属性,所述占位符中占据有匹配所述类型属性的句子成分;
    确定模块(702),用于确定所述占位符在所述自然语言语句中的位置;
    添加模块(703),用于基于所述占位符的类型属性以及所述占位符在所述自然语言语句中的位置,在所述自然语言语句中添加介词。
  10. 根据权利要求9所述的调整自然语言语句的装置(700),其特征在于,
    所述添加模块(703),用于将占据所述自然语言语句中的主语占位符的第一句子成分,确定为所述自然语言语句中的主语;将占据所述自然语言语句中的谓语占位符的第二句子成分,确定为所述自然语言语句中的谓语;将占据所述自然语言语句中的宾语占位符的第三句子成分,确定为所述自然语言语句中的宾语;当所述宾语位于所述主语与谓语之间时,在所述宾语与所述主语之间添加第一介词;当所述宾语位于所述主语与谓语之前时,在所述宾语 与所述主语之间添加第二介词。
  11. 根据权利要求9或10所述的调整自然语言语句的装置(700),其特征在于,
    所述添加模块(703),用于将占据所述自然语言语句中的补语占位符的第四句子成分,确定为所述自然语言语句中的第一补语,其中所述第一补语是基于用户输入确定的;在所述第一补语之前,添加第三介词。
  12. 根据权利要求9至11中任意一项所述的调整自然语言语句的装置(700),其特征在于,
    所述添加模块(703),用于将占据所述自然语言语句中的补语占位符的第五句子成分,确定为所述自然语言语句中的第二补语,所述第二补语是基于业务操作的输出数据确定的,其中所述业务操作是基于占据所述自然语言语句中的谓语占位符的谓语确定的;在所述第二补语之前,添加第四介词。
  13. 根据权利要求9至12中任意一项所述的调整自然语言语句的装置(700),其特征在于,
    所述添加模块(703),用于将占据所述自然语言语句中的状语占位符的第六句子成分,确定为所述自然语言语句中的状语,所述状语是基于业务操作的输入数据确定的,其中所述业务操作是基于占据所述自然语言语句中的谓语占位符的谓语确定的;在所述状语之前,添加第五介词。
  14. 根据权利要求9-13中任一项所述的调整自然语言语句的装置(700),其特征在于,还包括:
    更新模块(704),用于基于用户触发指令,在所述自然语言语句中移动所述占位符;确定所述占位符在所述自然语言语句中的更新位置;基于所述占位符的类型属性以及所述占位符在所述自然语言语句中的更新位置,在所述自然语言语句中更新介词。
  15. 根据权利要求9-14中任一项所述的调整自然语言语句的装置(700),其特征在于,
    所述自然语言语句适配于描述工作流,所述工作流表征工作单元中的资源执行业务操作。
  16. 根据权利要求15所述的调整自然语言语句的装置(700),其特征在于,还包括:
    执行模块(705),用于将所述自然语言语句转换为描述所述工作流的低代码表示;解析所述低代码表示,得到以节点链接汇编形式表示的工作流;将该节点链接汇编形式表示的工作流编译并下载到对应的工作单元的主控制器的运行时上,以执行所述工作流。
  17. 一种调整自然语言语句的装置(500),其特征在于,包括:
    至少一个存储器(501),被配置为存储计算机可读代码;
    至少一个处理器(502),被配置为调用所述计算机可读代码,执行如权利要求1~8任一 项所述的调整自然语言语句的方法(100)的步骤。
  18. 一种计算机可读介质,其特征在于,所述计算机可读介质上存储有计算机可读指令,所述计算机可读指令在被处理器执行时,使所述处理器执行如权利要求1~8任一项所述的调整自然语言语句的方法(100)的步骤。
  19. 一种计算机程序产品,其特征在于,所述计算机程序产品被有形地存储在计算机可读介质上并且包括计算机可读指令,所述计算机可读指令在被执行时使至少一个处理器执行如权利要求1~8任一项所述的调整自然语言语句的方法(100)的步骤。
PCT/CN2022/090003 2022-04-28 2022-04-28 调整自然语言语句的方法、装置及存储介质 WO2023206267A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/090003 WO2023206267A1 (zh) 2022-04-28 2022-04-28 调整自然语言语句的方法、装置及存储介质

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/090003 WO2023206267A1 (zh) 2022-04-28 2022-04-28 调整自然语言语句的方法、装置及存储介质

Publications (1)

Publication Number Publication Date
WO2023206267A1 true WO2023206267A1 (zh) 2023-11-02

Family

ID=88516848

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/090003 WO2023206267A1 (zh) 2022-04-28 2022-04-28 调整自然语言语句的方法、装置及存储介质

Country Status (1)

Country Link
WO (1) WO2023206267A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060178868A1 (en) * 2005-01-14 2006-08-10 Classified Ventures Methods and systems for generating natural language descriptions from data
CN101930428A (zh) * 2009-06-18 2010-12-29 万继华 计算机理解自然语言的系统及方法
US20180113850A1 (en) * 2016-10-25 2018-04-26 Hewlett Packard Enterprise Development Lp Workflow generation from natural language statements
CN108021547A (zh) * 2016-11-04 2018-05-11 株式会社理光 一种自然语言的生成方法、自然语言生成装置及电子设备
CN109933772A (zh) * 2017-12-15 2019-06-25 Tcl集团股份有限公司 语义分析方法及终端设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060178868A1 (en) * 2005-01-14 2006-08-10 Classified Ventures Methods and systems for generating natural language descriptions from data
CN101930428A (zh) * 2009-06-18 2010-12-29 万继华 计算机理解自然语言的系统及方法
US20180113850A1 (en) * 2016-10-25 2018-04-26 Hewlett Packard Enterprise Development Lp Workflow generation from natural language statements
CN108021547A (zh) * 2016-11-04 2018-05-11 株式会社理光 一种自然语言的生成方法、自然语言生成装置及电子设备
CN109933772A (zh) * 2017-12-15 2019-06-25 Tcl集团股份有限公司 语义分析方法及终端设备

Similar Documents

Publication Publication Date Title
US11238232B2 (en) Written-modality prosody subsystem in a natural language understanding (NLU) framework
US20220350965A1 (en) Method for generating pre-trained language model, electronic device and storage medium
US5321608A (en) Method and system for processing natural language
Friedrich et al. Process model generation from natural language text
US5966686A (en) Method and system for computing semantic logical forms from syntax trees
CN113220836B (zh) 序列标注模型的训练方法、装置、电子设备和存储介质
US8762131B1 (en) Systems and methods for managing a complex lexicon comprising multiword expressions and multiword inflection templates
US10922614B2 (en) Converting procedural text to an actionable knowledge form
US20220414463A1 (en) Automated troubleshooter
CN111656453A (zh) 用于信息提取的层次实体识别和语义建模框架
CN112069206B (zh) 基于rpa及ai的数据查询方法、装置、介质及计算设备
CN113553411B (zh) 查询语句的生成方法、装置、电子设备和存储介质
CN111695325A (zh) 用于自然语言处理的基于解析树的向量化
Zheng et al. Dynamic prompt-based virtual assistant framework for BIM information search
CN112582073B (zh) 医疗信息获取方法、装置、电子设备和介质
CN112269884B (zh) 信息抽取方法、装置、设备及存储介质
CN108932225A (zh) 用于将自然语言需求转换成为语义建模语言语句的方法和系统
CN110442877B (zh) 使用机器人规划作为平行语言语料库
CN111831624A (zh) 数据表创建方法、装置、计算机设备及存储介质
WO2023206267A1 (zh) 调整自然语言语句的方法、装置及存储介质
US20230111052A1 (en) Self-learning annotations to generate rules to be utilized by rule-based system
WO2023206261A1 (zh) 生成描述工作流的自然语言语句的方法、装置及存储介质
CN111898762B (zh) 深度学习模型目录创建
US7657422B2 (en) System and method for text analysis
CN114201957A (zh) 文本情感分析方法、装置及计算机可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22939118

Country of ref document: EP

Kind code of ref document: A1