Text recognition method and device, electronic equipment and computer readable storage medium
By combining semantic rule bases and templates, the machine model can obtain multiple target questions and answers in a single text traversal, solving the problem of low efficiency in existing technologies and improving the efficiency and accuracy of text recognition.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-10
- Publication Date
- 2026-03-24
AI Technical Summary
Existing machine learning models are inefficient because they require setting multiple target questions and traversing the text multiple times when recording dialogue text information.
The text to be identified is segmented using a pre-defined semantic rule base. The first and second semantic sets in the semantic template are used to determine the target questions and corresponding target answers, respectively. The judgment is made by combining the string sequence identifier and the pre-defined semantic rule base, so as to obtain multiple target questions and answers in one traversal.
It improves the efficiency and accuracy of text recognition, reduces workload, lowers recognition difficulty, and ensures the accuracy of target questions and answers.
Smart Images

Figure CN114372479B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of text recognition, and more specifically, to a text recognition method, a text recognition device, an electronic device, and a computer-readable storage medium. Background Technology
[0002] With the advancement of artificial intelligence technology, machine learning models are increasingly being applied in fields such as customer service and sales, helping businesses record information from conversations to improve service quality and generate better revenue.
[0003] Currently available machine learning models typically require pre-setting target questions when recording dialogue text information. They then perform text recognition on the text to extract the text corresponding to the target information. However, if multiple target questions need to be extracted, each target question often needs to be set separately, and the text needs to be traversed multiple times based on the number of target questions, resulting in low efficiency in obtaining the target text. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a text recognition method that can obtain multiple target questions and corresponding question answers by traversing the text to be recognized once, thereby improving the efficiency of text recognition.
[0005] In a first aspect, this application provides a text recognition method, the method comprising: acquiring a text to be recognized; segmenting the text to be recognized based on a preset semantic rule base to obtain multiple strings to be recognized; judging each string to be recognized based on a preset semantic template to determine the semantic recognition result corresponding to each string to be recognized, wherein the semantic template includes a first semantic set and a second semantic set, the first semantic set being used to determine a target question in the text to be recognized; and the second semantic set being used to determine a target answer corresponding to the target question.
[0006] In this embodiment, by acquiring the text to be identified and segmenting it to obtain multiple strings to be identified, the target questions in the multiple strings to be identified are obtained through the first semantic set in the semantic template, and the semantic statements corresponding to the target answers to the target questions are obtained through the second semantic set in the semantic template. This enables the machine model to acquire multiple target questions and corresponding question answers by traversing the text to be identified only once, thereby improving the efficiency of text recognition.
[0007] In one embodiment, before judging each string to be identified based on a preset semantic template, the method includes: adding a sequence identifier to each string to be identified according to the order in which each string appears in the text to be identified.
[0008] In this embodiment of the application, since the determination of the target question and the target answer corresponding to the target question generally has a chronological order, by adding a sequence identifier to each string to be identified according to the order in which each string appears in the text to be identified before judging each string to be identified, and in addition, the judgment result of the string to be identified is usually set to correspond to the string to be identified, it is convenient to find the corresponding source of the obtained target question and the target answer corresponding to the target question in the text to be identified, which facilitates the subsequent verification of the correctness of the semantic recognition result.
[0009] In one embodiment, the step of judging each string to be recognized based on a preset semantic template and determining the semantic recognition result corresponding to each string to be recognized includes: judging each string to be recognized sequentially based on the sequence identifier of the string and a preset semantic rule base until a first target string corresponding to any first semantic in the first semantic set is determined; starting from the first target string, judging the undetermined strings to be recognized sequentially according to the sequence identifier of the strings to be recognized until the number of determined second target strings reaches a preset threshold, wherein the second target string matches a second semantic in the second semantic set; repeating the above steps until the judgment of the strings to be recognized is completed.
[0010] In this embodiment, each string to be identified is judged sequentially by the sequential identifier of the string and the preset semantic rule base to obtain the first target string corresponding to any first semantic in the first semantic set. Then, starting from the first target string, the judgment is continued on the undetermined strings to be identified until the number of second target strings corresponding to any second semantic in the second semantic set is obtained. This allows a target question to have multiple target answers, which improves the accuracy of the target answer corresponding to the target question to a certain extent.
[0011] In one embodiment, the semantic template further includes a third semantic set, which is used to limit the judgment range of the second target string corresponding to each first target string. After judging each string to be identified sequentially based on the sequential identifier of the string and a preset semantic rule base until the first target string corresponding to any first semantic in the first semantic set is determined, the method further includes: determining the first third target string that matches any third semantic in the third semantic set from the remaining strings to be identified; and determining the second target string that matches any second semantic in the second semantic set from the strings to be identified between the first target string and the third target string.
[0012] In this embodiment, the semantic template may further include a third semantic set. After determining the first target string corresponding to any first semantic in the first semantic set, the first third target string matching any third semantic in the third semantic set is determined from the remaining strings to be identified. The entire string to be identified is segmented using the first and third target strings to obtain a smaller search range. Then, a second target string matching any second semantic in the second semantic set is determined from the search range. That is, the text to be identified can be divided into multiple parts using each first target string and the first third target string that appears after each first target string. Then, the corresponding second semantic set string is determined from each part. This helps to improve the processing speed of the text to be identified to a certain extent, while reducing the difficulty of identifying the text, reducing workload and improving recognition accuracy.
[0013] Secondly, this application provides a speech recognition device, comprising: an acquisition module for acquiring text to be recognized; a segmentation module for segmenting the text to be recognized based on a preset semantic rule base to obtain multiple strings to be recognized; and a matching module for judging each string to be recognized based on a preset semantic template to determine the semantic recognition result corresponding to each string to be recognized, wherein the semantic template includes a first semantic set and a second semantic set, the first semantic set being used to determine a target question in the text to be recognized; and the second semantic set being used to determine a target answer corresponding to the target question.
[0014] In one embodiment, the device further includes an identification module, used to add a sequence identifier to each string according to the order in which the strings are generated before judging each string to be identified based on a preset semantic template.
[0015] In one embodiment, the matching module is further configured to: judge each string to be identified sequentially based on the sequential identifier of the string and a preset semantic rule base until a first target string corresponding to any first semantic in the first semantic set is determined; starting from the first target string, judge the unmatched strings to be identified sequentially according to the sequential identifier of the strings to be identified until the number of determined second target strings reaches a preset threshold, wherein the second target string matches a second semantic in the second semantic set; repeat the above steps until the judgment of the strings to be identified is completed.
[0016] In one embodiment, the matching module is further configured to: sequentially judge each string to be identified based on the sequential identifier of the string and a preset semantic rule base until a first target string corresponding to any first semantic in the first semantic set is determined; then determine the first third target string that matches any third semantic in the third semantic set from the remaining strings to be identified, wherein the semantic template further includes a third semantic set, which is used to limit the matching range of the second target string corresponding to each first target string; and determine the second target string that matches any second semantic in the second semantic set from the strings to be identified between the first target string and the third target string.
[0017] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor, the memory and the processor being connected; the memory being used to store a program; the processor being used to invoke the program stored in the memory to perform a method as described in the first aspect embodiments and / or in combination with any possible implementation of the first aspect embodiments.
[0018] Fourthly, embodiments of this application provide a storage medium having a computer program stored thereon, wherein the computer program, when run by a computer, performs a method as described in the first aspect embodiments and / or any possible implementation method in combination with the first aspect embodiments.
[0019] Details of one or more embodiments of this application are set forth in the following drawings and description. Other features, objects, and advantages of this application will become apparent from the specification, drawings, and claims. Attached Figure Description
[0020] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 A flowchart illustrating a text recognition method provided in an embodiment of this application;
[0022] Figure 2 A diagram illustrating a text recognition method provided in an embodiment of this application;
[0023] Figure 3 This is a structural block diagram of a text recognition device provided in an embodiment of this application;
[0024] Figure 4A diagram of an electronic device provided in an embodiment of this application.
[0025] Icons: Text recognition device 100; Acquisition module 10; Segmentation module 20; Identification module 30; Matching module 40. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0027] Please see Figure 1 , Figure 1 The flowchart below shows a text recognition method provided in an embodiment of this application. The text recognition method may include the following steps.
[0028] Step S11: Obtain the text to be recognized.
[0029] In this embodiment, the text to be identified is interactive text, such as call text or chat history in a chat tool.
[0030] In one embodiment, the text to be recognized can be obtained by performing speech recognition on a call recording and using the resulting speech-recognized text as the text to be recognized.
[0031] In another embodiment, the database itself stores the text to be recognized, and the text to be recognized can be obtained directly from the database.
[0032] Step S12: The text to be identified is segmented based on a preset semantic rule base to obtain multiple strings to be identified.
[0033] In one embodiment, the semantic rule base can be regular expressions, which are used to segment the text to be identified.
[0034] Specifically, regular expressions can be used to segment text based on preset symbols. Preset symbols include, but are not limited to, at least one of periods, exclamation marks, and question marks. Each character of the text to be recognized is identified. Whenever a preset symbol is recognized, the text to be recognized is segmented from the position of that preset symbol until the recognition of every character of the entire text to be recognized is completed, resulting in multiple strings to be recognized.
[0035] It is understandable that the text to be recognized may not contain preset symbols, but may include other symbols besides the preset symbols, such as semicolons, ellipses, newlines, etc., or the text to be recognized may lack or have no symbols. Therefore, to segment such text to be recognized, the semantic rule base can also set a cutting threshold for the corresponding characters of the string to be recognized. Whenever the cumulative number of characters recognized in the text to be recognized reaches the cutting threshold, the text to be recognized is segmented. For example, the cutting threshold can be set to 12. Whenever the cumulative number of characters recognized in the text to be recognized reaches 12, the text to be recognized is segmented, and the 12 recognized characters are automatically taken as a string to be recognized.
[0036] Of course, the text to be recognized can also be segmented using both of the above methods simultaneously. For example, if the cumulative number of characters recognized in the text reaches the segmentation threshold, but no preset symbol is recognized, then the text to be recognized is segmented based on the segmentation threshold for that iteration. If a preset symbol is recognized, but the cumulative number of recognized characters does not reach the segmentation threshold, then the text to be recognized is segmented based on a regular expression for that iteration. It should be noted that the string to be recognized is saved in the order of segmentation.
[0037] Step S13: Based on a preset semantic template, each string to be identified is judged to determine the semantic recognition result corresponding to each string to be identified. The semantic template includes a first semantic set and a second semantic set. The first semantic set is used to determine the target question in the text to be identified, and the second semantic set is used to determine the target answer corresponding to the target question.
[0038] In this embodiment, each string to be identified is judged sequentially according to the cutting order and based on a preset semantic template to determine the semantic recognition result corresponding to each string to be identified.
[0039] In one embodiment, a semantic template is pre-set and can be directly retrieved when needed. The semantic template includes a first semantic set and a second semantic set. The first semantic set includes multiple first semantics corresponding to questions. The second semantic set includes multiple second semantics corresponding to answers.
[0040] Furthermore, the semantic template can be set as a regular expression to judge each string to be recognized and determine the semantic recognition result corresponding to each string. For example, the first semantic can be set to "what is the job?" using a regular expression. When the recognized string to be recognized is "What is your job?", it is determined that the first semantic "what is the job?" exists in the string to be recognized. Therefore, the string to be recognized can be determined as the semantic recognition result of the target question in the text to be recognized.
[0041] It is understandable that by acquiring the text to be recognized and segmenting it, multiple strings to be recognized are obtained. By matching each string to be recognized with each first semantic in the first semantic set (e.g., similarity matching), the string corresponding to the question and the target question corresponding to that string are obtained from the multiple strings to be recognized. By matching each string to be recognized with each second semantic in the second semantic set (e.g., similarity matching), the string corresponding to the answer and the target answer corresponding to that string are obtained from the multiple strings to be recognized. Since the strings to be recognized are judged according to the segmentation order, whenever a target question corresponding to a string to be recognized is determined in the first semantic set, the target answer corresponding to any string to be recognized after that string is determined from the second semantic set. Thus, the machine model only needs to traverse the text to be recognized once to obtain the text information of multiple target questions and corresponding question answers, thereby improving the efficiency of text recognition.
[0042] In another embodiment, the semantic template can be a semantic model obtained by processing the model using a training set, a validation set, and a test set through machine learning. A first semantic set can be applied to a first sub-model for determining the question; a second semantic set can be applied to a second sub-model for determining the answer. Following the order of string segmentation, each string to be identified is input into the first sub-model to determine if it corresponds to a question. If it does, the corresponding target question is output. After the first sub-model outputs a target question, the strings following the one corresponding to that target question are sequentially input into the second sub-model (one string at a time) to determine if they correspond to an answer. If they do, the corresponding target answer is output, and so on, until all strings to be identified are judged.
[0043] Furthermore, the semantic model can be an NLP model.
[0044] For example, if the string to be identified is "What do you do for a living?", the first sub-model in the NLP model calculates the semantic similarity of the identified string and determines that the string to be identified is a question about occupation by matching it with the target question in the first semantic set. Then, it outputs the string to be identified as the semantic recognition result corresponding to the target question in the text to be identified.
[0045] Furthermore, semantic models can also include two categories: binary classification models and semantic similarity models.
[0046] Specifically, when the semantics of the string to be identified are determined to be equivalent to any semantics preset in the binary classification text library, the binary classification model outputs 1. At this time, the string to be identified can be output as the semantic recognition result corresponding to the target question in the text to be identified and / or the semantic recognition result of the target answer currently identified that corresponds to the target question in the text to be identified.
[0047] The semantic similarity model compares the string to be identified with any first semantic term in the first semantic set and / or any second semantic term in the second semantic set to determine whether the semantic similarity between the string to be identified and any first semantic term in the first semantic set and / or any second semantic term in the second semantic set exceeds a preset threshold. It can be understood that the semantic similarity output generally undergoes normalization, meaning the output semantic similarity value is within the range of [0, 1]. For example, a median value of 0.5 is chosen as the preset threshold. If the similarity threshold of the string to be identified is greater than or equal to 0.5, then the string to be identified is output as the semantic recognition result. It should be noted that the preset threshold can be set according to specific scenarios, which will not be elaborated further here.
[0048] Furthermore, semantic templates can be combined with logical operations for joint judgment to determine the semantic recognition result corresponding to each string to be recognized. That is, the NLP model and / or regular expression are connected through "AND" and "OR" logical operations to recognize the strings to be recognized and determine the semantic recognition result corresponding to each string.
[0049] For example, an NLP model can be connected to a regular expression by setting an AND logical operation to determine the semantic recognition result corresponding to each string to be recognized. That is, when the string to be recognized simultaneously conforms to the semantic recognition result defined by the NLP model and the semantic recognition result defined by the regular expression, the string to be recognized is determined to be the semantic recognition result.
[0050] It is understandable that by setting logical operations and semantic templates to jointly determine the semantic recognition result corresponding to each string to be recognized, the accuracy of determining the semantic recognition result can be improved to a certain extent.
[0051] In one embodiment, before judging each string to be recognized based on a preset semantic template in step S13, the text recognition method may further include: adding a sequence identifier to each string to be recognized according to the order in which each string appears in the text to be recognized.
[0052] In another embodiment, a sequence identifier can be added according to the generation timestamp corresponding to each string to be identified.
[0053] It is understandable that, since the determination of the target question and the target answer to the target question generally has a chronological order, by adding a sequence identifier to each string to be identified according to the order in which each string appears in the text to be identified before judging each string, and since the judgment result of the string to be identified corresponds to the string to be identified, it is easy to find the corresponding source of the obtained target question and the target answer to the target question in the text to be identified, which facilitates the subsequent verification of the correctness of the semantic recognition result.
[0054] In one embodiment, step S13, which involves judging each string to be identified based on a preset semantic template and determining the semantic recognition result corresponding to each string to be identified, may further include: judging each string to be identified sequentially based on the sequence identifier of the string and a preset semantic rule base until a first target string corresponding to any first semantic in the first semantic set is determined; starting from the first target string, judging the undetermined strings to be identified sequentially according to the sequence identifier of the strings to be identified until the number of determined second target strings reaches a preset threshold, wherein the second target string matches a second semantic in the second semantic set; repeating the above steps until the judgment of the strings to be identified is completed.
[0055] It is understandable that by using the sequential identifier of the strings and the preset semantic rule base, each string to be identified is judged in turn to obtain the first target string corresponding to any first semantic in the first semantic set. Then, starting from the first target string, the judgment is continued on the undetermined strings to be identified until the number of second target strings corresponding to any second semantic in the second semantic set is obtained. This allows a target question to have multiple target answers, which improves the accuracy of the target answer to the target question to a certain extent.
[0056] Furthermore, when the judgment of the last target string of the text to be recognized is completed, but the number of second target strings has not reached the preset threshold, the judgment of the target string can be terminated.
[0057] It's understandable that machine recognition errors can easily occur when all the strings to be recognized have been evaluated, but the number of the second target strings hasn't yet reached the preset threshold. Therefore, the stability of the machine model's recognition can be improved to some extent by setting the evaluation of the last string to be recognized to end after evaluating the last string of the text to be recognized.
[0058] In one embodiment, the semantic template may further include a third semantic set, which is used to limit the judgment range of the second target string corresponding to each first target string. After judging each string to be identified sequentially based on the sequential identifier of the string and a preset semantic rule base until the first target string corresponding to any first semantic in the first semantic set is determined, the method further includes: determining the first third target string that matches any third semantic in the third semantic set from the remaining strings to be identified; and determining the second target string that matches any second semantic in the second semantic set from the strings to be identified between the first target string and the third target string.
[0059] Furthermore, multiple third semantic sets can be obtained until the number of determined third target strings reaches a preset threshold.
[0060] For example, please refer to Figure 2 , Figure 2 This is a semantic recognition demonstration diagram provided in an embodiment of this application. S is the string to be recognized, S1-S9 are the generation order of each string to be recognized, X indicates failure, P represents the first target string, I represents the second target string, E represents the third target string, and the preset threshold corresponding to the number of times the third target string is determined is set to 2.
[0061] First, the first target string is identified from the remaining strings to be identified. If S1 fails, S2 is identified as the first target string. Next, the third target string is identified from the remaining strings to be identified. If S3 fails, S4 fails, S5 succeeds, and the count of the third target string is recorded as 1. If S6 succeeds, the count of the third target string is recorded as 2. At this point, the preset threshold corresponding to the count of the third target string is met, and the identification of the third target string stops. Further, the second target string is identified between S2 and S6; that is, the second target string is identified from S2 to S6. Finally, S4 is identified as the second target string.
[0062] It's understandable that the second target string may not exist in S2 to S6. Therefore, when determining the second target string in S2 to S6, we can start from S7 and continue determining the first target string.
[0063] Furthermore, the steps of determining the second target string and determining the first target string can be performed simultaneously. That is, while determining the second target string in steps S2 to S6, it is simultaneously determined in step S7 whether it belongs to the first target string. By simultaneously determining the second target string and the first target string, the efficiency of text recognition can be effectively improved.
[0064] It is understandable that the semantic template can also include a third semantic set. After determining the first target string corresponding to any first semantic in the first semantic set, the first third target string that matches any third semantic in the third semantic set is determined from the remaining strings to be recognized. The entire string to be recognized is then segmented using the first and third target strings to obtain a smaller search range. The second target string that matches any second semantic in the second semantic set is then determined from this search range. In other words, the text to be recognized can be divided into multiple parts using each first target string and the first third target string that appears after each first target string. Then, the corresponding second semantic set strings are determined from each part. This approach helps to improve the processing speed of the text to be recognized to some extent, while reducing the difficulty of recognizing the text, reducing workload, and improving recognition accuracy.
[0065] Please see Figure 3 Based on the same inventive concept, this application also provides a text recognition device 100, which includes: an acquisition module 10, a segmentation module 20, and a matching module 40.
[0066] Module 10 is used to acquire the text to be recognized.
[0067] The segmentation module 20 is used to segment the text to be identified based on a preset semantic rule library to obtain multiple strings to be identified.
[0068] The matching module 40 is used to judge each string to be identified based on a preset semantic template and determine the semantic recognition result corresponding to each string to be identified. The semantic template includes a first semantic set and a second semantic set. The first semantic set is used to determine the target question in the text to be identified, and the second semantic set is used to determine the target answer corresponding to the target question.
[0069] In this embodiment of the application, the text recognition device 100 further includes an identification module 30.
[0070] The identification module 30 is used to add a sequence identifier to each string according to the order in which the strings are generated before judging each string to be identified based on a preset semantic template.
[0071] In this embodiment, the matching module 40 is further configured to: judge each string to be identified sequentially based on the sequential identifier of the string and a preset semantic rule base until a first target string corresponding to any first semantic in the first semantic set is determined; starting from the first target string, judge the unmatched strings to be identified sequentially according to the sequential identifier of the strings to be identified until the number of determined second target strings reaches a preset threshold, wherein the second target string matches a second semantic in the second semantic set; repeat the above steps until the judgment of the strings to be identified is completed.
[0072] In this embodiment, the matching module 40 is further configured to: sequentially judge each string to be identified based on the sequential identifier of the string and a preset semantic rule base until a first target string corresponding to any first semantic in the first semantic set is determined; then determine the first third target string that matches any third semantic in the third semantic set from the remaining strings to be identified, wherein the semantic template further includes a third semantic set, which is used to limit the matching range of the second target string corresponding to each first target string; and determine the second target string that matches any second semantic in the second semantic set from the strings to be identified between the first target string and the third target string.
[0073] It is understood that the text recognition device 100 provided in this application corresponds to the text recognition method provided in this application. In order to keep the specification concise, the same or similar parts can be referred to the content of the text recognition method section, and will not be repeated here.
[0074] Each module in the aforementioned text recognition device 100 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the server, or stored in the server's memory as software, so that the processor can call and execute the operations corresponding to each module. The processor can be a central processing unit (CPU), a microprocessor, a microcontroller, etc.
[0075] The aforementioned text recognition method and / or text recognition device 100 can be implemented as a computer-readable instruction, which can be implemented in the form of, for example, Figure 4 It runs on the electronic device shown.
[0076] This application also provides an electronic device, including a memory, a processor, and computer-readable instructions stored in the memory and executable on the processor. When the processor executes the program, it implements the text recognition method described above.
[0077] Figure 4This is a schematic diagram of the internal structure of an electronic device according to an embodiment of this application. The electronic device may be a server. Please refer to... Figure 4 The electronic device includes a processor, a non-volatile storage medium, internal memory, an input device, a display screen, and a network interface connected via a system bus. The non-volatile storage medium can store an operating system and computer-readable instructions. When these computer-readable instructions are executed, they cause the processor to perform a text recognition method according to various embodiments of this application. The specific implementation process of this method can be found in [reference needed]. Figure 1 The specific details will not be elaborated here. The processor of this electronic device provides computing and control capabilities, supporting the operation of the entire electronic device. The internal memory can store computer-readable instructions, which, when executed by the processor, cause the processor to perform a text recognition method. The input device of the electronic device is used for inputting various parameters, the display screen of the electronic device is used for display, and the network interface of the electronic device is used for network communication. Those skilled in the art will understand that... Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0078] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium storing computer-readable instructions, which, when executed by a processor, implement the steps in the above-described text recognition method.
[0079] Any references to memory, storage, databases, or other media used herein may include non-volatile memory. Suitable non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
[0080] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0081] Furthermore, 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.
[0082] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0083] In this document, relational terms such as first and second are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0084] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A text recognition method, characterized in that, include: Obtain the text to be recognized; The text to be identified is segmented based on a preset semantic rule base to obtain multiple strings to be identified; Based on a preset semantic template, each string to be identified is judged to determine the semantic recognition result corresponding to each string to be identified. The semantic template includes a first semantic set and a second semantic set. The first semantic set is used to determine the target question in the text to be identified, and the second semantic set is used to determine the target answer corresponding to the target question. The semantic template further includes a third semantic set, which is used to limit the judgment range of the second target string corresponding to each first target string; based on the preset semantic template, each string to be identified is judged to determine the semantic recognition result corresponding to each string to be identified, including: Based on the sequential identifier of the strings and the preset semantic rule library, each string to be identified is judged in turn until the first target string corresponding to any first semantic in the first semantic set is determined. Starting from the first target string, according to the sequential identification of the strings to be identified, determine the third target string that matches any third semantic in the third semantic set from the remaining strings to be identified; When the number of the third target strings reaches a preset threshold, a second target string that matches any second semantic in the second semantic set is determined from the strings to be identified between the first target string and the last third target string, until the number of determined second target strings reaches the preset threshold, wherein the second target string matches a second semantic in the second semantic set.
2. The text recognition method as described in claim 1, characterized in that, Before judging each string to be identified based on a preset semantic template, the method includes: Add a sequence identifier to each string to be identified according to the order in which they appear in the call log.
3. A text recognition device, characterized in that, include: The acquisition module is used to acquire the text to be recognized; The segmentation module is used to segment the text to be identified based on a preset semantic rule library to obtain multiple strings to be identified; The matching module is used to judge each string to be identified based on a preset semantic template, and determine the semantic recognition result corresponding to each string to be identified. The semantic template includes a first semantic set and a second semantic set. The first semantic set is used to determine the target question in the text to be identified; the second semantic set is used to determine the target answer corresponding to the target question. The semantic template further includes a third semantic set, which is used to limit the judgment range of the second target string corresponding to each first target string. The matching module is further used to judge each string to be identified based on the preset semantic template in the following ways to determine the semantic recognition result corresponding to each string to be identified: judging each string to be identified sequentially based on the order identifier of the string and the preset semantic rule base until a first target string corresponding to any first semantic in the first semantic set is determined; starting from the first target string, according to the order identifier of the strings to be identified, determining the third target string that matches any third semantic in the third semantic set from the remaining strings to be identified; when the number of third target strings reaches a preset threshold, determining the second target string that matches any second semantic in the second semantic set from the strings to be identified between the first target string and the last third target string, until the number of determined second target strings reaches a preset threshold, wherein the second target string matches a second semantic in the second semantic set.
4. The text recognition device as described in claim 3, characterized in that, The device further includes: The identification module is used to add a sequence identifier to each string according to the order in which the strings are generated before judging each string to be identified based on a preset semantic template.
5. An electronic device, characterized in that, It includes a memory and a processor, wherein the memory stores computer-readable instructions, which, when executed by the processor, cause the processor to perform the text recognition method as described in claim 1 or 2 or to implement the function of the text recognition device as described in claim 3 or 4.
6. A non-volatile readable storage medium storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by the processor, the processor performs the text recognition method as described in claim 1 or 2, or implements the function of the text recognition device as described in claim 3 or 4.
Citation Information
Patent Citations
Text processing method and device, equipment and storage medium
CN112613322A