Text recognition method and device, electronic equipment, storage medium and program product

By converting the text to be identified into a text vector and performing similarity calculations and dynamic threshold adjustments with a sample text library, the problem of accuracy in identifying user needs in customer relationship management systems is solved, thereby improving the system's adaptability and user satisfaction.

CN120929604APending Publication Date: 2025-11-11CHINA UNITED NETWORK COMM GRP CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511030641.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-24
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

Existing customer relationship management and support systems struggle to accurately identify users' true needs when addressing customer issues, and are easily influenced by emotional expressions, leading to inaccurate identification results and decreased user satisfaction.

Method used

By converting the text to be identified into a text vector, similarity calculation is performed with a sample text library. Text features are extracted and classified by combining dynamic thresholds and multiple models (such as BERT, sentiment analysis, and clustering models). The threshold is dynamically adjusted to adapt to different contexts.

Benefits of technology

It improved the accuracy of user demand identification and the system's adaptability, enhanced robustness to emotional content, and increased user satisfaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120929604A_ABST
    Figure CN120929604A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a text recognition method and device, electronic equipment, a storage medium and a program product. The method comprises the steps of obtaining a to-be-recognized text; encoding the to-be-recognized text to obtain a text vector corresponding to the to-be-recognized text; calculating the similarity between the text vector and a preset sample text library; based on the similarity and a dynamic threshold, determining an identification result corresponding to the to-be-identified text; the dynamic threshold value is determined based on a basic threshold value determined according to a historical to-be-recognized text and the to-be-recognized text, and a dynamic component determined according to the to-be-recognized text. The method is used for achieving the effect of improving the user demand recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a text recognition method, apparatus, electronic device, storage medium, and program product. Background Technology

[0002] While existing customer relationship management and support systems employ various data analysis and natural language processing techniques to identify customer needs and feedback, they still face certain challenges in practical applications. On the one hand, the system struggles to accurately identify questions raised by existing or potential customers. On the other hand, during the collection of text data, the system is susceptible to interference from emotional expressions by irrelevant individuals, which can render the identified problems unhelpful in providing practical guidance.

[0003] Current text recognition methods lack effective recognition mechanisms. When a user's speech contains a lot of emotional or off-topic content, the system cannot fully understand the user's intentions and the authenticity of the content. This will result in the user's real problems not being located quickly, leading to a decrease in user satisfaction. Summary of the Invention

[0004] This application provides a text recognition method, apparatus, electronic device, storage medium, and program product to improve the accuracy of user requirement recognition.

[0005] In a first aspect, embodiments of this application provide a text recognition method, characterized in that it includes:

[0006] Obtain the text to be recognized;

[0007] The text to be identified is encoded to obtain a text vector corresponding to the text to be identified;

[0008] Calculate the similarity between the text vector and a pre-set sample text library;

[0009] Based on the similarity and the dynamic threshold, the recognition result corresponding to the text to be recognized is determined; the dynamic threshold is determined based on the basic threshold determined according to the historical text to be recognized and the text to be recognized, and the dynamic component determined according to the text to be recognized.

[0010] In one possible implementation, obtaining the text to be recognized includes:

[0011] Noise filtering is performed on the text to be identified;

[0012] Based on a pre-defined vocabulary, text enhancement is performed on the noise-filtered text to be recognized.

[0013] Contextual information is annotated into the enhanced text to be recognized.

[0014] The process of encoding the text to be identified to obtain the text vector corresponding to the text to be identified includes:

[0015] The text to be identified, after being annotated with contextual information, is encoded to obtain the text vector.

[0016] In one possible implementation, encoding the text to be identified after context information annotation to obtain the text vector includes:

[0017] The semantic feature vector of the text to be identified is extracted through the semantic channel after the context information is annotated, and the syntactic feature vector of the text to be identified is extracted through the syntactic channel after the context information is annotated.

[0018] The semantic feature vector and the syntactic feature vector are fused to obtain the text vector.

[0019] In one possible implementation, the sample text library includes a positive text library and a negative text library, wherein the positive text library contains text vectors of multiple positive texts and the negative text library contains text vectors of multiple negative texts.

[0020] The calculation of the similarity between the text vector and a pre-set sample text library includes:

[0021] The text vector is compared with the text vectors of positive text in the positive text library and the text vectors of negative text in the negative text library to obtain positive similarity and negative similarity.

