Information retrieval method and device based on natural language processing and electronic equipment

Through natural language processing technology, the search text entered by users is analyzed and automated, which solves the problem of inefficient information retrieval in the existing technology and realizes efficient and low professional information retrieval.

CN120123459APending Publication Date: 2025-06-10RICHFIT INFORMATION TECH +1
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202311659927.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-05
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

In the prior art, users need to be highly professional in order to effectively search information in massive structured data, resulting in inefficient search efficiency.

Method used

The information retrieval method based on natural language processing is adopted to analyze the search text input by the user through natural language processing technology, automatically generate combined search conditions and convert them into standard formats, and then search results from the database to be queried.

Benefits of technology

No users need to care about the data source and acquisition methods, which significantly improves the efficiency of information retrieval and reduces professional requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120123459A_ABST
    Figure CN120123459A_ABST
Patent Text Reader

Abstract

The invention provides an information retrieval method and device based on natural language processing and electronic equipment. The method comprises the steps that a retrieval text input by a user is acquired; the retrieval text is analyzed in a natural language processing mode, a combined retrieval condition and a retrieval projection are obtained, and the retrieval projection is a result field needing to be returned for retrieval; the combined retrieval condition is converted into a standard format, a target combined retrieval condition is generated, and the standard format is a format which is defined by the database to be queried and used for achieving data query; and determining a retrieval result conforming to the retrieval text from the to-be-queried database by utilizing the target combination retrieval condition and the retrieval projection. According to the method, the retrieval requirement of the user is analyzed in a natural language processing mode, the query is automatically completed, and the retrieval result is returned, so that the user does not need to care about a data source and an acquisition way, and the query efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of information processing technologies, and in particular, to an information retrieval method, apparatus, and electronic device based on natural language processing. Background Art

[0002] After years of informatization, PetroChina has accumulated a large amount of structured data in various business systems. These data are diverse in types and cover various business fields such as design, exploration, exploitation, production, sales, safety, and management. Due to the scattered, multi-application, and wide-technology nature of the accumulated data, it requires personnel familiar with the business to find and query the corresponding data from the corresponding applications. The relationship can be summarized as "professional personnel - professional applications - professional data".

[0003] Common data retrieval methods require users to input business / subject domains, business tables, fields, query conditions, etc., and then perform subsequent query processing based on the query data input by the users. Specifically, it is necessary to screen out a target business table that meets the query data from thousands of business tables. Such a retrieval method has very high professional requirements for query personnel, is very inconvenient for personnel to use, and greatly reduces the retrieval efficiency. Summary of the Invention

[0004] In view of this, the purpose of this application is to provide at least one information retrieval method, apparatus, and electronic device based on natural language processing. By parsing the user's retrieval requirements through natural language processing, the query is automatically completed and the retrieval results are returned, enabling users to be unaware of the data sources and acquisition methods and improving the query efficiency.

[0005] This application mainly includes the following aspects:

[0006] In the first aspect, an embodiment of this application provides an information retrieval method based on natural language processing. The method includes: obtaining a retrieval text input by a user; parsing the retrieval text using natural language processing to obtain a combined retrieval condition and a retrieval projection, where the retrieval projection is the result field that needs to be returned by the retrieval; converting the combined retrieval condition into a standard format to generate a target combined retrieval condition, where the standard format is the format defined by the database to be queried for implementing data queries; and using the target combined retrieval condition and the retrieval projection to determine retrieval results that meet the retrieval text from the database to be queried.

[0007] In a possible implementation, the combined retrieval condition is determined in the following manner: perform word segmentation on the retrieval text to obtain multiple words; add part-of-speech tags to each word, where the part-of-speech tag indicates the corresponding part of speech of the word; remove stop words from the multiple words to obtain multiple words to be processed, and stop words are words that do not affect the original semantics of the retrieval text; extract at least one retrieval condition from the multiple words to be processed according to multiple preset grammar rules; generate a combined retrieval condition according to the at least one retrieval condition.

