Text matching method and device
By creating multiple target combinations in the content platform and establishing a binding relationship with the business vocabulary, the problem of low configuration and matching efficiency of traditional AC automaton solutions in large-scale users and complex business scenarios is solved, and more efficient is achieved text matching and vocabulary management.
Patent Information
- Application Number
- CN202411649475.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-02-18
AI Technical Summary
When dealing with large-scale users and complex business scenarios, the traditional AC automata solution needs to configure and modify the business thesaurus one by one, which increases operational costs and is difficult to ensure the timeliness and accuracy of configuration or modifications, and is very long. Text matching often leads to text matching failure.
By creating multiple target combinations according to the text type, each target combination includes multiple phrases, establishing a binding relationship between multiple business thesaurus and multiple target combinations, and when the binding relationship is established, the target text is combined with The target combination bound to the target business thesaurus performs text matching. Text matching includes redundant segmentation of the target text in character order to perform multi-text block matching.
It improves the efficiency of configuring or modifying multiple business thesaurus and the success rate of text matching, avoids the tedious process of operating business thesaurus one by one, and enhances the ability to match super long texts.
Smart Images

Figure CN119474258A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of text matching, and in particular, to a text matching method, apparatus, computer device, computer-readable storage medium, and computer program product. Background Art
[0002] In today's digital age, content platforms, as an important carrier of information dissemination, carry a massive amount of text data. In order to ensure the compliance and security of platform content and improve user experience, effective monitoring of phrases in text has become an indispensable part of content platforms.
[0003] Currently, the AC automaton solution has become the preferred solution for filtering phrases on many content platforms with its efficient basic content recognition capabilities. However, when dealing with large-scale users and complex business scenarios, the traditional AC automaton solution needs to configure and modify the business vocabulary one by one, which not only increases operating costs, but also makes it difficult to ensure the timeliness and accuracy of configuration or modification. In addition, text matching often fails for ultra-long text matching.
[0004] It should be noted that the above content is not necessarily prior art, nor is it intended to limit the scope of patent protection of this application. Summary of the invention
[0005] Embodiments of the present application provide a text matching method, apparatus, computer device, computer-readable storage medium, and computer program product to solve or alleviate one or more of the technical problems raised above.
[0006] One aspect of an embodiment of the present application provides a text matching method, the method comprising: Creating multiple target combinations according to text types, wherein each target combination includes multiple phrases; Establishing binding relationships between a plurality of business word libraries and a plurality of the target combinations; When the binding relationship is established, text matching is performed on the target text under the target business and one or more target combinations bound to the target business vocabulary to obtain a matching result, wherein the target business vocabulary is one of the multiple business vocabulary; The text matching includes: redundantly segmenting the target text in character order to match multiple text blocks; each text block overlaps a text of a preset character length with its adjacent text block at the junction.
[0007] Optionally, create multiple target combinations based on text type, including: Create a vocabulary of phrases; The words in the phrase word library are classified and packaged according to the text type to obtain a plurality of the target combinations.
[0008] Optionally, redundant segmentation is performed on the target text in character order to perform multi-text block matching, including: Determining the character length of the target text; When the character length is greater than a preset threshold, obtaining multiple text blocks according to the target text; Performing distributed matching operations on multiple text blocks through multiple text matching service instances to obtain the matching results; Among them, one text matching service instance corresponds to one text block, and the distributed matching operation is to operate on the multiple text blocks in parallel.
[0009] Optionally, performing a distributed matching operation on the multiple text blocks to obtain the matching result includes: Acquire multiple distributed matching results of the distributed matching operation, where one text block corresponds to one distributed matching result; A concatenation operation is performed on the multiple distributed matching results to obtain the matching result for the target text.
[0010] Optionally, the preset character length is obtained by the following operation: Obtaining the maximum character length of each phrase in one or more target combinations bound to the target business vocabulary; The maximum character length is determined as the preset character length.
[0011] Optionally, the text matching further includes: Determining the character length of the target text; When the character length is not greater than a preset threshold, a matching operation is performed on the target text through a single text matching service instance.
[0012] Another aspect of an embodiment of the present application provides a text matching device, the device comprising: A creation module, used for creating a plurality of target combinations according to the text type, wherein each target combination includes a plurality of phrases; An establishing module, used for establishing a binding relationship between a plurality of business word libraries and a plurality of the target combinations; The matching module is used to perform text matching on the target text under the target business and one or more target combinations bound to the target business vocabulary to obtain a matching result when the binding relationship is established. The target business vocabulary is one of multiple business vocabulary.
[0013] Another aspect of an embodiment of the present application provides a computer device, including: at least one processor; and a memory communicatively coupled to the at least one processor; Wherein: the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method as described above.
[0014] Another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method described above is implemented.
[0015] Another aspect of an embodiment of the present application provides a computer program product, including a computer program, which implements the method described above when executed by a processor.
[0016] The above technical solution adopted in the embodiment of the present application may have the following advantages: Create multiple target combinations according to the text type. Each target combination includes multiple phrases. According to business needs, a binding relationship is established between multiple business lexicons (such as barrage lexicons, comment lexicons, etc.) and multiple target combinations. Among them, one target combination can be bound to multiple business lexicons. When the binding relationship is established, the target text under the target business is matched with one or more target combinations bound to the target business lexicon to obtain a matching result. Among them, the text matching includes: redundant segmentation of the target text in character order to match multiple text blocks. Each text block overlaps the text of a preset character length at the junction with its adjacent text block. It can be seen that when it is necessary to add or delete one or more phrases in multiple business lexicons, the embodiment of the present application does not need to operate these business lexicons one by one. It only needs to configure the target combination (i.e., add or delete phrases), and the associated business lexicon will be automatically updated, thereby improving the efficiency of configuring or modifying multiple business lexicons and the success rate of text matching. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.
[0018] Figure 1 The following schematically shows an operating environment diagram of the text matching method according to the first embodiment of the present application; Figure 2 The flowchart of the text matching method according to the first embodiment of the present application is schematically shown; Figure 3 Schematically shows Figure 2Flow chart of sub-steps of step S200; Figure 4 Schematically shows Figure 2 Flow chart of sub-steps of step S204; Figure 5 A flowchart of the steps for determining the preset character length is schematically shown; Figure 6 Schematically shows Figure 4 Flow chart of sub-steps of step S404; Figure 7 The following schematically shows an exemplary application flow chart of the present application; Figure 8 The schematic diagram of truncation for redundant segmentation of the target text is shown schematically; Fig. 9 The schematic diagram schematically shows the binding relationship between the target combination and the business vocabulary; Fig.10 A block diagram schematically shows a text matching device according to the second embodiment of the present application; and Fig.11 The hardware architecture diagram of the computer device according to the third embodiment of the present application is schematically shown. DETAILED DESCRIPTION
[0019] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0020] It should be noted that the descriptions involving "first", "second", etc. in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0021] In the description of the present application, it should be understood that the numerical labels before the steps do not indicate the order in which the steps are executed, but are only used to facilitate the description of the present application and to distinguish each step, and therefore should not be understood as a limitation on the present application.
[0022] First, the following terms are explained: AC (Aho-Corasick) automaton: is a multi-pattern string matching algorithm based on Trie tree and KMP (Knuth-Morris-Pratt, a cross-platform framework based on Kotlin language). It can find multiple pattern strings in the main text string.
[0023] Trie tree: A data structure used to quickly retrieve elements from a string collection.
[0024] K8S (Kubernetes): An open source container orchestration and management system for automated deployment, expansion, and management of containerized applications. It supports multiple copies, automatic recovery, load balancing, and other features.
[0025] Secondly, in order to facilitate those skilled in the art to understand the technical solutions provided in the embodiments of the present application, the relevant technologies are described below: In today's digital age, content platforms, as an important carrier of information dissemination, carry a massive amount of text data. In order to ensure the compliance and security of platform content and improve user experience, effective monitoring of phrases in text has become an indispensable part of content platforms.
[0026] However, the applicant understands that as the business scenarios of content platforms become more complex and the user scale grows, the limitations of conventional text matching become more and more obvious, making it difficult to quickly respond to business development and the speed of change of users.
[0027] To this end, the present application embodiment provides a text matching technical solution to overcome the above problems. See below for details.
[0028] Finally, for ease of understanding, an exemplary operating environment is provided below.
[0029] like Figure 1 As shown, the operating environment diagram includes: development platform 2, server 4, client 6, where: The development platform 2 can be a workstation, a personal computer, a virtual instance in a cloud platform, etc., providing a development environment and a development interface for users. The development platform 2 can run a Windows system, an IOS system, or a Unix system, etc. After the development platform 2 develops an application (installation package), it can be distributed through the server 4.
[0030] Server 4, as a storage platform, can be composed of multiple computing devices. The multiple computing devices can include virtualized computing instances. Virtualized computing instances can include virtual machines, such as simulations of computer systems, operating systems, servers, etc. The computing device can load the virtual machine based on a virtual image and / or other data that defines specific software (e.g., operating system, dedicated application, server) for simulation. As the demand for different types of processing services changes, different virtual machines can be loaded and / or terminated on one or more computing devices. A hypervisor can be implemented to manage the use of different virtual machines on the same computing device.
[0031] Server 4 can provide services such as storage and distribution of application programs.
[0032] The server 4 may be configured to communicate with the development platform 2 , the client 6 , etc. via a network.
[0033] The client 6 can provide a user access page, and can also automatically download an installation package from the server 4 to perform software updates, etc.
[0034] The following uses the development platform as the execution subject to introduce the technical solution of the present application through multiple embodiments. It should be noted that these embodiments can be implemented in a variety of different forms and should not be interpreted as being limited to the embodiments described here.
[0035] Embodiment 1 Figure 2 The flowchart of the text matching method according to the first embodiment of the present application is schematically shown.
[0036] like Figure 2 As shown, the text matching method may include steps S200 to S204, wherein: Step S200: creating multiple target combinations according to the text type, wherein each target combination includes multiple phrases.
[0037] Step S202: establishing a binding relationship between a plurality of business word libraries and a plurality of the target combinations.
[0038] Step S204, when the binding relationship is established, text matching is performed on the target text under the target business and one or more target combinations bound to the target business vocabulary to obtain a matching result, wherein the target business vocabulary is one of the multiple business vocabulary.
[0039] The text matching method provided in this embodiment creates multiple target combinations according to the text type. Each target combination includes multiple phrases (i.e., various words involving illegality and violation of public order and good morals). According to business needs, a binding relationship is established between multiple business vocabulary libraries (e.g., bullet screen vocabulary libraries, comment vocabulary libraries, etc.) and multiple target combinations. Among them, a target combination can establish a binding relationship with multiple business vocabulary libraries. A business vocabulary library can also establish a binding relationship with multiple target combinations. When the binding relationship is established, the target text under the target business is subjected to text matching with one or more target combinations bound to the target business vocabulary library to obtain a matching result. Among them, the text matching includes: redundant segmentation of the target text in character order to match multiple text blocks. Each text block overlaps the text of a preset character length at the junction with its adjacent text block. When it is necessary to add or delete one or more phrases in multiple business vocabulary libraries, the embodiment of the present application does not need to operate these business vocabulary libraries one by one. Only the target combination needs to be modified (i.e., adding or deleting phrases), and the associated business vocabulary library will be automatically updated accordingly. It can be seen that the embodiments of the present application improve the efficiency of configuring or modifying multiple business vocabulary libraries and the success rate of text matching.
[0040] The following combination Figure 2 , each step in steps S200~S204 and other optional steps are explained in detail.
[0041] Step S200 , create multiple target combinations according to the text type, where each target combination includes multiple phrases.
[0042] The text type may be various types such as financial risk type, market risk type, legal risk type, technical risk type, etc.
[0043] Phrases are word elements in a target portfolio. For example, a market risk portfolio could contain phrases such as "consumer", "competitor", etc.
[0044] In some embodiments, in addition to creating target combinations according to text types, different target combinations can also be created according to the severity of the risk (such as low, medium, and high risk). Different target combinations are provided with phrases of different risk levels. The severity of the risk can be determined based on historical data, expert opinions, industry standards, or corporate regulations.
[0045] In an optional embodiment, if Figure 3 As shown, step S200 may include: Step S300, creating a phrase word library; Step S302, classifying and packaging the words in the phrase word library according to the text type to obtain a plurality of the target combinations.
[0046] You can collect phrases from internal data. For example, you can collect phrases from documents, reports, emails, chat logs, etc. within the company. You can collect phrases from external data. For example, you can search for business-related phrases through search engines, social media, news websites, etc. You can store the collected phrases in a phrase database. You can store the phrase database on a local server. You can also choose to store the phrase database on a cloud server.
[0047] In some embodiments, the collected phrases may be sorted, for example, by removing duplicate, invalid or irrelevant information.
[0048] In some embodiments, the collected phrases may be semantically analyzed by natural language processing technology to obtain synonyms of these phrases, and these synonyms may be added to the phrase word library to enrich the content of the phrase word library.
[0049] The word library can be classified by manual tagging. It can also be classified according to specific business needs by using machine learning algorithms (such as Naive Bayes, Support Vector Machine, Deep Learning, etc.), thereby improving the accuracy and efficiency of word classification.
[0050] In some embodiments, more specific sub-category combinations may be defined under each target combination. For example, under target combination A, it may be subdivided into sub-category combinations such as "A1", "A2", and "A3".
[0051] In this embodiment, a phrase word library is created, and the words in the phrase word library are classified and packaged according to the text type to generate multiple target combinations. These target combinations are subsequently used to bind one or more business word libraries, thereby improving the efficiency of configuring phrases for business word libraries.
[0052] Step S202 , establishing a binding relationship between the plurality of business word libraries and the plurality of target combinations.
[0053] You can set the binding rules between the business vocabulary and the target combination according to business needs. Fig. 9 , multiple business word libraries are bound to multiple target combinations according to binding rules. Binding rules can be matching logic based on factors such as text type (such as sensitive type, risk type, business type, important type), risk (sensitive, business) level, business field, geographical factors, user groups, etc.
[0054] In some embodiments, the binding relationship between the business vocabulary and the target combination may be stored and managed by a database management system or text management software.
[0055] Establish a binding relationship between the business vocabulary and the target business. For example, establish a binding relationship between the barrage vocabulary and the barrage business.
[0056] In this embodiment, a binding relationship between the target business and the business vocabulary and a binding relationship between the business vocabulary and the target combination are established, so that when a target text under the target business is subsequently received, the target text can be matched with the phrases in the target combination bound to the corresponding business vocabulary.
[0057] Step S204 , when the binding relationship is established, performing text matching on the target text under the target business and one or more target combinations bound to the target business vocabulary to obtain a matching result, wherein the target business vocabulary is one of the multiple business vocabulary; The text matching includes: redundantly segmenting the target text in character order to match multiple text blocks; each text block overlaps a text of a preset character length with its adjacent text block at the junction.
[0058] The target service may be a comment service, IM (Instant Messaging) information service, bullet comment service, etc. The target text may be a comment, bullet comment, chat history, etc.
[0059] For example, in the review business, when a user comments "This plot is too outrageous, I can't bear to watch it anymore", the comment is used as the target text and is compared one by one with the phrases in all target combinations bound to the review business vocabulary. If the words "plot" and "outrageous" in the comment successfully match the phrases in the target combination, it is determined that the target text (i.e. the comment posted by the user) involves the phrase.
[0060] In some embodiments, the target text may be compared with the phrase in the target combination to determine whether the phrase is included in the target text. If the similarity exceeds a preset threshold, the target text is determined to contain an expression similar to the phrase, and is considered to contain risky (sensitive) content, thereby improving the accuracy of risk (sensitive) identification.
[0061] It can be seen that the traditional method of segmenting the target text according to character order and fixed character length may cause missed matches when performing phrase matching later. For example, when the word "hello" is segmented according to a fixed character length, it may be segmented into two text blocks, "hel" and "lo". When these two text blocks are subsequently matched separately for phrases, missed matches will also occur.
[0062] In order to solve the above problem, this embodiment redundantly segments the target text in character order so that each text block overlaps with its adjacent text block by a preset character length (for example, 2 characters) at the junction. Figure 8 , if the target text is "Statistical information module can view the statistics of users' recent comments and bullet screens". After redundant segmentation, text block 1 is "Statistical information module can be checked", text block 2 is "can view users' recent comments", text block 3 is "recent comment bullet screen statistics", and text block 4 is "statistical data".
[0063] Specifically, assume that the character length of the target text of the business input is N. The target text can be divided into P segments, where P = N / (n-2K). Where n is the upper limit of the character length of the target text, and K is the longest character length in the target combination bound to the target business vocabulary corresponding to the target text. When actually dividing each segment of text, except for the first two segments, the middle segments are based on n-2K as the benchmark length, and K lengths are redundant before and after. For ease of understanding, you can combine Fig. 9 , the starting and ending positions of the first segment are: 0 to n-1. The starting and ending positions of the second segment are: n×(2-1)-K×(2-1) to (n-2K)×(2-1)+K×(2-1). The starting and ending positions of the third segment are: n×(3-1)-K×(3-1) to (n-2K)×(3-1)+K×(3-1), the starting and ending positions of the fourth segment are: n×(4-1)-K×(4-1) to (n-2K)×(4-1)+K×(4-1), and so on, until the starting and ending positions of the last segment s are: n×(s-1)-K×(s-1) to (n-2K)×(s-1)+(N-1).
[0064] In this embodiment, the target text is redundantly segmented in character order, and each text block obtained by redundant segmentation overlaps a preset length of text with its adjacent text block at the junction, so that when the text block is subsequently matched with a phrase, there will be no missing match problem.
[0065] In an optional embodiment, the text matching further includes: Determining the character length of the target text; When the character length is not greater than a preset threshold, a matching operation is performed on the target text through a single text matching service instance.
[0066] In an optional embodiment, if Figure 4 As shown, step S204 may include: Step S400, determining the character length of the target text; Step S402, when the character length is greater than a preset threshold, obtaining multiple text blocks according to the target text; Step S404, performing a distributed matching operation on the multiple text blocks through multiple text matching service instances to obtain the matching result; Among them, one text matching service instance corresponds to one text block, and the distributed matching operation is to operate on the multiple text blocks in parallel.
[0067] When the character length of the target text exceeds a preset threshold (for example, 4 characters), the target is segmented to obtain multiple text blocks. For example, the target text is "I am trying to learn a new programming language recently", text block 1 is "I am recently", text block 2 is "trying to learn", text block 3 is "a new", and text block 4 is "programming language".
[0068] Based on K8S, multiple text matching service instances can be deployed at the same time. Text matching service instances can be dynamically allocated according to the number of text blocks obtained by segmentation. For example, if the number of text blocks obtained by segmentation is 4, 4 text matching service instances can be started to perform phrase matching operations on these text blocks in parallel.
[0069] In some embodiments, in addition to deploying multiple text matching service instances to match multiple text blocks, a single text service instance can also be used to match, thereby reducing management costs. Specifically, the segmented text blocks can be stored in a message queue. Then, the text service instance is used to retrieve the text blocks one by one from the message queue for matching operations.
[0070] It can be seen that when using the AC automaton solution to phrase match an overlong text (e.g., a text of more than 10,000 words), the problem of excessive CPU resource occupation often occurs, which leads to the failure of the matching process. In order to solve this problem, in the present embodiment, the overlong target text is divided into a plurality of text blocks. Then, these text blocks are processed in parallel by the same number of text matching service instances. This not only significantly improves the efficiency of the text matching operation, but also solves the problem of excessive resource occupation, thereby improving the success rate of phrase matching.
[0071] In an optional embodiment, if Figure 5 As shown, the preset character length is obtained by the following operations: Step S500, obtaining the maximum character length of each phrase in one or more target combinations bound to the target business vocabulary; Step S502: determining the maximum character length as the preset character length.
[0072] In this embodiment, the maximum character length of the phrases in all target combinations bound to the target business vocabulary is obtained, and this maximum character length is used as the preset character length for text redundancy segmentation, thereby effectively reducing the possibility of missing matches.
[0073] In an optional embodiment, if Figure 6 As shown, step S404 may include: Step S600, obtaining multiple distributed matching results of the distributed matching operation, where one text block corresponds to one distributed matching result; Step S602: performing a concatenation operation on the multiple distributed matching results to obtain the matching result for the target text.
[0074] In some embodiments, operations such as deduplication and sorting may be performed on the splicing results to facilitate subsequent processing and analysis.
[0075] In order to make this application easier to understand, the following Figure 7 An exemplary application is provided.
[0076] Step S700, creating a phrase database.
[0077] Step S702, classifying and packaging the words in the phrase word library according to the phrase type to generate a plurality of target combinations.
[0078] Step S704: Establish binding relationships between multiple business word libraries and multiple target combinations according to business requirements. Establish binding relationships between target business word libraries and target businesses. One business word library can establish binding relationships with multiple target combinations. One target combination can also establish binding relationships with multiple business word libraries.
[0079] Step S706, obtaining the target text (such as barrage) under the target service (such as barrage service).
[0080] Step S708, determining the character length of the target text. If the character length is greater than a preset threshold, performing redundancy segmentation on the target text to obtain multiple text blocks.
[0081] Step S710: Based on K8S, multiple text matching service instances are started to perform distributed phrase matching on multiple text blocks to obtain matching results of multiple text blocks, wherein one text matching service instance corresponds to one text block.
[0082] Step S712: concatenate multiple matching results and return them to the upstream business.
[0083] Embodiment 2 Fig.10The block diagram of the text matching device according to the second embodiment of the present application is schematically shown. The device can be divided into one or more program modules, one or more program modules are stored in a storage medium, and are executed by one or more processors to complete the embodiment of the present application. The program module referred to in the embodiment of the present application refers to a series of computer program instruction segments that can complete specific functions. The following description will specifically introduce the functions of each program module in this embodiment. Fig.10 As shown, the apparatus 1000 may include: a creation module 1100, a building module 1200, and a matching module 1300, wherein: A creation module 1100 is used to create multiple target combinations according to the text type, wherein each target combination includes multiple phrases; Establishing module 1200, used to establish binding relationships between multiple business word libraries and multiple target combinations; A matching module 1300 is used to perform text matching on a target text under a target business and one or more target combinations bound to a target business vocabulary to obtain a matching result when the binding relationship is established, wherein the target business vocabulary is one of a plurality of business vocabularys; The text matching includes: redundantly segmenting the target text in character order to match multiple text blocks; each text block overlaps a text of a preset character length with its adjacent text block at the junction.
[0084] In an optional embodiment, multiple target combinations are created according to the text type, including: Create a vocabulary of phrases; The words in the phrase word library are classified and packaged according to the text type to obtain a plurality of the target combinations.
[0085] In an optional embodiment, redundant segmentation is performed on the target text in character order to perform multi-text block matching, including: Determining the character length of the target text; When the character length is greater than a preset threshold, obtaining multiple text blocks according to the target text; Performing distributed matching operations on multiple text blocks through multiple text matching service instances to obtain the matching results; Among them, one text matching service instance corresponds to one text block, and the distributed matching operation is to operate on the multiple text blocks in parallel.
[0086] In an optional embodiment, performing a distributed matching operation on multiple text blocks to obtain the matching result includes: Acquire multiple distributed matching results of the distributed matching operation, where one text block corresponds to one distributed matching result; A concatenation operation is performed on the multiple distributed matching results to obtain the matching result for the target text.
[0087] In an optional embodiment, the preset character length is obtained by the following operation: Obtaining the maximum character length of each phrase in one or more target combinations bound to the target business vocabulary; The maximum character length is determined as the preset character length.
[0088] In an optional embodiment, the text matching further includes: Determining the character length of the target text; When the character length is not greater than a preset threshold, a matching operation is performed on the target text through a single text matching service instance.
[0089] Embodiment 3 Fig.11 The schematic diagram of the hardware architecture of a computer device 10000 suitable for implementing the text matching method according to the third embodiment of the present application is shown. In some embodiments, the computer device 10000 may be a terminal device such as a smart phone, a wearable device, a tablet computer, a personal computer, a vehicle terminal, a game console, a virtual device, a workbench, a digital assistant, a set-top box, a robot, etc. In other embodiments, the computer device 10000 may be a rack server, a blade server, a tower server, or a cabinet server (including an independent server, or a server cluster composed of multiple servers), etc. Fig.11 As shown, the computer device 10000 includes but is not limited to: a memory 10010, a processor 10020, and a network interface 10030 that can communicate with each other through a system bus. Among them: The memory 10010 includes at least one type of computer-readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (such as SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 10010 can be an internal storage module of the computer device 10000, such as a hard disk or memory of the computer device 10000. In other embodiments, the memory 10010 can also be an external storage device of the computer device 10000, such as a plug-in hard disk equipped on the computer device 10000, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 10010 can also include both the internal storage module of the computer device 10000 and its external storage device. In this embodiment, the memory 10010 is generally used to store the operating system and various application software installed in the computer device 10000, such as program codes of the text matching method, etc. In addition, the memory 10010 can also be used to temporarily store various data that have been output or will be output.
[0090] In some embodiments, the processor 10020 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other chips. The processor 10020 is generally used to control the overall operation of the computer device 10000, such as performing control and processing related to data interaction or communication with the computer device 10000. In this embodiment, the processor 10020 is used to run the program code stored in the memory 10010 or process data.
[0091] The network interface 10030 may include a wireless network interface or a wired network interface, and the network interface 10030 is generally used to establish a communication link between the computer device 10000 and other computer devices. For example, the network interface 10030 is used to connect the computer device 10000 to an external terminal through a network, and to establish a data transmission channel and a communication link between the computer device 10000 and the external terminal. The network may be a wireless or wired network such as an intranet, the Internet, the Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Bluetooth, Wi-Fi, etc.
[0092] It should be pointed out that Fig.11 Only a computer device having components 10010 - 10030 is shown, but it should be understood that implementation of all of the components shown is not a requirement, and more or fewer components may alternatively be implemented.
[0093] In this embodiment, the text matching method stored in the memory 10010 can also be divided into one or more program modules and executed by one or more processors (such as processor 10020) to complete the embodiment of the present application.
[0094] Embodiment 4 An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, wherein when the computer program is executed by a processor, the steps of the text matching method in the embodiment are implemented.
[0095] In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the computer-readable storage medium can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the computer-readable storage medium can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the computer-readable storage medium can also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the computer-readable storage medium is generally used to store an operating system and various application software installed on the computer device, such as the program code of the text matching method in the embodiment, etc. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or are to be output.
[0096] Embodiment 5 An embodiment of the present application also provides a computer program product, including a computer program, which implements the method in the above embodiment when executed by a processor.
[0097] Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the present application can be implemented by general-purpose computer devices, they can be concentrated on a single computer device, or distributed on a network composed of multiple computer devices, optionally, they can be implemented by executable program codes of computer devices, so that they can be stored in a storage device and executed by the computer device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.
[0098] It should be noted that the above are only preferred embodiments of the present application, and the patent protection scope of the present application is not limited thereto. Any equivalent structure or equivalent process transformation made using the contents of the specification and drawings of the present application, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A text matching method, characterized in that: The method comprises: Creating multiple target combinations according to text types, wherein each target combination includes multiple phrases; Establishing a binding relationship between a plurality of business word libraries and a plurality of the target combinations; When the binding relationship is established, text matching is performed on the target text under the target business and one or more target combinations bound to the target business vocabulary to obtain a matching result, wherein the target business vocabulary is one of the multiple business vocabulary; The text matching includes: redundantly segmenting the target text in character order to match multiple text blocks; each text block overlaps a text of a preset character length with its adjacent text block at the junction.
2. The method according to claim 1, characterized in that Create multiple target combinations based on text type, including: Create a vocabulary of phrases; The words in the phrase word library are classified and packaged according to the text type to obtain a plurality of the target combinations.
3. The method according to claim 1 or 2, characterized in that: The target text is segmented redundantly according to the character sequence to perform multi-text block matching, including: Determining the character length of the target text; When the character length is greater than a preset threshold, obtaining multiple text blocks according to the target text; Performing distributed matching operations on multiple text blocks through multiple text matching service instances to obtain the matching results; Among them, one text matching service instance corresponds to one text block, and the distributed matching operation is to operate on the multiple text blocks in parallel.
4. The method according to claim 3, characterized in that Performing a distributed matching operation on the plurality of text blocks to obtain the matching result includes: Acquire multiple distributed matching results of the distributed matching operation, where one text block corresponds to one distributed matching result; A concatenation operation is performed on the multiple distributed matching results to obtain the matching result for the target text.
5. The method according to claim 1, characterized in that: The preset character length is obtained by the following operations: Obtaining the maximum character length of each phrase in one or more target combinations bound to the target business vocabulary; The maximum character length is determined as the preset character length.
6. The method according to any one of claims 1 to 5, characterized in that: The text matching also includes: Determining the character length of the target text; When the character length is not greater than a preset threshold, a matching operation is performed on the target text through a single text matching service instance.
7. A text matching device, characterized in that: The device comprises: A creation module, used for creating a plurality of target combinations according to the text type, wherein each target combination includes a plurality of phrases; An establishing module, used for establishing a binding relationship between a plurality of business word libraries and a plurality of the target combinations; a matching module, configured to perform text matching on a target text under a target business and one or more target combinations bound to a target business vocabulary to obtain a matching result when the binding relationship is established, wherein the target business vocabulary is one of a plurality of business vocabularys; The text matching includes: redundantly segmenting the target text in character order to match multiple text blocks; each text block overlaps a text of a preset character length with its adjacent text block at the junction.
8. A computer device, characterized in that: include: at least one processor; and a memory communicatively connected to the at least one processor; wherein: The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and when the computer instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to claims 1 to 6 are implemented.