Text search method and device, electronic equipment and storage medium
By performing multi-dimensional evaluation and feature analysis on candidate fragments in the search text, determining the evaluation scores, and selecting candidate fragments with high evaluation scores as search results, the problem of low accuracy of search results of existing search engine highlighting functions is solved, and the search results of existing search engines is realized. More accurate search results matching.
Patent Information
- Application Number
- CN202310954253.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-31
- Publication Date
- 2025-02-18
AI Technical Summary
The search results given by the existing search engine highlighting function are not very accurate and cannot effectively meet the actual needs of users.
By obtaining candidate fragments matching the search statement in the search text, and performing multi-dimensional evaluation on each candidate fragment, obtaining its characteristics, determining the evaluation score, and finally selecting candidate fragments with high evaluation scores as the search results.
It improves the accuracy and matching of search results, can better meet the actual needs of users and provide more accurate search results.
Smart Images

Figure CN119474408A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a text search method, device, electronic device and storage medium. Background Art
[0002] With the development of science and technology, search engines (such as Elastic Search) have made it easier for people to obtain information. Users enter corresponding keywords in the search engine to search, and the search engine uses a highlight function to perform search queries, returns search results and displays them in the form of highlighted snippets.
[0003] However, the search results given by directly using the search engine highlighting function sometimes do not meet the actual needs of users, so the search results are not accurate. Summary of the invention
[0004] The purpose of the present application is to propose a text search method, device, electronic device and storage medium to address the deficiencies of the above-mentioned prior art, and this purpose is achieved through the following technical solutions.
[0005] The first aspect of the present application provides a text search method, the method comprising:
[0006] Obtaining at least one candidate segment matching the search statement in the search text;
[0007] Each candidate segment is evaluated in different dimensions to obtain the features corresponding to each candidate segment in each evaluation dimension; the features reflect the matching characteristics between the candidate segment and the search statement;
[0008] Determine an evaluation score for each candidate segment based on the features corresponding to each candidate segment in each evaluation dimension;
[0009] A search result of the search statement is selected from the at least one candidate segment according to the evaluation score.
[0010] In some embodiments of the present application, the performing of different dimension evaluations on each candidate segment to obtain the corresponding features of each candidate segment in each evaluation dimension includes:
[0011] For each candidate segment, the text content contained in the candidate segment is extracted; the core words and phrase words contained in the search sentence are obtained; different dimensional evaluations are performed based on the core words, the phrase words and the text content to obtain the corresponding features of the candidate segment in each evaluation dimension.
[0012] In some embodiments of the present application, the candidate fragment has the following characteristics: the text content contains a search statement, the text content contains a core word, the text content contains a phrase word, the fragment length is within a preset character range, and the index mark position is within the first preset number of characters of the fragment, and the index mark position is any one or more of the following: the index mark position is the position of the search statement, phrase word or core word in the fragment.
[0013] In some embodiments of the present application, extracting the text content contained in the candidate segment includes:
[0014] The non-text content in the candidate segment is removed to obtain the text content of the candidate segment; wherein the non-text content includes line breaks, space characters, and emoticons.
[0015] In some embodiments of the present application, determining the evaluation score of each candidate segment based on the features corresponding to each candidate segment in each evaluation dimension includes:
[0016] For each candidate segment, a preset level of a feature corresponding to the candidate segment in each evaluation dimension is obtained; and an evaluation score of the candidate segment is determined according to the obtained preset level.
[0017] In some embodiments of the present application, before performing different dimension evaluations on each candidate segment to obtain the features corresponding to each candidate segment in each evaluation dimension, the method further includes:
[0018] Displaying a text segment evaluation setting interface; and acquiring configured evaluation dimension information in response to a configuration operation of the text segment evaluation setting interface.
[0019] In some embodiments of the present application, obtaining at least one candidate segment matching the search statement in the search text includes:
[0020] The core words and phrase words included in the search sentence are obtained; a matching segment is searched in the search text based on the search sentence, the core words and the phrase words by calling a preset search engine, and the searched matching segment is used as a candidate segment.
[0021] A second aspect of the present application provides a text search device, the device comprising:
[0022] A fragment acquisition module, used to acquire at least one candidate fragment matching the search statement in the search text;
[0023] A segment evaluation module is used to evaluate each candidate segment in different dimensions, obtain the features corresponding to each candidate segment in each evaluation dimension, and determine the evaluation score of each candidate segment based on the features corresponding to each candidate segment in each evaluation dimension;
[0024] A result determination module is used to select a search result of the search statement from the at least one candidate segment according to the evaluation score.
[0025] The third aspect of the present application proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method described in the first aspect above.
[0026] The fourth aspect of the present application proposes a computer-readable storage medium having a computer program stored thereon, wherein the program is executed by a processor to implement the steps of the method described in the first aspect above.
[0027] Based on the text search method and device described in the first and second aspects above, the present application has at least the following beneficial effects or advantages:
[0028] By obtaining multiple candidate fragments matched by the search statement and evaluating each candidate fragment in different dimensions to obtain the features corresponding to each candidate fragment in each evaluation dimension, the candidate fragments are scored based on the different features of each candidate fragment. Since the features obtained by the evaluation can reflect the matching characteristics of the candidate fragment and the search statement, the evaluation score of the candidate fragment obtained based on the feature can reflect the matching degree between the search result and the search statement. Therefore, the search result further selected according to the evaluation score is more accurate and can better meet the actual needs of users.
[0029] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0031] Figure 1 is a flow chart of an embodiment of a text search method according to an exemplary embodiment;
[0032] Figure 2 A specific flow chart showing a method of implementing text search according to an exemplary embodiment;
[0033] Figure 3 is a structural schematic diagram of a text search device according to an exemplary embodiment;
[0034] Figure 4 is a schematic diagram of a hardware structure of an electronic device according to an exemplary embodiment;
[0035] Figure 5 The figure is a schematic diagram of the structure of a storage medium according to an exemplary embodiment. DETAILED DESCRIPTION
[0036] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0037] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0038] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0039] As mentioned above, the existing search results given by the search engine highlighting function sometimes do not meet the actual needs of users, so the search results are not accurate. For example, the search results given by the search engine highlighting function are truncated to fixed-length fragments due to length restrictions, resulting in the loss of key information. For another example, the search engine highlighting function is mainly based on lexical analysis and matching pattern queries. For texts with complex grammatical structures or specific text formats, the search results displayed may not meet expectations.
[0040] In view of this, the present application proposes a text search method, which obtains multiple candidate fragments matched by the search statement, and evaluates each candidate fragment in different dimensions to obtain the features corresponding to each candidate fragment in each evaluation dimension, so as to score the candidate fragments based on the different features of each candidate fragment. Since the features obtained by the evaluation can reflect the matching characteristics of the candidate fragment and the search statement, the evaluation score of the candidate fragment obtained based on the feature can reflect the matching degree between the search result and the search statement. Therefore, the search result further selected according to the evaluation score is more accurate and can better meet the actual needs of the user.
[0041] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The several specific embodiments listed can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0042] Figure 1 The flowchart of an embodiment of a text search method according to an exemplary embodiment includes the following steps:
[0043] Step 101: Obtain at least one candidate segment matching the search statement in the search text.
[0044] In this step, the search text is the corpus content to be matched and searched, which can be a document specified by the user. Usually, the search text can be an article, user comment, news, advertisement, etc. The application does not limit the number of search texts. The search sentence is the content to be queried and matched, which can be a sentence entered by the user according to actual use needs. For example, the user wants to know whether prosthetic rhinoplasty has side effects, so he enters the search sentence "side effects of prosthetic rhinoplasty" with the intention of searching for relevant information on the side effects of prosthetic rhinoplasty.
[0045] Furthermore, the candidate segments are matching segments initially found in the search text, and the query method used may be a query based on lexical analysis and matching patterns.
[0046] In an optional embodiment, the core words and phrase words included in the search sentence can be obtained, and a preset search engine can be called to search for matching fragments in the search text based on the search sentence, the core words and the phrase words, and the searched matching fragments can be used as candidate fragments. In the process of querying the search sentence, the core words and phrase words can guide the search engine, which can improve the accuracy of the search engine returning matching fragments.
[0047] Among them, core words refer to the word segmentation information that users are concerned about. Some business-related core words can be pre-set according to actual business needs. The included core words can be obtained by traversing the search sentence. Phrase words refer to words composed of more than one word, which semantically express the meaning of a word. The included phrase words can be obtained by segmenting the search sentence.
[0048] For example, the search statement is "side effects of prosthetic rhinoplasty", the core words obtained are "rhinoplasty" and "prosthetic rhinoplasty", and the phrase words are "prosthetic rhinoplasty" and "side effects".
[0049] It should be noted here that the search engine must search for at least one matching segment. If the search engine does not search for a matching segment, that is, the search engine returns empty, indicating that there is no matching segment in the search text, and the current processing flow can be terminated.
[0050] Still taking the search sentence given above as an example, suppose the search text is "Prosthetic rhinoplasty improves poor nose shape, but rhinoplasty as a surgery will also encounter various problems. Some people are afraid of adverse effects after rhinoplasty, so does prosthetic rhinoplasty have side effects? Are the side effects serious? The doctor of the plastic surgery hospital will help you to accept whether there are side effects of prosthetic rhinoplasty and make you more beautiful. Are there side effects of prosthetic rhinoplasty? Online consultation on whether prosthetic rhinoplasty materials may cause side effects. The doctor said that first of all, the materials for prosthetic rhinoplasty are silicone and expanded polytetrafluoroethylene. Silicone has good elasticity, easy shaping, good chemical inertness, non-toxic, non-carcinogenic, non-teratogenic, and good tissue compatibility, and is used by many people. After the prosthesis is implanted in the body, a mild one-time inflammatory reaction is locally present, and a thin layer of fibrous capsule is formed around it in the later stage. Expanded polytetrafluoroethylene is a porous solid into which tissues can grow, and biological phase It has good tolerance. It has certain flexibility and relative incompressibility, and can be carved or heated to shape. Prosthetic rhinoplasty methods may cause side effects. Prosthetic rhinoplasty is a surgical method that uses special materials to raise the flat and concave nose bridge. The incision for the operation is generally chosen in the columella or nostril. After the material is implanted, the incision is sutured. Regarding the side effects of prosthetic rhinoplasty, the doctor of the plastic surgery hospital said that generally, if you choose a regular medical institution and use a suitable prosthesis, there will generally be no side effects of the operation. The doctor pointed out that prosthetic rhinoplasty does not have a big adverse reaction. Occasionally, some sequelae will occur, most of which are related to the patient's careless choice of plastic surgery hospital and improper postoperative care. Therefore, in order to avoid the side effects of prosthetic rhinoplasty, you must carefully choose a prosthetic rhinoplasty plastic surgery hospital, and do a good job of postoperative care, and you can't be careless. "
[0051] By calling the Elastic Search search engine, the Elastic Search search engine returns the following 10 matching fragments as candidate fragments:
[0052] 1. "Some people are afraid of adverse effects after rhinoplasty. <em>Rhinoplasty <em>have <em>side effect <em>? <em>side effect <em>The doctor at the big plastic surgery hospital will accept you <em>Rhinoplasty <em>Is there <em>side effect <em>";
[0053] 2. "Online consultation <em>Prosthesis <em>Materials may cause <em>side effect <em>The doctor said, first <em>Prosthesis <em>The most common materials are silicone and expanded polytetrafluoroethylene.
[0054] 3." <em>Rhinoplasty <em>Really <em>side effect <em>";
[0055] 4." <em>Rhinoplasty <em>Really <em>side effect <em>Modern people choose <em>Rhinoplasty <em>More and more people are looking to shape their own perfect nose, which is inseparable from the fact that people generally have low noses. ";
[0056] 5." <em>Rhinoplasty <em>Methods may lead to <em>side effect <em> <em>Rhinoplasty <em>It is a surgical method that uses special materials to raise the low and concave nose bridge. ";
[0057] 6. "Targeting <em>Rhinoplasty <em>of <em>side effect <em>Doctors at plastic surgery hospitals said that if you choose a regular medical institution and use the right prosthesis, the surgery will not cause <em>side effect <em>of";
[0058] 7. "Some sequelae may occur occasionally, most of which are related to the patient's careless choice of plastic surgery hospital and improper postoperative care. <em>Rhinoplasty <em> <em>side effect <em>";
[0059] 8. The doctor pointed out <em>Rhinoplasty <em>The surgery does not cause any serious adverse reactions.";
[0060] 9." <em>Rhinoplasty <em>Improve the poor nose shape, but rhinoplasty as a surgery will also encounter various problems. ";
[0061] 10. "Choose carefully <em>Rhinoplasty <em>Plastic surgery hospitals must also provide good post-operative care and cannot be careless. "
[0062] As can be seen from the above candidate segment examples, each candidate segment contains not only the complete sentence in the search text that matches the search statement, but also the index tags of the matched phrase segmentation and / or core word" <em>", the index mark indicates the position of the matching word in the candidate segment.
[0063] Step 102: Evaluate each candidate segment in different dimensions to obtain features corresponding to each candidate segment in each evaluation dimension.
[0064] In this step, the features of the candidate segments can characterize the matching characteristics with the search sentence.
[0065] In an optional embodiment, for each candidate segment, the text content contained in the candidate segment can be extracted, the core words and phrase words contained in the search sentence can be obtained, and then different dimensions of evaluation can be performed based on the core words, phrase words and text content to obtain the characteristics of the candidate segment in each evaluation dimension.
[0066] Among them, since the candidate segment contains non-text content in addition to text content, and the non-text content is irrelevant to the search sentence, it is necessary to extract the text content contained in the candidate segment for evaluation, which is easier to analyze the characteristics. The description of the core words and phrase words can refer to the relevant description in the above step 101, and this application will not repeat them here.
[0067] Each evaluation dimension can be configured by the user according to actual needs or can also be a default configuration. Based on this, it should be noted that before executing step 102, the evaluation dimensions can be pre-configured according to actual needs. The implementation process is: by displaying the text fragment evaluation setting interface, and responding to the configuration operation of the text fragment evaluation setting interface, the configured evaluation dimension information is obtained. For example, the configured evaluation dimensions include: whether the fragment contains the core words and / or phrase words and / or complete search sentences of the search statement, whether the fragment length is within a certain character range, whether the index mark position is within the first preset number of characters of the fragment, etc. In this way, by considering factors such as the fragment length and the index mark position to evaluate the fragment in different dimensions to select the best fragment, a more reasonable and easy-to-read search result can be provided, which helps users quickly locate key information and improve the overall search experience.
[0068] It can be seen that the characteristics of the candidate segment in each evaluation dimension are: the text content contains a complete search sentence, the text content contains a core word, the text content contains a phrase word, the segment length is within a preset character range, and the index mark position is within the first preset number of characters of the segment. As mentioned above, the index mark position is the position of the search sentence, phrase word or core word in the segment.
[0069] The following is a detailed explanation of each of the above characteristics:
[0070] 1. The feature of containing the search sentence: refers to the fact that the text content of the candidate segment contains the complete search sentence;
[0071] 2. The feature of containing core words: This means that the text content of the candidate segment contains the core words in the search sentence;
[0072] 3. Features containing phrase words: This means that the text content of the candidate segment contains the phrase words in the search sentence;
[0073] 4. The feature that the length of the segment is within the preset character range: refers to the length of the candidate segment after removing the index mark is within the preset character range, for example, the segment length is between 15 characters and 28 characters;
[0074] 5. The feature that the index mark position is within the first preset number of characters of the segment: refers to that the index mark is within the first preset number of characters of the candidate segment, for example, the index mark is within the first 15 characters of the candidate segment.
[0075] Based on the above description, it can be seen that by conducting a multi-dimensional and comprehensive evaluation of candidate fragments, more expected and easy-to-read search results can be provided. For example, considering the fragment length can avoid search results that are too long or too short. Another example is that considering the inclusion of complete search sentences, core words, phrase words, etc. can avoid the influence of complex grammatical structure text or specific text format on search results.
[0076] It is understandable that the above-mentioned several features are only exemplary, and the evaluation dimensions can be expanded according to different application scenarios and requirements to meet specific search requirements. And each evaluation dimension corresponds to a feature.
[0077] In an optional implementation, in the process of extracting the text content contained in the candidate segment, the text content of the candidate segment is obtained by removing the non-text content in the candidate segment.
[0078] Among them, non-text content includes line breaks, space characters, emoticons, index marks, etc. In specific implementation, the candidate fragments can be parsed by using an HTML parser to obtain a document object containing only text content, and then a CSS (Cascading Style Sheet) selector is used to read the text content in the document object, thereby obtaining text content that can be analyzed and queried.
[0079] Step 103: Determine the evaluation score of each candidate segment based on the features corresponding to each candidate segment in each evaluation dimension.
[0080] In this step, since the features of the candidate fragment can characterize the matching characteristics with the search statement, the evaluation score determined based on the features of the candidate fragment can better reflect the degree of matching between the candidate fragment and the search statement. The specific reflection form is that the higher the evaluation score, the higher the matching degree.
[0081] In an optional embodiment, for each candidate segment, a preset level of a feature corresponding to the candidate segment in each evaluation dimension may be obtained, and the evaluation score of the candidate segment may be determined according to the obtained preset level.
[0082] The preset level may reflect the importance of the corresponding feature. Usually, the user sets a level for each feature according to actual needs. The higher the level, the more important the user considers the feature. Optionally, the specific representation of the level may be a score or a weight.
[0083] In specific implementation, the corresponding score or weight can be pre-set for each feature on the evaluation dimension according to the importance of different features. In this way, through a flexible scoring mechanism, appropriate fragments can be selected for display according to the importance of search keywords and special needs, and customized fragment displays can be achieved to provide more targeted and personalized search results. For example, the corresponding evaluation score for features containing search statements is 15, the corresponding evaluation score for features containing core words is 10, the corresponding evaluation score for features containing phrase words is 6, the corresponding evaluation score for features whose fragment length is within the preset character range is 2, and the corresponding evaluation score for features whose index mark position is within the first preset number of characters of the fragment is 3.
[0084] Based on this, taking the scoring as an example, when determining the evaluation score of the candidate segment according to the obtained preset level, in one example, the preset scores corresponding to each feature can be directly accumulated to obtain the final evaluation score. In another example, the final evaluation score can also be obtained by weighted summing the preset scores corresponding to each feature.
[0085] For the process from step 102 to step 103, taking the 10 candidate segments given in step 101 as an example, for the first candidate segment, its characteristics are: containing core words, containing phrase words, and the segment length is greater than 10, and the evaluation score is 18 points; for the second candidate segment, its characteristics are: containing phrase words, and the segment length is greater than 10, and the evaluation score is 8 points; for the third candidate segment, its characteristics are: containing standard words, containing phrase words, the segment length is greater than 10, and the position of the index mark is within 15 characters of the candidate segment, and the evaluation score is 21 points. The 4th, 5th, 6th, 7th, 8th, 9th, and 10th candidate segments are evaluated in turn to obtain evaluation scores.
[0086] Step 104: Select search results of the search statement from at least one candidate segment according to the evaluation score.
[0087] In an optional embodiment, a candidate segment corresponding to the highest evaluation score may be selected from at least one candidate segment as the search result.
[0088] As mentioned above, the evaluation score of the first candidate segment is 18 points, the evaluation score of the second candidate segment is 8 points, and the evaluation score of the third candidate segment is 21 points. Finally, the third candidate segment is selected as the search result:" <em>Rhinoplasty <em>Really <em>side effect <em>"
[0089] It should be noted here that the above-mentioned method of determining search results by selecting the highest evaluation score is only a specific example. Other selection methods can also be used to determine search results according to actual needs, such as selecting search results by selecting evaluation scores exceeding a certain threshold.
[0090] At this point, the above Figure 1 The search process shown in the figure obtains multiple candidate fragments matched by the search statement, and evaluates each candidate fragment in different dimensions to obtain the features corresponding to each candidate fragment in each evaluation dimension, so as to score each candidate fragment based on the different features of each candidate fragment. Since the features obtained by the evaluation can reflect the matching characteristics of the candidate fragment and the search statement, the evaluation score of the candidate fragment obtained based on the feature can reflect the matching degree between the search result and the search statement. Therefore, the search result further selected according to the evaluation score is more accurate and can better meet the actual needs of the user.
[0091] Based on the above Figure 1 Based on the embodiment shown, a specific solution for implementing text search is given below, such as Figure 2 As shown, including step 1 to step 10:
[0092] Step 1: Obtain the core words and phrase words of the search sentence through NLP (Natural Language Processing) analysis.
[0093] Step 2: Get the fragment array returned by the ES search engine based on the search statement, core words, and phrase words.
[0094] Step 3: Initialize the maximum evaluation score maxScore to -1.
[0095] Step 4: If the fragment array is not empty, iterate through each fragment in the fragment array, and for each fragment, obtain the string representation of the fragment.
[0096] Step 5: Use HTML parser to parse the string into a document object.
[0097] Step 6: If the document object is not null, get the text content collection of the fragment using the CSS selector.
[0098] Step 7: If the text content set is not empty, the score of the fragment is calculated according to a series of rules:
[0099] - If the text content set contains the complete search statement, give a score of +15.
[0100] - If the text content set contains the core word of the query, a score of +10 is given.
[0101] - If the text content collection contains the query phrase word, give a score of +6.
[0102] - If the index marker is within the first 15 characters of the fragment, a score of +3 is given.
[0103] - If the fragment length after removing the index markers is between 15 and 28 characters, give a score of +2.
[0104] - If the fragment length after removing the index marker is greater than 10 characters, give a score of +2.
[0105] Step 8: If the calculated evaluation score is greater than maxScore, update maxScore to the current evaluation score.
[0106] Step 9: After traversing all segments, assign the segment corresponding to maxScore to the search result.
[0107] The execution subject of the embodiment of the present application may be an application, service, instance, software-based functional module, virtual machine (VM), container or cloud server, etc., or a hardware device (such as a server or terminal device) or hardware chip (such as CPU, GPU, FPGA, NPU, AI acceleration card or DPU) with data processing function. The device for implementing text search can be deployed on the computing device of the application party that provides the corresponding service or on a cloud computing platform that provides computing power, storage and network resources. The mode in which the cloud computing platform provides services to the outside world may be IaaS (Infrastructure as a Service), PaaS (Platform as a Service), SaaS (Software as a Service) or DaaS (Data as a Service). Taking the platform providing SaaS software as a service (Software as a Service) as an example, the cloud computing platform can use its own computing resources to provide training of text search models or functional execution of text search modules, and the specific application architecture can be built according to service requirements. For example, the platform can provide construction services based on the above model to application parties or individuals using platform resources, and further call the above model and implement online or offline text search functions based on text search requests submitted by related clients or servers and other devices.
[0108] Corresponding to the above-mentioned embodiments of the text search method, the present application also provides embodiments of a text search device.
[0109] Figure 3 FIG. 1 is a schematic diagram showing a structure of a text search device according to an exemplary embodiment. The device is used to execute the text search method provided in any of the above embodiments, such as Figure 3 As shown, the text search device includes:
[0110] The segment acquisition module 210 is used to acquire at least one candidate segment matching the search statement in the search text;
[0111] The segment evaluation module 220 is used to evaluate each candidate segment in different dimensions, obtain the features corresponding to each candidate segment in each evaluation dimension, and determine the evaluation score of each candidate segment based on the features corresponding to each candidate segment in each evaluation dimension;
[0112] The result determination module 230 is configured to select a search result of the search statement from the at least one candidate segment according to the evaluation score.
[0113] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.
[0114] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0115] The embodiments of the present application also provide an electronic device corresponding to the text search method provided in the aforementioned embodiments to execute the aforementioned text search method.
[0116] Figure 4 6 is a hardware structure diagram of an electronic device according to an exemplary embodiment, the electronic device includes: a communication interface 601, a processor 602, a memory 603 and a bus 604; wherein the communication interface 601, the processor 602 and the memory 603 communicate with each other through the bus 604. The processor 602 can execute the text search method described above by reading and executing the machine executable instructions corresponding to the control logic of the text search method in the memory 603. The specific content of the method is referred to the above embodiment, which will not be repeated here.
[0117] The memory 603 mentioned in this application can be any electronic, magnetic, optical or other physical storage device, and can contain storage information, such as executable instructions, data, etc. Specifically, the memory 603 can be RAM (Random Access Memory), flash memory, storage drive (such as hard disk drive), any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 601 (which can be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used.
[0118] The bus 604 may be an ISA bus, a PCI bus or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 603 is used to store programs, and the processor 602 executes the programs after receiving execution instructions.
[0119] Processor 602 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in processor 602 or an instruction in software form. The above-mentioned processor 602 can be a general-purpose processor, including a network processor (Network Processor, referred to as NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware decoding processor to execute, or the hardware and software modules in the decoding processor are combined to execute.
[0120] The electronic device provided in the embodiment of the present application and the text search method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented therein.
[0121] The present application also provides a computer-readable storage medium corresponding to the text search method provided in the above embodiment. Figure 5 As shown, the computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is executed by a processor, the text search method provided by any of the aforementioned embodiments will be executed.
[0122] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.
[0123] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the text search method provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.
[0124] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0125] It should also be noted that the term "includes", "comprising" or any other variation thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the existence of other identical elements in the process, method, commodity or device including the element.
[0126] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.< / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em> < / em>
Claims
1. A text search method, characterized in that: The method comprises: Obtaining at least one candidate segment matching the search statement in the search text; Each candidate segment is evaluated in different dimensions to obtain the features corresponding to each candidate segment in each evaluation dimension; the features reflect the matching characteristics between the candidate segment and the search statement; Determine an evaluation score for each candidate segment based on the features corresponding to each candidate segment in each evaluation dimension; A search result of the search statement is selected from the at least one candidate segment according to the evaluation score.
2. The method according to claim 1, characterized in that The step of performing different dimension evaluations on each candidate segment to obtain corresponding features of each candidate segment in each evaluation dimension includes: For each candidate segment, extract the text content contained in the candidate segment; Obtaining core words and phrase words included in the search sentence; Different dimensional evaluations are performed based on the core words, the phrase words and the text content to obtain the corresponding features of the candidate segment in each evaluation dimension.
3. The method according to any one of claims 1 or 2, characterized in that: The candidate fragment has the following features corresponding to each evaluation dimension: the text content contains a complete search statement, the text content contains a core word, the text content contains a phrase word, the fragment length is within a preset character range, and the index mark position is within the first preset number of characters of the fragment, and any one or more of the following, wherein the index mark position is the position of the search statement, phrase word, or core word in the fragment.
4. The method according to claim 2, characterized in that: The extracting text content contained in the candidate segment includes: Removing non-text content from the candidate segment to obtain text content of the candidate segment; The non-text content includes line breaks, space characters and emoticons.
5. The method according to claim 1, characterized in that The step of determining the evaluation score of each candidate segment based on the features corresponding to each candidate segment in each evaluation dimension includes: For each candidate segment, obtaining a preset level of a feature corresponding to the candidate segment in each evaluation dimension; The evaluation score of the candidate segment is determined according to the obtained preset level.
6. The method according to any one of claims 1 to 5, characterized in that: Before performing different dimension evaluations on each candidate segment to obtain the features corresponding to each candidate segment in each evaluation dimension, the method further includes: Display the text snippet evaluation settings interface; In response to a configuration operation of the text segment evaluation setting interface, configured evaluation dimension information is obtained.
7. The method according to claim 1, characterized in that The step of obtaining at least one candidate segment matching the search statement in the search text includes: Obtaining core words and phrase words included in the search sentence; The preset search engine is called to search for matching segments in the search text based on the search sentence, the core words and the phrase words, and the searched matching segments are used as candidate segments.
8. A text search device, characterized in that: The device comprises: A fragment acquisition module, used to acquire at least one candidate fragment matching the search statement in the search text; A segment evaluation module is used to evaluate each candidate segment in different dimensions, obtain the features corresponding to the candidate segment in each evaluation dimension, and determine the evaluation score of the candidate segment based on the features corresponding to the candidate segment in each evaluation dimension; A result determination module is used to select a search result of the search statement from the at least one candidate segment according to the evaluation score.
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 program to implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the steps of the method according to any one of claims 1 to 7.