[0008] In a possible implementation, the preset grammar rules include multiple grammar fragments arranged in order, and each grammar fragment includes a word or a part-of-speech tag. Among them, for each preset grammar rule, the following operations are performed: match the multiple words to be processed with the multiple grammar fragments corresponding to the preset grammar rule; in the multiple words to be processed, if there is a target word sequence that conforms to the preset grammar rule, it is determined that the target word sequence matches the preset grammar rule successfully, and a corresponding retrieval condition is generated according to the preset grammar rule and the target word sequence; in the multiple words to be processed, if there is no target word sequence that conforms to the preset grammar rule, it is determined that no retrieval condition corresponding to the preset grammar rule can be extracted from the multiple words to be processed, and the matching fails.

[0009] In a possible implementation, generating a combined retrieval condition according to at least one retrieval condition includes: removing the words that participate in generating the retrieval condition from the multiple words to be processed to obtain the remaining words; determining a retrieval projection among the remaining words; for each remaining word, if the part-of-speech tag corresponding to the remaining word is a dictionary, extract the dictionary value corresponding to the remaining word and form a corresponding retrieval condition together with the remaining word; determining the logical relationship between the multiple retrieval conditions according to the conjunctions and their positions corresponding to the remaining words; generating a combined retrieval condition according to the multiple retrieval conditions and the logical relationship between the retrieval conditions.

[0010] In a possible implementation, the method further includes: analyzing the remaining words other than those participating in forming the combined retrieval condition, and determining whether there are words with part-of-speech tags of nouns or verbs in the remaining words; if there are words with part-of-speech tags of nouns or verbs in the remaining words, a parsing failure prompt is given.

[0011] In a possible implementation, the database to be queried includes multiple data tables. Among them, converting the combined retrieval condition into a standard format to generate a target combined retrieval condition includes: for each retrieval condition in the combined retrieval condition, converting each word corresponding to the retrieval condition into the corresponding standard word format; converting the logical relation operator in the combined retrieval condition into the equivalent logical operator corresponding to the database to be queried; for each retrieval condition in the combined retrieval condition, converting the retrieval condition into the equivalent retrieval condition corresponding to the database to be queried; and generating the converted target combined retrieval condition.

[0012] In a possible implementation, using the target combined retrieval condition and the retrieval projection to determine the retrieval result that meets the retrieval text from the database to be queried includes: determining the data tables in which there are fields corresponding to the retrieval projection among the multiple data tables as the first candidate data tables; converting the field names corresponding to each field in the first candidate data tables into the corresponding standard format; using the combined retrieval condition to screen out the second candidate data tables from the multiple first candidate data tables; if there is at least one second candidate data table, randomly selecting one from the at least one second candidate data tables as the target data table, and extracting the data values corresponding to the retrieval projection in the target data table and returning them to the user side; if there is no second candidate data table, returning that the retrieval result is empty and giving a retrieval out-of-range prompt.

[0013] In a second aspect, an information retrieval device based on natural language processing is further provided in an embodiment of the present application. The device includes: an acquisition module, configured to acquire the retrieval text input by the user; an analysis module, configured to analyze the retrieval text by using natural language processing to obtain a combined retrieval condition and a retrieval projection, where the retrieval projection is the result field that needs to be returned by the retrieval; a conversion module, configured to convert the combined retrieval condition into a standard format to generate a target combined retrieval condition, and the standard format is the format defined by the database to be queried for implementing data query; and a query module, configured to use the target combined retrieval condition and the retrieval projection to determine the retrieval result that meets the retrieval text from the database to be queried.

[0014] In a third aspect, an electronic device is further provided in an embodiment of the present application, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device runs, communication is carried out between the processor and the memory through the bus. When the machine-readable instructions are run by the processor, the steps of the information retrieval method based on natural language processing in the first aspect or any possible implementation manner in the first aspect are executed.

[0015] Fourthly, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it executes the steps of the information retrieval based on natural language processing in the first aspect or any possible implementation manner in the first aspect.

[0016] An information retrieval method, device and electronic device based on natural language processing provided by an embodiment of the present application include: obtaining a retrieval text input by a user; parsing the retrieval text by using a natural language processing method to obtain a combined retrieval condition and a retrieval projection, where the retrieval projection is a result field that needs to be returned by the retrieval; converting the combined retrieval condition into a standard format to generate a target combined retrieval condition, and the standard format is a format for implementing data query defined by the database to be queried; and determining a retrieval result that meets the retrieval text from the database to be queried by using the target combined retrieval condition and the retrieval projection. The present application parses the user's retrieval requirements by using a natural language processing method, automatically completes the query and returns the retrieval result, so that the user does not need to care about the data source and the acquisition method, improving the query efficiency.