[0022] Based on the positive similarity and the negative similarity, the one with the larger value is taken as the similarity between the text vector and the sample text library.

[0023] In one possible implementation, the step of calculating the base threshold includes:

[0024] Obtain a preset number of historical similarities between the target texts and the sample text library, as well as the generation time of the historical recognition results corresponding to each target text;

[0025] The historical similarities are sorted according to a preset number of times, and the historical similarities that are in the preset position after sorting are used as the first parameter.

[0026] The second parameter is determined based on the time decay rule and the time difference between the generation time of each historical recognition result and the current time.

[0027] Obtain the business type corresponding to the text to be identified, and based on the correspondence between multiple business types and multiple weight values, use the weight value corresponding to the business type of the text to be identified as the third parameter;

[0028] The basic threshold is determined by combining the first parameter, the second parameter, and the third parameter.

[0029] In one possible implementation, determining the second parameter based on the time decay rule and the time difference between the generation time of each of the historical identification results and the current time includes:

[0030] For a preset number of historical recognition results, calculate the time difference between the generation time and the current time;

[0031] Using the time decay rule and the time difference, the decay parameter corresponding to each of the historical recognition results is determined;

[0032] A preset number of attenuation parameters are sorted, and the attenuation parameter that is in a preset position after sorting is used as the second parameter.

[0033] In one possible implementation, the step of determining the dynamic component includes:

[0034] The text vector corresponding to the text to be identified is input into a pre-trained clustering model to obtain the cluster classification result corresponding to the text vector.

[0035] Based on the cluster classification result, the density value corresponding to the cluster classification result is obtained from the dynamically maintained cluster density dictionary, and the fourth parameter is determined based on the density value and the preset density threshold; the cluster density dictionary is dynamically maintained based on the recognition result corresponding to the continuously acquired text to be recognized.

[0036] The text vector corresponding to the text to be identified is input into a pre-trained sentiment analysis model to obtain the fifth parameter corresponding to the text vector.

[0037] The dynamic component is determined based on the fourth parameter and the fifth parameter.

[0038] In one possible implementation, the method further includes:

[0039] From multiple response strategies, the target response strategy corresponding to the recognition result of the text to be recognized is matched, and the text to be recognized is responded to.

[0040] Secondly, embodiments of this application provide a text recognition device, comprising:

[0041] The acquisition module is used to acquire the text to be recognized;

[0042] The encoding module is used to encode the text to be identified to obtain a text vector corresponding to the text to be identified;

[0043] The calculation module is used to calculate the similarity between the text vector and a pre-set sample text library;

[0044] The determination module is used to determine the recognition result corresponding to the text to be recognized based on the similarity and the dynamic threshold; the dynamic threshold is determined based on the basic threshold determined according to the historical text to be recognized and the text to be recognized, and the dynamic component determined according to the text to be recognized.

[0045] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;

[0046] The memory stores computer-executed instructions;

[0047] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0048] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.

[0049] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0050] The text recognition method, apparatus, electronic device, storage medium, and program product provided in this application convert the text to be recognized into a text vector and then calculates its similarity with an existing sample text library. This effectively captures the semantic features of the text to be recognized. By using similarity judgment rather than simple keyword matching, the essence of the text content can be more accurately identified, improving the accuracy of classification. Furthermore, by setting a dynamic threshold, the threshold can be adjusted in real time by combining historical and current texts to be recognized. This allows the text recognition method to continuously learn and adapt, avoiding the problems of static thresholds being too sensitive or too lenient. This enhances the adaptability and agility of the system, improves the accuracy of user demand recognition, and enhances the overall intelligence level of judgment. Attached Figure Description

[0051] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0052] Figure 1 A schematic diagram illustrating a scenario for the text recognition method provided in this application;

[0053] Figure 2 A flowchart illustrating the text recognition method provided in this application;

[0054] Figure 3 A schematic diagram of the text recognition device provided in this application;

[0055] Figure 4 A schematic diagram of the structure of the electronic device provided in this application.

[0056] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0057] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0058] The text recognition method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network.

[0059] For example, the text recognition method is applied to terminal 102. Terminal 102 can acquire the text to be recognized based on the received recognition instruction; encode the text to be recognized to obtain the text vector corresponding to the text to be recognized; further, it retrieves a sample text library from the data storage system of server 104 and calculates the similarity between the text vector and the pre-set sample text library; finally, based on the similarity and a dynamic threshold, it determines the recognition result corresponding to the text to be recognized; the dynamic threshold is determined based on the basic threshold determined according to the historical text to be recognized and the text to be recognized, and the dynamic component determined according to the text to be recognized. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster composed of multiple servers. Terminal 102 and server 104 can be directly or indirectly connected via wired or wireless communication, such as through a network connection.

