Question number query method and device, equipment and medium
By optimizing the word segmentation process through longest string matching and knowledge base semantic retrieval, the problems of word segmentation accuracy and semantic understanding in intelligent query technology are solved, thereby improving word segmentation accuracy and the reliability of semantic analysis.
Patent Information
- Application Number
- CN202511635972.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-10
- Publication Date
- 2026-02-17
AI Technical Summary
Existing intelligent query technologies suffer from low word segmentation accuracy, lack of business understanding capabilities, and weak semantic uncertainty handling capabilities, leading to semantic understanding errors and decreased accuracy.
The longest string matching algorithm is used to match the query statement to generate a list of definite words. The word segmentation results are optimized by word segmentation and semantic retrieval of a preset knowledge base until the list of definite words is empty or the preset number of iterations is reached.
It improves the accuracy of word segmentation in complex texts and contextual inquiry scenarios, enhances the reliability of semantic analysis and entity recognition, and reduces word segmentation errors.
Smart Images

Figure CN121542405A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of artificial intelligence technology, and in particular to query methods, apparatus, devices and media. Background Technology
[0002] With the rapid development of large language model technology and the emergence of intelligent agent applications, intelligent querying scenarios that utilize large models to connect user query needs with database query logic and quickly and accurately obtain user-related data have become a common requirement. Although there are still considerable differences between different technical implementation solutions, the internal process of intelligent querying all requires understanding the natural language flexibly inputted by users, parsing the user's true intent, and converting it into database query statements. This directly affects the accuracy of intelligent querying.
[0003] Currently, intelligent query technology primarily employs two methods for semantic word segmentation. One method directly relies on knowledge base retrieval and a large-scale model for word segmentation. Because word segmentation and retrieval are two independent processes, performing either action first can lead to semantic misunderstandings, and rich grammatical variations further decrease accuracy. The other method involves fine-tuning the large-scale word segmentation model, allowing it to pre-learn business knowledge. However, this method is relatively costly and requires performance evaluation. Furthermore, due to dynamic changes in knowledge, business expansion, and the model's own technological iterations, it's difficult to achieve perfect fine-tuning in one step. Summary of the Invention
[0004] In view of this, embodiments of the present disclosure provide a query method, apparatus, device, and medium to address the problems of low word segmentation accuracy, lack of business understanding, and weak semantic uncertainty handling capabilities in the prior art.
[0005] A first aspect of this disclosure provides a query method, the method comprising: responding to receiving a query statement from a user, matching the query statement according to a longest string matching algorithm to obtain a list of determined words; segmenting the query statement after deleting all determined words from the list of determined words to obtain a list of words to be determined; performing a semantic search on each word to be determined using a preset knowledge base to update the list of determined words and the list of words to be determined; and ending the process until the list of words to be determined is empty or a preset number of iterations is reached.
[0006] A second aspect of this disclosure provides a query device, comprising: a matching unit, configured to, in response to receiving a user's query statement, match the query statement according to a longest string matching algorithm to obtain a list of determined words; a word segmentation unit, configured to segment the query statement after deleting all determined words from the list of determined words to obtain a list of words to be determined; and a retrieval unit, configured to perform a semantic retrieval of each word to be determined using a preset knowledge base to update the list of determined words and the list of words to be determined; and to terminate the process until the list of words to be determined is empty or a preset number of iterations is reached.
[0007] A third aspect of this disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.
[0008] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0009] The beneficial effects of this disclosure compared to the prior art are as follows: First, in response to a user's query statement, the query statement is matched using the longest string matching algorithm to obtain a list of definite words. Second, the query statement after deleting all definite words from the definite word list is segmented to obtain a list of words to be determined. Finally, a semantic retrieval of a preset knowledge base is performed on each word to be determined to update the definite word list and the list of words to be determined; the process ends when the list of words to be determined is empty or a preset number of iterations is reached. This disclosure effectively reduces segmentation errors and improves segmentation accuracy for complex text, text with omissions, and contextual follow-up questions by using the longest string matching in the semantic knowledge base and subsequent iterative optimization of the segmentation results, making subsequent semantic analysis and entity recognition based on segmentation more reliable. Attached Figure Description
[0010] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0011] Figure 1 This is a schematic diagram illustrating an application scenario of the query method according to some embodiments of the present disclosure;
[0012] Figure 2 This is a flowchart of some embodiments of the query method according to this disclosure;
[0013] Figure 3 These are flowcharts of other embodiments of the query method according to this disclosure;
[0014] Figure 4 This is a schematic diagram of the structure of some embodiments of the question query device according to the present disclosure;
[0015] Figure 5 This is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. Detailed Implementation
[0016] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0017] It should also be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings. Unless otherwise specified, the embodiments and features described in this disclosure can be combined with each other.
[0018] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0019] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0020] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0021] This disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0022] Figure 1 This is a schematic diagram illustrating an application scenario of the query method according to some embodiments of the present disclosure.
[0023] exist Figure 1In the application scenario, firstly, the computing device 101 can respond to the user's query statement 102 by matching the query statement 102 according to the longest string matching algorithm to obtain a list of definite words 103. Secondly, the computing device 101 can perform word segmentation on the query statement after deleting all definite words from the list of definite words to obtain a list of words to be determined 104. Finally, the computing device 101 can perform a preset knowledge base semantic search on each word to be determined to update the list of definite words and the list of words to be determined; the process ends when the list of words to be determined is empty or a preset number of iterations is reached, as shown in Figure 105.
[0024] It should be noted that the aforementioned computing device 101 can be either hardware or software. When the computing device 101 is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device. When the computing device 101 is software, it can be installed in the hardware devices listed above. It can be implemented as, for example, multiple software programs or software modules used to provide distributed services, or as a single software program or software module. No specific limitations are made here.
[0025] It should be understood that Figure 1 The number of computing devices shown is merely illustrative. Any number of computing devices can be used depending on implementation needs.
[0026] Figure 2 This is a flowchart of some embodiments of the query method according to the present disclosure. Figure 2 The query method can be derived from Figure 1 The computing device 101 performs the operation. For example... Figure 2 As shown, the query method includes:
[0027] In step S201, in response to receiving the user's query statement, the query statement is matched according to the longest string matching algorithm to obtain a list of definite words.
[0028] In some embodiments, this disclosure pertains to a query method for a large-scale model, where the large-scale model is a large language model. Determined terms refer to business terms matched using the longest string matching method in the semantic knowledge base after initial word segmentation by the large-scale model, representing semantically accurate and unambiguous terms. General knowledge consists of common-sense, well-known logical information, such as inferring a specified time based on the current time. The semantic knowledge base contains domain-specific information, such as the definition, calculation formula, and explanation of a certain indicator in the query scenario. For example, when a user's query is "Company A's XX indicator situation last year," "Company A" will match the enterprise name entity in the knowledge base, which is a business term, while "last year" is an unambiguous time description entity, representing general knowledge.
[0029] Step S201 also includes the following steps:
[0030] The first step is to segment the above query statement into several initial strings.
[0031] Here, preliminary word segmentation is performed based on a large language model.
[0032] The second step is to match the initial string containing the most consecutive characters with the preset strings in the preset knowledge base until the longest preset string is matched, thus obtaining a definite word.
[0033] Here, the "longest string matching" algorithm is first used to match the longest string in the pre-defined knowledge base. "Longest string matching" means finding the longest string in the question and matching it with the longest string in the pre-defined knowledge base whose name (the node attributes to be matched include both name and synonym / abbreviation attributes). For example, in the question "Analysis of COSCO Shipping Technology's Financial Statements Last Year": assuming the pre-defined knowledge base contains ["COSCO", "shipping", "COSCO Shipping"], even if "COSCO" is matched first in the question, the matching will not stop but will continue to search for "COSCO Shipping", "COSCO Shipping", "COSCO Shipping to", etc., until the longest subsequence is matched. The longest matched subsequence is the current definite word.
[0034] The third step is to obtain a list of definite words based on each definite word.
[0035] Here, a list of determined words is formed based on all the determined words. As an example: if “COSCO Shipping Technology” is found to be an abbreviation of the enterprise name entity in the preset knowledge base, and “last year” is matched by the large model, it is included in the initial list of determined words: [“COSCO Shipping Technology”, “2024”].
[0036] It should be noted that the large model will infer based on the current time, thus inferring that "last year" was "2024" based on the current year (2025).
[0037] Step S202: The query statement that has deleted all the definite words in the definite word list is segmented to obtain the list of words to be determined.
[0038] In some embodiments, word segmentation is performed based on a large model.
[0039] Step S203: Perform a semantic search of the preset knowledge base for each word to be determined in order to update the list of determined words and the list of words to be determined; the process ends when the list of words to be determined is empty or the preset number of iterations is reached.
[0040] In some embodiments, the preset number of iterations is 2.
[0041] Step S203 also includes:
[0042] The first step is to convert each word to be determined into a word vector. The second step is to perform semantic retrieval using a pre-defined knowledge base based on each word vector. The third step is to recall similar words corresponding to each word to be determined from the pre-defined knowledge base according to a pre-defined recall threshold. The fourth step is to update the list of determined words and the list of words to be determined based on the similar words corresponding to each word to be determined. Here, firstly, if the similarity between any pre-defined word in the pre-defined knowledge base and the word to be determined is less than the pre-defined recall threshold, it is not recalled. Secondly, if the similarity between any pre-defined word in the pre-defined knowledge base and the word to be determined is equal to or greater than the pre-defined recall threshold, and it ranks within the top pre-defined number in descending order, then that pre-defined word is identified as a similar word and recalled.
[0043] Here, "words to be determined" refers to words that, after initial word segmentation but not yet validated by knowledge retrieval, need to be transformed into "determined words" or "uncertain words" through knowledge base retrieval and model evaluation. Uncertain words are those whose semantics cannot be clearly defined after knowledge base retrieval and model evaluation. They can be divided into two categories: First, the knowledge base retrieves 0 results, with no matching knowledge entity; second, the knowledge base retrieves multiple results, but the large model cannot determine a unique match, requiring further clarification from the user. For example, a user asks about profit metrics, but the knowledge base contains multiple profit metrics such as gross profit and net profit, making it impossible to determine the user's true intent.
[0044] As an example, taking the word "enterprise" as an example, the word is first converted into a vector representation (representing semantic information) using an embedding model. This vector representation is then used for semantic similarity retrieval in a knowledge base, where vector representations for each entity have already been pre-built. Cosine similarity is calculated between the vector representation of "enterprise" and the vector representations of other entities in the knowledge base. A threshold is set during recall, such as threshold = 0.8. If the similarity is less than 0.8, the entity will not be recalled; if the similarity is greater than 0.8, the three entities with the highest similarity are returned. For example, "enterprise" recalls three entities: "enterprise entity," "listed company entity," and "subsidiary entity," while "financial statement analysis" recalls one entity: "enterprise financial statement analysis (including profitability / solvency analysis)." All information—the user's question, the selected phrase, and the candidate entity information recalled based on the vectors—is fed to the large model via prompt words. After the large model considers this information, it is updated as follows:
[0045] Specific keyword list: [“COSCO Shipping Technology”, “2024”, “Financial Statement Analysis”]
[0046] List of words to be determined: [{"word", "enterprise", "type": "selection", "candidate entity": ["enterprise entity", "listed company entity", "subsidiary entity"]}].
[0047] In one exemplary embodiment of this disclosure, after recalling similar words corresponding to each word to be determined in a preset knowledge base according to a preset recall threshold, the method further includes:
[0048] Fifth step: If the number of similar words corresponding to any word to be determined is greater than one, then each similar word of the word to be determined is transmitted to the target display device, wherein the target display device is used to display each similar word.
[0049] Here, if multiple entities are recalled from the list of words to be determined, it needs to be returned to the user for confirmation, so that the user's actual intention is to ask which entity they want to ask about.
[0050] In one exemplary embodiment of this disclosure, each round of word segmentation takes a list of defined words as input and marks them with preset symbols; wherein, the preset symbols are used to mark the defined words as indivisible.
[0051] Here, all rounds of word segmentation must use this list as the "anchor point," and pre-defined words cannot be split. Furthermore, the segmentation of words to be determined must be optimized around pre-defined words. That is, when used as input to the model, the rule is explicitly added to the prompt words: "When performing word segmentation, pre-defined words cannot be split."
[0052] Next, word segmentation and phrase determination are performed:
[0053] Based on the existing entity knowledge in the knowledge base, the following word segments are formed:
[0054] Specific keywords: ["COSCO Shipping Technology", "Financial Statement Analysis Results", "202412"]
[0055] Uncertain choice: [Entity / Listed Company / Subsidiary]
[0056] The large model reflects on the segmented word groups described above: When designing prompt words, it's crucial to clearly define task boundaries, validation dimensions, judgment rules, and output formats to avoid ambiguous semantics and ensure the large model can execute validation according to fixed logic. The large model analyzes and judges from three aspects: "reasonableness of uncertain words," "parameter completeness," and "semantic consistency." If these criteria are not met, the process proceeds to the next round. For example, regarding "reasonableness of uncertain words," the large model's rules are used to determine whether the uncertain word's appearance in the current query context is reasonable.
[0057] The uncertain term "enterprise" has the same attributes as the certain term "COSCO Shipping Technology" and does not require further clarification. It is necessary to consider whether there are other reasonable word segments for "enterprise" or whether the term has a practical function based on semantics.
[0058] The iteration rounds follow the same logic as the process described above. The prompts for each iteration round will specify the rules and requirements: "If you encounter uncertain words during the first segmentation, you need to re-evaluate and analyze the incorrect segmentation results based on the previous segmentation, and find a more reasonable segmentation method." This requires the large model to conduct a first-round reflection and summary, which can be used as a basis for rethinking. Considering that the knowledge entity "COSCO Shipping Technology" contains the attribute of a "listed company," the segmentation can be readjusted as follows:
[0059] Confirmed keyword list: [“COSCO Shipping Technology”, “202412”]
[0060] List of keywords to be determined: [“Listed companies”, “Financial statement analysis”]
[0061] After a new round of knowledge base retrieval, the term to be determined was able to recall two knowledge entities: "listed company entity" and "corporate financial statement analysis," and both were changed to the determined term. Therefore, the resulting new parameter set is as follows:
[0062] The list of keywords is: [“COSCO Shipping Technology”, “202412”, “Financial Statement Analysis Results”, “Listed Company Entity”].
[0063] The prompt will specify the termination rule: when all word segments are determined to be unambiguous and a corresponding indicator or dimension entity can be found, the iterative word segmentation process will terminate.
[0064] Finally, after reflection, if the parameter set results meet the termination condition, the model determines that the semantic recognition process has met the termination condition and ends. Considering that the semantic reflection iteration usually does not exceed 2 rounds, we default to 2 iterations. If uncertain words still exist after more than 2 rounds, the iteration terminates, the final parameter set containing uncertain words is output, and interactive feedback is provided to the user.
[0065] For words whose meaning remains uncertain after semantic recognition, it is necessary to interact with the user to clarify their intent.
[0066] Words whose meanings are uncertain are the words in the "words to be determined" list from the previous step. Each uncertain word falls into two categories: either no related entity was found after semantic recognition, or multiple related entities were found, but it's unclear which one it is. For the former, the user needs to "fill in the blank" with an explanation of the uncertain word; for the latter, the user needs to "select" the true intent. Through these steps, the semantic recognition of the user's question is improved.
[0067] In one exemplary embodiment of this disclosure, if "0 results are found for the word to be determined" in a certain round of semantic recognition, and the large model confirms that "the knowledge base does not contain the entity", it is directly classified as an uncertain word without the need for subsequent iterations.
[0068] like Figure 3 The figure shows a query method provided in a specific embodiment of this disclosure.
[0069] The beneficial effects of this disclosure compared to the prior art are as follows: First, in response to a user's query statement, the query statement is matched using the longest string matching algorithm to obtain a list of definite words. Second, the query statement after deleting all definite words from the definite word list is segmented to obtain a list of words to be determined. Finally, a semantic retrieval of a preset knowledge base is performed on each word to be determined to update the definite word list and the list of words to be determined; the process ends when the list of words to be determined is empty or a preset number of iterations is reached. This disclosure effectively reduces segmentation errors and improves segmentation accuracy for complex text, text with omissions, and contextual follow-up questions by using the longest string matching in the semantic knowledge base and subsequent iterative optimization of the segmentation results, making subsequent semantic analysis and entity recognition based on segmentation more reliable.
[0070] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of this disclosure, and will not be described in detail here.
[0071] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the embodiments of the method disclosed herein.
[0072] Figure 4 These are schematic diagrams illustrating the structure of some embodiments of the query device according to this disclosure. For example... Figure 4 As shown, the query device includes: a matching unit 401, used to match the query statement received from a user according to the longest string matching algorithm to obtain a list of definite words; a word segmentation unit 402, used to segment the query statement after deleting all definite words from the list of definite words to obtain a list of words to be determined; and a retrieval unit 403, used to perform a semantic search on each word to be determined using a preset knowledge base to update the list of definite words and the list of words to be determined; the process ends when the list of words to be determined is empty or a preset number of iterations is reached.
[0073] In some optional implementations of some embodiments, the matching unit 401 is configured to: segment the above query statement to obtain several initial strings; match the initial string containing the most consecutive characters with a preset string in a preset knowledge base until the longest preset string is matched, thus obtaining a definite word; and obtain a list of definite words based on each definite word.
[0074] In some optional implementations of some embodiments, the retrieval unit 403 is configured to: convert each word to be determined into a word vector to be determined; perform semantic retrieval of a preset knowledge base based on each word vector to be determined; recall similar words corresponding to each word to be determined in the preset knowledge base based on a preset recall threshold; and update the list of determined words and the list of words to be determined based on the similar words corresponding to each word to be determined.
[0075] In some optional implementations of certain embodiments, after recalling similar words corresponding to each word to be determined in a preset knowledge base according to a preset recall threshold, the above-mentioned question query device is further configured to:
[0076] If the number of similar words corresponding to any word to be determined is greater than one, then each similar word of the word to be determined is transmitted to the target display device, whereby the target display device is used to display each similar word.
[0077] In some optional implementations of some embodiments, the above-mentioned recalling of similar words corresponding to each word to be determined in a preset knowledge base according to a preset recall threshold includes: if the similarity between any preset word in the preset knowledge base and the word to be determined is less than the preset recall threshold, then no recall is made; if the similarity between any preset word in the preset knowledge base and the word to be determined is equal to or greater than the preset recall threshold, and is ranked within the first preset number in descending order, then the preset word is determined as a similar word and recalled.
[0078] In some optional implementations of certain embodiments, the preset number of iterations is 2.
[0079] In some optional implementations of some embodiments, the above-mentioned question query device is further configured such that: in each round of word segmentation, a list of determined words is taken as input and marked with a preset symbol; wherein, the preset symbol is used to mark that the determined words cannot be split.
[0080] The following is for reference. Figure 5 It illustrates electronic devices suitable for implementing some embodiments of this disclosure (e.g., Figure 1 A schematic diagram of the structure of the computing device 101)500. Figure 5 The server shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments of this disclosure.
[0081] like Figure 5As shown, the electronic device 500 may include a processing unit (e.g., a central processing unit, a graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. The RAM 503 also stores various programs and data required for the operation of the electronic device 500. The processing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0082] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows electronic device 500 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 An electronic device 500 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively. Figure 5 Each box shown can represent a device or multiple devices as needed.
[0083] In particular, according to some embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, some embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 509, or installed from storage device 508, or installed from ROM 502. When the computer program is executed by processing device 501, it performs the functions defined in the methods of some embodiments of this disclosure.
[0084] It should be noted that, in some embodiments of this disclosure, the computer-readable medium described above may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In some embodiments of this disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In some embodiments of this disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0085] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0086] The aforementioned computer-readable medium may be included in the aforementioned device; or it may exist independently and not assembled into the electronic device. The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: in response to receiving a user's query statement, match the query statement according to the longest string matching algorithm to obtain a list of definite words; segment the query statement after deleting all definite words from the list of definite words to obtain a list of words to be determined; perform a semantic search on each word to be determined using a preset knowledge base to update the list of definite words and the list of words to be determined; and terminate the process until the list of words to be determined is empty or a preset number of iterations is reached.
[0087] Computer program code for performing operations of some embodiments of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, and conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0088] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0089] The units described in some embodiments of this disclosure can be implemented in software or hardware. The described units can also be housed in a processor; for example, a processor may be described as including a matching unit, a word segmentation unit, and a retrieval unit. The names of these units do not necessarily limit the unit itself; for example, a matching unit may be described as "a unit that, in response to receiving a user's query statement, matches the query statement according to a longest string matching algorithm to obtain a determined word list."
[0090] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0091] The above description is merely a selection of preferred embodiments of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in the embodiments of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described inventive concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features with similar functions disclosed in the embodiments of this disclosure.
Claims
1. A query number lookup method, characterized in that, The method comprises: In response to receiving a user's question query statement, the question query statement is matched according to a longest string matching algorithm to obtain a determined word list; The question query statement from which all determined words in the determined word list are deleted is segmented to obtain a to-be-determined word list; Each to-be-determined word is subjected to preset knowledge base semantic retrieval to update the determined word list and the to-be-determined word list; until the to-be-determined word list is empty or a preset iteration number is reached, the process ends.
2. The query method of claim 1, wherein, The matching according to the longest string matching algorithm to obtain the determined word list comprises: The question query statement is segmented to obtain a plurality of initial strings; The initial string containing the most continuous characters is matched with a preset string in a preset knowledge base until the longest preset string is matched, thereby obtaining a determined word; According to each determined word, a determined word list is obtained.
3. The method of claim 1, wherein, The preset knowledge base semantic retrieval of each to-be-determined word to update the determined word list and the to-be-determined word list comprises: Each to-be-determined word is converted into a to-be-determined word vector; Each to-be-determined word vector is subjected to preset knowledge base semantic retrieval; According to a preset recall threshold, similar words corresponding to each to-be-determined word are recalled in the preset knowledge base; According to the similar words corresponding to each to-be-determined word, the determined word list and the to-be-determined word list are updated.
4. The method of claim 1, wherein, After the similar words corresponding to each to-be-determined word are recalled in the preset knowledge base according to the preset recall threshold, the method further comprises: If the number of similar words corresponding to any to-be-determined word is greater than one, each similar word of the to-be-determined word is transmitted to a target display device, wherein the target display device is configured to display each similar word.
5. The method of claim 3, wherein, The recalling of the similar words corresponding to each to-be-determined word in the preset knowledge base according to the preset recall threshold comprises: If the similarity between any preset word in the preset knowledge base and the to-be-determined word is less than the preset recall threshold, the similar word is not recalled; If the similarity between any preset word in the preset knowledge base and the to-be-determined word is equal to or greater than the preset recall threshold and the preset word ranks within a preset number in descending order, the preset word is determined as a similar word and is recalled.
6. The method of claim 1, wherein, The preset iteration number is 2 times.
7. The method of claim 1, wherein, The method further comprises: The segmentation in each round takes the determined word list as input and marks the determined word list with a preset symbol; wherein the preset symbol is used to mark that the determined word cannot be split.
8. A query device, comprising: The device comprises: A matching unit configured to, in response to receiving a user's question query statement, match the question query statement according to a longest string matching algorithm to obtain a determined word list; A segmentation unit configured to segment the question query statement from which all determined words in the determined word list are deleted to obtain a to-be-determined word list; A retrieval unit configured to subject each to-be-determined word to preset knowledge base semantic retrieval to update the determined word list and the to-be-determined word list; until the to-be-determined word list is empty or a preset iteration number is reached, the process ends.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method according to any one of claims 1-7.
10. A computer-readable storage medium storing a computer program, the computer program comprising instructions that, when executed by a computer, cause the computer to perform the method of any one of claims 1 to 9. The computer program is executed by the processor to implement the steps of the method according to any one of claims 1-7.