[0017] To make the above objects, features and advantages of the present application more obvious and understandable, the following specifically enumerates preferred embodiments and, in conjunction with the accompanying drawings, the detailed description is as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.

[0019] Figure 1 Shows a flowchart of an information retrieval method based on natural language processing provided by an embodiment of the present application;

[0020] Figure 2 Shows one of the flowcharts of a method for determining a retrieval condition provided by an embodiment of the present application;

[0021] Figure 3 Shows another flowchart of a method for determining a retrieval condition provided by an embodiment of the present application;

[0022] Figure 4 Shows a functional module diagram of an information retrieval device based on natural language processing provided by an embodiment of the present application;

[0023] Figure 5 Shows a schematic structural diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0024] To make the objectives, technical solutions and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. It should be understood that the accompanying drawings in this application are only for the purposes of illustration and description, and are not used to limit the protection scope of this application. In addition, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate the operations implemented according to some embodiments of this application. It should be understood that the operations in the flowchart may not be implemented in sequence, and steps without logical context relationships may be reversed or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart or remove one or more operations from the flowchart under the guidance of the content of this application.

[0025] In addition, the described embodiments are only some embodiments of this application, rather than all embodiments. The components of the embodiments of this application usually described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of this application claimed, but only represents the selected embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative efforts fall within the protection scope of this application.

[0026] In the field of oil information processing, for common data retrieval methods, users need to enter the data query page. The data query page includes a large number of different types of business themes and different types of business tables under the business themes. The business tables contain different fields. Users need to find the business / theme domain, business table, field, query conditions, etc. that need to be queried among a large number of business themes and business tables, and then perform subsequent queries. Such a retrieval method requires the retrieval personnel to select various parameters for query retrieval from a very professional perspective, which not only has very high professional requirements for the query personnel, but also greatly reduces the retrieval efficiency.

[0027] Based on this, the embodiments of this application provide an information retrieval method, device and electronic device based on natural language processing. By parsing the user's retrieval requirements in a natural language processing manner, the query is automatically completed and the retrieval results are returned, enabling users to not care about the data source and acquisition method, and improving the query efficiency. Specifically as follows:

[0028] Please refer to Figure 1 , Figure 1 which shows a flowchart of an information retrieval method based on natural language processing provided by the embodiments of this application. As Figure 1 shown, the method provided by the embodiments of this application includes the following steps:

[0029] S100. Obtain the retrieval text input by the user.

[0030] S200. Parse the retrieval text using natural language processing to obtain combined retrieval conditions and a retrieval projection.

[0031] Among them, the retrieval projection is the result field that the retrieval needs to return.

[0032] S300. Convert the combined retrieval conditions into a standard format to generate target combined retrieval conditions.

[0033] Among them, the standard format is the format defined by the database to be queried for implementing data queries.

[0034] S400. Use the target combined retrieval conditions and the retrieval projection to determine the retrieval results that meet the retrieval text from the database to be queried.

[0035] In step S100, the present application can obtain the retrieval text input by the user through a preset human-machine conversation interface. Specifically, the preset human-machine conversation interface is connected to the voice interaction module and the intelligent screen, enabling the user to input the retrieval text by voice or directly input the corresponding retrieval text through the intelligent screen.

[0036] In step S200, it is necessary to parse the retrieval text input by the user. Specifically, the main method is to use natural language processing to extract the core elements corresponding to the retrieval text from the retrieval text. Among them, the core elements include combined retrieval conditions and a retrieval projection.

[0037] In the present application, if the parsing is successful, the final parsing result includes the retrieval result display method, the retrieval projection, the combined retrieval conditions, and the remaining word segmentation. During the parsing process, the display method is the display form of the final retrieval result on the user side, which is preset and can be directly read from the preset storage location. The display methods include, but are not limited to, lists, pie charts, and bar charts.

[0038] In step S300, for different types of databases to be queried, the data formats corresponding to the retrieval conditions defined for data queries or retrievals inside them are different. Only by using the data format defined inside the database to be queried itself can data retrieval be completed in the database to be queried. If the generated retrieval conditions do not conform to the data format defined by the database to be queried, the retrieval cannot be completed, and a retrieval failure prompt will be generated and returned to the user side. Therefore, before formally retrieving in the database to be queried, the present application needs to convert the parsed retrieval conditions into the standard format corresponding to the database to be queried so that the retrieval results can be successfully obtained in the database to be queried.