[0060] For example, the text recognition method is applied to server 104. After receiving a recognition instruction, terminal 102 can send the instruction to server 104. Server 104, based on the instruction, obtains the text to be recognized; encodes the text to be recognized to obtain a text vector corresponding to the text; further, it retrieves a sample text library from the data storage system and calculates the similarity between the text vector and the sample text library; finally, based on the similarity and a dynamic threshold, it determines the recognition result corresponding to the text to be recognized. The dynamic threshold is determined based on a basic threshold determined according to historical texts to be recognized and the dynamic components determined according to the text to be recognized. It is understood that the data storage system can be an independent storage device, or the data storage system can be located on server 104, or the data storage system can be located on another terminal.

[0061] In one embodiment, a text recognition method is provided. This embodiment illustrates the application of this text recognition method to a terminal. It is understood that this text recognition method can also be applied to a server, and can also be applied to a system including a terminal and a server, and implemented through the interaction between the terminal and the server. Figure 2 As shown, the text recognition method includes:

[0062] Step 202: Obtain the text to be recognized.

[0063] It should be noted that the terminal can obtain the text to be recognized when it receives a recognition command from the user.

[0064] A recognition instruction refers to an instruction used to retrieve text content to be analyzed from a specific data source and to recognize the problem or requirement expressed by that text content. This recognition instruction may originate from a scheduled task, an API call, or be driven by a specific event.

[0065] The text to be identified refers to the original text content that needs to be analyzed for user intent and its authenticity. It may be short text, long text, or multimodal data. The identification command can instruct the terminal to extract the text to be identified from several specific social media platforms or databases.

[0066] Step 204: Encode the text to be recognized to obtain the text vector corresponding to the text to be recognized.

[0067] The process of encoding the text to be recognized may include several steps, such as text preprocessing, text vector encoding, and obtaining text vectors using an encoding model. In the text preprocessing step, the terminal may, for example, filter noise from the text to be recognized, perform text enhancement on the noise-filtered text to be recognized, and annotate the enhanced text with context information to perform preliminary parsing of the text to be recognized. Subsequently, the terminal can decompose the preprocessed text to be recognized into tokens, such as words or sub-words, supported by the encoding model used in this embodiment, and match the unique number corresponding to each token based on a preset word index. Furthermore, each number is mapped to a high-dimensional continuous vector through a pre-trained word embedding matrix.

[0068] It should be noted that this embodiment does not limit the method of obtaining text vectors through text encoding, as long as it can obtain a high-dimensional vector representation from the original text.

[0069] Step 206: Calculate the similarity between the text vector and the pre-set sample text library.

[0070] The sample text library may contain multiple sub-text libraries, each storing a large number of sample texts used to indicate different intentions.

[0071] As an example, the terminal can calculate the cosine similarity between the text vector corresponding to the text to be identified and the text vector of each sample text in each sub-text library, and select several pre-defined similarity values ​​with larger values ​​from each sub-text library as the similarity between the text vector corresponding to the text to be identified and the sample text library.

[0072] Step 208: Determine the recognition result corresponding to the text to be recognized based on similarity and dynamic threshold; the dynamic threshold is determined based on the basic threshold determined according to the historical text to be recognized and the dynamic component determined according to the text to be recognized.

[0073] The dynamic threshold is used to determine the similarity between the text to be identified and the sample text library. When the similarity between the text to be identified and the sample text library reaches the dynamic threshold, it can be determined that the user intent conveyed by the text to be identified is the same as the intent corresponding to the sample text library, thereby completing the determination of the intent of the text to be identified.

[0074] The base threshold serves as the fundamental decision boundary for judging the text to be recognized, and is used to initially distinguish the actual intent of the text to be recognized. The dynamic component is used to indicate the parameters that are used to adjust the base threshold based on the actual text to be recognized.

[0075] The terminal can dynamically determine the actual dynamic threshold by superimposing the influence of the current text to be identified on the historical text to be identified. For example, preset weight values ​​can be configured for the basic threshold and the dynamic component to obtain the final dynamic threshold.

[0076] The process of obtaining the dynamic threshold can be represented by the following formula:

