Data configuration method, electronic device and storage medium
Through the intention and entity recognition model of natural language text, the premium calculation rules in the insurance business system are identified and configured, and the problems of complex configuration and high threshold in the existing technology are solved, and the effect of simplifying configuration and reducing costs is achieved.
Patent Information
- Application Number
- CN202311453911.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2043-11-02
AI Technical Summary
In the insurance business system, the premium calculation and configuration process is complex, and the hard-coded method is easy to affect the system stability. The configuration of Groovy DSL scripts is cumbersome and has high thresholds, resulting in increased maintenance costs and user understanding costs.
By obtaining the user's natural language text, using the trained intent and entity recognition model to identify the intent elements and entity elements in the premium calculation rules, match the preset component template and fill the entity elements, generate the target configuration item, and encapsulate it as Interface allows users to configure premium calculation rules only by entering natural language text.
It reduces the user's learning costs and the maintenance costs of calculation rules, simplifies the premium calculation and configuration process, and improves the ease of use and efficiency of configuration.
Smart Images

Figure CN117522592B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent terminals, and in particular to a data configuration method, an electronic device and a computer-readable storage medium. Background Art
[0002] In the process of digitalization in the insurance field, premium calculation can be realized by connecting the premium calculation engine of the insurance business system through the partner system. However, the current method of realizing premium calculation configuration in the process of inter-system access is relatively complicated and time-consuming.
[0003] For example, the premium calculation rules can be hard-coded into the insurance business system through Java or Python. However, if the formula hard-coded is coupled with the code of the insurance business system, the stability of the original code of the insurance business system will be easily affected if the formula is changed. For another example, the premium calculation rules can be configured through Groovy DSL scripts, but the configuration process is relatively cumbersome and requires certain professional expertise from business personnel. The entry threshold is high and difficult to get started. The above methods will complicate the premium calculation and configuration process, increase maintenance costs and user understanding costs. Summary of the invention
[0004] The embodiments of the present application provide a data configuration method, an electronic device, and a computer-readable storage medium. By acquiring the user's natural language text, the intent elements and entity elements related to the premium calculation rules in the natural language text are identified using the trained intent and entity recognition model, and then based on the intent elements, a target component template that matches the intent is matched from a preset component template library, and the entity elements are filled into the target component template to obtain a target configuration item, and the target configuration item is encapsulated as a target interface. As a result, the user who designs the calculation rules only needs to input the natural language text, and the intent and entity recognition model can be called to identify the premium calculation rules corresponding to the natural text, and the premium calculation rules can be configured as a target interface. Users who use the insurance business system to calculate premiums only need to call the interface to calculate the premium amount using the premium calculation rules configured by the interface.
[0005] In a first aspect, an embodiment of the present application provides a data configuration method, which is applied to a first electronic device, and the method includes: obtaining a text to be processed input by a user through a first interface, and calling a first interface of a first model of a second electronic device based on the text to be processed, wherein the text to be processed is a natural language text, and the first model is used for intent recognition and entity recognition; obtaining a first recognition result from the second electronic device based on the first interface, wherein the first recognition result includes an intent recognition result and an entity recognition result; generating a component script based on the first recognition result, wherein the component script is used to characterize the intent, entity, and parameters of the entity of the text to be processed; drawing a target configuration item on the first interface according to the component script, converting the component script into a calculation rule script, and storing it.
[0006] That is, the first electronic device can be a terminal for designing an interface, or it can provide an interface for designing an interface for the user. The second electronic device can be a server. The text to be processed input by the user is obtained through the interface, and the trained intent and entity recognition model in the second electronic device is called to identify the intent, entity and entity value in the natural language text, and a component script is generated according to the first recognition result containing the intent, entity and entity value, and then the icon corresponding to the instantiated calculation rule (such as a calculation formula) is drawn on the first interface according to the component script, that is, the target configuration item that can be used to characterize the calculation rule. Then, the calculation rule script can be determined according to the calculation formula corresponding to the drawn target configuration item, and then it is convenient to call the calculation rule script to calculate the premium when the premium calculation is required. Thereby, the user who designs the calculation rule only needs to input the natural language text, and the intent and entity recognition model can be called to identify the premium calculation rule corresponding to the natural text.
[0007] In a possible implementation of the first aspect above, the first recognition result includes a first element, a second element, and a value of the second element, wherein the first element is used to represent the intent, and the second element is used to represent an entity in the text to be processed.
[0008] That is, the first element is an intent element, which may include an intent; the second element is an entity element, which may include an entity name, and the value of the second element is the value of the entity.
[0009] In a possible implementation of the first aspect above, a component script is generated according to the first recognition result, including: matching a target component template from a preset component template library based on the first element; filling the second element and the parameters of the second element into the target component template to obtain the component script.
[0010] That is, based on the intent, the corresponding component template is matched from the preset component template library, and the entity and the entity value are filled into the target component template to obtain the component script.
[0011] In some embodiments, placeholders are reserved in the component template to identify the insertion positions of entities and entity values.
[0012] In a possible implementation of the first aspect above, calling the first interface of the first model of the second electronic device according to the text to be processed includes: generating a calling request containing the text to be processed according to the text to be processed; and sending the calling request to the second electronic device to call the first interface of the first model of the second electronic device.
[0013] That is, a call request containing the text to be processed is generated according to the text to be processed, the natural language text is sent to the second electronic device through the call request, and the intent, entity and entity value in the natural language text are identified by calling the intent and entity recognition interface (i.e., the first interface) using the trained intent and entity recognition model (i.e., the first model).
[0014] In a possible implementation of the first aspect above, a target configuration item is drawn on a first interface according to a component script, including: parsing the component script into drawing elements corresponding to one or more components, wherein the drawing elements are used to characterize a rendering style and a layout style of the component; drawing icons corresponding to one or more components on the first interface based on the drawing elements; and taking the one or more components as target configuration items.
[0015] That is, the component script may include one or more drawing elements corresponding to the components, for example, drawing elements in HTML format, and then, the instantiation icon of the component is drawn on the interface according to the component rendering style and layout style contained in the drawing element. Furthermore, the calculation rules (such as calculation formulas) expressed by the drawn component can be used as target configuration items, so that users can intuitively view whether the calculation rules covered by the configuration items are correct.
[0016] In the second aspect, an embodiment of the present application also provides a data configuration method, which is applied to a second electronic device, and the method includes: obtaining a call request for a first interface sent by a first electronic device, wherein the call request includes a text to be processed input by a user, and the text to be processed is a natural language text; inputting the text to be processed into a first model corresponding to the first interface to obtain a first recognition result, wherein the first model is used for intent recognition and entity recognition, and wherein the first recognition result includes an intent recognition result and an entity recognition result; and returning the first recognition result to the first electronic device.
[0017] That is, by calling the interface, the natural language text to be processed is input into the first model (that is, the trained intent and entity recognition model), and the calculation rules contained in the natural language text to be processed can be identified.
[0018] In a possible implementation of the second aspect above, the text to be processed is input into the first model corresponding to the first interface to obtain a first recognition result, including: inputting the text to be processed into the first model corresponding to the first interface to obtain a first element, a second element and parameters of the second element, wherein the first element is used to represent the intent and the second element is used to represent the entity in the text to be processed.
[0019] That is, the first model corresponding to the first interface inputs the text to be processed, and the intent, entity and entity value can be identified.
[0020] In a possible implementation of the second aspect above, the text to be processed is input into the first model corresponding to the first interface to obtain the second element, including: inputting the text to be processed into the first model corresponding to the first interface to determine the third element, wherein the third element is used to characterize the entity in the text to be processed; and screening the third element to obtain the second element.
[0021] When the text to be processed is input into the first model, the obtained results may include a single entity being recognized as multiple entity types or multiple entity values. In this case, it is necessary to screen the multiple recognition results of the single entity to determine the accurate entity and entity value.
[0022] In a possible implementation of the second aspect above, the first model includes a word segmenter, a feature generator, a classifier, and at least one entity extractor.
[0023] That is, the first model includes at least a word segmenter, a feature generator, a classifier and at least one entity extractor, which is used to segment natural language, then extract feature vectors from the segmented natural language, and then classify the feature vectors to extract entities and entity values from the classified feature vectors.
[0024] In a possible implementation of the second aspect above, the third element is screened, including: corresponding to the situation where a single element in the third element corresponds to entity types and entity values with multiple different attributes, filtering the first repeated item in the third element to obtain a filtered third element, wherein the first repeated item is used to represent an entity whose position in the text to be processed is covered by other entities; scoring the filtered third element, and taking the third element with the largest score as the second element.
[0025] It can be understood that the first repeated item is an entity whose position in the text to be processed is covered by other entities, for example, "1.34" can be covered by "-1.34". Then, it is ensured that the extracted entity is a correct entity.
[0026] In a possible implementation of the second aspect above, the entity extractor includes a preset weight, and the filtered third element is scored, and the third element with the largest score is used as the second element, including: scoring the filtered third element based on the weight of each entity extractor, and using the third element with the largest score as the second element.
[0027] It can be understood that in the case where a single element corresponds to multiple entity types with different attributes, a weight for scoring can be set for each entity extractor, and the entity type extracted by each entity extractor can be scored based on the above weight, and the entity with the largest score and the entity value are used as the identified second element.
[0028] In a possible implementation of the second aspect, taking the third element with the highest score as the second element further includes: when the score of the third element with the highest score is less than a first score threshold, not taking the third element with the highest score as the second element.
[0029] It can be understood that by setting the first scoring threshold, all third elements with scores less than the first scoring threshold are deleted to avoid inaccurate entity recognition results.
[0030] In a possible implementation of the second aspect above, the method for acquiring the first model includes: generating a corresponding corpus template according to the first element; generating a data set according to the corpus template; and training the first model to be trained using the data set to obtain the first model.
[0031] That is, a corpus template is generated based on the intent element, and a data set is directly generated based on the corpus template to train or test the first model to be trained, and the first model (i.e., the trained intent and entity recognition model) is obtained to improve the recognition accuracy of the model.
[0032] In the third aspect, an embodiment of the present application also provides an electronic device, comprising: one or more processors; one or more memories; one or more memories storing one or more instructions, when one or more instructions are executed by the one or more processors, the electronic device executes the data configuration method provided by the first aspect and various possible implementations.
[0033] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, characterized in that instructions are stored on the storage medium, and when the instructions are executed on a computer, the computer executes the data configuration method provided by the above-mentioned first aspect and various possible implementations.
[0034] In a fifth aspect, an embodiment of the present application further provides a computer program product, characterized in that it includes a computer program / instruction, which, when executed by a processor, implements the data configuration method provided by the above-mentioned first aspect and various possible implementations. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 A schematic diagram of a scenario based on hard-coded premium calculation is shown;
[0036] Figure 2 A schematic diagram of a scenario of premium calculation is shown according to some embodiments of the present application;
[0037] Figure 3A A schematic diagram of a data configuration scenario is shown according to some embodiments of the present application;
[0038] Figure 3B According to an embodiment of the present application, a flow chart of a data configuration method is shown;
[0039] Figure 4 According to an embodiment of the present application, a flow chart of a method for calling an intent and entity recognition interface is shown;
[0040] Figure 5 According to an embodiment of the present application, a schematic diagram of a data configuration interface structure is shown;
[0041] Figure 6 According to some embodiments of the present application, a schematic flow chart of a method for training an intent and entity recognition model is shown;
[0042] Figure 7 According to some embodiments of the present application, a flowchart of a training intent and entity recognition model is shown;
[0043] Figure 8 According to an embodiment of the present application, a block diagram of a terminal 300B is shown. DETAILED DESCRIPTION
[0044] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0045] Illustrative embodiments of the present application include, but are not limited to, a data configuration method, an electronic device, and a computer-readable storage medium, among others.
[0046] It can be understood that the electronic devices to which the present application is applicable may be mobile phones, tablet computers, desktops, laptops, handheld computers, netbooks, augmented reality (AR) / virtual reality (VR) devices, smart TVs, wearable devices, etc., as well as devices having one or more processors embedded or coupled thereto, without limitation herein.
[0047] In order to facilitate understanding of the technical solutions provided by the embodiments of the present application, the meanings of some related field terms involved in the embodiments of the present application are explained below.
[0048] (1) Natural language processing (NLP) is a field that studies the interaction between human language and computers. It involves the technology of computer understanding, processing and generating natural language.
[0049] (2) Intent recognition is a key task in natural language processing, which aims to determine the intention or purpose of the user when interacting. It is mainly used in the fields of dialogue systems, intelligent assistants and automatic customer service. In some embodiments of the present application, intent recognition is to identify the specific operation of a step in the premium calculation rule, such as assigning a value, looking up a rate table, comparing two premiums, making conditional judgments, etc.
[0050] (3) Entity recognition (NER) is an important task in natural language processing, which aims to identify named entities of specific types from text, such as names of people, places, and organizations. In some embodiments of the present application, the entities are mainly custom entities in the field related to the premium calculation formula.
[0051] (4) Premium calculation is the process of obtaining the calculation result by passing the values of the relevant factors affecting the premium in the input information to the calculation formula based on the input information and the pre-configured calculation formula.
[0052] Combine the following Figure 1 Detailed description of the scenario where premium calculation is performed based on hard-coded calculation rules.
[0053] Figure 1 A schematic diagram of a scenario based on hard-coded premium calculation is shown.
[0054] refer to Figure 1The terminal 100 may be connected to the server 200, which may be a cloud server. The server 200 may provide an insurance business system 201, which may include a calculation rule 011 configured in a hard-coded manner. It should be understood that the terminal 100 may provide a system interface with a premium calculation function for the user to obtain the premium calculation request of the user, and send the premium calculation request to the insurance business system 201. Furthermore, the insurance business system 201 may determine the premium according to the premium calculation request combined with the implanted calculation rule, and send it to the terminal 100 to provide to the user.
[0055] It can be understood that configuring the calculation rule-related code for the insurance business system 201 based on hard coding will cause the code of the insurance business system 201 to be coupled with the calculation rule configuration code. When the calculation rule-related configuration needs to be modified, it is easy to affect the code of the insurance business system 201. This makes the modification and maintenance of the calculation rules in the insurance business system 201 costly and complicated.
[0056] To avoid the above problems, Figure 2 According to some embodiments of the present application, a schematic diagram of a premium calculation scenario is shown.
[0057] refer to Figure 2 The terminal 300A can be connected to the server 400, which can be a cloud server. The server 400 can provide the premium calculation rules 401 and the interface 402 of the insurance business system, and the code of the premium calculation rules 401 is decoupled from the code of the interface 402. The interface 402 is configured with the premium calculation rules, so modifying the premium calculation rules will no longer affect the code of the insurance business system itself.
[0058] In some implementations, users can configure premium calculation rules through Groovy DSL scripts, but the configuration process is relatively cumbersome, has certain professional requirements for business personnel, and has a high entry threshold and is difficult to get started.
[0059] Therefore, in order to avoid the problem that it is too cumbersome to configure the premium calculation rules to the interface 402, the embodiment of the present application provides a data configuration method, by obtaining the natural language text of the user, using the trained intention and entity recognition model to identify the intention elements and entity elements related to the premium calculation rules in the natural language text, wherein the intention element is used to characterize the intention or user purpose expressed by the natural language, and the entity element is used to characterize the entity name and entity parameters in the natural language sentence. Then, based on the intention element, a target component template that matches the intention is matched from the preset component template library, and the entity element is filled into the target component template to obtain the target configuration item, and the target configuration item is encapsulated as a target interface. It should be understood that the target configuration item can be used to realize the intention expressed by the user's natural language and realize the configuration processing of the calculation rules. Thereby, the user who designs the calculation rules only needs to input the natural language text, and the intention and entity recognition model can be called to identify the premium calculation rules corresponding to the natural text, and the premium calculation rules are configured as the target interface. And the user who uses the insurance business system to calculate the premium only needs to call the interface to calculate the premium amount using the premium calculation rules configured by the interface.
[0060] It should be understood that the user who designs the calculation rules may include a developer who develops and configures the calculation formula. The user who uses the insurance business system to calculate the premium may be an insurance business person.
[0061] In some embodiments, the above-mentioned entity element includes an entity name and an entity value.
[0062] Figure 3A According to some embodiments of the present application, a schematic diagram of a data configuration scenario is shown.
[0063] refer to Figure 3A, terminal 300B can be a development terminal, the user can be a developer, and terminal 300B is connected to server 400. When the user wants to configure a premium calculation rule 401 with an interface 402, the user can input a natural language text to be processed to describe the premium calculation rule into terminal 300B, and terminal 300B calls the corresponding intent and entity recognition interface (not shown in the figure) according to the natural language text to be processed, and recognizes the intent elements, entity elements and parameters of the entity elements in the natural language text to be processed, such as the value of the entity element. The above recognition result is returned to terminal 300B, and terminal 300B can determine the script of the premium calculation rule according to the recognition result, and draw an instantiated target configuration item on the screen according to the script to provide it to the user, so that the user can intuitively understand whether the calculation rule corresponding to the current target configuration item is correct. Then, terminal 300B receives the user operation and can save the target configuration item as a target script. Furthermore, the terminal 300B may encapsulate the target script as an interface 402 and publish it to the server 400 , so that the subsequent insurance business system may call the interface 402 through the server 400 to run the premium calculation rules, such as the premium calculation formula, contained in the script.
[0064] Combine the following Figure 3B right Figure 3A The specific implementation process of the example scenario is described in detail.
[0065] Figure 3B According to an embodiment of the present application, a flow chart of a data configuration method is shown.
[0066] The specific implementation method includes the following steps:
[0067] S301, the terminal 300B obtains the text to be processed, and generates a call request according to the text to be processed.
[0068] Exemplarily, terminal 300B can obtain the text to be processed, generate a call request containing the text to be processed based on the text to be processed, call the intention and entity recognition interface through the call request, and transfer the text to be processed to the trained intention and entity recognition model to realize the recognition processing of the intention elements and entity elements in the text to be processed.
[0069] It should be understood that users can describe the calculation rules in natural language, and the natural language statement describing the calculation rules is the text to be processed. By analyzing the text to be processed, the intent contained therein can be identified and the intent elements can be obtained. Each intent element can correspond to an operation related to the calculation rules. For example, a user can write "A is equal to B", then the intent contained therein is "assign B to A", and the intent elements contained therein correspond to the "assignment" operation. Furthermore, the user only needs to input the text to be processed in natural language to configure the calculation rules described in the text to be processed into the target interface.
[0070] It should be understood that the above “A equals B” can also be expressed in languages of different countries, such as English, and no specific language limitation is imposed herein.
[0071] In some embodiments, the terminal 300B may provide a computing rule configuration application having a first interface, and the terminal 300B may provide a region for the user to input text to be processed through a window in the first interface.
[0072] refer to Figure 4 , an input box window 01 is provided in the first interface, an input area 011 is provided in the window for accepting the text to be processed input by the user, and a confirmation button 012 is provided, and the icon of the confirmation button 012 is, for example, "Enter". When the terminal 300B detects the user's confirmation operation 10 on the confirmation button 012, a call request can be generated for the text to be processed in the input area 011, and the intention and entity recognition interface 02 can be called to call the trained intention and entity recognition model 03. The trained intention and entity recognition model 03 can identify the intention element and the entity element based on the text information to be processed contained in the acquired call request, and generate the intention element and the entity element into an object 04 in a preset format, and present it to the user.
[0073] S302 , the terminal 300B uses a call request to call the intent and entity recognition interface of the server 400 .
[0074] Exemplarily, after terminal 300B obtains the text to be processed, it can generate a call request based on the text to be processed to call the intent and entity recognition interface of server 400, so that the text to be processed in the call request can be input into the trained intent and entity recognition model through the interface to identify the intent elements and entity elements contained in the text to be processed.
[0075] In some embodiments, the above-mentioned intent and entity recognition interface can be a RESTful API, wherein the RESTful API is an API that meets the architectural style of representational state transfer (REST).
[0076] S303, the server 400 inputs the text to be processed into the trained intent and entity recognition model to obtain intent elements, entity elements and parameters of the entity elements.
[0077] Exemplarily, the server 400 may input the text to be processed into a trained intent and entity recognition model to identify the intent element (ie, the first element), the entity element (ie, the second element), and the parameters of the entity element (ie, the parameters of the second element).
[0078] In some embodiments, the trained intent and entity recognition model is a deep learning model trained using corpus. The training process will be described below in conjunction with Figure 6 and Figure 7 A detailed description is given and no further elaboration is given here.
[0079] S304, the server 400 returns the intent element, the entity element and the parameters of the entity element to the terminal 300B.
[0080] Exemplarily, the server 400 may package the intent element, the entity element, and the parameters of the entity element into an object in a preset format, and send them together to the terminal 300B.
[0081] In some embodiments, the intent element, entity element, and parameters of the entity element may be packaged into an object in JavaScript object notation (JSON) format.
[0082] In some embodiments, an entity element includes an entity name, and a parameter of the entity element includes a value of the entity.
[0083] S305, terminal 300B matches the target component template from the preset component template library according to the intent element.
[0084] Exemplarily, terminal 300B can match a target component template with the same intent element from a preset component template library according to the intent element. Among them, the preset component template library can provide different templates corresponding to different intents, and different entity elements can be identified by specific placeholders in the template. It can be understood that the placeholder can be used to specifically identify the position where the entity value should be filled for different entities. The intent template can contain multiple entities and their corresponding placeholders.
[0085] Furthermore, each intent can be queried to a corresponding template file, so that the terminal 300B can find the corresponding template file according to the intent in the text to be processed input by the user. Therefore, when the user inputs a text to be processed, the terminal 300B can identify multiple different intent elements according to the text to be processed, and then match multiple target component templates from the preset component template library. Among them, the target component is a component with the function of the operation corresponding to the intent.
[0086] It should be understood that the target component template already has a description of the relevant entity elements, but no specific entity elements have been filled in. Therefore, the terminal 300B can set a slot for the position where the entity element needs to be filled, that is, set a reserved placeholder for the entity element to be filled, so as to facilitate filling in the corresponding entity element and the parameters of the entity element through the reserved placeholder.
[0087] S306, the terminal 300B fills the entity element and the parameters of the entity element into the target component template, obtains the component script, and stores it.
[0088] Exemplarily, the terminal 300B fills the entity element and the parameters of the entity element into the slot in the target component template to obtain a component script describing the component style and component function. In the scenario of configuring the premium calculation rule, the component script includes the premium calculation rule to be set and the required component style, such as the premium calculation formula.
[0089] S307: Terminal 300B draws a target configuration item including at least one component according to the component script.
[0090] Exemplarily, terminal 300B can draw one or more components into a set of icons arranged in sequence based on the component style and component properties contained in the component script. The icon set can represent the calculation operation process corresponding to the premium calculation rule. The operation order or calculation formula arrangement order defined in the component script can correspond to determine the arrangement order of the components, and obtain the calculation operation process corresponding to the calculation rule that the user expects to configure.
[0091] In some embodiments, the components in the preset component template library need to be manually dragged by the user to the component display area of the first interface, so that the user has to traverse all the components in the preset component template library to find the required components, which is very cumbersome. If the calculation rules are more complicated, that is, the operations required for the calculation (corresponding to the intention elements) are more, then the components will also be more. For example, there are hundreds of calculation steps, and each calculation step also involves multiple variables, functions, operations, judgments, etc., which corresponds to hundreds of components. It is too time-consuming and labor-intensive to manually drag the components one by one, and it is impossible to complete the calculation rule configuration in batches.
[0092] In the embodiment of the present application, terminal 300B can identify the intent elements and entity elements corresponding to the calculation rules based on the natural language text input by the user, and then determine the component script containing the icon styles and attribute parameters of multiple components, so as to realize the batch identification of all operations corresponding to the calculation rules as a task flow composed of one or more components, for example, as a pipeline, so as to automatically draw out a visual component task flow in batches, which is convenient to operate and saves time and effort.
[0093] In some embodiments, the terminal 300B may parse the component script into a drawing element, for example, into a drawing file in an extensible markup language (XML) format, so as to draw the component style in the component script in a given window in the first interface. Figure 5 , the first interface 500 is provided with an input box window 01 and a configuration item display area 501, the input box window 01 is provided with an input area 011 for accepting the text to be processed input by the user, and is provided with a confirmation button 012, the icon of which is, for example, "Enter". In response to the situation where the terminal 300B detects the user's confirmation operation on the confirmation button 012, the corresponding target configuration item can be obtained according to the text to be processed in the input area 011, and the target configuration item is instantiated as an icon in a component unit and displayed in the configuration item display area 501, so that the user can intuitively check whether the calculation rules covered by the configuration item are correct.
[0094] S308, the terminal 300B encapsulates the target configuration item into a target interface.
[0095] Exemplarily, the terminal 300B may encapsulate the target configuration item as a target interface, for example, encapsulating the pipeline as an API.
[0096] In some embodiments, the calculation formula corresponding to the target configuration item can be converted into a calculation script in yet another markup language (YAML) format.
[0097] In other embodiments, the terminal 300B may send the calculation script corresponding to the target configuration item to the server 400, and the server 400 may encapsulate the target configuration item into a target interface and publish it, so that the insurance business system may call the target interface through the server 400 to run the corresponding premium calculation rules.
[0098] S309 , the terminal 300B publishes the target interface to the server 400 .
[0099] Exemplarily, the terminal 300B publishes a target interface to the server 400, so that the configured calculation rules can be used by calling the target interface. It should be understood that the target interface is different from the first interface used to call the intent and entity recognition model mentioned above, which is loaded with the premium calculation rules represented by the natural language text, such as the insurance calculation formula. After the target interface is called, the premium calculation rules can be loaded and the premium can be calculated. Figure 2 The target interface is interface 402, and the user can call the target interface to load the premium calculation rules corresponding to the above component script, such as the premium calculation formula, through the target interface to implement premium calculation processing.
[0100] In some embodiments, the target interface can run the premium calculation rules by loading the calculation script in the above YAML format.
[0101] In some embodiments, the server 400 may register the target interface with the gateway to facilitate the user to call the target interface.
[0102] It can be understood that in steps S301 to S309 in the embodiment of the present application, the terminal 300B can call the intention and entity recognition interface of the intention and entity recognition model of the server 400 by obtaining the user's natural language text to be processed, extract the intention elements, entity elements and parameters of the entity elements in the natural language text to be processed to generate a component script, and generate a visual calculation operation flow with the component script in the first interface of the terminal 300B, and each node in the calculation operation flow corresponds to a component. Among them, the calculation operation flow is the target configuration item, and the target configuration item can be encapsulated as a target interface to realize the configuration of the calculation rules as a callable target interface. As a result, the user only needs to input the natural language text to be processed to complete the configuration processing of the premium calculation rules, which reduces the user's learning cost and the maintenance cost of the calculation rules, and is easy to get started, and the configuration process is time-saving and labor-saving.
[0103] In some embodiments, the server 400 may generate a corpus data set to train the intent and entity recognition model to be trained, obtain the trained intent and entity recognition model, and store it.
[0104] Exemplarily, the corpus dataset may include a training dataset and a test dataset, wherein the training dataset is used to train the intent and entity recognition model to be trained, for example, the training dataset can be used to train a deep learning model; and the test dataset is used to verify whether the trained intent and entity recognition model is accurate.
[0105] Combine the following Figure 6 A detailed description of the process of training intent and entity recognition models.
[0106] Figure 6 A schematic flowchart of a method for training an intent and entity recognition model is shown according to some embodiments of the present application.
[0107] It can be understood that Figure 6 The execution subject of each step of the shown process can be the server 400, and the execution subject of a single step will not be elaborated further.
[0108] S601. Generate a corpus template according to each intent category.
[0109] It can be understood that different intents correspond to different operations. For example, in the field of premium calculation, there can be: an intent to assign values, an intent to look up a rate table, an intent for conditional judgment, an intent to compare two variables, an intent to compare sizes, an intent to calculate the difference between two dates, an intent for premium allocation, etc. Different corpus templates can be made for different intents, and special identifiers can be used in the template to identify different contents to achieve redundant information filtering.
[0110] Exemplarily, the symbol "@" can be used to identify the defined entity name, the symbol "~" can be used to identify a certain type of expression, the symbol "?" can be used to identify non-essential expressions, and the symbol "*" can be used to identify the proportion value for constructing the corpus. For example, for the case where the expression "make" in an imperative sentence is concretized as words such as "let", "take", or "make" in English, the symbol "~" can be used to identify the above-mentioned words expressing "make".
[0111] S602. Generate a training data set and a test data set according to the corpus template.
[0112] Exemplarily, a data set generation tool can be used to generate a data set according to the corpus template. For example, the intent template of relevant corpus can be identified. For example, if the corpus template of the corpus "A is equal to B" is identified as the "assignment" intent template, the following data set can be generated:
[0113] "Intent: Assignment
[0114] Examples:
[0115] - A (entity type 1)
[0116] - B (entity type 2)
[0117] Assign B (entity type 2) to A (entity type 1)"
[0118] In some embodiments, 80% of the generated data set can be used to generate a training data set, and the remaining 20% of the generated data set can be used to generate a test data set.
[0119] S603, input the training data set into the intent and entity recognition model to be trained to obtain a trained intent and entity recognition model.
[0120] Exemplarily, the training data set can be input into the intent and entity recognition model to be trained, and then the recognition results with higher confidence are adopted to optimize the parameters in the intent and entity recognition model to obtain a trained intent and entity recognition model. The trained intent and entity recognition model can more accurately identify the intent elements, entity elements and parameters of entity elements in the natural language text to be processed.
[0121] It should be understood that the process of training intent recognition and named entity recognition includes word segmentation of the corpus data in the training data set, and then feature extraction of the word segmented data to obtain feature vectors corresponding to relevant features, such as sequence feature vectors of character sequences, sequence feature vectors of sentence sequences, etc. Finally, the feature vector is input into the classifier and at least one entity extractor in the model for training and verification, and then the trained model is saved.
[0122] In some embodiments, reference Figure 7 The intent and entity recognition model may include a tokenizer, a feature generator, a classifier, and at least one entity extractor to identify the intent elements and entity elements in the text to be processed, and determine the parameters of the entity elements, such as the value of the entity. The training data set is input for training, and the test data set is used for verification to obtain the trained intent and entity recognition model.
[0123] Among them, the tokenizer can be used to split the sentences in the text to be processed into tokens, so that the sentences can be converted into a character sequence formed by a plurality of continuous tokens, and the character sequence is converted into a digital sequence by encoding and other means, so as to facilitate input into the required input model. Among them, each token split from the sentence corresponds to a unique code. In some embodiments, a custom tokenizer can be used to perform tokenization processing on the text to be processed to remove redundant information, such as removing repeated entities, removing emoticons, removing redundant symbols, etc.
[0124] The feature generator can be used to extract sequence features and sentence features based on the digital sequence obtained by the tokenizer. Among them, the sequence feature is represented by a matrix of size (number of chunks * feature dimension), which contains the feature vector of each chunk in the sentence. The sentence feature is represented by a matrix of size (1 * feature dimension), which contains the feature vector of the complete conversation and can be used for the intent classification of the sentence. For example, a language model feature generator can be used, which can be used as a feature generator through a pre-trained model. The input is the user message, response message waiting to be processed text, and the output is a dense variable. For another example, a regular expression feature generator can be used, which can create a message representation using a regular expression. Note that the input can only be a user message, and the output content is a sparse vector. For another example, a count vector feature generator can be used, which can express user messages, intents, and response messages in a bag of words model, and the output is also a sparse matrix.
[0125] A classifier is a data model for classifying classifier samples in data mining, and the data model includes a classification algorithm, such as logistic regression, naive Bayes, k-nearest neighbors, decision tree, or support vector machines. In some embodiments, a DIET classifier can be used, which is a deep learning model for intent recognition and entity recognition. It is based on a transformer architecture, accepts the sentence embedding vector passed in, and calculates a series of classification results, such as intent and entity information, through a neural network.
[0126] Entity extractors can be used to extract entities from information, such as names or locations. For example, the conditional random field entity extractor (CRFEntityExtractor) can use conditional random (CRF) to perform named entity recognition. The CRF entity extractor can receive different features as input data, including but not limited to part-of-speech features, features generated by RegexFeaturizer, or features generated by other pre-trained models. In addition, the CRF entity extractor can also implement entity extraction based on BILOU tags. For another example, the RegexEntityExtractor entity extractor extracts entities from information using the lookup table and regular expressions defined in the training data. It can check whether the user message contains an entry in one of the lookup tables or matches one of the regular expressions. If a match is found, the value is extracted as an entity.
[0127] It should be noted that, in the case where the entity extractor obtains multiple different entity types, the multiple different entity types can be scored one by one according to the preset weight of each extractor, and the entity type with the largest score is selected as the extraction result.
[0128] S604, input the test data set into the trained intent and entity recognition model to verify the recognition accuracy of the trained intent and entity recognition model.
[0129] Exemplarily, by inputting a test data set into a trained intent and entity recognition model, a test result can be obtained. The higher the accuracy of the intent element, entity element, and the value of the entity element in the test result, the higher the recognition accuracy of the trained intent and entity recognition model, and the better the performance.
[0130] In some embodiments, the performance of the trained intent and entity recognition model can be examined from indicators such as precision, recall, and F1-measure. The higher the values of the above indicators, the better the performance.
[0131] The accuracy rate is the number of correctly classified samples divided by the total number of samples. The higher the accuracy rate, the more accurate the output results of the trained intent and entity recognition model.
[0132] Recall, also known as recall rate, is the proportion of all positive examples that are correctly predicted. It is used to evaluate the detection coverage of the detector for all targets to be detected, indicating how many positive examples in the sample are predicted correctly. It can be used to indicate whether the correct detection results output by the trained intent and entity recognition model are complete enough.
[0133] The F1 value is the harmonic mean of the two model evaluation indicators, precision and recall, and can be used to comprehensively evaluate the trained intent and entity recognition models.
[0134] It can be understood that through the above steps S601 to S604, different data set templates can be made based on different intents, and training data sets and test data sets can be generated according to the data set templates, and then the training data sets are used to train the intent and entity recognition models, and the test data sets are used to verify the performance of the trained intent and entity recognition models. The training data sets and test data sets generated by the above templates based on different intent classifications can more effectively train intent and entity recognition models with high accuracy and high recall rate. This ensures that the natural language text to be processed can accurately and without omission generate the configuration item files corresponding to the calculation rules.
[0135] In addition, in some embodiments, since the intent and entity recognition model is configured with multiple entity extractors, different entity extractors correspond to different entity extraction algorithms. Therefore, when conflicts occur between groups of entity elements determined by different entity extractors, it is necessary to select appropriate entities in combination with the current intent, entity extraction algorithm, confidence score, etc. Therefore, after obtaining the results output by the trained intent and entity recognition model, the intent and entity recognition interface can further process the extracted groups of entities:
[0136] (1) Filter out entity information whose text positions are overlapped;
[0137] (2) Calculate the scores of the entity types extracted by each entity extractor according to the weights of multiple different entity extractors, select the entity type with the maximum score, and output the entity type with the maximum score when the score value is greater than or equal to a score threshold (i.e., a first score threshold).
[0138] It should be noted that all entities below the scoring threshold will be deleted.
[0139] It should be understood that an entity can have two attributes: entity name and entity value. For example, in the statement "assign-1.34tobase_rate", the name of the entity "-1.34" is "var_val" and the entity value is -1.34. Multiple different entity extractors will return their own extracted entities, which contain entity names and entity values.
[0140] Therefore, in some embodiments, entities that do not exist in the text intent can be deleted based on the entity name. Incomplete entities can also be determined based on the position of the entity in the text and deleted. For example, the entity "-1.34" in the sentence "assign-1.34 tobase_rate", if the entity value extracted by entity extractor A is "-1.34", the entity value extracted by entity extractor B is "1.34". Since the text position of "1.34" is in "-1.34", the text position of "1.34" is covered / overlapped by "-1.34", the entity "1.34" extracted by entity extractor B is deleted to reduce the extraction of erroneous entities.
[0141] For entities with the same entity value and location information but different entity names, the entity extractor weights and calculates the score result of each entity type, and selects the entity name with the largest score as the judgment result of the entity type. In other embodiments, a score threshold can be set, and if the maximum score is lower than the score threshold, the entity type is deleted.
[0142] For example, in the above statement "assign-1.34to base_rate", if the entity "base_rate" is extracted, the entity name extracted by entity extractor C is "var_common" with a confidence score of 0.78, and the entity name extracted by entity extractor D is "var_result" with a confidence score of 0.83. Assume that the weight of entity extractor C is 1.0, the weight of entity extractor D is 1.1, and the score threshold is 0.85. Then the score of entity name var_common is 0.78, the score of entity name var_result is 0.913, and the output entity name is "var_result".
[0143] In some embodiments, according to the empirical value, the confidence of the CRF entity extractor is larger, so the weight of the CRF entity extractor is larger.
[0144] Figure 8 A block diagram of a terminal 300B is shown according to an embodiment of the present application. In some embodiments, the terminal 300B may include one or more processors 804, a system control logic 808 connected to at least one of the processors 804, a system memory 812 connected to the system control logic 808, a non-volatile memory (NVM) 816 connected to the system control logic 808, and a network interface 820 connected to the system control logic 808.
[0145] In some embodiments, the processor 804 may include one or more single-core or multi-core processors. In some embodiments, the processor 804 may include any combination of a general-purpose processor and a dedicated processor (e.g., a graphics processor, an application processor, a baseband processor, etc.). In an embodiment where the terminal 300B uses an enhanced base station (evolved node b, eNB) or a radio access network (radio access network, RAN) controller, the processor 804 may be configured to execute various embodiments that comply with the present invention.
[0146] In some embodiments, system control logic 808 may include any suitable interface controller to provide any suitable interface to at least one of processors 804 and / or any suitable device or component in communication with system control logic 808 .
[0147] In some embodiments, the system control logic 808 may include one or more memory controllers to provide an interface to the system memory 812. The system memory 812 may be used to load and store data and / or instructions. In some embodiments, the system memory 812 of the terminal 300B may include any suitable volatile memory, such as a suitable dynamic random access memory (DRAM).
[0148] The NVM / memory 816 may include one or more tangible, non-transitory computer-readable media for storing data and / or instructions. In some embodiments, the NVM / memory 816 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as at least one of a hard disk drive (HDD), a compact disc (CD) drive, and a digital versatile disc (DVD) drive.
[0149] NVM / storage 816 may include a portion of storage resources on the device on which terminal 300B is installed, or it may be accessible by the device but not necessarily a portion of the device. For example, NVM / storage 816 may be accessed over a network via network interface 820 .
[0150] In particular, the system memory 812 and the NVM / storage 816 may include, respectively, a temporary copy and a permanent copy of the instruction 824. The instruction 824 may include instructions that, when executed by at least one of the processors 804, cause the terminal 300B to implement the above-described data configuration method. In some embodiments, the instruction 824, hardware, firmware, and / or software components thereof may be additionally / alternatively placed in the system control logic 808, the network interface 820, and / or the processor 804.
[0151] The network interface 820 may include a transceiver for providing a radio interface for the terminal 300B, and then communicating with any other suitable device (such as a front-end module, an antenna, etc.) through one or more networks. In some embodiments, the network interface 820 may be integrated with other components of the terminal 300B. For example, the network interface 820 may be integrated with at least one of the processors 804, the system memory 812, the NVM / storage 816, and at least one of a firmware device with instructions (not shown in the figure), and when at least one of the processors 804 executes the instructions, the terminal 300B implements the above-mentioned data configuration method.
[0152] The network interface 820 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, the network interface 820 may be a network adapter, a wireless network adapter, a telephone modem and / or a wireless modem.
[0153] In one embodiment, at least one of the processors 804 may be packaged together with logic for one or more controllers of the system control logic 808 to form a system in package (SiP). In one embodiment, at least one of the processors 804 may be integrated on the same die with logic for one or more controllers of the system control logic 808 to form a system on chip (SoC).
[0154] The terminal 300B may further include: an input / output (I / O) device 832. The I / O device 832 may include a user interface to enable a user to interact with the terminal 300B; the design of the peripheral component interface enables the peripheral components to interact with the terminal 300B. In some embodiments, the terminal 300B further includes a sensor for determining at least one of an environmental condition and location information related to the terminal 300B.
[0155] In some embodiments, the user interface may include, but is not limited to, a display (e.g., an LCD display, a touch screen display, etc.), a speaker, a microphone, one or more cameras (e.g., a still image camera and / or a video camera), a flashlight (e.g., an LED flash), and a keyboard.
[0156] In some embodiments, the peripheral component interface may include, but is not limited to, a non-volatile memory port, an audio jack, and a power interface.
[0157] In some embodiments, the sensors may include, but are not limited to, gyroscope sensors, accelerometers, proximity sensors, ambient light sensors, and positioning units. The positioning unit may also be part of or interact with the network interface 820 to communicate with components of a positioning network (e.g., global positioning system (GPS) satellites).
[0158] The various embodiments disclosed in the present application may be implemented in hardware, software, firmware, or a combination of these implementation methods. The embodiments of the present application may be implemented as a computer program or program code executed on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0159] Program code can be applied to input instructions to perform the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, a processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application specific integrated circuit (ASIC), or a microprocessor.
[0160] Program code can be implemented with high-level programming language or object-oriented programming language to communicate with the processing system. When necessary, program code can also be implemented with assembly language or machine language. In fact, the mechanism described in this application is not limited to the scope of any specific programming language. In either case, the language can be a compiled language or an interpreted language.
[0161] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, instructions may be distributed over a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine (e.g., computer) readable form, including, but not limited to, floppy disks, optical disks, optical disks, read-only memories (CD-ROMs), magneto-optical disks, read-only memories (ROMs), random access memories (RAMs), erasable programmable read-only memories (EPROMs), electrically erasable programmable read-only memories (EEPROMs), magnetic or optical cards, flash memory, or a tangible machine-readable memory for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in electrical, optical, acoustic, or other forms of propagation signals. Therefore, machine-readable media include any type of machine-readable media suitable for storing or transmitting electronic instructions or information in a machine (e.g., computer) readable form.
[0162] In the accompanying drawings, some structural or method features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be required. Instead, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. In addition, the inclusion of structural or method features in a particular figure does not mean that such features are required in all embodiments, and in some embodiments, these features may not be included or may be combined with other features.
[0163] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.
[0164] It should be noted that, in the examples and description of the present application, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or equipment. In the absence of further restrictions, the elements defined by the statement "comprise one" do not exclude the presence of other identical elements in the process, method, article or equipment including the elements.
[0165] Although the present application has been illustrated and described with reference to certain embodiments thereof, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the scope of the present application.
Claims
1. A data configuration method, applied to a first electronic device, characterized in that: The method comprises: Acquire a text to be processed input by a user through a first interface, and call a first interface of a first model of a second electronic device according to the text to be processed, wherein the text to be processed is a natural language text, and the first model is used for intent recognition and entity recognition; Acquire a first recognition result from the second electronic device based on the first interface, wherein the first recognition result includes an intent recognition result and an entity recognition result; Generate a component script according to the first recognition result, wherein the component script is used to characterize the intent, entity, and parameter of the entity of the text to be processed, the first recognition result includes a first element, a second element, and a value of the second element, wherein the first element is used to characterize the intent, and the second element is used to characterize the entity in the text to be processed, and the generating of the component script according to the first recognition result includes: Matching a target component template from a preset component template library based on the first element; Fill the second element and the parameter of the second element into the target component template to obtain a component script; Parsing the component script into drawing elements corresponding to one or more components, wherein the drawing elements are used to represent the rendering style and layout style of the component; Drawing one or more icons corresponding to the components on the first interface based on the drawing element; The one or more components are used as target configuration items, and the component scripts are converted into calculation rule scripts and stored.
2. The method according to claim 1, characterized in that The calling the first interface of the first model of the second electronic device according to the text to be processed includes: Generating a call request including the text to be processed according to the text to be processed; The calling request is sent to the second electronic device to call the first interface of the first model of the second electronic device.
3. A data configuration method, applied to a second electronic device, characterized in that: The method comprises: Acquire a call request for a first interface sent by a first electronic device, wherein the call request includes a text to be processed input by a user, and the text to be processed is a natural language text; Inputting the text to be processed into a first model corresponding to the first interface to obtain a first recognition result, wherein the first model is used for intent recognition and entity recognition, the first recognition result includes a first element, a second element, and a parameter of the second element, the first element is used to characterize the intent, and the second element is used to characterize the entity in the text to be processed, and the inputting the text to be processed into the first model corresponding to the first interface to obtain the second element includes: Input the text to be processed into the first model corresponding to the first interface, and determine a third element, wherein the third element is used to characterize an entity in the text to be processed; The third element is screened to obtain the second element, wherein the screening of the third element includes: corresponding to the case where a single element in the third element corresponds to entity types and entity values of multiple different attributes, filtering the first repeated item in the third element to obtain the filtered third element, scoring the filtered third element based on the weight of each entity extractor, and taking the third element with the largest score as the second element, wherein the first repeated item is used to characterize an entity whose position in the text to be processed is covered by other entities; corresponding to the case where the score of the third element with the largest score is less than a first scoring threshold, not taking the third element with the largest score as the second element; The first recognition result is returned to the first electronic device.
4. The method according to claim 3, characterized in that The first model includes a word segmenter, a feature generator, a classifier and at least one entity extractor.
5. The method according to claim 3, characterized in that: The method of obtaining the first model includes: Generate a corresponding corpus template according to the first element; Generate a data set according to the corpus template; The first model to be trained is trained using the data set to obtain the first model.
6. An electronic device, characterized in that: include: one or more processors; One or more memories; the one or more memories store one or more instructions, and when the one or more instructions are executed by the one or more processors, the electronic device executes the data configuration method according to any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that: The storage medium stores instructions, which, when executed on a computer, enable the computer to execute the data configuration method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Processing method and device for insurance premium calculation, medium and electronic equipment
CN109559241A
Intention model training method and device, intention identification method and device, equipment and medium
CN110287283A
Natural language processing method, natural language processing device and intelligent question-answering system
CN111026842A
Information processing method and device, electronic equipment and computer readable medium
CN111091469A
Configured insurance product docking processing method and device, equipment and storage medium
CN113888340A