[0039] In step S400, in the database to be queried, use the target combination retrieval condition to search for the target data table that meets this retrieval, and return the data corresponding to the retrieval projection in the target data table to the user side as the retrieval result to complete the retrieval.

[0040] In steps S100 to S400, the core of the entire processing process lies in reducing the process of professional personnel manually entering screening conditions. The retrieval requirements of the user are directly parsed through natural language processing, and the query is automatically completed and the retrieval result is returned, enabling the user to not care about the data source and acquisition method, and improving the query efficiency.

[0041] In specific implementation, please refer to Figure 2 , Figure 2 FIG. 1 shows one of the flowcharts of a method for determining a retrieval condition provided by an embodiment of the present application. As Figure 2 shown, the present application determines the retrieval condition in the following manner:

[0042] S210. Perform word segmentation processing on the retrieval text to obtain a plurality of words.

[0043] S220. Add part-of-speech tags to each word.

[0044] Among them, the part-of-speech tag indicates the part of speech corresponding to the word.

[0045] S230. Remove stop words from the plurality of words to obtain a plurality of words to be processed.

[0046] Among them, the stop word is a word that does not affect the original semantics of the retrieval text;

[0047] S240. Extract at least one retrieval condition from the plurality of words to be processed according to a plurality of preset grammar rules.

[0048] S250. Generate a combined retrieval condition according to at least one retrieval condition.

[0049] In one example, taking the retrieval text "What are the production methods of Well Tazhong 161 in 2022?" as an example, the process of determining the corresponding combined retrieval conditions is as follows: First, the retrieval text is segmented to obtain the following words: "2022", "Tazhong 161", "Well", "of", "production method", "are", "which", and "?", and then these words are part-of-speech tagged, and after tagging, we get: "2022 / DATETIME", "Tazhong 161 / xav = dic: well name", "Well / xan", "of / u", "production method / xan", "are / v", "which / rq", "? / w", where, n represents a noun, v represents a verb, DATETIME represents date and time, xan represents an attribute name, xav represents a standard value or dictionary value. For example, in "Tazhong 161 / xav = dic: well name", the part-of-speech tag corresponding to the word "Tazhong 161" is "xav = dic: well name", indicating that the part of speech of "Tazhong 161" in the dictionary dic is well name, u represents a particle, rq represents a pronoun, and w represents a modal particle.

[0050] Then, stop words "Well / xan", "of / u", "are / v", "which / rq", "? / w" are removed from the above multiple words, and finally multiple words to be processed "2022 / DATETIME", "Tazhong 161 / xav = dic: well name" and "production method / xan" are obtained. Then, according to the preset grammar rules, at least one retrieval condition is extracted from the above words to be processed, and a combined retrieval condition is formed from the extracted retrieval conditions.

[0051] In a preferred embodiment, the preset grammar rules include multiple grammar fragments arranged in order, and each grammar fragment includes a word and / or a part-of-speech tag. Among them, for each preset grammar rule, the following is executed:

[0052] The multiple words to be processed are matched with the multiple grammar fragments corresponding to the preset grammar rule. Among the multiple words to be processed, if there exists a target word sequence that conforms to the preset grammar rule, it is determined that the target word sequence matches the preset grammar rule successfully, and according to the preset grammar rule and the target word sequence, a corresponding retrieval condition is generated. Among the multiple words to be processed, if there does not exist a target word sequence that conforms to the preset grammar rule, it is determined that the multiple words to be processed cannot extract the retrieval condition corresponding to the preset grammar rule, and the matching fails.

[0053] Specifically, taking the grammar fragment " / xan is / / xav" as an example, assuming that there exists a target word sequence among the multiple words to be processed, in this target word sequence:

[0054] The first word is "Well", and the corresponding part-of-speech tag is "xan";

[0055] The second word is "yes";