[0077] H = Z1K1 + Z2K2

[0078] Where H represents the dynamic threshold, Z1 represents the weight value corresponding to the basic threshold, K1 represents the basic threshold, Z1 represents the weight value corresponding to the dynamic component, and K1 represents the dynamic component.

[0079] The aforementioned text recognition method effectively captures the semantic features of the text by converting it into a text vector and then calculating its similarity with an existing sample text library. Utilizing similarity judgment, rather than simple keyword matching, it can more accurately identify the essence of the text content and improve classification accuracy. Furthermore, by setting dynamic thresholds, the threshold can be adjusted in real time based on historical and current text samples, allowing the method to continuously learn and adapt. This avoids the problems of static thresholds being too sensitive or too lenient, thereby enhancing the system's adaptability and agility, improving the accuracy of user requirement recognition, and enhancing the overall intelligence level of judgment.

[0080] In some alternative embodiments, step 202 includes:

[0081] Noise filtering is applied to the text to be recognized;

[0082] Based on a pre-defined vocabulary, text enhancement is performed on the noise-filtered text to be recognized.

[0083] Contextual information is annotated into the enhanced text to be recognized.

[0084] Step 208 includes:

[0085] The text to be identified, after being annotated with contextual information, is encoded to obtain a text vector.

[0086] Noise filtering of the text to be recognized aims to remove interfering information and noise, such as irrelevant symbols, garbled characters, redundant spaces, repeated words, meaningless characters, or special characters. This step typically employs techniques such as regular expressions, character filtering, stop word removal, or spell correction.

[0087] Furthermore, the terminal can utilize a pre-set vocabulary (which may include keywords, common expressions, etc.) to expand or replace the text to be recognized, thereby enhancing its expressiveness and information content. This step can employ techniques such as synonym replacement, keyword supplementation, and phrase enhancement to improve the semantic representation of the text and ensure that key information is highlighted.

[0088] Furthermore, the terminal can add tags or annotations based on the content of the enhanced text to be recognized, indicating key information, entities, sentiments, relationships, or topics. This step can be automatically labeled using natural language processing techniques (such as named entity recognition, relation extraction, and sentiment analysis), or manually labeled using rules.

[0089] Specifically, in one embodiment, the step of encoding the text to be recognized after context information annotation to obtain a text vector includes:

[0090] The semantic feature vector of the text to be identified is extracted through the semantic channel after the context information is annotated, and the syntactic feature vector of the text to be identified is extracted through the syntactic channel after the context information is annotated.

[0091] The semantic feature vector and the syntactic feature vector are fused to obtain the text vector.

[0092] In this embodiment, the terminal, for example, uses a dual-channel Bidirectional Encoder Representations from Transformers (BERT) structure to obtain the text vector of the text to be recognized. The dual-channel BERT structure includes a semantic channel and a syntactic channel.

[0093] The process of extracting semantic feature vectors of the text to be recognized by the terminal may include, for example, using a deep learning model in natural language processing, such as the transformer or other semantic understanding model, to extract semantic information from the text to be recognized after context information annotation, thereby being able to understand the potential intentions, themes and emotional tones in the text to be recognized after context information annotation, and being able to take the context into account, improve the accuracy of understanding and enhance the robustness of recognition.

[0094] The process of extracting syntactic feature vectors from the text to be identified by the terminal may include, for example, using syntactic analysis tools (such as dependency parsing, phrase structure analysis, etc.) to extract the grammatical features of the text to be identified after context information annotation, and converting information such as sentence structure, word relationships, and modification relationships into syntactic feature vectors.

[0095] The aforementioned text recognition method reduces the impact of noise on text vectorization and similarity calculation by sequentially performing noise filtering, text enhancement, and contextual information annotation on the text to be recognized, thus avoiding misjudgment or recognition bias caused by noise. It also improves the expressiveness of the text to be recognized, making it closer to the actual context, and provides structured and semantic information for subsequent analysis. This significantly improves the quality and expressiveness of the text to be recognized, provides a solid foundation for subsequent similarity calculation and judgment, and enhances the accuracy, robustness, and adaptability of the text recognition method.

[0096] In some optional embodiments, the sample text library includes a positive text library and a negative text library, wherein the positive text library contains text vectors of multiple positive texts and the negative text library contains text vectors of multiple negative texts;

[0097] Step 206 includes:

