Text matching method and device, equipment and storage medium
By using a funnel-shaped hierarchical matching method, the problems of slow response speed and low accuracy of text matching in medical informatization are solved, achieving efficient and accurate text matching, which is suitable for data standardization in the medical field.
Patent Information
- Application Number
- CN202511961823.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-23
- Publication Date
- 2026-02-17
AI Technical Summary
In medical informatics, existing technologies suffer from slow response speed and low matching accuracy during text matching, mainly due to irrelevant text interference and the comparison of a large number of candidate entities.
A funnel-shaped hierarchical matching method is adopted, which includes four levels: complete matching, initial model matching, rule-rewritten model matching, and semantic-rewritten model matching. Preprocessing is used to reduce meaningless differences, and the matching process is terminated when the conditions are met at each level to avoid irrelevant information interfering with the core semantic extraction.
Significantly reduces computational load, improves text matching efficiency and accuracy, ensures response speed and precision, and meets the high-efficiency data standardization needs of the medical field.
Smart Images

Figure CN121542409A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a text matching method, apparatus, device and storage medium. Background Technology
[0002] With the advancement of medical informatization and the standardization of medical insurance settlement, the non-standardized texts of drugs, diagnosis and treatment, and consumables have inherent literal differences from the standard inventory. Text matching is needed to achieve data standardization in order to support efficient collaboration in medical services.
[0003] However, in the existing text matching process that uses a model to recall and then sort, the sorting step requires comparing hundreds of candidate entities one by one, which results in a large amount of computation and slow response speed. Moreover, irrelevant text carried in the text can interfere with the pure semantic model, making it difficult to accurately extract the core semantics, resulting in insufficient matching accuracy and thus low text matching efficiency and accuracy. Summary of the Invention
[0004] To address the aforementioned issues, this application provides a text matching method, apparatus, device, and storage medium, with the aim of improving the efficiency and accuracy of text matching.
[0005] The embodiments of this application disclose the following technical solutions:
[0006] Firstly, this application provides a text matching method, including:
[0007] Perform preprocessing operations on the input query text to obtain the matching text adapted to the pre-configured standard library;
[0008] Based on the pre-configured standard library, the funnel-shaped hierarchical matching process is performed on the text to be matched. The funnel-shaped hierarchical matching includes four levels in the order of processing: complete matching, initial model matching, model matching after rule rewriting, and model matching after semantic rewriting. When the matching of the previous level does not meet the preset conditions corresponding to the previous level, the matching of the next level is entered.
[0009] For each level of matching, when the matching result of the current level meets the preset conditions corresponding to the current level, the text result matched at the current level is taken as the target matching text and the matching process is terminated.
[0010] Optionally, the method described above, which performs a full match process on the text to be matched based on the pre-configured standard library, includes:
[0011] The entity text in the pre-configured standard library is mapped to a preset hash table, and the text to be matched is completely compared with each entity text in the hash table at the character level to obtain the first-level matching result.
[0012] If the first-level matching result is that there is a matching result for any entity text that is completely identical in characters, then it is determined that the text to be matched is completely matched with any entity text, and the any entity text is taken as the target matching text;
[0013] or,
[0014] If the first-level matching result is that there is no matching result for any entity text that is completely identical to the original text, then it is determined that the first-level matching result does not meet the preset conditions corresponding to the complete matching level, and enters the first model matching level.
[0015] Optionally, in the method described above, the initial model matching process includes:
[0016] The pre-configured recall model is invoked to calculate the semantic similarity between the text to be matched and the entity text in the pre-configured standard library, and the second-level matching result is determined; the second-level matching result includes the first most similar item and the first matching degree corresponding to the first most similar item;
[0017] If the first matching degree is greater than or equal to the first preset threshold, then the first most similar item is taken as the target matching text;
[0018] or,
[0019] If the first matching degree is less than the first preset threshold, it is determined that the second level matching result does not meet the preset conditions corresponding to the first model matching level, and enters the model matching level after rule rewriting.
[0020] Optionally, as described above, the process of model matching after rule rewriting includes:
[0021] Based on a pre-configured rule base, the text to be matched is corrected to obtain multiple first names to be matched; the correction process includes removing redundant fields and replacing characters based on a preset misspelling table;
[0022] The plurality of first names to be matched are respectively input into the recall model, and semantic similarity is calculated with the entity text in the pre-configured standard library to obtain the third-level matching result; the third-level matching result includes the second most similar item corresponding to each first name to be matched and the second matching degree corresponding to each second most similar item;
[0023] If at least one target second matching degree is greater than or equal to the second preset threshold in the third-level matching results, then the second most similar item corresponding to the maximum value among the at least one target second matching degrees is determined as the target matching text;
[0024] or,
[0025] If each second matching degree in the third-level matching result is less than the second preset threshold, then the third-level matching result is determined not to meet the preset conditions corresponding to the model matching level after rule rewriting, and enters the model matching level after semantic rewriting.
[0026] Optionally, in the method described above, the process of matching the semantically rewritten model includes:
[0027] The pre-configured large model is invoked to perform semantic rewriting on the text to be matched, resulting in multiple second names to be matched; the semantic rewriting process is to convert the non-standard expression of the text to be matched into a standard expression that conforms to the pre-configured standard library.
[0028] The plurality of second names to be matched are respectively input into the recall model, and semantic similarity is calculated with the entity text in the pre-configured standard library to obtain the fourth-level matching result; the fourth-level matching result includes the third most similar item corresponding to each second name to be matched and the third matching degree corresponding to each third most similar item;
[0029] When at least one target third matching degree is greater than or equal to a third preset threshold in the fourth-level matching results, the third most similar item corresponding to the maximum value of the at least one target third matching degree is determined as the target matching text.
[0030] Optionally, the method described above further includes:
[0031] When each third matching degree in the fourth-level matching result is less than the third preset threshold, it is determined that the fourth-level matching result does not meet the preset conditions corresponding to the matching level of the semantically rewritten model.
[0032] The second-level matching results, the third-level matching results, and the fourth-level matching results are deduplicated to obtain a set of matching results;
[0033] According to the preset hierarchical weighting rules, based on the matching degree of each most similar item in the matching result set, the comprehensive weighted value corresponding to each most similar item is calculated; the hierarchical weighting rules are configured with corresponding preset weights according to the processing order of the matching levels, and the matching levels corresponding to the preset weights from high to low are the initial model matching level, the model matching level after rule rewriting, and the model matching level after semantic rewriting.
[0034] The most similar item corresponding to the maximum value of the comprehensive weighted value of each most similar item is determined as the target matching text.
[0035] Optionally, in the method described above, the preprocessing operation on the input query text to obtain the matching text adapted to the pre-configured standard library includes:
[0036] The text to be queried is processed by unifying capitalization, removing spaces and newline characters, unifying half-width and full-width characters, and standardizing Roman characters to obtain the text to be matched.
[0037] Secondly, this application provides a text matching device, comprising:
[0038] The preprocessing module is used to perform preprocessing operations on the input query text to obtain the matching text adapted to the pre-configured standard library;
[0039] The hierarchical matching module is used to perform a funnel-shaped hierarchical matching process on the text to be matched based on the pre-configured standard library. The funnel-shaped hierarchical matching includes four levels in the order of processing: complete matching, initial model matching, rule-rewritten model matching, and semantic-rewritten model matching. When the matching of the previous level does not meet the preset conditions corresponding to the previous level, it enters the next level of matching.
[0040] The hierarchical matching module is used to, for each level of matching, when the matching result of the current level meets the preset conditions corresponding to the current level, take the text result matched at the current level as the target matching text and terminate the matching process.
[0041] Thirdly, this application provides an electronic device, the device including: a processor, and a memory communicatively connected to the processor;
[0042] The memory stores instructions that the computer executes;
[0043] The processor executes computer execution instructions stored in memory to implement any of the text matching methods described in the above embodiments.
[0044] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement any of the text matching methods described in the above embodiments.
[0045] Compared with the prior art, this application has the following advantages:
[0046] The method of this application preprocesses the input query text to obtain a matching text adapted to a pre-configured standard library, which reduces meaningless differences between the query text and the standard library. Then, based on the pre-configured standard library, a funnel-shaped hierarchical matching process is performed on the matching text. The funnel-shaped hierarchical matching includes four levels in the order of processing: complete matching, initial model matching, rule-rewritten model matching, and semantic-rewritten model matching. If the matching of the previous level does not meet the preset conditions of the previous level, the matching will proceed to the next level. For each level of matching, if the matching result of the current level meets the preset conditions of the current level, the text result matched by the current level will be used as the target matching text and the matching process will be terminated. This method replaces the traditional recall-then-sort matching process with funnel-style hierarchical matching. Matching terminates when the preset conditions are met at the previous level, eliminating the need to compare and sort hundreds of candidate entities one by one, significantly reducing the amount of computation and effectively solving the problem of slow response speed in existing technologies. At the same time, in hierarchical matching, rule rewriting can remove irrelevant text such as codes and specifications before model matching, and semantic rewriting can optimize non-standard expressions before model matching, which can avoid irrelevant information interfering with the core semantic extraction, ultimately improving the efficiency and accuracy of text matching simultaneously. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 A flowchart illustrating a text matching method provided in an embodiment of this application;
[0049] Figure 2 A flowchart illustrating a specific implementation of a text matching method provided in this application embodiment;
[0050] Figure 3 This is a schematic diagram of the structure of a text matching device provided in an embodiment of this application;
[0051] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and accompanying drawings. It should be particularly noted that the embodiments described in this application are only a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0053] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0054] As described earlier, with the deepening of medical informatization, the full implementation of standardized medical insurance settlement, and the continuous improvement of the demand for refined hospital management, the standardization of data for pharmaceuticals, treatment items, and medical consumables—as core entities in medical services—has become crucial for opening up medical data links and ensuring efficient business collaboration. In actual business scenarios, the text to be matched for these entities often comes from hospital billing invoices, medical insurance reimbursement vouchers, purchase orders, and other documents. These documents often contain additional redundant fields such as codes, specifications, product names, and medical insurance level markings. For example, non-standardized expressions commonly found on invoices include "(10% B) Longzhu Ointment," "Bailin Tablets [0.44g*72s / box]," or "Water-soluble Vitamin Injection (Shui Le Wei)."
[0055] The medical field's standard database is structured data compiled based on national or industry standards. It only stores core entity information, such as standard names, unique codes, and core attributes, and does not include additional fields such as specifications, codes, and product names found in the aforementioned documents. This leads to an inherent literal difference between the text to be matched and the entity information in the standard database. This difference makes it difficult to achieve efficient correlation using traditional data statistics and manual verification methods. This not only causes problems such as poor medical data interoperability, delays in medical insurance settlement and review, and disconnect between procurement and inventory management, but may also lead to data statistics errors and reimbursement compliance risks due to inconsistent information. Therefore, there is an urgent need to eliminate the literal difference between the text to be matched and the standard database through professional text matching technology, mapping non-standard document text to standardized entity information in the standard database. This will enable unified and standardized management of core medical entity data, providing data support for the efficient operation of the entire process of medical services, medical insurance settlement, and supply chain management.
[0056] In existing technologies, the typical approach is to use a model-based recall and ranking scheme. This involves using a lightweight matching model to quickly filter out dozens to hundreds of candidate entities that may be related to the text to be matched from a massive standard library of data, thus significantly narrowing down the matching range. Then, a more accurate semantic model is used to calculate and score the semantic similarity between the text to be matched and each candidate entity. The candidate results are then rearranged according to the scores, and finally, the entity with the highest score and the strongest relevance is output as the standard matching result to ensure the accuracy of the matching.
[0057] However, this scheme requires semantic similarity calculation and scoring for hundreds of candidate entities one by one during the ranking process, which involves handling a large number of paired text comparison tasks. This results in a large computational load and a slow overall response speed, making it difficult to meet the needs of efficient matching in medical applications. At the same time, the long irrelevant text carried by the text to be matched can interfere with the judgment of the pure semantic model, making it difficult for the model to accurately extract core semantic information. This leads to deviations in semantic similarity calculation and poor matching results, resulting in low matching efficiency and accuracy.
[0058] Through research, the inventors proposed a text matching method, device, equipment, and storage medium, which improved the efficiency and accuracy of standardized text matching in the medical field.
[0059] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0060] See Figure 1This figure is a flowchart illustrating a text matching method provided in an embodiment of this application. Figure 1 As shown, the method includes:
[0061] S101: Perform preprocessing operations on the input query text to obtain the matching text adapted to the pre-configured standard library.
[0062] In this embodiment, basic Python string manipulation and regular expressions are used to preprocess the text without altering its core semantics. Built-in string methods are used to unify the case of the text; regular expressions are used to match and remove redundant characters such as spaces and newlines; character encoding conversion tools are used to unify half-width and full-width characters; and Roman characters in the text are standardized according to preset Roman character mapping rules, ultimately resulting in a text whose format is compatible with the pre-configured standard library.
[0063] As one feasible approach, preprocessing is performed on the input query text to obtain matching text adapted to a pre-configured standard library. The specific implementation process includes the following steps:
[0064] The query text is processed by unifying capitalization, removing spaces and newline characters, unifying half-width and full-width characters, and standardizing Roman characters to obtain the text to be matched.
[0065] In this embodiment, if the input query text is "Vitamin B6 Injection [2ML:100MG] (Class A)\n (Specification: 0.1g / vial)", when performing preprocessing, since the entity names in the standard library are often labeled with uppercase letters to indicate vitamin categories and dosage units, the uppercase letters B6, ML, and MG in the text are kept unchanged, while the lowercase letters are kept as is, thus achieving case uniformity. Then, redundant spaces before and after the text, newline characters "\n", and extra spaces other than irrelevant "(Class A)" and "(Specification: 0.1g / vial)" within the parentheses are removed, retaining only the necessary spacing of the core expression. Subsequently, full-width brackets "【】" and "()" are unified into half-width brackets "[]" and "()", and full-width numbers "0", "1", and "2" are converted into half-width numbers, achieving uniformity between half-width and full-width characters. Finally, the dosage units "ML" and "MG" are confirmed to be consistent with the unified expression specifications of the standard library and do not require adjustment. For example, if the dosage units in the standard library are lowercase, then the uppercase “ML” and “MG” in the query text will be converted to lowercase “ml” and “mg”, and finally the matching text “Vitamin B6 Injection [2ml:100mg]” will be obtained to match the standard library.
[0066] In this embodiment, to address formatting issues in medical query texts such as inconsistent capitalization, redundant spaces / line breaks, mixed use of half-width and full-width characters, and inconsistent Roman numeral representations, standardization processing is used to precisely eliminate meaningless formatting interference. This ensures that the text to be matched is consistent with a pre-configured standard library based on national / industry standards in terms of format, effectively reducing the inherent literal differences between the two and avoiding misjudgments of perfect matching or model matching deviations caused by formatting issues. This further improves the accuracy of subsequent matching at each level.
[0067] S102: Based on the pre-configured standard library, the funnel-style hierarchical matching process is performed on the text to be matched. The funnel-style hierarchical matching includes four levels in the order of processing: complete matching, initial model matching, model matching after rule rewriting, and model matching after semantic rewriting. When the matching of the previous level does not meet the preset conditions corresponding to the previous level, it enters the next level of matching.
[0068] In this embodiment, based on a pre-configured standard library, the processing order of complete matching of the text to be matched, initial model matching, model matching after rule rewriting, and model matching after semantic rewriting is advanced layer by layer, and funnel-style hierarchical matching is only performed when the corresponding preset conditions are not met at the current level. The pre-configured standard library is a set of structured entities for pharmaceuticals, medical treatments, and consumables compiled based on national / industry standards, containing core information such as entity standard names and codes. Full matching involves a character-level comparison between the text to be matched and the standard library entity text, achieving fast comparison by mapping standard library entities to hash tables, with the preset condition being complete character matching. Initial model matching utilizes a trained semantic similarity recall model to calculate the semantic similarity between the text to be matched and the standard library entities, outputting the most similar item and matching degree, with the preset condition being a matching degree higher than a set threshold. Rule-rewritten model matching first uses a pre-configured query rule library containing rules for redundant field removal and misspelling replacement to perform deterministic error correction on the text to be matched, generating multiple names to be matched before inputting them into the recall model to recalculate similarity, with the preset condition being a matching degree higher than a threshold for any name to be matched. Semantic rewriting model matching uses a general large model to perform semantic-level standardization adjustments on the text, converting non-standard expressions into standard library-compatible forms and generating multiple names to be matched, then calculating similarity using the recall model, with the preset condition being a matching degree higher than a threshold for any name to be matched.
[0069] S103: For each level of matching, when the matching result of the current level meets the preset conditions corresponding to the current level, the text result matched at the current level is taken as the target matching text and the matching process is terminated.
[0070] In this embodiment, the target matching text is the standard library specification entity text that matches the core semantics of the text to be queried, selected from the current level of matching. For each level of matching, the matching logic is executed level by level in a funnel-shaped hierarchical matching order. Here, "level" refers to the four sequentially advancing matching stages, each with its own exclusive matching mechanism. The preset conditions corresponding to the current level need to be set differently according to the characteristics of each level. In specific implementation, after each level of matching is completed, the system automatically verifies whether the matching result meets the preset conditions of that level. If it does, the currently matched specification entity text is directly determined as the target matching text, and the process termination mechanism is triggered, preventing further level matching.
[0071] In this embodiment, by performing preprocessing operations on the input query text, a matching text adapted to the pre-configured standard library is obtained, which can reduce meaningless differences between the query text and the standard library. Then, based on the pre-configured standard library, a funnel-shaped hierarchical matching process is performed on the matching text. The funnel-shaped hierarchical matching includes four levels in the order of processing: complete matching, initial model matching, rule-rewritten model matching, and semantic-rewritten model matching. When the matching of the previous level does not meet the preset conditions corresponding to the previous level, the matching of the next level is initiated. For each level of matching, when the matching result of the current level meets the preset conditions corresponding to the current level, the text result matched by the current level is taken as the target matching text and the matching process is terminated. This method replaces the traditional recall-then-sort matching process with funnel-style hierarchical matching. Matching terminates when the preset conditions are met at the previous level, eliminating the need to compare and sort hundreds of candidate entities one by one, significantly reducing the amount of computation and effectively solving the problem of slow response speed in existing technologies. At the same time, in hierarchical matching, rule rewriting can remove irrelevant text such as codes and specifications before model matching, and semantic rewriting can optimize non-standard expressions before model matching, which can avoid irrelevant information interfering with the core semantic extraction, ultimately improving the efficiency and accuracy of text matching simultaneously.
[0072] Based on the above embodiments, if the matching result of the semantically rewritten model matching level still does not meet the preset conditions corresponding to the semantically rewritten model matching level, the method may further include the following steps:
[0073] When the third matching degree in each of the fourth-level matching results is less than the third preset threshold, the fourth-level matching result is determined not to meet the preset conditions corresponding to the matching level of the semantically rewritten model. The second, third, and fourth-level matching results are deduplicated to obtain a set of matching results. Based on the matching degree of each most similar item in the matching result set, a comprehensive weighted value is calculated according to the preset hierarchical weighting rules. The hierarchical weighting rules configure corresponding preset weights according to the processing order of the matching levels. The matching levels corresponding to the preset weights from high to low are, in order, the initial model matching level, the rule-rewritten model matching level, and the semantically rewritten model matching level. The most similar item corresponding to the maximum value of the comprehensive weighted value for each most similar item is determined as the target matching text.
[0074] In this embodiment, when the third matching degree of each of the semantically rewritten model matching levels is less than the third preset threshold, it is determined that the fourth-level matching result does not meet the preset condition corresponding to that level. Subsequently, deduplication processing is performed on the second-level matching results of the initial model matching level, the third-level matching results of the rule-rewritten model matching level, and the fourth-level matching results of the semantically rewritten model matching level to remove duplicate standard library entities, resulting in a set of matching results containing all non-duplicate most similar items and their corresponding matching degrees. Then, according to the preset level weight rules, based on the matching degree corresponding to each most similar item, the preset weight of its level is multiplied to calculate the comprehensive weighted value corresponding to each most similar item. The entity text corresponding to the maximum comprehensive weighted value is determined from the comprehensive weighted values corresponding to each most similar item as the target matching text. The preset level weight rules are fixed and unique preset weights configured according to the matching level processing order, with the weights from high to low corresponding to the initial model matching level, the rule-rewritten model matching level, and the semantically rewritten model matching level. Specifically, the preset weight corresponding to the first model matching level is the highest, and the preset weight corresponding to the model matching level after semantic rewriting is the lowest.
[0075] In this embodiment, when the preset conditions are not met at any level of the matching of texts related to pharmaceuticals, diagnosis and treatment, and consumables in the medical field, the matching results at the second to fourth levels are deduplicated to remove redundant interference. Then, a comprehensive weighted calculation is performed based on the weight rules that match the priority of the matching logic to highlight the matching items that fit the core semantics of the original text. The optimal result is selected in a quantitative way to improve the matching accuracy and objectivity. At the same time, this step only performs lightweight processing on the most similar items that have been selected at each level, with a small amount of computation and no additional burden on the system. It is specifically adapted to the special characteristics of medical texts containing redundant fields and non-standard expressions, ensuring that even when the text differs greatly from the standard library, the target text that fits the specifications can still be output, avoiding business interruption due to matching failure and ensuring the continuity of core businesses such as medical insurance settlement and data standardization.
[0076] As one feasible approach, the process of performing a full match on the text to be matched based on a pre-configured standard library includes the following steps:
[0077] The entity texts in the pre-configured standard library are mapped to a preset hash table, and the text to be matched is compared character-level with each entity text in the hash table to obtain the first-level matching result. If the first-level matching result is that there is a comparison result for any entity text that is completely identical to the first entity text, then it is determined that the text to be matched is completely matched with any entity text, and that entity text is taken as the target matching text. Alternatively, if the first-level matching result is that there is no comparison result for any entity text that is completely identical to the first entity text, then it is determined that the first-level matching result does not meet the preset conditions corresponding to the complete matching level, and enters the first model matching level.
[0078] In this embodiment, all entity texts covering drug, diagnosis, and consumable categories in the pre-configured standard library are first used as keys. Entity texts include, but are not limited to, standard names and core aliases. The corresponding entity codes and attribute information are used as values to construct a preset hash table for fast querying. Through the key-value matching mechanism of the hash table, the text to be matched is compared character by character with the entity texts corresponding to all keys in the hash table to ensure that the character order and content are completely consistent, with no extra characters, missing characters, or different characters. If any entity text corresponding to any key completely matches the characters of the text to be matched, the first-level matching is considered successful, and that entity text is taken as the target matching text. If, after traversing all entity texts in the hash table, no completely matching match is found, the first-level matching result is determined not to meet the preset conditions of the complete matching level, and the system automatically enters the initial model matching level.
[0079] In this embodiment, by mapping the standardized drug, diagnosis, and consumable entity texts in the pre-configured standard library to a preset hash table, the efficient key-value query characteristics of the hash table significantly improve the comparison speed between the text to be matched and the standard library entity text, solving the problem of slow response in traditional traversal-based full matching and improving matching efficiency. Simultaneously, character-level full matching can directly capture pre-processed matches that are completely identical to standard library entities, without requiring subsequent model calculations or rewriting processes. This reduces unnecessary resource consumption and ensures absolute accuracy of results in full matching scenarios, avoiding deviations caused by indirect calculations in the semantic model. Furthermore, this step, as the first level of funnel-style matching, achieves rapid stream routing through explicit character-complete match determination rules. When a match meets the criteria, the target text is directly output; otherwise, it proceeds to subsequent model matching levels. This quickly locks in results for simple matching scenarios while reserving progressive space for accurate matching in complex and differing scenarios. It effectively adapts to business scenarios in the medical field where standard library entity specifications and pre-processed query texts may have complete matches, further compensating for the shortcomings of existing technologies in efficient and accurate stream routing matching.
[0080] As an feasible approach, the initial model matching process includes the following steps:
[0081] The pre-configured recall model is invoked to calculate the semantic similarity between the text to be matched and the entity text in the pre-configured standard library, and the second-level matching result is determined. The second-level matching result includes the first most similar item and the first matching degree corresponding to the first most similar item. If the first matching degree is greater than or equal to the first preset threshold, the first most similar item is taken as the target matching text. Alternatively, if the first matching degree is less than the first preset threshold, it is determined that the second-level matching result does not meet the preset conditions corresponding to the first model matching level, and the model matching level after rule rewriting is entered.
[0082] In this embodiment, the pre-configured recall model is a trained semantic similarity model used to capture semantic relationships between texts. By calling this recall model, the text to be matched is compared with all entity texts in the standard library one by one to calculate semantic similarity. The entity with the highest similarity is selected as the first most similar item based on the quantized score output by the model, and its corresponding quantized score is the first matching degree, thus obtaining the second-level matching result. Subsequently, the first matching degree in the second-level matching result is compared with a pre-set first preset threshold. If the first matching degree is greater than or equal to the threshold, the first most similar item is directly determined as the target matching text. If the first matching degree is less than the threshold, it is determined that the second-level matching result does not meet the preset conditions corresponding to the first model matching level, and the matching process automatically enters the model matching level after rule rewriting.
[0083] In this embodiment, the semantic understanding capability of the pre-configured recall model is utilized to avoid reliance on literal matching. It accurately captures the deep semantic association between the text to be matched and the medical entity text in the pre-configured standard library, effectively mitigating the natural literal differences between medical text and the standard library caused by additional fields such as encoding and specifications, thus improving the accuracy of the initial match. Simultaneously, this step only filters the first most similar item and its corresponding first matching degree, eliminating the need to process hundreds of candidate items as in traditional solutions. This reduces computational load, improves response time, and enhances overall matching speed. Furthermore, through a clear judgment rule based on a first preset threshold, the matching results are rapidly distributed. Only when the threshold is met is the target matching text directly output, avoiding subsequent redundant processes. When the threshold is not met, the matching process enters the rule-rewritten model matching layer, forming a progressively accurate matching logic. This ensures high efficiency and fully adapts to the business needs of standardizing pharmaceutical and medical device entities in the medical field.
[0084] As an feasible approach, the process of model matching after rule rewriting includes the following steps:
[0085] Based on a pre-configured rule base, the text to be matched is corrected to obtain multiple first names to be matched. The correction process includes removing redundant fields and replacing characters based on a preset misspelling table. The multiple first names to be matched are input into the recall model, and semantic similarity is calculated with entity text in the pre-configured standard library to obtain the third-level matching results. The third-level matching results include the second most similar item corresponding to each first name to be matched and the second matching degree corresponding to each second most similar item. If at least one target second matching degree in the third-level matching results is greater than or equal to a second preset threshold, the second most similar item corresponding to the maximum value of at least one target second matching degree is determined as the target matching text. Alternatively, if each second matching degree in the third-level matching results is less than the second preset threshold, the third-level matching results are determined not to meet the preset conditions corresponding to the matching level of the model after rule rewriting, and the model enters the matching level after semantic rewriting.
[0086] In this embodiment, the pre-configured rule base is built for the characteristics of text in the medical field. It includes rules for identifying and removing redundant fields such as encoding, specifications, and medical insurance levels, as well as a mapping table of common misspellings and correct expressions of medical entities. The correction process is to automatically remove irrelevant redundant information in the text to be matched based on the redundant field removal rules in the rule base, and at the same time, accurately replace common misspellings based on the preset misspelling table. Multiple first names to be matched are generated by combining multiple rules to retain the core semantics and better fit the expression of the standard library. Subsequently, multiple first-to-match names are input into a pre-configured semantic similarity retrieval model, and semantic similarity is calculated one by one with all entity texts in the pre-configured standard library. For each first-to-match name, the entity with the highest similarity is selected as the second most similar item, and its corresponding quantized score is the second matching degree. All second most similar items and their corresponding second matching degrees constitute the third-level matching result. Each second matching degree is compared with a preset second threshold. If at least one second matching degree is greater than or equal to the second preset threshold, the second most similar item corresponding to the maximum value of the second matching degree is taken as the target matching text. If all second matching degrees are less than the threshold, it is determined that the third-level matching result does not meet the corresponding preset condition, and the matching process enters the semantically rewritten model matching level.
[0087] In this embodiment, addressing the common issues of redundant fields such as encoding, specifications, and medical insurance levels in medical texts and frequent typos, the targeted correction capabilities of a pre-configured rule base are utilized. By eliminating redundant fields and removing irrelevant interference information, and replacing erroneous characters based on a pre-defined typo table, the inherent literal differences between the text to be matched and the pre-configured standard library are significantly reduced without altering the core semantics. This solves the shortcomings of existing technologies where pure semantic models are susceptible to interference from irrelevant text and have low matching accuracy. Simultaneously, multiple first-match names are generated through multi-rule combinations, expanding the coverage of semantic matching and reducing the risk of missing optimal matches due to a single expression. Furthermore, the rule rewriting is a non-model-based processing method, which is highly efficient, fits the overall funnel-shaped hierarchical matching process, and improves response speed. By inputting multiple first-match names into the recall model to calculate similarity and filtering by threshold, the reliability of the matching results is ensured. When the target is met, the target text is directly output; when the target is not met, the model enters the semantically rewritten matching level, forming a progressive and precise matching process, further guaranteeing the accuracy and efficiency of standardized matching of medical entities.
[0088] As an feasible approach, the process of semantically rewritten model matching includes the following steps:
[0089] A pre-configured large model is invoked to perform semantic rewriting on the text to be matched, resulting in multiple second names to be matched. Semantic rewriting involves converting non-standard expressions of the text to be matched into standardized expressions conforming to a pre-configured standard library. These multiple second names to be matched are then input into a recall model, and semantic similarity is calculated between them and entity texts in the pre-configured standard library to obtain fourth-level matching results. These fourth-level matching results include the third most similar term corresponding to each second name to be matched and the third matching degree corresponding to each third most similar term. If at least one target third matching degree in the fourth-level matching results is greater than or equal to a third preset threshold, the third most similar term corresponding to the maximum value of at least one target third matching degree is determined as the target matched text.
[0090] In this embodiment, the pre-configured large model is a general-purpose large model with the ability to understand and rewrite text semantics in the medical field. Its core function is to optimize text representations to fit a standard library. The semantic rewriting process can identify non-standard expressions such as redundant product names and non-standard expressions in the text. Without changing the core semantics, it converts these non-standard expressions into standardized expressions conforming to the pre-configured standard library, thereby generating multiple second match names that focus on the core semantics and conform to the expression habits of the standard library. Subsequently, these second match names are input into a pre-configured semantic similarity retrieval model, and semantic similarity is calculated one by one with all entity texts in the standard library. For each second match name, the entity with the highest similarity is selected as the third most similar item, and its corresponding quantified score is the third matching degree. All third most similar items and their corresponding third matching degrees constitute the fourth-level matching result. Each third matching degree is compared with a preset third threshold. If at least one third matching degree is greater than or equal to the threshold, the third most similar item corresponding to the maximum value of the third matching degree is selected and determined as the target matching text.
[0091] In this embodiment, to address non-standard issues such as redundant product names and non-standard dosage form descriptions that may still exist in medical texts after preprocessing and rule rewriting, the semantic understanding and rewriting capabilities of a pre-configured large model are leveraged to convert the text into a standardized expression that conforms to the pre-configured standard library without deviating from the core semantics. This effectively reduces the semantic differences between the text and the standard library, compensating for the shortcomings of pure semantic models in adapting to non-standard texts. Simultaneously, multiple second matching names are generated to expand the coverage of semantic matching and reduce the risk of missing the optimal matching item due to a single expression. By inputting multiple second matching names into the recall model to calculate semantic similarity, and then filtering based on a third preset threshold and selecting the third most similar item corresponding to the highest score as the target matching text, the accuracy and reliability of the matching results are ensured, while also conforming to the efficient characteristics of the overall funnel-shaped hierarchical matching process. This further improves matching accuracy in scenarios where rule rewriting fails to meet the standards.
[0092] The following describes the specific implementation process of the above embodiment using the text to be queried in a hospital billing invoice: “(Class B) Water-soluble Vitamin Injection (Shui Le Wei 1 Type II) [5ML / vial] (Code: H20230015)”. This includes: using Python's basic string manipulation and regular expression tools, unifying text case, converting “ML” to the standard library-compatible “ml”, removing redundant leading and trailing spaces, meaningless newlines, and irrelevant “(Class B)” and “(Code: H20230015)” fields within parentheses, converting full-width brackets “【】” and “()” to half-width brackets “[]” and “()”, unifying half-width and full-width characters, and standardizing the Roman numeral “Ⅱ” to “II”. Finally, the text to be matched, “Water-soluble Vitamin Injection (Shui Le Wei 1 Type II) [5ml / vial]”, is obtained, ensuring that the format is compatible with the pre-configured drug standard library. When entering the full match level, all entity texts in the standard library, such as "water-soluble vitamins for injection" and "vitamin C injection", are mapped to hash tables. The text to be matched is compared character by character with all entity texts in the hash table. Because the text to be matched contains the specification "[5ml / vial]" and the product name "Water-soluble Vitamin 1 II", no entity with completely matching characters is found, the match fails, and the system enters the first model matching level.
[0093] In the initial model matching level, the trained semantic similarity retrieval model is invoked to calculate the semantic similarity between the preprocessed text to be matched and the standard library entities one by one. The most similar item "water-soluble vitamins for injection" and the corresponding matching degree is 0.7. Since the matching degree is lower than the preset threshold of 0.8, the model matching level after rule rewriting is entered.
[0094] In the rule-rewritten model matching level, based on the pre-configured rule base, the specification field "[5ml / vial]" and the product name suffix "(Water-soluble Vitamin 1 II type)" are removed from the text to be matched. At the same time, possible typos are corrected, and two first names to be matched, "water-soluble vitamin injection" and "water-soluble vitamin", are generated. The two names to be matched are input into the recall model matching respectively. The matching degree corresponding to "water-soluble vitamin injection" is 0.78 and the matching degree corresponding to "water-soluble vitamin" is 0.75. Both are lower than the preset threshold of 0.8. It is determined that the rule-rewritten model matching does not meet the preset conditions, and enters the semantic rewritten model matching level.
[0095] In the semantically rewritten model matching level, a general large model is called to perform semantic normalization adjustment on the preprocessed original text to be matched, remove interference from product names and optimize the expression, and generate two second names to be matched: "water-soluble vitamins for injection" and "water-soluble vitamin injection". These are then input into the recall model to calculate the similarity. The matching degree for "water-soluble vitamins for injection" is 0.76 and the matching degree for "water-soluble vitamin injection" is 0.73, both of which are lower than the preset threshold of 0.8. Therefore, it is determined that the semantically rewritten model matching does not meet the preset conditions.
[0096] Finally, duplicate matching results are removed from the initial model matching level, the model matching level after rule rewriting, and the model matching level after semantic rewriting, resulting in four non-duplicate candidate entities: "water-soluble vitamins for injection", "water-soluble vitamin injection", "water-soluble vitamins", and "water-soluble vitamin injection". The comprehensive weighted value is then calculated according to the preset weighting rules. Specifically, if the initial model matching weight is 0.3, the matching weight after rule rewriting is 0.5, and the matching weight after semantic rewriting is 0.2, then the comprehensive weighted value of "water-soluble vitamins for injection" is 0.7×0.3 + 0.76×0.2 = 0.362, the comprehensive weighted value of "water-soluble vitamin injection" is 0.78×0.5 = 0.39, the comprehensive weighted value of "water-soluble vitamins" is 0.75×0.5 = 0.375, and the comprehensive weighted value of "water-soluble vitamin injection" is 0.73×0.2 = 0.146. Finally, "water-soluble vitamin injection" with the highest comprehensive weighted value is selected as the target matching text to complete the standardized matching of medical invoice text.
[0097] See Figure 2 This figure is a flowchart illustrating a specific implementation of a text matching method provided in an embodiment of this application. Figure 2 As shown, the specific implementation process of this application embodiment is given below, and the specific implementation process includes the following steps:
[0098] S201: Preprocess the input query text to obtain the text to be matched.
[0099] S202: Based on the pre-configured standard library, perform a full match process on the text to be matched to obtain the first-level matching result.
[0100] S203: Determine if there is a complete match; if yes, use the completely matched entity text as the target text and execute step S213; if no, execute S204-S205.
[0101] S204: Invoke the pre-configured recall model, calculate the semantic similarity between the text to be matched and the entity text in the pre-configured standard library, and determine the second-level matching result.
[0102] S205: Determine whether the first preset condition is met; the first preset condition is the preset condition corresponding to the first model matching level; if yes, then take the first most similar item as the target matching text and execute step S213; if no, then execute S206-S208.
[0103] S206: Based on a pre-configured rule base, the text to be matched is modified to obtain multiple first names to be matched.
[0104] S207: Input multiple first-level names to be matched into the recall model and perform semantic similarity calculation with the entity text in the pre-configured standard library to obtain the third-level matching results.
[0105] S208: Determine whether the second preset condition is met; the second preset condition is the preset condition corresponding to the matching level of the model after rule rewriting; if yes, then take the second most similar item corresponding to the maximum matching degree in the third level matching result as the target matching text and execute step S213; if no, then execute S209-S211.
[0106] S209: Call the pre-configured large model to perform semantic rewriting on the text to be matched, and obtain multiple second names to be matched.
[0107] S210: Input multiple second names to be matched into the recall model and perform semantic similarity calculation with the entity text in the pre-configured standard library to obtain the fourth-level matching result.
[0108] S211: Determine whether the third preset condition is met; the third preset condition is the preset condition corresponding to the matching level of the model after semantic rewriting; if yes, take the third most similar item corresponding to the maximum matching degree in the fourth level matching result as the target matching text and execute step S213; if no, execute S212-S213.
[0109] S212: Determine the target matching text from the second-level matching results, the third-level matching results, and the fourth-level matching results.
[0110] S213: Output the target matching text.
[0111] See Figure 3 This figure is a schematic diagram of the structure of a text matching device provided in an embodiment of this application. Figure 3 As shown, the device 30 includes a preprocessing module 31 and a layered matching module 32.
[0112] The preprocessing module 31 performs preprocessing operations on the input query text to obtain the matching text adapted to the pre-configured standard library. The hierarchical matching module 32 performs a funnel-shaped hierarchical matching process on the matching text based on the pre-configured standard library. The funnel-shaped hierarchical matching includes four levels in the processing order: complete matching, initial model matching, rule-rewritten model matching, and semantic-rewritten model matching. If the matching of the previous level does not meet the preset conditions corresponding to the previous level, it will proceed to the next level of matching. For each level of matching, if the matching result of the current level meets the preset conditions corresponding to the current level, the text result matched by the current level will be used as the target matching text and the matching process will be terminated.
[0113] The text matching device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0114] Furthermore, based on the above embodiments, when performing a full match on the text to be matched based on the pre-configured standard library, the hierarchical matching module 32 is specifically used to map the entity text in the pre-configured standard library to a preset hash table, and perform a character-level full match between the text to be matched and each entity text in the hash table to obtain the first-level matching result; if the first-level matching result is that there is a comparison result for any entity text that is completely identical in character, then it is determined that the text to be matched is completely matched with any entity text, and any entity text is taken as the target matching text; or, if the first-level matching result is that there is no comparison result for any entity text that is completely identical in character, then it is determined that the first-level matching result does not meet the preset conditions corresponding to the full match level, and enters the first model matching level.
[0115] The text matching device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0116] Furthermore, based on the above embodiments, in the initial model matching process, the hierarchical matching module 32 is specifically used to call the pre-configured recall model, calculate the semantic similarity between the text to be matched and the entity text in the pre-configured standard library, and determine the second-level matching result; the second-level matching result includes the first most similar item and the first matching degree corresponding to the first most similar item; if the first matching degree is greater than or equal to the first preset threshold, the first most similar item is used as the target matching text; or, if the first matching degree is less than the first preset threshold, it is determined that the second-level matching result does not meet the preset conditions corresponding to the initial model matching level, and enters the rule-rewritten model matching level.
[0117] The text matching device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0118] Furthermore, based on the above embodiments, in the process of model matching after rule rewriting, the hierarchical matching module 32 is specifically used to correct the text to be matched based on the pre-configured rule base to obtain multiple first names to be matched; the correction process includes removing redundant fields and replacing characters based on a preset misspelling table; the multiple first names to be matched are input into the recall model respectively, and semantic similarity is calculated with the entity text in the pre-configured standard library to obtain the third-level matching result; the third-level matching result includes the second most similar item corresponding to each first name to be matched and the second matching degree corresponding to each second most similar item; if there is at least one target second matching degree in the third-level matching result that is greater than or equal to the second preset threshold, then the second most similar item corresponding to the maximum value of at least one target second matching degree is determined as the target matching text; or, if each second matching degree in the third-level matching result is less than the second preset threshold, then it is determined that the third-level matching result does not meet the preset conditions corresponding to the model matching level after rule rewriting, and enters the model matching level after semantic rewriting.
[0119] The text matching device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0120] Furthermore, based on the above embodiments, in the process of model matching after semantic rewriting, the hierarchical matching module 32 is specifically used to call the pre-configured large model to perform semantic rewriting on the text to be matched, and obtain multiple second names to be matched; the semantic rewriting process is to convert the non-standard expression of the text to be matched into a standard expression that conforms to the pre-configured standard library.
[0121] Multiple second names to be matched are input into the recall model and semantic similarity is calculated with entity text in the pre-configured standard library to obtain the fourth-level matching result. The fourth-level matching result includes the third most similar item corresponding to each second name to be matched and the third matching degree corresponding to each third most similar item. When there is at least one target third matching degree in the fourth-level matching result that is greater than or equal to the third preset threshold, the third most similar item corresponding to the maximum value of at least one target third matching degree is determined as the target matching text.
[0122] The text matching device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0123] Furthermore, based on the above embodiments, the hierarchical matching module 32 is also used to determine that the fourth-level matching result does not meet the preset conditions corresponding to the semantically rewritten model matching level when each third matching degree in the fourth-level matching result is less than the third preset threshold; to perform deduplication processing on the second-level matching result, the third-level matching result, and the fourth-level matching result to obtain a matching result set; to calculate the comprehensive weighted value corresponding to each most similar item based on the matching degree corresponding to each most similar item in the matching result set according to the preset hierarchical weight rules; the hierarchical weight rules are to configure the corresponding preset weights according to the processing order of the matching levels, and the matching levels corresponding to the preset weights from high to low are the first model matching level, the rule-rewritten model matching level, and the semantically rewritten model matching level; and to determine the most similar item corresponding to the maximum value of the comprehensive weighted value of each most similar item as the target matching text.
[0124] The text matching device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0125] Furthermore, based on the above embodiments, the preprocessing module 31 is specifically used to perform case unification processing, space and newline character removal processing, half-width and full-width character unification, and Roman character standardization processing on the text to be queried, so as to obtain the text to be matched.
[0126] The text matching device provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be described again here.
[0127] See Figure 4 The figure is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, including:
[0128] Memory 11 is used to store computer programs;
[0129] The processor 12 is configured to implement the steps of a text matching method as described in any of the above method embodiments when executing the computer program.
[0130] In this embodiment, the device can be an in-vehicle computer, a PC (Personal Computer), or a terminal device such as a smartphone, tablet computer, handheld computer, or portable computer.
[0131] The device may include a memory 11, a processor 12, and a bus 13.
[0132] The memory 11 includes at least one type of readable storage medium, such as flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the device, such as the hard disk of the device. In other embodiments, the memory 11 may be an external storage device of the device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, Flash Card, etc. Furthermore, the memory 11 may include both internal and external storage units of the device. The memory 11 can be used not only to store application software installed on the device and various types of data, such as program code executing text matching methods, but also to temporarily store data that has been output or will be output. In some embodiments, the processor 12 may be a Central Processing Unit (CPU).
[0133] In some embodiments, processor 12 may be a central processing unit (CPU), controller, microcontroller, microprocessor or other data processing chip, used to run program code stored in memory 11 or process data, such as program code for executing a text matching method.
[0134] This bus 13 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0135] Furthermore, the device may also include a network interface 14, which may optionally include a wired interface and / or a wireless interface (such as a Wi-Fi interface, a Bluetooth interface, etc.), typically used to establish communication connections between the device and other electronic devices.
[0136] Optionally, the device may further include a user interface 15, which may include a display, an input unit such as a keyboard, and optionally, a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen, etc. The display may also be appropriately referred to as a screen or display unit, used to display information processed in the device and to display a visual user interface.
[0137] Figure 4 Only devices with components 11-15 are shown; those skilled in the art will understand that... Figure 4 The structure shown does not constitute a limitation on the device and may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0138] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides a computer-readable storage medium storing computer instructions for causing the computer to perform the methods described in any of the above embodiments.
[0139] The computer-readable media in this application embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media 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 memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0140] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to perform the methods described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0141] It should be noted that the various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for methods, apparatuses, electronic devices, and media, since they are basically similar to the method embodiments, the descriptions are relatively simple, and relevant parts can be referred to the descriptions of the method embodiments. The methods, apparatuses, electronic devices, and media described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components indicated as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of the solution in this embodiment according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0142] The above description is merely one specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method of text matching, characterized by, The method comprises the following steps: performing a preprocessing operation on input query text to obtain matching text adapted to a preconfigured standard library; performing a funnel-type hierarchical matching process on the matching text based on the preconfigured standard library, wherein the funnel-type hierarchical matching comprises four levels in processing order, i.e., complete matching, first model matching, rule-rewritten model matching, and semantic-rewritten model matching, and entering the next level of matching when the preset condition corresponding to the previous level of matching is not met in the previous level of matching; for each level of matching, when the matching result of the current level of matching meets the preset condition corresponding to the current level of matching, taking the text result matched by the current level of matching as the target matching text and terminating the matching process.
2. The method of claim 1, wherein, performing a complete matching process on the matching text based on the preconfigured standard library, comprising: mapping the entity text in the preconfigured standard library into a preset hash table, and performing character-level complete comparison between the matching text and each entity text in the hash table to obtain a first level of matching result; if the first level of matching result is that the comparison result corresponding to any entity text is character complete coincidence, it is determined that the matching text is completely matched with the any entity text, and the any entity text is taken as the target matching text; or, if the first level of matching result is that there is no comparison result corresponding to any entity text that is character complete coincidence, it is determined that the first level of matching result does not meet the preset condition corresponding to the complete matching level, and the first model matching level is entered.
3. The method of claim 1, wherein, The processing process of the first model matching comprises: calling a preconfigured recall model to perform semantic similarity calculation between the matching text and the entity text in the preconfigured standard library to determine a second level of matching result; the second level of matching result comprises a first most similar item and a first matching degree corresponding to the first most similar item; if the first matching degree is greater than or equal to a first preset threshold, the first most similar item is taken as the target matching text; or, if the first matching degree is less than the first preset threshold, it is determined that the second level of matching result does not meet the preset condition corresponding to the first model matching level, and the rule-rewritten model matching level is entered.
4. The method of claim 3, wherein, The processing process of the rule-rewritten model matching comprises: performing correction processing on the matching text based on a preconfigured rule library to obtain a plurality of first matching names; the correction processing comprises eliminating redundant fields and character replacement based on a preset wrong word table; inputting the plurality of first matching names into the recall model respectively, and performing semantic similarity calculation between the first matching names and the entity text in the preconfigured standard library to obtain a third level of matching result; the third level of matching result comprises a second most similar item corresponding to each first matching name and a second matching degree corresponding to each second most similar item; if there is at least one target second matching degree greater than or equal to a second preset threshold in the third level of matching result, the second most similar item corresponding to the maximum value in the at least one target second matching degree is determined as the target matching text; or, If each second matching degree in the third level matching result is less than a second preset threshold, it is determined that the third level matching result does not satisfy a preset condition corresponding to the rule rewritten model matching level, and a semantic rewritten model matching level is entered.
5. The method of claim 3, wherein, The processing procedure of the semantic rewritten model matching includes: A preconfigured large model is called to perform semantic rewriting processing on the to-be-matched text, and a plurality of second to-be-matched names are obtained; the semantic rewriting processing is to convert non-standard expressions of the to-be-matched text into standard expressions conforming to the preconfigured standard library; The plurality of second to-be-matched names are respectively input into the recall model, and semantic similarity calculation is performed on the second to-be-matched names and entity texts in the preconfigured standard library, to obtain a fourth level matching result; the fourth level matching result includes third most similar items corresponding to each second to-be-matched name and third matching degrees corresponding to each third most similar item; When there is at least one target third matching degree greater than or equal to a third preset threshold in the fourth level matching result, a third most similar item corresponding to a maximum value in the at least one target third matching degree is determined as a target matching text.
6. The method of claim 5, wherein, The method further includes: When each third matching degree in the fourth level matching result is less than the third preset threshold, it is determined that the fourth level matching result does not satisfy a preset condition corresponding to the semantic rewritten model matching level; De-duplication processing is performed on the second level matching result, the third level matching result and the fourth level matching result, to obtain a matching result set; According to a preset level weight rule, a comprehensive weighted value corresponding to each most similar item is calculated based on a matching degree corresponding to each most similar item in the matching result set; the level weight rule is to configure a corresponding preset weight according to a processing order of a matching level, and the matching levels corresponding to the preset weights from high to low are in turn a first model matching level, a rule rewritten model matching level and a semantic rewritten model matching level; A most similar item corresponding to a maximum value in the comprehensive weighted value corresponding to each most similar item is determined as a target matching text.
7. The method of claim 1, wherein, The preprocessing operation performed on the input to-be-queried text to obtain the to-be-matched text adapted to the preconfigured standard library includes: The to-be-queried text is subjected to case unification processing, space and line break symbol elimination processing, half-width and full-width character unification and Roman character standardization processing, to obtain the to-be-matched text.
8. A text matching apparatus, characterized by comprising: It includes: A preprocessing module is configured to perform a preprocessing operation on an input to-be-queried text to obtain a to-be-matched text adapted to a preconfigured standard library; A layered matching module is configured to perform a funnel-type layered matching processing procedure on the to-be-matched text based on the preconfigured standard library; the funnel-type layered matching includes four levels in turn according to a processing order, i.e., complete matching, first model matching, rule rewritten model matching and semantic rewritten model matching, and when a preset condition corresponding to a previous level is not satisfied in a previous level matching, a next level matching is entered. The hierarchical matching module is configured to, for matching of each level, when a matching result of a current level meets a preset condition corresponding to the current level, taking the text result matched by the current level as a target matching text and terminating the matching process.
9. An electronic device, comprising: The device comprises a processor and a memory connected to the processor in communication; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by the processor to implement the method according to any one of claims 1 to 8.