[0056] The third word is labeled "塔中161" and the corresponding part-of-speech tag is "xav", then it is determined that the target word sequence matches the grammatical fragment " / xan是 / / xav" successfully, and the corresponding search condition generated is "井名=塔中161", for example, if the grammatical fragment is "2022年 / DATETIME", then in the above-mentioned to-be-processed words "2022年 / DATETIME", "塔中161 / xav=dic:井名" and "取出方法 / xan", there is a target word sequence consisting of "2022年 / DATETIME" alone, which matches the grammatical fragment "2022年 / DATETIME", and the corresponding search condition generated is "DEFAULT_DATETIME=2022年".

[0057] In another preferred embodiment, see Figure 3 , Figure 3 FIG. 2 shows a second flow chart of a method for determining search conditions provided by an embodiment of the present application. Figure 3 As shown, step S250 includes:

[0058] S2501. Among a plurality of words to be processed, remove the words that participate in generating a combined search condition and obtain the remaining words.

[0059] S2502. Determine the search projection among the remaining words.

[0060] The search projection indicates the final search field.

[0061] S2503: For each remaining word, if the part-of-speech tag corresponding to the remaining word is a dictionary, extract the dictionary value corresponding to the remaining word, and form a corresponding search condition together with the remaining word.

[0062] Specifically, the equation formed between the dictionary value corresponding to the remaining word and the remaining word is determined as the corresponding search condition.

[0063] S2504: Determine the logical relationship between the multiple search conditions based on the corresponding conjunctions and conjunction positions in the remaining words.

[0064] S2505. Generate a combined search condition based on multiple search conditions and the logical relationship between the search conditions.

[0065] Specifically, taking step S2503 as an example, the word "Tower 161 / xav=dic: Well name", whose corresponding value in the dictionary dic is "Well name", the search condition formed is "Well name=Tower 161".

[0066] The finally formed combined query condition is "AND(Well Name=Tazhong 161), ((DEFAULT_DATETIME=2022)", and the retrieval projection is "Production Method".

[0067] In a preferred embodiment, the method further includes:

[0068] After determining the combined retrieval condition, analyze the remaining words other than those participating in forming the combined retrieval condition, and determine whether there are words with part-of-speech tags of nouns or verbs in the remaining words. If there are words with part-of-speech tags of nouns or verbs in the remaining words, a parsing failure prompt is given.

[0069] Specifically, if there are words with part-of-speech tags of nouns or verbs in the remaining words, it means that there are still unprocessed words in the remaining words, and a parsing failure prompt for the retrieval text needs to be given according to exception handling.

[0070] In the prior art, the business data tables of each system will eventually be summarized in the data management center. Since the table names, column names, and code specification values required for management may be mapped and changed during the integration process, resulting in the actual stored data tables or data not being the originally defined ones, when using the combined retrieval condition to retrieve the changed data tables, incorrect results are often returned.

[0071] To solve the above problems, in the embodiments of the present application, the database to be queried includes multiple data tables, and step S300 includes:

[0072] From multiple data tables, for each retrieval condition in the combined retrieval condition, convert each word corresponding to the retrieval condition into the corresponding standard word format, convert the logical relationship operator in the combined retrieval condition into the equivalent logical operator corresponding to the database to be queried, and for each retrieval condition in the combined retrieval condition, convert the retrieval condition into the equivalent retrieval condition corresponding to the database to be queried, and generate the converted target combined retrieval condition.

[0073] Before the present application officially uses the combined retrieval conditions to perform data search on the database to be queried, it is necessary to first convert the combined retrieval conditions into a standard format. Specifically, for each retrieval condition, each word corresponding to the retrieval condition needs to be converted into the standard word format, which is convenient for subsequent query in the data table to be queried. Secondly, perform equivalent conversions on the roadbed relationship operators and retrieval conditions respectively. For example, if the database to be queried is an ES database, the logical relationship operators in the combined retrieval conditions are converted into the equivalent logical operators corresponding to the ES database. Specifically, for example, the logical relationship operator "AND" is converted into the equivalent logical operator "MUST" corresponding to the ES database, the logical relationship operator "OR" is converted into the equivalent logical operator "Should" corresponding to the ES database, and the logical relationship operator "NOT" is converted into the equivalent logical operator "MUST NOT" corresponding to the ES database.

[0074] In a preferred embodiment, step S400 includes:

[0075] Determine the data tables in which there are fields corresponding to the retrieval projection in multiple data tables as the first candidate data tables, and convert the field names in each of the first candidate data tables into the corresponding standard format; use the target combined retrieval conditions to screen out the second candidate data tables from the multiple first candidate data tables. If there is at least one second candidate data table, randomly select one from the at least one second candidate data table as the target data table, extract the data values corresponding to the retrieval projection in the target data table and return them to the user side. If there is no second candidate data table, return that the retrieval result is empty and give a retrieval out-of-range prompt.

[0076] In the present application, multiple first candidate data tables can be determined from multiple data tables in the database according to the retrieval projection first, and then for each first candidate data table, the field names corresponding to each field in the first candidate data table are converted into the corresponding standard format to overcome the distortion generated during data storage. For example, assume that the retrieval projection is "daily output". For the user, the data to be retrieved is the daily output corresponding to the well. However, there is a field named "daily output" in both the well monthly output data table and the well daily output data table. However, the actual standard name of the "daily output" field in the well monthly output data table should be "average daily output within a month". In this case, before processing the data table, the field value corresponding to "daily output" in the well monthly output data table will still be returned as the result for the actual retrieval, which results in an incorrect return result. Therefore, before officially performing the retrieval, it is necessary to convert the field names corresponding to each field in the first candidate data tables into the standard format. For example, correct the "daily output" field in the well monthly output data table to "average daily output within a month", and then perform the retrieval after such modification to ensure the accuracy of the retrieval result.

[0077] Perform standard format conversion on both sides of the retrieval conditions and the data table, which can further ensure the accuracy of the retrieval.

[0078] Based on the same application concept, an information retrieval device based on natural language processing corresponding to the information retrieval method based on natural language processing provided in the above embodiments is further provided in the embodiments of the present application. Since the principle of solving problems by the device in the embodiments of the present application is similar to the information retrieval method based on natural language processing in the above embodiments of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be elaborated.

[0079] Please refer to Figure 4 , Figure 4 which shows a functional module diagram of an information retrieval device based on natural language processing provided in an embodiment of the present application. As Figure 4 shown, the device includes:

[0080] An acquisition module 500, configured to acquire a retrieval text input by a user;

[0081] An analysis module 510, configured to analyze the retrieval text by using natural language processing to obtain a combined retrieval condition and a retrieval projection, where the retrieval projection is a result field that needs to be returned by the retrieval;

[0082] A conversion module 520, configured to convert the combined retrieval condition into a standard format to generate a target combined retrieval condition, where the standard format is a format for implementing data query defined by the database to be queried;

[0083] A query module 530, configured to determine a retrieval result that meets the retrieval text from the database to be queried by using the target combined retrieval condition and the retrieval projection.

[0084] Based on the same application concept, please refer to Figure 5 , Figure 5 which shows a schematic structural diagram of an electronic device provided in an embodiment of the present application. The electronic device 600 includes: a processor 610, a memory 620, and a bus 630. The memory 620 stores machine-readable instructions executable by the processor 610. When the electronic device 600 runs, communication is performed between the processor 610 and the memory 620 through the bus 630. When the machine-readable instructions are run by the processor 610, the steps of the information retrieval method based on natural language processing provided in any of the above embodiments are executed.

[0085] Based on the same application concept, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, the steps of the information retrieval method based on natural language processing provided in the above embodiments are executed.

[0086] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems and devices described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein. In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical functional division, and there can be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

[0087] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0088] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.

[0089] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or a part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical discs that can store program codes.

[0090] The above is only the specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application and should be covered by the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. An information retrieval method based on natural language processing, characterized in that, the method includes: obtaining the retrieval text input by the user; using natural language processing to parse the retrieval text to obtain a combined retrieval condition and a retrieval projection, where the retrieval projection is the result field that the retrieval needs to return; converting the combined retrieval condition into a standard format to generate a target combined retrieval condition, where the standard format is the format defined by the database to be queried for implementing data query; using the target combined retrieval condition and the retrieval projection to determine the retrieval result that meets the retrieval text from the database to be queried.

2. The method according to claim 1, characterized in that, the combined retrieval condition is determined by the following method: performing word segmentation on the retrieval text to obtain multiple words; adding a part-of-speech tag to each word, where the part-of-speech tag indicates the corresponding part of speech of the word; removing stop words from the multiple words to obtain multiple words to be processed, where the stop words are words that do not affect the original semantics of the retrieval text; extracting at least one retrieval condition from the multiple words to be processed according to multiple preset grammar rules; generating the combined retrieval condition according to the at least one retrieval condition.