[0098] The text vectors are compared with the text vectors of positive texts in the positive text library and the text vectors of negative texts in the negative text library to obtain positive similarity and negative similarity.

[0099] Based on positive and negative similarity, the larger value is used as the similarity between the text vector and the sample text library.

[0100] The positive text library includes real texts that indicate the existence of problems that need to be solved, while the negative text library includes fake texts that indicate only emotional expressions and that there are no actual problems that need to be solved.

[0101] In this embodiment, the terminal can calculate the cosine similarity between the text vector corresponding to the text to be identified and the text vectors of each positive text in the positive text library, and the cosine similarity between the text vector corresponding to the text to be identified and the text vectors of each negative text in the negative text library, to obtain multiple positive similarities and multiple negative similarities. Furthermore, the multiple positive similarities and multiple negative similarities are sorted in descending order, and the similarity with the largest value is taken as the similarity between the text vector corresponding to the text to be identified and the sample text library.

[0102] The text recognition method described above can more intuitively determine the tendency of the text to be recognized by comparing the similarity between the text to be recognized and positive and negative texts, rather than referring to a single category, thereby reducing misjudgment. Furthermore, if the text to be recognized has a high similarity in positive texts but also has a certain similarity in negative texts, taking the maximum value can better reflect the actual characteristics of the text to be recognized and improve the accuracy and robustness of classification.

[0103] In some alternative embodiments, the step of calculating the base threshold includes:

[0104] Obtain a preset number of historical similarities between the texts to be identified and the sample text library, as well as the generation time corresponding to each historical identification result;

[0105] Sort a preset number of historical similarities, and use the historical similarity that is in a preset position after sorting as the first parameter;

[0106] The second parameter is determined based on the time decay rule and the time difference between the generation time of each historical recognition result and the current time.

[0107] Obtain the business type corresponding to the text to be recognized, and based on the correspondence between multiple business types and multiple weight values, use the weight value corresponding to the business type of the text to be recognized as the third parameter;

[0108] The basic threshold is determined by combining the first, second, and third parameters.

[0109] The time decay rule can include a daily decay rate, which is a coefficient between 0 and 1 used to represent the rate at which the data weights of the historical recognition results of the historical text to be recognized decay over time.

[0110] In this embodiment, the terminal can extract the historical similarity between a preset number (e.g., the most recent 100) of historical texts to be identified and the sample text library. At the same time, it obtains the generation time of the historical identification result of each historical text to be identified. Then, it sorts the historical similarity of the 100 historical texts to be identified in ascending order and uses the historical similarity at a preset position (e.g., 75th position) as the first parameter.

[0111] In one embodiment, the step of determining the second parameter based on the time decay rule and the time difference between the generation time of each historical recognition result and the current time may include: calculating the time difference between the generation time and the current time for a preset number of historical recognition results; determining the decay parameter corresponding to each historical recognition result using the time decay rule and the time difference; sorting the preset number of decay parameters, and using the decay parameter that is in a preset position after sorting as the second parameter.

[0112] In this embodiment, the terminal calculates the time difference Δt between the generation time of each historical recognition result and the current time. This time difference Δt can be in seconds, or even days. After converting the time difference Δt, it is rounded up to obtain the number of times the daily decay rate is included in the time decay rule, thereby determining the decay parameter corresponding to each historical recognition result.

[0113] The process of determining the attenuation parameter can be represented by the following formula:

[0114]

[0115] Where P represents the attenuation parameter, Q represents the daily attenuation rate, and Δt represents the time difference between the generation time of historical recognition results and the current time. This indicates that the time difference Δt is converted to a daily unit and then rounded up.

[0116] Subsequently, the terminal sorts a preset number of attenuation parameters and uses the attenuation parameter that is in the preset position after sorting as the second parameter.

[0117] The process of obtaining the business type corresponding to the text to be recognized can be achieved by matching the text to be recognized with a phrase library corresponding to multiple business types. As an example, the terminal can quickly classify the text to be recognized based on the phrase library corresponding to multiple business types, using regular expressions or exact matching.

[0118] Multiple service types correspond one-to-one with multiple preset weight values. After the terminal determines the service type of the text to be recognized, it matches the weight value corresponding to that service type as the third parameter.

[0119] Finally, the terminal can, for example, use the product of the first parameter, the second parameter, and the third parameter as the base threshold K1.

