Text search method, device, equipment and storage medium
By performing word segmentation processing and part-of-speech recognition on text search requests, and adjusting weights in combination with preset lists and search fields, the problem of meaningless word matching in search engines is solved, and search accuracy and efficiency are improved.
Patent Information
- Application Number
- CN202210422204.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-21
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2042-04-21
Smart Images

Figure CN114741492B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a text search method, device, equipment and storage medium. Background Art
[0002] In current search engines, a large amount of data can usually be searched out based on a request statement. However, since there are a large number of meaningless words matching the request statement in the data searched out from the search engine, the data searched out from the search engine is inaccurate. Summary of the invention
[0003] In view of the above, it is necessary to provide a text search method, device, equipment and storage medium that can improve search accuracy and search efficiency.
[0004] In one aspect, the present invention provides a text search method, the text search method comprising:
[0005] When a text search request is received, obtaining a request statement according to the text search request;
[0006] Performing word segmentation processing on the request sentence to obtain a search term and a part of speech of the search term in the request sentence;
[0007] Identifying the search field corresponding to the request statement according to the search vocabulary;
[0008] Acquire the initial weight of the search term according to the part of speech of the sentence, and adjust the initial weight according to the preset list and the search field to obtain the target weight;
[0009] Acquire multiple preliminary screening texts matching the request statement based on preset dimensions, each preliminary screening text including multiple text segmentations;
[0010] Calculating the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentations;
[0011] Acquire a matching degree between the target text and the request sentence based on the preset dimension;
[0012] The target text is displayed according to the hit rate and the matching degree to obtain a search list.
[0013] According to a preferred embodiment of the present invention, the adjusting process of the initial weight according to the preset list and the search field to obtain the target weight includes:
[0014] Acquire domain words corresponding to the search domain from the preset list, and acquire common words in all application domains from the preset list;
[0015] Calculating the similarity between the search term and the domain term;
[0016] The initial weight corresponding to the search terms whose similarity is greater than a preset similarity threshold is set as a first preset weight, and the initial weight corresponding to the search terms matching the common terms is set as a second preset weight, to obtain the target weight, wherein the first preset weight is greater than the second preset weight.
[0017] According to a preferred embodiment of the present invention, the step of calculating the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentation words includes:
[0018] Determine a text segmentation that matches the search term as a target segmentation, and obtain a matching segmentation weight of the target segmentation from the target weight;
[0019] Filter the preliminary screening texts whose word segmentation weights are all less than a preset weight threshold to obtain the target text;
[0020] Obtaining initial segmentation weights of multiple text segmentations in the target text;
[0021] For each target text, the sum of the matching word segmentation weights is calculated to obtain a first value, and the sum of the initial word segmentation weights is calculated to obtain a second value;
[0022] The ratio of the first value to the second value is calculated to obtain the hit rate.
[0023] According to a preferred embodiment of the present invention, identifying the search field corresponding to the request statement according to the search vocabulary includes:
[0024] Obtain key words for all application areas described;
[0025] Counting the number of key words in each application field that match the search words;
[0026] The application field with the largest number of words is determined as the search field.
[0027] According to a preferred embodiment of the present invention, the word segmentation processing of the request sentence to obtain the search words and the part of speech of the search words in the request sentence includes:
[0028] Dividing the request sentence based on a preset dictionary to obtain multiple division paths and initial vocabulary corresponding to each division path;
[0029] Obtaining a set score of the initial vocabulary in the preset dictionary;
[0030] Calculate the path score of each divided path according to the set score;
[0031] Determine the initial word corresponding to the divided path with the largest path score as the search word;
[0032] The sentence part of speech is filtered out from the set parts of speech of the search word in the preset dictionary based on the position of the search word in the request sentence.
[0033] According to a preferred embodiment of the present invention, obtaining the initial weight of the search term according to the sentence part of speech includes:
[0034] Get the part-of-speech level mapping table;
[0035] Acquire the vocabulary level corresponding to the search vocabulary from the part-of-speech level mapping table according to the sentence part-of-speech;
[0036] A weight corresponding to the vocabulary level is obtained as the initial weight.
[0037] According to a preferred embodiment of the present invention, the target text is displayed according to the hit rate and the matching degree to obtain a search list including:
[0038] Calculating the relevance between the target text and the request sentence according to the hit rate and the matching degree;
[0039] Extracting a text arrangement order from the text search request;
[0040] The target text is displayed according to the relevance and the text arrangement order.
[0041] On the other hand, the present invention further provides a text search device, the text search device comprising:
[0042] an acquisition unit, configured to acquire a request statement according to the text search request when a text search request is received;
[0043] A processing unit, configured to perform word segmentation processing on the request sentence to obtain a search term and a part of speech of the search term in the request sentence;
[0044] an identification unit, configured to identify a search field corresponding to the request statement according to the search vocabulary;
[0045] An adjustment unit, configured to obtain an initial weight of the search term according to the part of speech of the sentence, and adjust the initial weight according to a preset list and the search field to obtain a target weight;
[0046] The acquisition unit is further used to acquire a plurality of preliminary screening texts matching the request statement based on a preset dimension, each preliminary screening text including a plurality of text segmentations;
[0047] A calculation unit, used for calculating the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentation words;
[0048] The acquisition unit is further configured to acquire a matching degree between the target text and the request sentence based on the preset dimension;
[0049] A display unit is used to display the target text according to the hit rate and the matching degree to obtain a search list.
[0050] On the other hand, the present invention further provides an electronic device, comprising:
[0051] a memory storing computer readable instructions; and
[0052] The processor executes the computer-readable instructions stored in the memory to implement the text search method.
[0053] On the other hand, the present invention further proposes a computer-readable storage medium, in which computer-readable instructions are stored. The computer-readable instructions are executed by a processor in an electronic device to implement the text search method.
[0054] It can be seen from the above technical solutions that the present invention sets the initial weight of the search vocabulary by the part of speech of the search vocabulary in the request sentence, and can distinguish the contribution of words of different parts of speech to the search results, and then use the preset list and the search field to adjust the initial weight, which can accurately determine the importance of the search vocabulary in the search field, and then use the target weight to filter out part of the data in the multiple preliminary screening texts. Since there are high-frequency words that match meaningless words in the multiple preliminary screening texts, the multiple preliminary screening texts can be accurately filtered through the target weight, thereby improving the search accuracy of the target text. In addition, the target weight and the multiple text segmentation can be used to filter the target text without analyzing the text semantics, thereby improving the search efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a flow chart of a preferred embodiment of the text search method of the present invention.
[0056] Figure 2 It is a functional module diagram of a preferred embodiment of the text search device of the present invention.
[0057] Figure 3It is a schematic diagram of the structure of an electronic device of a preferred embodiment of the text search method of the present invention. DETAILED DESCRIPTION
[0058] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0059] like Figure 1 FIG. 1 is a flowchart of a preferred embodiment of the text search method of the present invention. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.
[0060] The text search method can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0061] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0062] The text search method is applied to one or more electronic devices, which are devices that can automatically perform numerical calculations and / or information processing according to pre-set or stored computer-readable instructions, and whose hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0063] The electronic device may be any electronic product that can perform human-computer interaction with a user, such as a personal computer, a tablet computer, a smart phone, a personal digital assistant (PDA), a game console, an interactive network television (IPTV), a smart wearable device, etc.
[0064] The electronic device may include a network device and / or a user device. The network device includes, but is not limited to, a single network electronic device, an electronic device group consisting of multiple network electronic devices, or a cloud consisting of a large number of hosts or network electronic devices based on cloud computing.
[0065] The network where the electronic device is located includes, but is not limited to: the Internet, a wide area network, a metropolitan area network, a local area network, a virtual private network (VPN), etc.
[0066] S10: When a text search request is received, a request statement is obtained according to the text search request.
[0067] In at least one embodiment of the present invention, the text search request carries a text arrangement order and the request statement, wherein the text arrangement order refers to an order from large to small, or an order from small to large.
[0068] The request sentence refers to a sentence that needs to be searched for text, for example, the request sentence may be: What is the highest level of a youth league organization?
[0069] In at least one embodiment of the present invention, the electronic device obtaining a request statement according to the text search request includes:
[0070] Parsing the message of the text search request to obtain data information carried in the message;
[0071] Information corresponding to the preset tag is extracted from the data information as the request statement.
[0072] The preset label may be a question mark.
[0073] Through the above implementation, the request statement can be accurately and quickly obtained.
[0074] S11, performing word segmentation processing on the request sentence to obtain search terms and the part of speech of the search terms in the request sentence.
[0075] In at least one embodiment of the present invention, the sentence parts of speech include, but are not limited to: adjectives, quantifiers, place names, organizations, idioms, and the like.
[0076] In at least one embodiment of the present invention, the electronic device performs word segmentation processing on the request sentence to obtain the search terms and the part of speech of the search terms in the request sentence includes:
[0077] Dividing the request sentence based on a preset dictionary to obtain multiple division paths and initial vocabulary corresponding to each division path;
[0078] Obtaining a set score of the initial vocabulary in the preset dictionary;
[0079] Calculate the path score of each divided path according to the set score;
[0080] Determine the initial word corresponding to the divided path with the largest path score as the search word;
[0081] The sentence part of speech is filtered out from the set parts of speech of the search word in the preset dictionary based on the position of the search word in the request sentence.
[0082] The preset dictionary stores a plurality of set words and a set score and a set part of speech of each set word. For example, the set score of the set word "praise" is 0.8, and the set part of speech is verb.
[0083] By dividing the request statement through the preset dictionary and calculating the path score of each divided path, the search term can be accurately determined, and then the part of speech of the statement can be accurately screened in combination with the position of the search term in the request statement.
[0084] Specifically, the electronic device selects the sentence part of speech from the set parts of speech of the search word in the preset dictionary based on the position of the search word in the request sentence, including:
[0085] Obtaining the grammatical structure of the request statement;
[0086] Identify the sentence component corresponding to the position based on the grammatical structure;
[0087] The part of speech corresponding to the sentence component is acquired from the set part of speech as the sentence part of speech.
[0088] Through the above implementation, the grammatical structure and the set part of speech can be combined to accurately determine the part of speech of the sentence.
[0089] S12: Identify the search field corresponding to the request statement according to the search terms.
[0090] In at least one embodiment of the present invention, the search field refers to a field corresponding to the request statement, for example, the search field may be an automobile field or the like.
[0091] In at least one embodiment of the present invention, the electronic device identifying the search field corresponding to the request statement according to the search vocabulary includes:
[0092] Obtain key terms for all application areas;
[0093] Counting the number of key words in each application field that match the search words;
[0094] The application field with the largest number of words is determined as the search field.
[0095] The key words are obtained from a preset website.
[0096] By counting the number of words, the search field can be accurately located.
[0097] S13, obtaining the initial weight of the search term according to the part of speech of the sentence, and adjusting the initial weight according to a preset list and the search field to obtain a target weight.
[0098] In at least one embodiment of the present invention, the initial weight is obtained based on a part-of-speech level mapping table, wherein the part-of-speech level mapping table stores a mapping relationship between parts of speech and levels. It can be understood that there is a corresponding relationship between the level and the initial weight.
[0099] The preset list stores vocabulary corresponding to all application fields.
[0100] The target weight is used to indicate the importance of the search term to this text search.
[0101] In at least one embodiment of the present invention, the electronic device acquiring the initial weight of the search term according to the sentence part of speech includes:
[0102] Get the part-of-speech level mapping table;
[0103] Acquire the vocabulary level corresponding to the search vocabulary from the part-of-speech level mapping table according to the sentence part-of-speech;
[0104] A weight corresponding to the vocabulary level is obtained as the initial weight.
[0105] Through the above implementation, the initial weight can be quickly acquired.
[0106] In at least one embodiment of the present invention, the electronic device adjusts the initial weight according to the preset list and the search field to obtain the target weight, which includes:
[0107] Acquire domain words corresponding to the search domain from the preset list, and acquire common words in all application domains from the preset list;
[0108] Calculating the similarity between the search term and the domain term;
[0109] The initial weight corresponding to the search terms whose similarity is greater than a preset similarity threshold is set as a first preset weight, and the initial weight corresponding to the search terms matching the common terms is set as a second preset weight, to obtain the target weight, wherein the first preset weight is greater than the second preset weight.
[0110] The common words refer to words included in all the application fields. For example, the common words may be: in, have, is, etc.
[0111] The preset similarity threshold can be set according to actual needs.
[0112] The first preset weight is usually set as the weight corresponding to the highest vocabulary level, and the second preset weight is usually set as the weight corresponding to the lowest vocabulary level. It can be understood that the higher the vocabulary level, the greater the corresponding weight.
[0113] Through the above implementation, the initial weight can be adjusted to improve the accuracy of the target weight.
[0114] S14, obtaining a plurality of preliminary screening texts matching the request statement based on a preset dimension, each preliminary screening text including a plurality of text segmentations.
[0115] In at least one embodiment of the present invention, the preset dimension may be any dimension. For example, the preset dimension may be a text matching dimension.
[0116] The multiple initially screened texts refer to texts whose text matching values are greater than a preset matching threshold.
[0117] In at least one embodiment of the present invention, the electronic device acquiring a plurality of preliminary screening texts matching the request statement based on a preset dimension comprises:
[0118] Get all the search engine texts in the search engine;
[0119] Calculate the text matching value between each engine text and the request statement;
[0120] The engine texts whose text matching values are greater than the preset matching threshold are determined as the multiple preliminary screening texts.
[0121] Specifically, the electronic device may calculate a text matching value between each engine text and the request sentence according to vocabulary similarity.
[0122] S15, calculating the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentations.
[0123] In at least one embodiment of the present invention, the target text refers to the initially screened text corresponding to the text segmentation whose segmentation weight is greater than or equal to a preset weight threshold.
[0124] The hit rate is used to indicate the matching status between the target text and the request sentence in the part-of-speech dimension.
[0125] In at least one embodiment of the present invention, the electronic device calculates the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentation words, including:
[0126] Determine a text segmentation that matches the search term as a target segmentation, and obtain a matching segmentation weight of the target segmentation from the target weight;
[0127] Filter the preliminary screening texts whose word segmentation weights are all less than a preset weight threshold to obtain the target text;
[0128] Obtaining initial segmentation weights of multiple text segmentations in the target text;
[0129] For each target text, the sum of the matching word segmentation weights is calculated to obtain a first value, and the sum of the initial word segmentation weights is calculated to obtain a second value;
[0130] The ratio of the first value to the second value is calculated to obtain the hit rate.
[0131] By filtering the primary screening text, the search accuracy can be improved. At the same time, since there is no need to analyze the interference text, the search efficiency can be improved.
[0132] S16: Obtain the matching degree between the target text and the request sentence based on the preset dimension.
[0133] In at least one embodiment of the present invention, the matching degree refers to the text matching value mentioned above, which will not be described in detail in the present invention.
[0134] S17, displaying the target text according to the hit rate and the matching degree to obtain a search list.
[0135] It should be emphasized that in order to further ensure the privacy and security of the above search list, the above search list can also be stored in a node of a blockchain.
[0136] In at least one embodiment of the present invention, the search list refers to a list generated after sorting the target text according to the text arrangement order.
[0137] In at least one embodiment of the present invention, the electronic device displays the target text according to the hit rate and the matching degree, and the obtained search list includes:
[0138] Calculating the relevance between the target text and the request sentence according to the hit rate and the matching degree;
[0139] Extracting a text arrangement order from the text search request;
[0140] The target text is displayed according to the relevance and the text arrangement order to obtain a search list.
[0141] The relevance may be determined based on a weighted sum of the hit rate and the matching degree.
[0142] The method of extracting the text arrangement order is similar to the method of extracting the request sentence, and the present invention will not elaborate on this.
[0143] The relevance can be accurately quantified through the hit rate and the matching degree, thereby improving the accuracy of the search list.
[0144] It can be seen from the above technical solutions that the present invention sets the initial weight of the search vocabulary by the part of speech of the search vocabulary in the request sentence, and can distinguish the contribution of words of different parts of speech to the search results, and then use the preset list and the search field to adjust the initial weight, which can accurately determine the importance of the search vocabulary in the search field, and then use the target weight to filter out part of the data in the multiple preliminary screening texts. Since there are high-frequency words that match meaningless words in the multiple preliminary screening texts, the multiple preliminary screening texts can be accurately filtered through the target weight, thereby improving the search accuracy of the target text. In addition, the target weight and the multiple text segmentation can be used to filter the target text without analyzing the text semantics, thereby improving the search efficiency.
[0145] like Figure 2 , which is a functional module diagram of a preferred embodiment of the text search device of the present invention. The text search device 11 includes an acquisition unit 110, a processing unit 111, a recognition unit 112, an adjustment unit 113, a calculation unit 114 and a display unit 115. The module / unit referred to in the present invention refers to a series of computer-readable instruction segments that can be acquired by the processor 13 and can perform fixed functions, which are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0146] When receiving a text search request, the acquisition unit 110 acquires a request sentence according to the text search request.
[0147] In at least one embodiment of the present invention, the text search request carries a text arrangement order and the request statement, wherein the text arrangement order refers to an order from large to small, or an order from small to large.
[0148] The request sentence refers to a sentence that needs to be searched for text, for example, the request sentence may be: What is the highest level of a youth league organization?
[0149] In at least one embodiment of the present invention, the acquiring unit 110 acquires the request statement according to the text search request, including:
[0150] Parsing the message of the text search request to obtain data information carried in the message;
[0151] Information corresponding to the preset tag is extracted from the data information as the request statement.
[0152] The preset label may be a question mark.
[0153] Through the above implementation, the request statement can be accurately and quickly obtained.
[0154] The processing unit 111 performs word segmentation processing on the request sentence to obtain a search term and a part of speech of the search term in the request sentence.
[0155] In at least one embodiment of the present invention, the sentence parts of speech include, but are not limited to: adjectives, quantifiers, place names, organizations, idioms, and the like.
[0156] In at least one embodiment of the present invention, the processing unit 111 performs word segmentation processing on the request sentence to obtain search terms and the sentence parts of speech of the search terms in the request sentence include:
[0157] Dividing the request sentence based on a preset dictionary to obtain multiple division paths and initial vocabulary corresponding to each division path;
[0158] Obtaining a set score of the initial vocabulary in the preset dictionary;
[0159] Calculate the path score of each divided path according to the set score;
[0160] Determine the initial word corresponding to the divided path with the largest path score as the search word;
[0161] The sentence part of speech is filtered out from the set parts of speech of the search word in the preset dictionary based on the position of the search word in the request sentence.
[0162] The preset dictionary stores a plurality of set words and a set score and a set part of speech of each set word. For example, the set score of the set word "praise" is 0.8, and the set part of speech is verb.
[0163] By dividing the request statement through the preset dictionary and calculating the path score of each divided path, the search term can be accurately determined, and then the part of speech of the statement can be accurately screened in combination with the position of the search term in the request statement.
[0164] Specifically, the processing unit 111 selects the sentence part of speech from the set parts of speech of the search word in the preset dictionary based on the position of the search word in the request sentence, including:
[0165] Obtaining the grammatical structure of the request statement;
[0166] Identify the sentence component corresponding to the position based on the grammatical structure;
[0167] The part of speech corresponding to the sentence component is acquired from the set part of speech as the sentence part of speech.
[0168] Through the above implementation, the grammatical structure and the set part of speech can be combined to accurately determine the part of speech of the sentence.
[0169] The identification unit 112 identifies the search field corresponding to the request sentence according to the search words.
[0170] In at least one embodiment of the present invention, the search field refers to a field corresponding to the request statement, for example, the search field may be an automobile field or the like.
[0171] In at least one embodiment of the present invention, the identifying unit 112 identifies the search field corresponding to the request statement according to the search vocabulary, including:
[0172] Obtain key terms for all application areas;
[0173] Counting the number of key words in each application field that match the search words;
[0174] The application field with the largest number of words is determined as the search field.
[0175] The key words are obtained from a preset website.
[0176] By counting the number of words, the search field can be accurately located.
[0177] The adjustment unit 113 obtains the initial weight of the search term according to the part of speech of the sentence, and adjusts the initial weight according to a preset list and the search field to obtain a target weight.
[0178] In at least one embodiment of the present invention, the initial weight is obtained based on a part-of-speech level mapping table, wherein the part-of-speech level mapping table stores a mapping relationship between parts of speech and levels. It can be understood that there is a corresponding relationship between the level and the initial weight.
[0179] The preset list stores vocabulary corresponding to all application fields.
[0180] The target weight is used to indicate the importance of the search term to this text search.
[0181] In at least one embodiment of the present invention, the adjusting unit 113 obtains the initial weight of the search term according to the sentence part of speech, including:
[0182] Get the part-of-speech level mapping table;
[0183] Acquire the vocabulary level corresponding to the search vocabulary from the part-of-speech level mapping table according to the sentence part-of-speech;
[0184] A weight corresponding to the vocabulary level is obtained as the initial weight.
[0185] Through the above implementation, the initial weight can be quickly acquired.
[0186] In at least one embodiment of the present invention, the adjusting unit 113 adjusts the initial weight according to the preset list and the search field to obtain the target weight, which includes:
[0187] Acquire domain words corresponding to the search domain from the preset list, and acquire common words in all application domains from the preset list;
[0188] Calculating the similarity between the search term and the domain term;
[0189] The initial weight corresponding to the search terms whose similarity is greater than a preset similarity threshold is set as a first preset weight, and the initial weight corresponding to the search terms matching the common terms is set as a second preset weight, to obtain the target weight, wherein the first preset weight is greater than the second preset weight.
[0190] The common words refer to words included in all the application fields. For example, the common words may be: in, have, is, etc.
[0191] The preset similarity threshold can be set according to actual needs.
[0192] The first preset weight is usually set as the weight corresponding to the highest vocabulary level, and the second preset weight is usually set as the weight corresponding to the lowest vocabulary level. It can be understood that the higher the vocabulary level, the greater the corresponding weight.
[0193] Through the above implementation, the initial weight can be adjusted to improve the accuracy of the target weight.
[0194] The acquisition unit 110 acquires a plurality of preliminary screening texts matching the request statement based on a preset dimension, each of the preliminary screening texts including a plurality of text segmentations.
[0195] In at least one embodiment of the present invention, the preset dimension may be any dimension. For example, the preset dimension may be a text matching dimension.
[0196] The multiple initially screened texts refer to texts whose text matching values are greater than a preset matching threshold.
[0197] In at least one embodiment of the present invention, the acquiring unit 110 acquires a plurality of preliminary screening texts matching the request statement based on a preset dimension, including:
[0198] Get all the search engine texts in the search engine;
[0199] Calculate the text matching value between each engine text and the request statement;
[0200] The engine texts whose text matching values are greater than the preset matching threshold are determined as the multiple preliminary screening texts.
[0201] Specifically, the acquisition unit 110 may calculate a text matching value between each engine text and the request sentence according to vocabulary similarity.
[0202] The calculation unit 114 calculates the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentations.
[0203] In at least one embodiment of the present invention, the target text refers to the initially screened text corresponding to the text segmentation whose segmentation weight is greater than or equal to a preset weight threshold.
[0204] The hit rate is used to indicate the matching status between the target text and the request sentence in the part-of-speech dimension.
[0205] In at least one embodiment of the present invention, the calculation unit 114 calculates the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentation words, including:
[0206] Determine a text segmentation that matches the search term as a target segmentation, and obtain a matching segmentation weight of the target segmentation from the target weight;
[0207] Filter the preliminary screening texts whose word segmentation weights are all less than a preset weight threshold to obtain the target text;
[0208] Obtaining initial segmentation weights of multiple text segmentations in the target text;
[0209] For each target text, the sum of the matching word segmentation weights is calculated to obtain a first value, and the sum of the initial word segmentation weights is calculated to obtain a second value;
[0210] The ratio of the first value to the second value is calculated to obtain the hit rate.
[0211] By filtering the primary screening text, the search accuracy can be improved. At the same time, since there is no need to analyze the interference text, the search efficiency can be improved.
[0212] The acquisition unit 110 acquires a matching degree between the target text and the request sentence based on the preset dimension.
[0213] In at least one embodiment of the present invention, the matching degree refers to the text matching value mentioned above, which will not be described in detail in the present invention.
[0214] The display unit 115 displays the target text according to the hit rate and the matching degree to obtain a search list.
[0215] It should be emphasized that in order to further ensure the privacy and security of the above search list, the above search list can also be stored in a node of a blockchain.
[0216] In at least one embodiment of the present invention, the search list refers to a list generated after sorting the target text according to the text arrangement order.
[0217] In at least one embodiment of the present invention, the display unit 115 displays the target text according to the hit rate and the matching degree, and the obtained search list includes:
[0218] Calculating the relevance between the target text and the request sentence according to the hit rate and the matching degree;
[0219] Extracting a text arrangement order from the text search request;
[0220] The target text is displayed according to the relevance and the text arrangement order to obtain a search list.
[0221] The relevance may be determined based on a weighted sum of the hit rate and the matching degree.
[0222] The method of extracting the text arrangement order is similar to the method of extracting the request sentence, and the present invention will not elaborate on this.
[0223] The relevance can be accurately quantified through the hit rate and the matching degree, thereby improving the accuracy of the search list.
[0224] It can be seen from the above technical solutions that the present invention sets the initial weight of the search vocabulary by the part of speech of the search vocabulary in the request sentence, and can distinguish the contribution of words of different parts of speech to the search results, and then use the preset list and the search field to adjust the initial weight, which can accurately determine the importance of the search vocabulary in the search field, and then use the target weight to filter out part of the data in the multiple preliminary screening texts. Since there are high-frequency words that match meaningless words in the multiple preliminary screening texts, the multiple preliminary screening texts can be accurately filtered through the target weight, thereby improving the search accuracy of the target text. In addition, the target weight and the multiple text segmentation can be used to filter the target text without analyzing the text semantics, thereby improving the search efficiency.
[0225] like Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device of a preferred embodiment of the text search method of the present invention.
[0226] In one embodiment of the present invention, the electronic device 1 includes, but is not limited to, a memory 12, a processor 13, and computer-readable instructions stored in the memory 12 and executable on the processor 13, such as a text search program.
[0227] Those skilled in the art will understand that the schematic diagram is merely an example of the electronic device 1 and does not constitute a limitation on the electronic device 1. The electronic device 1 may include more or fewer components than shown in the diagram, or a combination of certain components, or different components. For example, the electronic device 1 may also include input and output devices, network access devices, buses, etc.
[0228] The processor 13 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 13 is the computing core and control center of the electronic device 1, and uses various interfaces and lines to connect various parts of the entire electronic device 1, and executes the operating system of the electronic device 1 and various installed applications, program codes, etc.
[0229] Exemplarily, the computer-readable instructions may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present invention. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer-readable instructions in the electronic device 1. For example, the computer-readable instructions may be divided into an acquisition unit 110, a processing unit 111, an identification unit 112, an adjustment unit 113, a calculation unit 114, and a display unit 115.
[0230] The memory 12 can be used to store the computer-readable instructions and / or modules, and the processor 13 implements various functions of the electronic device 1 by running or executing the computer-readable instructions and / or modules stored in the memory 12, and calling the data stored in the memory 12. The memory 12 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the electronic device, etc. The memory 12 can include non-volatile and volatile memories, such as: a hard disk, a memory, a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other storage devices.
[0231] The memory 12 may be an external memory and / or an internal memory of the electronic device 1. Furthermore, the memory 12 may be a memory in a physical form, such as a memory stick, a TF card (Trans-flash Card), and the like.
[0232] If the module / unit integrated in the electronic device 1 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware to complete it through computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium. When the computer-readable instructions are executed by the processor, the steps of the above-mentioned various method embodiments can be implemented.
[0233] The computer-readable instructions include computer-readable instruction codes, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM).
[0234] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed text search, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0235] Combination Figure 1 The memory 12 in the electronic device 1 stores computer-readable instructions to implement a text search method, and the processor 13 can execute the computer-readable instructions to implement:
[0236] When a text search request is received, obtaining a request statement according to the text search request;
[0237] Performing word segmentation processing on the request sentence to obtain a search term and a part of speech of the search term in the request sentence;
[0238] Identifying the search field corresponding to the request statement according to the search vocabulary;
[0239] Acquire the initial weight of the search term according to the part of speech of the sentence, and adjust the initial weight according to the preset list and the search field to obtain the target weight;
[0240] Acquire multiple preliminary screening texts matching the request statement based on preset dimensions, each preliminary screening text including multiple text segmentations;
[0241] Calculating the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentations;
[0242] Acquire a matching degree between the target text and the request sentence based on the preset dimension;
[0243] The target text is displayed according to the hit rate and the matching degree to obtain a search list.
[0244] Specifically, the specific implementation method of the processor 13 for the above-mentioned computer readable instructions can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0245] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0246] The computer-readable storage medium stores computer-readable instructions, wherein the computer-readable instructions are used to implement the following steps when executed by the processor 13:
[0247] When a text search request is received, obtaining a request statement according to the text search request;
[0248] Performing word segmentation processing on the request sentence to obtain a search term and a part of speech of the search term in the request sentence;
[0249] Identifying the search field corresponding to the request statement according to the search vocabulary;
[0250] Acquire the initial weight of the search term according to the part of speech of the sentence, and adjust the initial weight according to the preset list and the search field to obtain the target weight;
[0251] Acquire multiple preliminary screening texts matching the request statement based on preset dimensions, each preliminary screening text including multiple text segmentations;
[0252] Calculating the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentations;
[0253] Acquire a matching degree between the target text and the request sentence based on the preset dimension;
[0254] The target text is displayed according to the hit rate and the matching degree to obtain a search list.
[0255] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0256] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0257] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0258] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. The multiple units or devices mentioned can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0259] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A text search method, characterized in that: The text search method comprises: When a text search request is received, obtaining a request statement according to the text search request; Performing word segmentation processing on the request sentence to obtain a search term and a part of speech of the search term in the request sentence; Identifying the search field corresponding to the request statement according to the search vocabulary; The initial weight of the search words is obtained according to the part of speech of the sentence, and the initial weight is adjusted according to the preset list and the search field to obtain the target weight, including: obtaining the field vocabulary corresponding to the search field from the preset list, and obtaining the common vocabulary in all application fields from the preset list; calculating the similarity between the search words and the field vocabulary; setting the initial weight corresponding to the search words whose similarity is greater than a preset similarity threshold as a first preset weight, and setting the initial weight corresponding to the search words matching the common vocabulary as a second preset weight, to obtain the target weight, wherein the first preset weight is greater than the second preset weight; Acquire multiple preliminary screening texts matching the request statement based on preset dimensions, each preliminary screening text including multiple text segmentations; Calculating the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentation words, including: determining the text segmentation word matching the search term as the target segmentation word, and obtaining the matching segmentation word weight of the target segmentation word from the target weight; filtering the preliminary screening texts whose segmentation word weights are all less than a preset weight threshold to obtain the target text; obtaining the initial segmentation word weights of the multiple text segmentation words in the target text; for each target text, calculating the sum of the matching segmentation word weights to obtain a first value, and calculating the sum of the initial segmentation word weights to obtain a second value; calculating the ratio of the first value to the second value to obtain the hit rate; Acquire a matching degree between the target text and the request sentence based on the preset dimension; The target text is displayed according to the hit rate and the matching degree to obtain a search list.
2. The text search method according to claim 1, characterized in that: The step of identifying the search field corresponding to the request statement according to the search vocabulary includes: Obtain key words for all application areas described; Counting the number of key words in each application field that match the search words; The application field with the largest number of words is determined as the search field.
3. The text search method according to claim 1, characterized in that: The word segmentation process of the request sentence to obtain the search words and the part of speech of the search words in the request sentence includes: Dividing the request sentence based on a preset dictionary to obtain multiple division paths and initial vocabulary corresponding to each division path; Obtaining a set score of the initial vocabulary in the preset dictionary; Calculate the path score of each divided path according to the set score; Determine the initial word corresponding to the divided path with the largest path score as the search word; The sentence part of speech is filtered out from the set parts of speech of the search word in the preset dictionary based on the position of the search word in the request sentence.
4. The text search method according to claim 1, characterized in that: The step of obtaining the initial weight of the search term according to the sentence part of speech includes: Get the part-of-speech level mapping table; Acquire the vocabulary level corresponding to the search vocabulary from the part-of-speech level mapping table according to the sentence part-of-speech; A weight corresponding to the vocabulary level is obtained as the initial weight.
5. The text search method according to claim 1, characterized in that: The target text is displayed according to the hit rate and the matching degree to obtain a search list including: Calculating the relevance between the target text and the request sentence according to the hit rate and the matching degree; Extracting a text arrangement order from the text search request; The target text is displayed according to the relevance and the text arrangement order.
6. A text search device, characterized in that: The text search device comprises: an acquisition unit, configured to acquire a request statement according to the text search request when a text search request is received; A processing unit, configured to perform word segmentation processing on the request sentence to obtain a search term and a part of speech of the search term in the request sentence; an identification unit, configured to identify a search field corresponding to the request statement according to the search vocabulary; An adjustment unit is used to obtain the initial weight of the search term according to the part of speech of the sentence, and adjust the initial weight according to a preset list and the search field to obtain a target weight, including: obtaining a field vocabulary corresponding to the search field from the preset list, and obtaining common vocabulary in all application fields from the preset list; calculating the similarity between the search term and the field vocabulary; setting the initial weight corresponding to the search term whose similarity is greater than a preset similarity threshold as a first preset weight, and setting the initial weight corresponding to the search term matching the common vocabulary as a second preset weight, to obtain the target weight, wherein the first preset weight is greater than the second preset weight; The acquisition unit is further used to acquire a plurality of preliminary screening texts matching the request statement based on a preset dimension, each preliminary screening text including a plurality of text segmentations; A calculation unit is used to calculate the hit rate of the target text in the multiple preliminary screening texts according to the target weight and the multiple text segmentation words, including: determining the text segmentation word matching the search term as the target segmentation word, and obtaining the matching segmentation word weight of the target segmentation word from the target weight; filtering the preliminary screening texts whose segmentation weights are all less than a preset weight threshold to obtain the target text; obtaining the initial segmentation word weights of multiple text segmentation words in the target text; for each target text, calculating the sum of the matching segmentation word weights to obtain a first value, and calculating the sum of the initial segmentation word weights to obtain a second value; calculating the ratio of the first value to the second value to obtain the hit rate; The acquisition unit is further configured to acquire a matching degree between the target text and the request sentence based on the preset dimension; A display unit is used to display the target text according to the hit rate and the matching degree to obtain a search list.
7. An electronic device, characterized in that: The electronic device comprises: a memory storing computer-readable instructions; and A processor executes the computer-readable instructions stored in the memory to implement the text search method according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement the text search method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Content search method and device, domain prediction model training method and device and storage medium
CN111737560A
Medical information search method and device, electronic device and storage medium
CN112199494A