3. The method according to claim 2, characterized in that, the preset grammar rules include multiple grammar segments arranged in order, and each grammar segment includes a word or a part-of-speech tag, wherein, for each preset grammar rule, perform: matching the multiple words to be processed with the multiple grammar segments corresponding to the preset grammar rule; in the multiple words to be processed, if there is a target word sequence that conforms to the preset grammar rule, it is determined that the target word sequence matches the preset grammar rule successfully, and a corresponding retrieval condition is generated according to the preset grammar rule and the target word sequence; in the multiple words to be processed, if there is no target word sequence that conforms to the preset grammar rule, it is determined that the multiple words to be processed cannot extract the retrieval condition corresponding to the preset grammar rule, and the matching fails.

4. The method according to claim 3, characterized in that, generating the combined retrieval condition according to the at least one retrieval condition includes: removing the words participating in generating the combined retrieval condition from the multiple words to be processed to obtain the remaining words; determining the retrieval projection among the remaining words; for each remaining word, if the corresponding part-of-speech tag of the remaining word is a dictionary, extracting the dictionary value corresponding to the remaining word and forming a corresponding retrieval condition with the remaining word; determining the logical relationship between the multiple retrieval conditions according to the corresponding conjunctions and the conjunction positions among the remaining words; generating the combined retrieval condition according to the multiple retrieval conditions and the logical relationship between the retrieval conditions.

5. The method according to claim 3, characterized in that, the method further includes: analyzing the remaining words except those participating in forming the combined retrieval condition, and determining whether there are words with part-of-speech tags of nouns or verbs in the remaining words; if there are words with part-of-speech tags of nouns or verbs in the remaining words, a parsing failure prompt is given.

6. The method according to claim 3, wherein, the database to be queried includes a plurality of data tables, wherein, converting the combined retrieval condition into a standard format to generate a target combined retrieval condition includes: For each retrieval condition in the combined retrieval condition, converting each word corresponding to the retrieval condition into a corresponding standard word format; Converting the logical relation operator in the combined retrieval condition into an equivalent logical operator corresponding to the database to be queried; For each retrieval condition in the combined retrieval condition, converting the retrieval condition into an equivalent retrieval condition corresponding to the database to be queried; Generating the converted target combined retrieval condition.

7. The method according to claim 6, wherein, Determining a retrieval result that meets the retrieval text from the database to be queried by using the target combined retrieval condition and the retrieval projection, includes: Determining the data tables in which the fields corresponding to the retrieval projection exist in the multiple data tables as the first candidate data tables; Converting the field names corresponding to each field in the first candidate data tables into corresponding standard formats; Using the target combined retrieval condition to screen out the second candidate data tables from the multiple first candidate data tables; If there is at least one second candidate data table, randomly selecting one from the at least one second candidate data tables as the target data table, and extracting the data values corresponding to the retrieval projection in the target data table and returning them to the user side; If there is no second candidate data table, returning that the retrieval result is empty and giving a retrieval out-of-range prompt.

8. An information retrieval device based on natural language processing, wherein, the device includes: An acquisition module, configured to acquire a retrieval text input by a user; An analysis module, configured to analyze the retrieval text by using a natural language processing method to obtain a combined retrieval condition and a retrieval projection, where the retrieval projection is the result field that needs to be returned by the retrieval; A conversion module, configured to convert the combined retrieval condition into a standard format to generate a target combined retrieval condition, where the standard format is the format defined by the database to be queried for implementing data query; A query module, configured to determine a retrieval result that meets the retrieval text from the database to be queried by using the target combined retrieval condition and the retrieval projection.

9. An electronic device, wherein, including: A processor, a memory and a bus, the memory stores machine-readable instructions executable by the processor, when the electronic device runs, the processor communicates with the memory through the bus, and when the machine-readable instructions are run by the processor, the steps of the information retrieval method based on natural language processing according to any one of claims 1 to 7 are executed.

10. A computer-readable storage medium, wherein, a computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, the steps of the information retrieval method based on natural language processing according to any one of claims 1 to 7 are executed.

Citation Information

Cited By

  • Natural language processing method, device and equipment

    CN121524318A

  • Intelligent semantic analysis method and system based on MDX framework

    CN121935268A