[0120] The aforementioned text recognition method extracts representative indicators from the historical similarity of multiple historical targets to avoid the influence of individual extreme values ​​on the overall judgment. Furthermore, by introducing a time factor, the judgment results are made more timely, avoiding interference from outdated information. At the same time, the dynamic decay mechanism can improve the adaptability of this text recognition method to sudden changes and new situations. Moreover, it can dynamically optimize the recognition mechanism according to the risk level or sensitivity of different types of businesses. This allows the final base threshold to take into account the differences in historical factors, time factors, and business scenarios, thereby improving the professionalism and adaptability of the judgment.

[0121] In some alternative embodiments, the step of determining the dynamic components includes:

[0122] Input the text vector corresponding to the text to be identified into a pre-trained clustering model to obtain the cluster classification result corresponding to the text vector;

[0123] Based on the cluster classification results, the density values ​​corresponding to the cluster classification results are obtained from the dynamically maintained cluster density dictionary, and the fourth parameter is determined based on the density values ​​and the preset density threshold; the cluster density dictionary is dynamically maintained based on the recognition results corresponding to the continuously acquired text to be recognized.

[0124] Input the text vector corresponding to the text to be identified into the pre-trained sentiment analysis model to obtain the fifth parameter corresponding to the text vector.

[0125] The dynamic components are determined based on the fourth and fifth parameters.

[0126] Clustering models, such as K-means and hierarchical clustering, can be used to assign text vectors corresponding to the text to be identified to a specific cluster. A preset density threshold is used to distinguish between high-density and low-density clusters. When the density value of the cluster corresponding to the text vector is greater than the density threshold, the text vector is determined to belong to a high-density cluster, and the preset value corresponding to the high-density cluster can be used as the fourth parameter. When the density value of the cluster corresponding to the text vector is less than the density threshold, the text vector is determined to belong to a low-density cluster, and the preset value corresponding to the low-density cluster can be used as the fourth parameter. It should be noted that the preset value for low-density clusters should be less than the preset value for high-density clusters.

[0127] Furthermore, the terminal can input the text vector corresponding to the text to be identified into a pre-trained sentiment analysis model (such as VADER, NLTK or BERT sentiment classifier) ​​to obtain the text sentiment score (e.g., between -1 and 1) corresponding to the text vector.

[0128] Finally, the terminal can configure the corresponding weight values ​​for the fourth and fifth parameters respectively to obtain the final dynamic components.

[0129] Furthermore, after confirming the recognition result of the text to be recognized, the text recognition method may also include: matching the target response strategy corresponding to the recognition result of the text to be recognized from multiple response strategies, and responding to the text to be recognized.

[0130] After determining the recognition result of the text to be recognized, the terminal, based on preset rules or matching models, finds the target response strategy that best matches the recognition result from multiple response strategies. Response strategies may include, for example, reply templates, processing procedures, and action plans.

[0131] The process of matching target response strategies can employ techniques such as keyword matching, category matching, logical rules, and machine learning models.

[0132] The above-described method for responding to text to be recognized can automatically select the most appropriate response based on the recognition results, making the system response more in line with user needs. This process reduces manual intervention, realizes an automatic closed loop of judgment and response, and improves work efficiency.

[0133] The aforementioned text recognition method can group similar text vectors into a single cluster. Different clusters can be compared with a preset density threshold to classify them into high-density or low-density clusters. The preset values ​​of high-density or low-density clusters can be used as the fourth parameter of the text vector corresponding to the text to be recognized, thereby enhancing the adaptability and flexibility of the recognition. Furthermore, by combining text category and sentiment features, it provides a more comprehensive basis for judgment. It also adjusts the recognition parameters in real time based on changes in cluster density to adapt to environmental changes. Through the combined effect of multi-dimensional information, it can reduce the false positive and false negative rates, adapt to the needs of different text types and sentiment biases, and improve the level of intelligence in judgment.

[0134] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0135] Based on the same inventive concept, this application also provides a text recognition device for implementing the text recognition method described above. The solution provided by this state determination device is similar to the implementation scheme described in the text recognition method above. Therefore, the specific limitations in one or more device embodiments provided below can be found in the limitations of the text recognition method above, and will not be repeated here.

[0136] In one embodiment, such as Figure 3 As shown, a text recognition device 300 is provided, comprising:

[0137] The acquisition module 302 is used to acquire the text to be recognized;

[0138] The encoding module 304 is used to encode the text to be recognized to obtain the text vector corresponding to the text to be recognized.

[0139] The calculation module 306 is used to calculate the similarity between the text vector and a pre-set sample text library;

