Population data sample expansion method, dialogue question-answering system, electronic device and storage medium
By receiving query statements related to the number of people in the population data expansion method, matching the intent of the number of people query, and using the preset expansion table and the expansion coefficient rule table to automatically calculate and output the accurate expansion value, the problems of many repetitive work, high time cost and error rate in the expansion process in data analysis in the prior art are solved, and more efficient and accurate data processing is achieved.
Patent Information
- Application Number
- CN202411978275.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2044-12-31
AI Technical Summary
When processing mobile phone signaling data, it is difficult for the prior art to fully reflect the real situation of the entire sample, resulting in the need to expand the sample in data analysis. However, this process has a lot of repetitive work, time cost and high error rates.
Provide a population data expansion method, by receiving query statements related to the number of people, matching the intent of the number of people, and using the preset expansion table and the expansion coefficient rule table, the accurate expansion value is automatically calculated and output.
It improves the accuracy and efficiency of data processing, reduces the error rate, meets the needs of different users, and enhances the practicality and flexibility of the system.
Smart Images

Figure CN119396860B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data technology, and in particular to a population data expansion method, a dialogue question-answering system, an electronic device and a storage medium. Background Art
[0002] As a type of big data, mobile signaling data is increasingly used in the fields of work-residence distribution, user residence behavior, travel mode and trajectory analysis, population flow monitoring, and business district passenger flow statistics. However, the mobile signaling data collected by operators faces some limitations, such as not everyone has a mobile phone, one person has multiple phones, different operators have different market shares, and data barriers between operators. These factors make it difficult for mobile signaling data to fully reflect the true situation of all samples. Therefore, in the actual application of mobile signaling data, it is usually necessary to expand the sample.
[0003] Currently, data analysts need to accurately match scenarios and months according to different application scenarios and the monthly fluctuations of the expansion coefficient table to determine the corresponding expansion coefficient rule table. When dealing with specific business needs, data analysts must first use the mobile phone signaling data provided by the operator to analyze and obtain preliminary results. Subsequently, the preliminary results are expanded using multiple sets of expansion coefficient rule tables managed by the analyst. This process involves a lot of repetitive work, with high time costs and error rates. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a population data sample expansion method, a dialogue question-answering system, an electronic device and a storage medium, which can automatically provide accurate sample expansion values while realizing basic question-answering, and provide users with rich and detailed query information. In order to achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0005] In a first aspect, the present invention provides a method for expanding population data, the method comprising: receiving a query statement related to the number of people and matching the number of people query intention; based on the obtained expansion table, determining whether there is an expandable field for the number of people query intention; wherein the expansion table maintains a target intention for population expansion and an expandable field corresponding to the target intention; if so, combining key data associated with the number of people query intention, executing a calculation rule corresponding to the number of people query intention to obtain an initial number of people query result corresponding to the expandable field; expanding the initial number of people query result based on a preset population expansion coefficient to obtain an expanded number of people result; and outputting the initial number of people query result and the expanded number of people result.
[0006] In a second aspect, the present invention provides a dialogue question-and-answer system, comprising: an input module, a determination module, a calculation module, an expansion module and an output module; the input module is used to receive query statements related to the number of people and match the number of people query intentions; the determination module is used to determine whether there is an expandable field for the number of people query intention based on the obtained expansion table; wherein the expansion table maintains a target intention for population expansion and an expandable field corresponding to the target intention; the calculation module is used to, if it exists, execute the calculation rules corresponding to the number of people query intention in combination with key data associated with the number of people query intention, and obtain an initial number of people query result corresponding to the expandable field; the expansion module is used to expand the initial number of people query result based on a preset population expansion coefficient to obtain an expanded number of people result; the output module is used to output the initial number of people query result and the expanded number of people result.
[0007] In a third aspect, the present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the population data expansion method described in any of the aforementioned implementations.
[0008] In a fourth aspect, the present invention provides a storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the population data expansion method as described in any one of the aforementioned implementations.
[0009] The population data expansion method, dialogue question-and-answer system, electronic device and storage medium provided by the embodiment of the present invention include: first receiving and matching the user's query intent, and then using the expansion table to determine whether there is a field suitable for population expansion in the query intent. This expansion table maintains the target intent and its corresponding expandable field, providing a basis for subsequent operations. If there is an expandable field, the corresponding calculation rules will be executed in combination with the key data to generate an initial number of people query result. Then, these initial results are expanded according to the preset population expansion coefficient to obtain a more accurate headcount. Finally, the output includes the initial query result and the expanded headcount result. This process not only improves the accuracy of the query processing, but also provides two result options for the user, meets the needs of different users, and thus enhances the practicality and flexibility of the system.
[0010] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0012] Figure 1 A schematic diagram of an interactive interface of a dialog question-answering system provided in an embodiment of the present invention;
[0013] Figure 2 A schematic flow chart of a population data expansion method provided by an embodiment of the present invention;
[0014] Figure 3 The sample provided by the embodiment of the present invention does not require population expansion;
[0015] Figure 4 A sample for population expansion provided in an embodiment of the present invention;
[0016] Figure 5 A functional module diagram of a dialogue question-answering system provided by an embodiment of the present invention;
[0017] Figure 6 This is a structural block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0019] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0020] It should be noted that relational terms such as "first" and "second" are used only 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", "comprises" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0021] Considering that the existing sample expansion technology involves a large amount of repetitive work, high time cost and error rate, an embodiment of the present invention provides a population sample expansion method that can be applied in a dialogue question-answering system, which can not only improve efficiency but also reduce error rate.
[0022] First, a dialogue question-answering system provided by an embodiment of the present invention is introduced.
[0023] In order to help enterprises improve service quality, various dialogue question-answering systems have emerged in various fields. These dialogue question-answering systems are also called dialogue question-answering robots, intelligent robots, and intelligent question-answering assistants, which can conduct daily conversations. For example, users can consult the permanent population data of each province, OD travel information, and the flow of migrant workers in the city, etc., which not only enhances the user experience, but also significantly reduces the human resource cost.
[0024] In order to more clearly explain the process of population expansion provided by the embodiment of the present invention, the embodiment of the present invention briefly analyzes the dialogue question-answering system. Figure 1 , Figure 1 A schematic diagram of the interaction of the dialogue question-answering system provided in an embodiment of the present invention.
[0025] The system first receives the user's question and compares it with the preset intent questions in the knowledge base to identify possible intents. Figure 1 The core content of the "Please Select" section.
[0026] Once the user confirms the intent, the system will collect key data associated with the intent through further inquiries, that is, fill the slots. When all necessary key data has been collected, the system will call the backend API interface for calculation.
[0027] The backend system configures the corresponding SQL or SparkSQL calculation rules for each intent, and defines the field name, data type, and name of the required slot field of the returned data. This information is maintained in the intent information table. For intuitive understanding, see Table 1.
[0028] Table 1
[0029]
[0030] Table 1 lists three sample columns of intent, where xq_id, description, return_field, return_field_alias, slot and plan represent the intent identifier, the descriptive content of the intent, the English field name of the return field, the Chinese field name, the slot, and the calculation rule. It should be understood that Table 1 is only an example, and the execution mode, synchronous mode or asynchronous mode, return field type, and other information of each intent can also be recorded in the intent information table, which will not be listed here one by one.
[0031] The conversational question-and-answer system can execute backend computing tasks based on the backend API interface according to the configuration in these intent information tables, combined with the user's confirmed intent and the key data provided to the slot.
[0032] It should be emphasized that the functional positioning of the English field names and the Chinese field names in the intent information table are different: the English field names are mainly used for back-end processing and data storage, while the Chinese field names are intended to be displayed to users to help them understand the meaning of the fields more intuitively.
[0033] Once the system completes the calculation, the calculation results can be packaged and converted into answer templates that are easy for users to understand.
[0034] After research, the inventors found that although all types of conversational question-answering systems on the market have the ability to identify and process specific tasks, these systems have not yet realized the function of expanding the sample, especially the ability to automatically expand the sample of task execution results. Especially in terms of population expansion, this limitation causes the conversational question-answering system to process intentions involving number queries, and its results are often not accurate and reliable, and it is unable to provide users with richer and more detailed information.
[0035] Therefore, an embodiment of the present invention provides a method for expanding population data, which involves pre-generating an expansion table and an expansion coefficient rule table, and providing these pre-generated table data to a dialogue question-and-answer system. The system will combine these table data and calculation results to provide users with richer and more detailed information.
[0036] First, the expansion coefficient rule table provided by the embodiment of the present invention is introduced. In the embodiment of the present invention, the expansion coefficient rule table is formed by a triple structure composed of information such as district and county code, district and county name, and expansion coefficient, as shown in Table 2.
[0037] Table 2
[0038]
[0039] In Table 2, the embodiment of the present invention uses a random number between 1 and 3 as a placeholder for the expansion coefficient, and the actual expansion coefficient can be flexibly configured by the user. The generated expansion coefficient rule table can be used as a configuration file and uploaded by the user to the dialogue question answering system.
[0040] It should be noted that, in the embodiment of the present invention, if the intention is to query the number of people and there is no specific district or county information but the sample needs to be expanded, a fixed coefficient value of 3.14 will be uniformly adopted. This fixed value is based on the proportion of the three networks.
[0041] Next, an implementation method of generating an expanded sample table provided by an embodiment of the present invention is introduced.
[0042] In the embodiment of the present invention, the sample expansion table is used to maintain the target intents that can be expanded in each preset intent in the intent information table, the expandable population field corresponding to the target intent, or the expandable population field and the district and county field. Based on this, the embodiment of the present invention provides two different implementation methods to generate the sample expansion table.
[0043] In the embodiment of the present invention, the first process of generating an expanded sample table is as follows:
[0044] Step a1: Obtain an intent information table; wherein the intent information table includes various preset intents and return fields corresponding to each intent;
[0045] In an embodiment of the present invention, the return field refers to the result output after executing the calculation rules, and the return field may include a Chinese field and an English field. For example, in Table 1, the return field name is represented by return_field and return_field_alias, where return_field represents the English return field name and return_field_alias represents the Chinese return field name. Each intent has a return field, which may contain population-related fields and district and county fields. It should be understood that the representation method of the return field name shown in Table 1 is only an example, and the user can set it flexibly, which is not limited here.
[0046] Step a2: Determine the intent corresponding to the returned field containing a population-related field, or containing both a population-related field and a district / county-related field, as the target intent;
[0047] In an embodiment of the present invention, population-related fields refer to those fields that are identified as being associated with population in the returned fields, while district and county-related fields refer to those fields that are identified as being associated with districts and counties. Specifically, population-related fields include not only Chinese field names related to population such as "number of people", "population", "population number", and "population quantity", but also English field names related to population such as "popu_value" and "ucnt". Similarly, district and county-related fields include not only Chinese field names related to districts and counties such as "district and county code", "district and county name", "administrative code", "administrative district code", "administrative division code", "administrative district name", "administrative division name", and "administrative district level", but also English field names related to districts and counties such as "town_code" and "zone".
[0048] Step a2 can be understood as follows: for each specific intent, the system can check the return field columns associated with the intent in the intent information table to determine whether these columns contain population-related fields and district-county-related fields. For example, referring to Table 1, if the return fields are represented by "return_field" and "return_field_alias", the system will search for population-related fields and district-county-related fields in the columns corresponding to these two fields. Once these fields are identified, the system will mark the corresponding intent as a "target intent".
[0049] Step a3: Based on the population-related fields of the target intent, or the population-related fields and the district and county-related fields, generate expandable sample column information corresponding to the target intent;
[0050] In one embodiment of the present invention, the system can first create a blank sample expansion table. The table contains two columns: an intent column and an expandable sample column. The intent column is used to record target intents that are determined to be suitable for population expansion. The expandable sample column is used to record information related to the expansion. Specifically, this information is based on the population-related fields in the target intent, or the population-related fields and the district and county-related fields.
[0051] Step a4: Generate an expansion table based on all target intentions and expandable sample column information.
[0052] For the convenience of description, the embodiment of the present invention refers to the expanded sample table generated by the process from step a1 to step a4 as "scale_conf_v1". For the convenience of intuitive understanding, Table 3 shows a "scale_conf_v1" sample column, where "intent" represents the intent column and "wait_scale_col" represents the expandable sample column. "populationNames" and "populationNamesAnno" respectively refer to the English field name and Chinese field name corresponding to the population-related field in the expandable sample field, and "zoneSlot" represents the district and county-related field in the expandable sample field.
[0053] Table 3
[0054]
[0055] It can be seen from Table 3 that the expansion table generated by the embodiment of the present invention covers the target intent closely related to the expansion and the district and county related fields and population related fields used for the expansion of the target intent, and these fields are intended to support the implementation of the expansion function. In view of the fact that most of the entries in the intent information table are added in batches and the update frequency of the table is relatively low, the expansion table does not need to be updated frequently. Of course, Table 3 is only an example and is not a limitation on the expansion table in the embodiment of the present invention, especially the field names such as "populationNames", "populationNamesAnno", "zoneSlot", etc., which can be customized by users and are not limited here.
[0056] The second implementation method of generating an expanded sample table provided by an embodiment of the present invention is described below, including the following process:
[0057] Step b1: obtaining an intention information table; wherein the intention information table includes various preset intentions and calculation rules corresponding to each intention;
[0058] In the embodiment of the present invention, the calculation rule refers to a series of calculation steps that must be followed to achieve a specific intention. These steps cover references to related data tables and joint operations on data tables or their fields. For example, please refer to Table 1, where "plan" in Table 1 represents the calculation rule. A sample plan field is as follows:
[0059] N(${address_province}) AND city_code IN (${address_city})");
[0060] $${jice_miit_industry_spf}=sync_mysql("select fnid,name from jice_miit_industry_scale_park group by fnid,name");
[0061] export $${find_industry_pabc}=sync_mysql("select count(.)cnt from ${gxb_industry_id_wkt} t1 JOIN ${jice_miit_industry_spf} t2 on (t1.id=t2.fnid)");
[0062] In this plan field example, "jice_miit_industry_spf" and "gxb_industry_id_wkt" are both required data tables. "id", "fnid", and "name" all represent fields in the table, and count() represents a joint operation.
[0063] Step b2: Generate a source table information table according to all intended calculation rules; wherein the source table information includes the source table and source fields directly recorded in each calculation rule;
[0064] Step b3: Configure an expandable sample flag for the source fields in the source table information table that can be used for population expansion.
[0065] In the embodiment of the present invention, it can be seen from the above plan field sample column that the table name and field name required to be used are clearly recorded in each calculation rule. Based on this, by analyzing the SparkSQL / SQL sequence corresponding to the "plan" field in the intent information table, the source table and source field used by the intent can be traced back and determined. The "source field" here refers to the field and / or county field in the source table, which means that the identified source field may be a pure field in the table, or it may contain both field in the table and county field. A source table information table can be generated through these source tables and source fields. For intuitive understanding, please refer to Table 4.
[0066] Table 4
[0067]
[0068] In Table 4, "table_name" is the English table name of the source table, "table_comment" is the descriptive information of the source table, "col_name" is the English field name of the source field, and "col_comment" is the Chinese field name of the source field. "is_weight" is an expansion mark, which is used to identify whether a source field can be expanded. As an example, the number "1" can be used to indicate that population expansion can be performed, and the number "0" can be used to indicate that population expansion cannot be performed. Users can also distinguish by other numbers, characters, etc., which are not limited here.
[0069] In the embodiment of the present invention, the expansion mark can be manually configured by the user. The user can configure the expandable mark for the population-related fields and the district and county fields in the source table based on actual experience, such as the number 1 in Table 4, and other non-expandable fields can be distinguished by other numbers, such as the number 0 in Table 4.
[0070] For example, as an example, in Table 4, the total population in the Seventh National Census data table is a national statistical value and does not need to be expanded, so it is marked as 0. POI is a frequently visited point, which is calculated based on the operator's signaling data and can be expanded, so it is marked as 1.
[0071] Step b4: for each intent, judging whether the used field in the process of executing the calculation rule is an expandable field based on the source table information table;
[0072] The used fields are any of the following and their combination: fields in the table and temporary fields, the fields in the table also include return fields and / or district and county fields; temporary fields are calculated from fields in multiple tables;
[0073] In the embodiment of the present invention, considering that the calculation rules may involve joint operations of tables or fields in tables, temporary fields or temporary fields will inevitably be generated. Therefore, in the embodiment of the present invention, these temporary fields are also considered within the scope.
[0074] In order to identify the above-mentioned fields, the following steps may also be performed during the execution of step b4:
[0075] Step 1: Extract each SQL statement recorded in the calculation rule and integrate it into multiple nested SQL statements, where each SQL statement represents an output table;
[0076] Step 2: Parse multiple nested SQL statements into a syntax tree, and determine the directly used table fields, generated temporary fields and / or temporary tables from the syntax tree.
[0077] In the actual implementation process, the system can extract the corresponding SparkSQL / SQL statements from the "plan" field in the intent information table and integrate them into multiple nested SQL statements. Then, use Python's sqlglot library to parse these SQL statements and convert them into syntax trees to extract the expressions in SQL. In this way, the system can directly identify temporary fields. For example, if the aggregation operation identifier "func" is used in the SQL expression, such as count(), sum(), avg(), etc., then the table or field obtained after the aggregation operation is performed is a temporary table or temporary field.
[0078] After determining a series of used fields, the system can match them with the fields in the source table information table to confirm whether these used fields are in the source table information table and have expandable sample marks, and then determine whether these fields are expandable sample fields. Therefore, the implementation method of the above step b4 can be:
[0079] If the used field is a field in the table, and if the used field is located in the source table information table and has an expandable flag, it is determined that the used field is an expandable field.
[0080] If the used field is a temporary field, if multiple fields that generate the temporary field are located in the source table information table and have an expandable sample flag, it is determined that the used field is an expandable sample field.
[0081] For example, if the expression in SQL uses fields from the table, you need to determine whether these fields exist in the source table information table and whether they are marked as expandable. If the expression uses aggregate functions, such as count(), you need to determine whether the table name specified in the brackets appears in the source table information table and whether it is marked as expandable; for functions such as sum() or avg(), you need to check whether the fields involved in the operation are listed in the source table information table and whether they are marked as expandable.
[0082] Step b5: If yes, create an expandable sample column and an expandable sample mark column corresponding to the intent of the use field, and use the use field and the expandable sample mark as the column values of the expandable sample column and the expandable sample mark column; otherwise, leave the expandable sample column and the expandable sample mark column corresponding to the intent empty;
[0083] Step b6: Generate an extended sample table based on the extendable sample column and extendable sample mark column corresponding to each intent.
[0084] After determining in step b4 whether the used field of each intention is an expandable sample field, an empty expandable sample table can be created, which has an intention identification column, an expandable sample column, and an expandable sample mark column. The expandable sample column includes a population-related field column and a district and county-related field column. If the used field is a population-related field and / or a district and county field, the population-related field column and the district and county-related field column are filled in respectively, and the expandable sample mark value is filled in the expandable sample mark column.
[0085] For the convenience of description, the embodiment of the present invention refers to the scaled sample table generated through the process of step b1 to step b6 as "scale_conf_v2". For the convenience of intuitive understanding, Table 5 shows an example of "scale_conf_v2".
[0086] Table 5
[0087]
[0088] In Table 5, xq_id represents the intent identifier, and the expandable columns include the population-related field column and the district and county-related field column. scale_cols represents the population-related field column, is_scale represents the expansion mark column, and zone_cols represents the district and county-related field column. It can be seen that for a certain intent, it may not have the population-related field and the district and county-related field, and the corresponding column values of the population-related field column and the district and county-related field column are both empty. There may also be only the population-related field but no district and county-related field, or only the expandable district and county-related field but no population-related field, and the corresponding column value of one of the population-related field column and the district and county-related field column is empty, or there are both population-related fields and district and county-related fields, and the corresponding column values of the population-related field column and the district and county-related field column are not empty.
[0089] It is worth emphasizing that the first solution (i.e., generating "scale_conf_v1") is based on the expansion of field names, which means that all population-related fields need to be expanded. The second solution (i.e., generating "scale_conf_v2") involves the introduction of multi-source data such as the Seventh National Census data. These data are already national statistical values, not from a single data source of mobile phone signaling operators. Therefore, this part of population data does not need to be expanded. However, given the need to adapt to multi-source data and considering the new population and county fields that may appear in the source table in the future, these fields may not be recognized by the first solution. Therefore, the source table information table can be configured in the second solution to flexibly specify which are population indicators and which are county indicators. The first solution can identify the population and county fields, and the second solution is more flexible, accurate and scalable in building an expansion system. The specific solution to generate the expansion table can be flexibly selected by the user according to actual needs, and is not limited here.
[0090] Next, the present invention will introduce how to use the above pre-generated sample expansion tables, namely the "scale_conf_v1" and "scale_conf_v2" samples, to perform the population expansion process. Figure 2 , Figure 2 A schematic flow chart of a population data expansion method provided in an embodiment of the present invention includes the following process:
[0091] S201: receiving a query statement related to the number of people and matching the query intent of the number of people;
[0092] S202: Based on the obtained sample expansion table, determine whether there is an expandable sample field for the number of people query intent; wherein the sample expansion table maintains the target intent for population expansion and the expandable sample field corresponding to the target intent.
[0093] S203: If it exists, combine the key data associated with the number of people query intention, execute the calculation rule corresponding to the number of people query intention, and obtain the initial number of people query result corresponding to the expandable sample field;
[0094] S204: Expanding the initial population query result based on a preset population expansion coefficient to obtain an expanded population result;
[0095] S205: Output the initial number query result and the expanded number query result.
[0096] In the above-mentioned population expansion method provided by the embodiment of the present invention, the system first receives and matches the user's query intent. Subsequently, the system uses the expansion table to determine whether there are fields suitable for population expansion in the query intent. This expansion table maintains the target intent and its corresponding expandable fields, providing a basis for subsequent operations. If there are expandable fields, the system will execute the corresponding calculation rules in combination with the key data to generate the initial number of people query results. Then, the system expands these initial results according to the preset population expansion coefficient to obtain a more accurate headcount. Finally, the system output includes the initial query results and the number of people after expansion. This process not only improves the accuracy of data processing, but also provides users with two result options, meets the needs of different users, and thus enhances the practicality and flexibility of the system.
[0097] The following embodiments of the present invention will provide a clear and detailed introduction to the above steps in conjunction with relevant drawings and tables.
[0098] In step S201, Figure 1 It can be seen that the query statements related to population are provided by users. After receiving the query statements related to population, the system can perform intent matching and determine the query intention of the number of people.
[0099] In the embodiment of the present invention, after determining the number of people's query intention, the system can also obtain key data related to the intention by asking further questions, which is used for subsequent calculation and sample expansion.
[0100] In S202, based on the obtained sample expansion table, it is determined whether there is an expandable sample field for the number of people query intent; wherein the sample expansion table is used to maintain the target intent for population expansion and the expandable sample fields corresponding to the target intent.
[0101] In the embodiment of the present invention, in the expanded sample table, the expandable sample fields include population-related fields, or population-related fields and district-county-related fields. For example, for scale_conf_v1, as shown in Table 3, the expandable sample fields corresponding to the intent "compute_subUI_visitor_gender_by_polygon" only include the population-related fields "ucnt" and "number of people", while the expandable sample fields corresponding to the intent "find_admin_work_disteibute_heat" include the population-related fields "ucnt" and "number of people", and the district-county-related field "address_country".
[0102] In the specific implementation process, after determining the number of people query intention, scale_conf_v1 or scale_conf_v2 in the above implementation can be used to determine whether the intention has an expandable sample field. For example, all the intentions that can be expanded in population are recorded in scale_conf_v1, so it can be checked whether the number of people query intention is in scale_conf_v1. If it is, it must have an expandable sample field, that is, the expansion sample column information.
[0103] In scale_conf_v2, all preset intents and the expandable sample columns and column values of each intent are recorded. Therefore, you can first find the number query intent in scale_conf_v2, and then check whether there are expandable sample fields in the corresponding expandable sample columns. For example, referring to Table 5, if the intent is "compute_subUI_ find_ population_distribute_by_polygon_heat", then there are no expandable sample fields in the corresponding expandable sample columns. If the intent is "find_adminstrative_code_ less_than_a_farmers_data", then it has both the population-related field "count" and the district and county-related field "fnid".
[0104] If it is determined through the above implementation that the number of people query intent does not have an expandable sample field, then the calculation rule corresponding to the intent is directly executed to obtain the initial number of people query result and output it to the user. If it does exist, then step S203 can be executed.
[0105] In step S203, if there is an expandable field for the number of people query intention, the key data associated with the number of people query intention can be combined first, the calculation rules corresponding to the number of people query intention can be executed, the initial number of people query result corresponding to the expandable field can be obtained, and then the sample can be expanded.
[0106] In one embodiment of the present invention, the key data associated with the query intent of the number of people is the key information associated with the query intent obtained by the system through follow-up questions after confirming the query intent of the user. For example, see Figure 1 , when the system determines that the user's query intention is "query the number of industrial parks according to province, city and time", it continues to output inquiry statements: "Please tell me your city", "Please confirm the observation period you need, you can enter a time period, such as May 2023-June 2023, or a specific date, such as 20230501", etc. to obtain key data related to the intention of "query the number of industrial parks according to province, city and time", such as city, time, etc. The specific calculation process can be referred to the prior art, which will not be repeated here. The query result based on the initial number of people obtained can be expanded, that is, step S204 is executed.
[0107] In step S204, the initial population query result is expanded based on a preset population expansion coefficient to obtain an expanded population result. The preset population expansion coefficient refers to the expansion coefficient in the expansion coefficient rule table described above.
[0108] From step S202, the embodiment of the present invention has determined that the number query intent has expandable sample fields, and the expandable sample fields may be population-related fields, or population-related fields and district and county-related fields. For example, referring to Table 3, for the intent "compute_subUI_visitor_gender_by_polygon", it can be seen from the expandable sample column that it only has population-related fields "ucnt" and "number of people", while the expandable sample column of the intent "find_admin_work_disteibute_heat" has both population-related fields "ucnt" and "number of people" and district and county-related fields "address_country". For another example, referring to Table 5, the expandable sample column of the intent "find_admin_population_disteibute_heat" only has the population-related field "count", but the column value of the district and county-related field column is empty, indicating that it only has population-related fields.
[0109] There are different processing methods for the above two situations, that is, the implementation method of step S204 includes the following process:
[0110] Step c1: If the number query intention in the expanded sample table only has population-related fields, the initial number query result is expanded based on a preset fixed population expansion coefficient value;
[0111] Step c2: If the number query intention in the expanded sample table has both population-related fields and district-county related fields, determine the target population expansion coefficient corresponding to the district-county related fields from the pre-set expansion coefficient rule table, and then expand the initial number query results based on the target population expansion coefficient.
[0112] In the embodiment of the present invention, after obtaining an intended initial number of people query result by calculation, the initial number of people query result may be multiplied by a corresponding sample expansion coefficient to obtain a sample expanded result.
[0113] Through the above implementation, it can be found that in the embodiment of the present invention, if an intended expandable field is only a population-related field, and there is no district and county-related field, then a fixed population expansion coefficient is used for expansion. If there are both population-related fields and district and county-related fields, then the expansion coefficient of the actual district and county corresponding to the district and county-related field is found from the preset expansion coefficient rule table, and then expansion is performed.
[0114] In one embodiment of the present invention, the implementation of step S204 may also include the following process:
[0115] Step d1: When the number of people query intent has key data and the key data contains a key district and county field, determine whether the key district and county field is consistent with the district and county related field corresponding to the number of people query intent in the expanded sample table;
[0116] Step d2: If there is inconsistency, the initial population query result is expanded based on the population expansion coefficient corresponding to the key district and county fields.
[0117] That is to say, if the key data input by the user also contains district and county information, the district and county information will be used directly and preferentially, that is, the district and county information input by the user has a higher priority than the district and county information built into the system.
[0118] After completing the sample expansion through step S204, the system can simultaneously output the query results before and after the sample expansion. When outputting the query results after the sample expansion, the expanded population field column can be added on the basis of the original output results to write the query results after the sample expansion, thereby completing the basic question and answer through the dialogue question and answer service while automatically providing the expanded value.
[0119] To understand the sample expansion effect of the embodiment of the present invention, please refer to Figure 3 and Figure 4 , Figure 3 The sample provided by the embodiment of the present invention does not require population expansion. Figure 4 The sample for population expansion provided in the embodiment of the present invention.
[0120] exist Figure 3 In , the system confirms that the intent to be queried is "Shanghai's permanent population situation", and the calculation results are displayed on the interface in a form that is easy for users to understand. It can be seen that the system determines that the "total population field" of the intent is not an expandable field, so in the output calculation results, including the total population of Shanghai and the total population information corresponding to each district and county, these total population information are not expanded, providing users with rich and detailed query results. Figure 4 In the query, the system confirms that the intent to be queried is "passenger flow in Beijing's business districts" and obtains the key data "20230901" and "Xidan" through follow-up questions. The system then determines that the return field "passenger flow" corresponding to the intent is an expandable field. The output calculation results include the total number of visitors to various business districts in Beijing and "Xidan" and the number of visitors after expansion, thereby completing the effect of automatically providing expanded values while realizing basic questions and answers through dialogue question and answer services.
[0121] In order to execute the corresponding steps in the above embodiments and various possible methods, a method for implementing the dialogue question answering system 30 is given below. Figure 5 , Figure 5 This is a functional module diagram of the dialogue question-answering system provided in an embodiment of the present invention. It should be noted that the basic principle and technical effects of the dialogue question-answering system 30 provided in this embodiment are the same as those in the above-mentioned embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above-mentioned embodiments. The dialogue question-answering system 30 includes: an input module 301, a determination module 302, a calculation module 303, an expansion module 304 and an output module 305;
[0122] Input module 301, used to receive a query sentence related to the number of people and match the query intention of the number of people;
[0123] Determination module 302, for determining whether there is an expandable sample field for the population query intent based on the obtained expansion sample table; wherein the expansion sample table maintains a target intent for population expansion and an expandable sample field corresponding to the target intent;
[0124] The calculation module 303 is used to execute the calculation rules corresponding to the number of people query intention in combination with the key data associated with the number of people query intention, if any, to obtain the initial number of people query result corresponding to the expandable sample field;
[0125] The sample expansion module 304 is used to expand the initial population query result based on a preset population sample expansion coefficient to obtain an expanded population result;
[0126] The output module 305 is used to output the initial number query result and the expanded number query result.
[0127] It is understandable that the input module 301, the determination module 302, the calculation module 303, the sample expansion module 304 and the output module 305 can be executed in coordination. Figure 2 Each step in the process is performed to achieve the corresponding technical effect.
[0128] In an optional implementation, the expandable fields include population-related fields, or population-related fields and district and county-related fields; the expansion module 304 is specifically used to expand the initial number of people query results based on a preset fixed population expansion coefficient value if the number of people query intention in the expanded table only has population-related fields; if the number of people query intention in the expanded table has both population-related fields and district and county-related fields, the target population expansion coefficient corresponding to the district and county field is determined from a preset expansion coefficient rule table, and then the initial number of people query results are expanded based on the target population expansion coefficient.
[0129] In an optional implementation, the sample expansion module 304 is also specifically used to determine whether the key district and county fields are consistent with the district and county related fields corresponding to the number of people query intention in the sample expansion table when there is key data for the number of people query intention and there is a key district and county field in the key data; if they are inconsistent, the initial number of people query results are expanded based on the population sample expansion coefficient corresponding to the key district and county field.
[0130] It should be noted that the division of modules in the above embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.
[0131] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable an electronic device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program executable code.
[0132] The embodiment of the present invention further provides an electronic device 40, see Figure 6 , Figure 6 The electronic device 40 is a block diagram of a structure of an electronic device provided in an embodiment of the present invention, and includes a memory 401, a processor 402, and a communication interface 403. The memory 401, the processor 402, and the communication interface 403 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0133] Optionally, the bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0134] In the embodiment of the present invention, the processor 402 may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in the embodiment of the present invention. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor. The software module may be located in the memory 401, and the processor 402 reads the program instructions in the memory 401 and completes the steps of the above method in combination with its hardware.
[0135] In the embodiment of the present invention, the memory 401 may be a non-volatile memory, such as a hard disk (HDD) or a solid-state drive (SSD), etc., or a volatile memory (Volatile Memory), such as RAM. The memory may also be any other medium that can be used to carry or store the desired program executable code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory in the embodiment of the present invention may also be a circuit or any other device that can realize a storage function, for storing instructions and / or data.
[0136] The memory 401 can be used to store software programs and modules, such as the instructions / modules of the dialogue question-answering system 30 provided in the embodiment of the present invention, which can be stored in the memory 401 in the form of software or firmware (Firmware) or fixed in the operating system (OS) of the electronic device 40. The processor 402 executes various functional applications and data processing by executing the software programs and modules stored in the memory 401. The communication interface 403 can be used to communicate signaling or data with other node devices.
[0137] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0138] Understandably, Figure 6 The structure shown is for illustration only. The electronic device 40 may also include Figure 6 More or fewer components as shown, or with Figure 6 Different configurations are shown. Figure 6 The components shown may be implemented in hardware, software or a combination thereof.
[0139] The electronic device 40 may also include a network device, which includes, but is not limited to, a single game server, a server group consisting of multiple game servers, or a cloud consisting of a large number of hosts or game servers based on cloud computing.
[0140] Based on the above embodiments, the present application further provides a storage medium, in which a computer program is stored. When the computer program is executed by a computer, the computer executes the population data expansion method provided in the above embodiments.
[0141] Based on the above embodiments, an embodiment of the present invention further provides a computer program. When the computer program is run on a computer, the computer executes the population data expansion method provided in the above embodiments.
[0142] Based on the above embodiments, an embodiment of the present invention further provides a chip, which is used to read a computer program stored in a memory and to execute the population data expansion method provided in the above embodiments.
[0143] An embodiment of the present invention also provides a computer program product, including instructions, which, when executed on a computer, enables the computer to execute the population data expansion method provided in the above embodiment.
[0144] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by instructions. These instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0145] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0146] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0147] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A population data expansion method, characterized in that: The method comprises: Receive query statements related to the number of people and match the query intent of the number of people; Based on the obtained sample expansion table, determine whether the number query intent has a sample expansion field; wherein the sample expansion table maintains a target intent for population expansion and a sample expansion field corresponding to the target intent; If it exists, combining the key data associated with the number of people query intention, executing the calculation rule corresponding to the number of people query intention, and obtaining the initial number of people query result corresponding to the expandable sample field; Expanding the initial population query result based on a preset population expansion coefficient to obtain an expanded population result; Outputting the initial number query result and the expanded number query result; When it is necessary to adapt to multi-source data and new population and county fields that may appear in the source table in the future, a method for obtaining an expanded sample table includes: configuring an expandable sample mark for the source field in the source table information table that can be expanded for population; the source table information includes the source table and source field directly recorded in each calculation rule; for each intention, judging whether the used field in the process of executing the calculation rule is an expandable sample field based on the source table information table; wherein the used field is any one of the following and a combination thereof: a field in the table and a temporary field, the field in the table also includes a return field and / or a county field; the temporary field is calculated by a plurality of fields in the table; if so, creating an expandable sample column and an expandable sample mark column of the intention corresponding to the used field, and using the used field and the expandable sample mark as the column values of the expanded sample column and the expandable sample mark column; otherwise, setting the expandable sample column and the expandable sample mark column corresponding to the intention to empty; generating the expanded sample table based on the expandable sample column and the expandable sample mark column corresponding to each intention.
2. The method for expanding population data according to claim 1, characterized in that: The expandable sample fields include population-related fields, or the population-related fields and district and county-related fields; The initial population query result is expanded based on a preset population expansion coefficient to obtain an expanded population result, including: If the number query intention in the expanded sample table only has the population-related field, the initial number query result is expanded based on a preset fixed population expansion coefficient value; If the number query intention in the expanded sample table has both the population-related fields and the district and county-related fields, the target population expansion coefficient corresponding to the district and county-related fields is determined from the pre-set expansion coefficient rule table, and then the initial number query result is expanded based on the target population expansion coefficient.
3. The method for expanding population data according to claim 2, characterized in that: The initial population query result is expanded based on a preset population expansion coefficient to obtain an expanded population result, further comprising: When the number query intent has key data and the key data contains a key district field, determine whether the key district field is consistent with the district-related field corresponding to the number query intent in the expanded sample table; If they are inconsistent, the initial population query result is expanded based on the population expansion coefficient corresponding to the key district and county field.
4. The method for expanding the population data sample according to any one of claims 1 to 3, characterized in that: When all population-related fields need to be expanded, the method of obtaining the expanded sample table includes: Obtaining an intent information table; wherein the intent information table includes each preset intent and a return field corresponding to each intent; Determine the intent corresponding to the returned field containing a population-related field, or containing both a population-related field and a district / county-related field, as the target intent; Based on the population-related field of the target intent, or the population-related field and the district and county-related field, generate expandable sample column information corresponding to the target intent; The expanded sample table is generated based on all the target intents and the expandable sample column information.
5. The method for expanding population data according to claim 1, characterized in that: The method for obtaining the expanded sample table also includes: Obtaining an intent information table; wherein the intent information table includes various preset intents and calculation rules corresponding to each intent; Generate the source table information table according to the calculation rules of all intentions; wherein the source fields include the table fields and / or the district and county fields of the source table; 6. The method for expanding population data according to claim 1, characterized in that: For each intent, judging whether a used field in the process of executing the calculation rule is an expandable field based on the source table information table includes: If the used field is a field in the table, and if the used field is located in the source table information table and has the expandable sample flag, determining that the used field is an expandable sample field; If the used field is the temporary field, and if a plurality of fields generating the temporary field are located in the source table information table and have the expandable flag, it is determined that the used field is an expandable field.
7. The method for expanding population data according to claim 1, characterized in that: For each intent, before determining whether a used field in the process of executing the calculation rule is an expandable field based on the source table information table, the method further includes: Extract each sql statement recorded in the calculation rule and integrate them into multiple nested sql statements, where each sql statement represents an output table; The nested multiple SQL statements are parsed into a syntax tree, and the directly used table fields, the generated temporary fields and / or temporary tables are determined from the syntax tree.
8. A dialogue question-answering system, characterized in that: include: Input module, determination module, calculation module, sample expansion module and output module; The input module is used to receive a query statement related to the number of people and match the query intention of the number of people; The determination module is used to determine whether there is an expandable sample field for the number of people query intention based on the obtained expansion sample table; wherein the expansion sample table maintains a target intention for population expansion and an expandable sample field corresponding to the target intention; The calculation module is used to, if present, execute the calculation rule corresponding to the number of people query intention in combination with the key data associated with the number of people query intention, and obtain the initial number of people query result corresponding to the expandable sample field; The sample expansion module is used to expand the initial population query result based on a preset population sample expansion coefficient to obtain an expanded population result; The output module is used to output the initial number query result and the expanded number query result; When it is necessary to adapt to multi-source data and new population and county fields that may appear in the source table in the future, a method for obtaining an expanded sample table includes: configuring an expandable sample mark for the source field in the source table information table that can be expanded for population; the source table information includes the source table and source field directly recorded in each calculation rule; for each intention, judging whether the used field in the process of executing the calculation rule is an expandable sample field based on the source table information table; wherein the used field is any one of the following and a combination thereof: a field in the table and a temporary field, the field in the table also includes a return field and / or a county field; the temporary field is calculated by a plurality of fields in the table; if so, creating an expandable sample column and an expandable sample mark column of the intention corresponding to the used field, and using the used field and the expandable sample mark as the column values of the expanded sample column and the expandable sample mark column; otherwise, setting the expandable sample column and the expandable sample mark column corresponding to the intention to empty; generating the expanded sample table based on the expandable sample column and the expandable sample mark column corresponding to each intention.
9. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor can execute the machine executable instructions to implement the population data expansion method described in any one of claims 1 to 7.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the population data expansion method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Intercity travel sample expansion method based on mobile phone signaling data
CN114466313A