[0140] The determination module 308 is used to determine the recognition result corresponding to the text to be recognized based on similarity and dynamic threshold; the dynamic threshold is determined based on the basic threshold determined according to the historical text to be recognized and the text to be recognized, as well as the dynamic component determined according to the text to be recognized.

[0141] In some optional embodiments, the acquisition module 302 is further configured to:

[0142] Noise filtering is applied to the text to be recognized;

[0143] Based on a pre-defined vocabulary, text enhancement is performed on the noise-filtered text to be recognized.

[0144] Contextual information is annotated into the enhanced text to be recognized.

[0145] Encoding module 304 is also configured as follows:

[0146] The text to be identified, after being annotated with contextual information, is encoded to obtain a text vector.

[0147] In some optional embodiments, the encoding module 304 is further configured to:

[0148] The semantic feature vector of the text to be identified is extracted through the semantic channel after the context information is annotated, and the syntactic feature vector of the text to be identified is extracted through the syntactic channel after the context information is annotated.

[0149] The semantic feature vector and the syntactic feature vector are fused to obtain the text vector.

[0150] In some optional embodiments, the sample text library includes a positive text library and a negative text library, wherein the positive text library contains text vectors of multiple positive texts and the negative text library contains text vectors of multiple negative texts;

[0151] The computing module 306 is also configured as follows:

[0152] The text vectors are compared with the text vectors of positive texts in the positive text library and the text vectors of negative texts in the negative text library to obtain positive similarity and negative similarity.

[0153] Based on positive and negative similarity, the larger value is used as the similarity between the text vector and the sample text library.

[0154] In some alternative embodiments, the determining module 308 is further configured to:

[0155] Obtain the historical similarity between a preset number of historical texts to be identified and the sample text library, as well as the generation time of the historical recognition results corresponding to each historical text to be identified;

[0156] Sort a preset number of historical similarities, and use the historical similarity that is in a preset position after sorting as the first parameter;

[0157] The second parameter is determined based on the time decay rule and the time difference between the generation time of each historical recognition result and the current time.

[0158] Obtain the business type corresponding to the text to be recognized, and based on the correspondence between multiple business types and multiple weight values, use the weight value corresponding to the business type of the text to be recognized as the third parameter;

[0159] The basic threshold is determined by combining the first, second, and third parameters.

[0160] In some alternative embodiments, the determining module 308 is further configured to:

[0161] For a preset number of historical recognition results, calculate the time difference between the generation time and the current time;

[0162] The decay parameters corresponding to each historical recognition result are determined by using time decay rules and time differences;

[0163] The preset number of attenuation parameters are sorted, and the attenuation parameter that is in the preset position after sorting is used as the second parameter.

[0164] In some alternative embodiments, the determining module 308 is further configured to:

[0165] Input the text vector corresponding to the text to be identified into a pre-trained clustering model to obtain the cluster classification result corresponding to the text vector;

[0166] Based on the cluster classification results, the density values ​​corresponding to the cluster classification results are obtained from the dynamically maintained cluster density dictionary, and the fourth parameter is determined based on the density values ​​and the preset density threshold; the cluster density dictionary is dynamically maintained based on the recognition results corresponding to the continuously acquired text to be recognized.

[0167] Input the text vector corresponding to the text to be identified into the pre-trained sentiment analysis model to obtain the fifth parameter corresponding to the text vector.

[0168] The dynamic components are determined based on the fourth and fifth parameters.

[0169] In some alternative embodiments, the determining module 308 is further configured to:

[0170] From multiple response strategies, the target response strategy corresponding to the recognition result of the text to be recognized is matched, and the text to be recognized is responded to.

[0171] Each module in the above-mentioned device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0172] Figure 4 A schematic diagram of the structure of the electronic device provided in this application. Figure 4 As shown, the electronic device 40 provided in this embodiment includes at least one processor 401 and a memory 402. Optionally, the device 40 further includes a communication component 403. The processor 401, memory 402, and communication component 403 are connected via a bus 404.

[0173] In a specific implementation, at least one processor 401 executes computer execution instructions stored in memory 402, causing at least one processor 401 to perform the above-described method.

[0174] The specific implementation process of processor 401 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0175] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0176] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0177] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0178] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0179] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0180] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0181] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0182] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0183] The units described as separate components may or may not be physically separate. The components shown 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 units can be selected to achieve the purpose of this embodiment according to actual needs.

[0184] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0185] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0186] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0187] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A text recognition method, characterized in that, include: Obtain the text to be recognized; The text to be identified is encoded to obtain a text vector corresponding to the text to be identified; Calculate the similarity between the text vector and a pre-set sample text library; Based on the similarity and the dynamic threshold, the recognition result corresponding to the text to be recognized is determined; the dynamic threshold is determined based on the basic threshold determined according to the historical text to be recognized and the text to be recognized, and the dynamic component determined according to the text to be recognized.

2. The method according to claim 1, characterized in that, The process of obtaining the text to be recognized includes: Noise filtering is performed on the text to be identified; Based on a pre-defined vocabulary, text enhancement is performed on the noise-filtered text to be recognized. Contextual information is annotated into the enhanced text to be recognized. The process of encoding the text to be identified to obtain the text vector corresponding to the text to be identified includes: The text to be identified, after being annotated with contextual information, is encoded to obtain the text vector.

3. The method according to claim 2, characterized in that, The process of encoding the text to be recognized after context information annotation to obtain the text vector includes: The semantic feature vector of the text to be identified is extracted through the semantic channel after the context information is annotated, and the syntactic feature vector of the text to be identified is extracted through the syntactic channel after the context information is annotated. The semantic feature vector and the syntactic feature vector are fused to obtain the text vector.

4. The method according to claim 1, characterized in that, The sample text library includes a positive text library and a negative text library. The positive text library contains text vectors of multiple positive texts, and the negative text library contains text vectors of multiple negative texts. The calculation of the similarity between the text vector and a pre-set sample text library includes: The text vector is compared with the text vectors of positive text in the positive text library and the text vectors of negative text in the negative text library to obtain positive similarity and negative similarity. Based on the positive similarity and the negative similarity, the one with the larger value is taken as the similarity between the text vector and the sample text library.

5. The method according to claim 1, characterized in that, The steps for calculating the basic threshold include: Obtain a preset number of historical similarities between the target texts and the sample text library, as well as the generation time of the historical recognition results corresponding to each target text; The historical similarities are sorted according to a preset number of times, and the historical similarities that are in the preset position after sorting are used as the first parameter. The second parameter is determined based on the time decay rule and the time difference between the generation time of each historical recognition result and the current time. Obtain the business type corresponding to the text to be identified, and based on the correspondence between multiple business types and multiple weight values, use the weight value corresponding to the business type of the text to be identified as the third parameter; The basic threshold is determined by combining the first parameter, the second parameter, and the third parameter.

6. The method according to claim 5, characterized in that, The determination of the second parameter based on the time decay rule and the time difference between the generation time of each historical recognition result and the current time includes: For a preset number of historical recognition results, calculate the time difference between the generation time and the current time; Using the time decay rule and the time difference, the decay parameter corresponding to each of the historical recognition results is determined; A preset number of attenuation parameters are sorted, and the attenuation parameter that is in a preset position after sorting is used as the second parameter.

7. The method according to claim 1, characterized in that, The step of determining the dynamic component includes: The text vector corresponding to the text to be identified is input into a pre-trained clustering model to obtain the cluster classification result corresponding to the text vector. Based on the cluster classification result, the density value corresponding to the cluster classification result is obtained from the dynamically maintained cluster density dictionary, and the fourth parameter is determined based on the density value and the preset density threshold; the cluster density dictionary is dynamically maintained based on the recognition result corresponding to the continuously acquired text to be recognized. The text vector corresponding to the text to be identified is input into a pre-trained sentiment analysis model to obtain the fifth parameter corresponding to the text vector. The dynamic component is determined based on the fourth parameter and the fifth parameter.

8. The method according to claim 1, characterized in that, The method further includes: From multiple response strategies, the target response strategy corresponding to the recognition result of the text to be recognized is matched, and the text to be recognized is responded to.

9. A text recognition device, characterized in that, include: The acquisition module is used to acquire the text to be recognized; The encoding module is used to encode the text to be identified to obtain a text vector corresponding to the text to be identified; The calculation module is used to calculate the similarity between the text vector and a pre-set sample text library; The determination module is used to determine the recognition result corresponding to the text to be recognized based on the similarity and the dynamic threshold; the dynamic threshold is determined based on the basic threshold determined according to the historical text to be recognized and the text to be recognized, and the dynamic component determined according to the text to be recognized.

10. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-8.

12. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-8.