Text extraction method and device, computer equipment and storage medium
By encoding and partitioning the multilingual business information text by preset encoding rules, text features are generated and input into the multilingual text recognition model for identification, the problems of low efficiency and high error rate in multilingual text processing are solved. , achieving more efficient and accurate text content extraction.
Patent Information
- Application Number
- CN202411551641.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-07
AI Technical Summary
When traditional text recognition models process multilingual business information text, there are problems such as low text processing efficiency and content extraction errors.
By obtaining the original text of multilinguals, encoding it using preset encoding rules common to multilinguals, the encoded text is obtained and divided into multiple sub-encoded texts. Then, each sub-encoded text is characterized, and generated text features, and input it into the trained multilingual text recognition model for text recognition, and output the recognition text. Finally, the target text is extracted according to the text category of the identified text.
It improves the efficiency and accuracy of multilingual text content extraction, and reduces the steps of text filtering and text filtering on multilingual text.
Smart Images

Figure CN119398041A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a text extraction method, apparatus, computer equipment and storage medium. Background Art
[0002] With the rapid advancement of the Internet and the rapid development of global finance and commerce, business information texts have shown explosive growth. It is necessary to extract the important content from different business information texts and then present these important contents to investors.
[0003] As the number of languages involved in commercial information texts increases, it is necessary to build an entity recognition solution that supports multiple languages. In the related art, the text corresponding to the commercial information is preprocessed, and then the processed text is input into a traditional text recognition model for content extraction, and finally the corresponding content extraction results are output. However, when the commercial information text is multilingual, the traditional text recognition model has low text processing efficiency and may also make errors in the content extraction of the commercial information text. Summary of the invention
[0004] The embodiments of the present application provide a text extraction method, apparatus, computer device and storage medium, which can improve the efficiency and accuracy of extracting multilingual text content.
[0005] To achieve the above object, a first aspect of an embodiment of the present application proposes a text extraction method, the method comprising:
[0006] Acquire original texts in multiple languages, and encode the original texts using preset encoding rules common to the multiple languages to obtain encoded texts;
[0007] Dividing the coded text to obtain a plurality of sub-coded texts;
[0008] Performing feature encoding on each sub-encoded text to generate text features corresponding to each sub-encoded text;
[0009] Inputting each text feature into a trained multilingual text recognition model for text recognition, and outputting a plurality of recognized texts, wherein the trained multilingual text recognition model is trained based on the multilingual training text under the preset encoding rule;
[0010] The text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category.
[0011] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides a text extraction device, the device comprising:
[0012] An acquisition module is used to acquire original texts in multiple languages and encode the original texts according to preset encoding rules common to multiple languages to obtain encoded texts;
[0013] A division module, used for dividing the coded text to obtain a plurality of sub-coded texts;
[0014] An encoding module, used for performing feature encoding on each sub-encoded text to generate text features corresponding to each sub-encoded text;
[0015] A recognition module, used for inputting each text feature into a trained multilingual text recognition model for text recognition, and outputting a plurality of recognized texts, wherein the trained multilingual text recognition model is trained based on the multilingual training text under the preset encoding rule;
[0016] The extraction module is used to determine the text category corresponding to each recognized text, and extract the target text from each recognized text according to the text category.
[0017] In some embodiments, a partitioning module is used to determine a specific coded character corresponding to a specific character in the coded text;
[0018] The coded text is divided according to the specific coded characters to obtain a plurality of sub-coded texts.
[0019] In some embodiments, the recognition module includes a position encoding submodule and a recognition submodule;
[0020] A position coding submodule, used for determining a corresponding position coding for each text feature, and combining each text feature with the position coding corresponding to each text feature to generate a target text feature corresponding to each text feature;
[0021] The recognition submodule is used to input each target text feature into the trained multilingual text recognition model for text recognition and output multiple recognized texts.
[0022] In some embodiments, the position encoding submodule is used to determine the arrangement order of the sub-encoded text corresponding to each text feature in the encoded text;
[0023] Forward encoding each of the text features according to the arrangement order to obtain a first position code;
[0024] Reversely encode each of the text features according to the arrangement order to obtain a second position code;
[0025] Each text feature, the first position code corresponding to each text feature, and the second position code are combined to generate a target text feature corresponding to each text feature.
[0026] In some embodiments, the trained multilingual text recognition model includes a trained encoding model and a trained decoding model, the trained encoding model includes a plurality of trained sub-encoding models, the trained decoding model includes a plurality of trained sub-decoding models, and the number of the sub-encoding models is greater than the number of the sub-decoding models;
[0027] A recognition submodule, used for inputting each target text feature into the trained encoding model, and outputting an attention feature corresponding to each target text feature;
[0028] The attention feature corresponding to each target text feature is input into the trained decoding model, and the recognition text corresponding to the target text feature is output.
[0029] In some embodiments, the recognition submodule is used to input each target text feature into the first sub-encoding model to obtain a sub-attention feature output by the first sub-encoding model;
[0030] Inputting the sub-attention feature output by the first sub-encoding model into the next sub-encoding model to obtain the sub-attention feature output by the next sub-encoding model;
[0031] Repeat the input of the sub-attention features output by the previous sub-encoding model into the next sub-encoding model until the last sub-encoding model outputs the attention features corresponding to each target text feature.
[0032] In some implementations, the identification submodule is used to obtain a task text and a task text feature corresponding to the task text;
[0033] The task text feature and each attention feature are input into the trained decoding model, and the recognition text corresponding to the target text feature is output.
[0034] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes a computer-readable storage medium, which stores a plurality of instructions suitable for loading by a processor to execute the text extraction method provided in the embodiment of the present application.
[0035] To achieve the above-mentioned purpose, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the text extraction method of the embodiment of the present application when executing the computer program.
[0036] The text extraction method, device, computer equipment and storage medium proposed in the present application obtain original texts in multiple languages, and encode the original texts according to preset encoding rules common to multiple languages to obtain encoded texts; divide the encoded texts to obtain multiple sub-encoded texts; feature encode each sub-encoded text to generate text features corresponding to each sub-encoded text; input each text feature into a trained multilingual text recognition model for text recognition, and output multiple recognized texts, wherein the trained multilingual text recognition model is trained based on multilingual training texts under preset encoding rules; determine the text category corresponding to each recognized text, and extract the target text from each recognized text according to the text category. In this way, the original text of multiple languages is encoded by a preset encoding rule common to multiple languages to obtain an encoded text, and then the encoded text is divided into multiple sub-encoded texts. Since the encoded text is generated based on the preset encoding rule, the sub-encoded text has uniformity, and then the text features of each sub-encoded text are generated, and finally input into the trained multilingual recognition model for recognition, thereby outputting multiple recognized texts. Compared with the related art of directly extracting text content from multilingual texts through traditional text recognition models, the present application adopts preset encoding rules to unify multiple languages, and reduces the steps of text screening and text filtering for multilingual texts, which is conducive to improving the efficiency and accuracy of the multilingual text content extraction by the trained multilingual text recognition model. After that, the text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category. In this way, the target text is further extracted according to the text category of the recognized text, which can further improve the efficiency and accuracy of multilingual text content extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 is a scenario diagram of the text extraction method provided in an embodiment of the present application;
[0038] Figure 2 It is a flowchart of the text extraction method provided in the embodiment of the present application;
[0039] Figure 3 is a schematic diagram of the structure of a trained multilingual text recognition model provided in an embodiment of the present application;
[0040] Figure 4 is another flowchart of the text extraction method provided in an embodiment of the present application;
[0041] Figure 5 is a structural schematic diagram of a text extraction device provided in an embodiment of the present application;
[0042] Figure 6 It is a schematic diagram of the hardware structure of the computer device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0044] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0045] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0046] First, some nouns involved in this application are analyzed:
[0047] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0048] Natural language processing (NLP): NLP uses computers to process, understand and apply human languages (such as Chinese, English, etc.). NLP is a branch of artificial intelligence and an interdisciplinary subject between computer science and linguistics. It is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text understanding. Natural language processing is often used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information intent recognition, information extraction and filtering, text classification and clustering, public opinion analysis and opinion mining. It involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.
[0049] Information Extraction: A text processing technology that extracts specified types of entity, relationship, event and other factual information from natural language text and forms structured data output. Information extraction is a technology that extracts specific information from text data. Text data is composed of some specific units, such as sentences, paragraphs, and chapters. Text information is composed of some small specific units, such as characters, words, phrases, sentences, paragraphs, or a combination of these specific units. Extracting noun phrases, names, place names, etc. from text data are all text information extraction. Of course, the information extracted by text information extraction technology can be various types of information.
[0050] Self-Attention Mechanism: The self-attention mechanism mainly allows the model to learn to pay attention to information at different locations within itself, thereby automatically assigning different importance weights to different parts. Unlike traditional attention mechanisms, the self-attention mechanism does not rely on external information sources, but calculates attention weights entirely based on the input data itself. The application of the self-attention mechanism in text is mainly to improve the accuracy and richness of text representation by capturing the dependencies between words in the text. The self-attention mechanism can better handle long-distance dependencies and can automatically learn important information in the text, thereby improving the quality and effect of representation.
[0051] Secondly, describe the technical problems existing in related technologies:
[0052] With the rapid advancement of the Internet and the rapid development of global finance and commerce, business information texts have shown explosive growth. It is necessary to extract the important content from different business information texts and then present these important contents to investors.
[0053] As the number of languages involved in commercial information texts increases, it is necessary to build an entity recognition solution that supports multiple languages. In the related art, the text corresponding to the commercial information is preprocessed, and then the processed text is input into a traditional text recognition model for content extraction, and finally the corresponding content extraction results are output. However, when the commercial information text is multilingual, the traditional text recognition model has low text processing efficiency and may also make errors in the content extraction of the commercial information text.
[0054] In order to solve the above technical problems, in the present application, a coded text is obtained by encoding the original text of multiple languages according to a preset coding rule common to multiple languages, and then the coded text is divided into multiple sub-coded texts. Since the coded text is generated based on the preset coding rule, the sub-coded text has uniformity, and then the text features of each sub-coded text are generated, and finally the text features are input into the trained multilingual recognition model for recognition, thereby outputting multiple recognized texts, which is conducive to improving the efficiency and accuracy of the trained multilingual text recognition model in extracting multilingual text content. After that, the text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category. In this way, the target text can be further extracted according to the text category of the recognized text, which can further improve the efficiency and accuracy of multilingual text content extraction.
[0055] Specifically, the embodiments of the present application provide a text extraction method, apparatus, computer device and storage medium, which can improve the efficiency and accuracy of extracting multilingual text content.
[0056] See also Figure 1 , Figure 1 Schematic diagram of the text extraction method provided in the embodiment of the present application. The schematic diagram of the scene can be used to roughly understand the text extraction method in the embodiment of the present application.
[0057] In multilingual original texts, there may be texts in multiple languages, such as Chinese text, English text, French text, etc. When traditional text recognition models encounter such multilingual original texts, due to the differences between the texts caused by different languages, traditional text recognition models will have problems such as text recognition errors and inaccurate text recognition.
[0058] In this application, a preset encoding rule common to multiple languages is adopted to encode the original text of multiple languages to obtain the encoded text, for example, the internationally used UTF-8 encoding rule is adopted. UTF-8 (8 bits, Universal Character Set / Unicode Transformation Format) is a variable-length character encoding for Unicode. It can be used to represent any character in the Unicode standard, and the first byte in its encoding is still compatible with ASCII, so that the software that originally processed ASCII characters can continue to be used without or with only a few modifications. Therefore, this encoding rule achieves perfect support for multiple languages by using different lengths of encoding representations for Unicode characters in different ranges.
[0059] Then the coded text is divided to obtain multiple sub-coded texts. It can be understood that the coded text is composed of character strings, and different character strings represent different language meanings, so the coded text needs to be divided, and the division rules are also very simple. For example, the coded text can be divided according to the characters corresponding to special symbols such as periods, commas or spaces, thereby obtaining multiple sub-coded texts.
[0060] Then, feature encoding is performed on each sub-coded text to obtain the text features corresponding to each sub-coded text. For example, simple hash encoding can be performed to assign a random vector of fixed length to each possible byte value. For each given sub-coded text, it is actually a byte sequence under the preset encoding rules. The vectors corresponding to each byte are concatenated to form the final vector representation, that is, the text features corresponding to each sub-coded text are obtained.
[0061] After obtaining the text features corresponding to each sub-encoded text, the text features corresponding to each sub-encoded text can be input into the trained multilingual text recognition model, and the trained multilingual text recognition model can perform data processing on multiple text features, thereby outputting corresponding multiple recognition texts. It should be noted that the trained multilingual text recognition model is obtained by training based on multilingual training texts under preset encoding rules, so the trained multilingual text recognition model has the ability to extract content from the encoded text under the preset encoding rules, thereby extracting the corresponding recognition text.
[0062] After obtaining multiple recognized texts, the text category corresponding to each recognized text can be determined, and then the content of each recognized text can be extracted based on the text category to obtain the target text. The target text is similar to the summary text after summarizing the recognized text, which is equivalent to summarizing the main meaning of the recognized text with a paragraph of text content.
[0063] It should be noted that the original multilingual text in this application can be a variety of types of texts, such as business journals, scientific reports, geography and humanities and other types of texts. When the original multilingual text is a business journal type text, the trained multilingual text recognition model in this application can extract important business information therein to provide investors with business information in other languages. That is, the trained multilingual text recognition model can realize information extraction of business texts.
[0064] As can be seen from the above, in the present application, the original text of multiple languages is encoded by a preset encoding rule common to multiple languages to obtain an encoded text, and then the encoded text is divided into multiple sub-encoded texts. Since the encoded text is generated based on the preset encoding rule, the sub-encoded text has uniformity, and then the text features of each sub-encoded text are generated, and finally input into the trained multilingual recognition model for recognition, thereby outputting multiple recognized texts. Compared with the related art of directly extracting the text content in the multilingual text through the traditional text recognition model, the present application adopts a preset encoding rule to unify the multiple languages, and reduces the steps of text screening and text filtering of the multilingual text, which is conducive to improving the efficiency and accuracy of the multilingual text content extraction of the trained multilingual text recognition model. After that, the text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category. In this way, the target text is further extracted according to the text category of the recognized text, which can further improve the efficiency and accuracy of the multilingual text content extraction.
[0065] The text extraction method, apparatus, computer device and storage medium provided in the embodiments of the present application are specifically described through the following embodiments. First, the text extraction method in the embodiments of the present application is described.
[0066] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0067] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0068] The text extraction method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The text extraction method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the text extraction method, etc., but is not limited to the above forms.
[0069] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer computer devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0070] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on the user's text data, the user's permission or consent will be obtained first, and the collection, use and processing of these data will comply with relevant laws, regulations and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or jump to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0071] See also Figure 2 , Figure 2 : is a flowchart of a text extraction method provided in an embodiment of the present application. The text extraction method may include the following steps:
[0072] Step 110: obtaining original texts in multiple languages, and encoding the original texts using preset encoding rules common to the multiple languages to obtain encoded texts;
[0073] Step 120, dividing the coded text to obtain a plurality of sub-coded texts;
[0074] Step 130: feature encode each sub-encoded text to generate text features corresponding to each sub-encoded text;
[0075] Step 140: input each text feature into a trained multilingual text recognition model to perform text recognition, and output a plurality of recognized texts, wherein the trained multilingual text recognition model is obtained based on multilingual training texts under a preset encoding rule;
[0076] Step 140: determine the text category corresponding to each recognized text, and extract the target text from each recognized text according to the text category.
[0077] Steps 110 to 140 will be described in detail below.
[0078] In step 110, original texts in multiple languages are obtained, and the original texts are encoded using preset encoding rules common to multiple languages to obtain encoded texts.
[0079] The multilingual original text can be various types of texts, such as business journals, scientific reports, geography and humanities, etc. The original text contains texts in different languages, such as Chinese text, English text, French text, etc.
[0080] In this application, a preset encoding rule common to multiple languages is adopted to encode the original text of multiple languages to obtain the encoded text, for example, the internationally used UTF-8 encoding rule is adopted. UTF-8 (8 bits, Universal Character Set / Unicode Transformation Format) is a variable-length character encoding for Unicode. It can be used to represent any character in the Unicode standard, and the first byte in its encoding is still compatible with ASCII, so that the software that originally processed ASCII characters can continue to be used without or with only a few modifications. Therefore, this encoding rule achieves perfect support for multiple languages by using different lengths of encoding representations for Unicode characters in different ranges.
[0081] For example, take the English text "life" as an example. The encoded text of "Life" under the UTF-8 encoding rule is: 4C69 66 65. They correspond to the hexadecimal encodings of "L", "i", "f" and "e" respectively. The encoded text is a byte sequence.
[0082] Similarly, all texts in the original texts in multiple languages can be encoded by preset encoding rules, thereby obtaining corresponding encoded texts.
[0083] In step 120, the encoded text is divided into multiple sub-encoded texts.
[0084] It is understandable that the encoded text is composed of different strings, and different strings represent different language meanings, so the encoded text needs to be divided, and longer strings are divided into strings of a certain length. This is conducive to the data processing of the subsequent trained multilingual text recognition model and can improve the data processing efficiency of the trained multilingual text recognition model.
[0085] In some implementations, the coded text is divided to obtain a plurality of sub-coded texts, including:
[0086] (1.1) determining in the coded text the specific coded character corresponding to the specific character;
[0087] (1.2) The coded text is divided according to specific coded characters to obtain multiple sub-coded texts.
[0088] Among them, the encoded text contains some specific encoding characters, such as period, comma or space, etc. The specific characters play the role of sentence segmentation, quotation, annotation, etc. of the text. These specific characters have corresponding specific encoding characters under the preset encoding rules. Therefore, the specific encoding characters corresponding to the specific characters can be determined in the encoded text, and then the encoded text can be divided according to the specific encoding characters to obtain multiple sub-encoded texts.
[0089] For example, the coded text corresponding to the English text "Life Is Great" is "4C 69 66 65 20 49 732047 72 65 61 74", where the space character is used to separate the three English words. The specific coding character corresponding to the space character is "20". The coded text can be divided according to 20 to obtain the sub-coded text "4C696665", which corresponds to the English text "Life", and the sub-coded text "4973204772656174", which corresponds to the English text "Is Great".
[0090] Through the above method, the encoded text can be divided to obtain multiple sub-encoded texts.
[0091] It should be noted that the above is only one way to divide the coded text. The coded text can also be divided by character length. For example, the maximum character length of a sub-coded text is N. It can also be divided according to semantic units. If there are pre-defined byte patterns corresponding to semantic units, it can be divided according to these patterns. For example, for texts in a specific field, there may be some specific terms or phrases with fixed byte patterns, which can be used as a separate sub-coded text. Each sub-coded text corresponds to a token.
[0092] In step 130, feature encoding is performed on each sub-coded text to generate text features corresponding to each sub-coded text.
[0093] Among them, each sub-coded text corresponds to a character string, and each sub-coded text needs to be encoded to generate a machine language that can be understood by the trained multilingual text recognition model, such as generating a corresponding vector, which is the text feature corresponding to the sub-coded text.
[0094] For example, simple hash coding can be performed to assign a random vector of fixed length to each possible byte value. For each given sub-encoded text, which is actually a byte sequence under the preset encoding rules, the vectors corresponding to each byte are concatenated to form the final vector representation, that is, the text features corresponding to each sub-encoded text are obtained.
[0095] For another example, a byte embedding model pre-trained on large-scale text data is used, which maps each byte to a low-dimensional vector space. For a given sub-encoded text, the embedding vectors corresponding to each byte are concatenated or averaged to obtain the final vector representation. Specifically, the byte embedding model can be trained using a method similar to Word2Vec or GloVe, and then each byte in the input byte sequence is converted into a corresponding embedding vector. If the byte sequence is "4C696665" ("Life"), the vector of each byte is obtained by looking up the embedding table, and then appropriate combination operations are performed to obtain the final vector.
[0096] For example, neural networks, such as convolutional neural networks (CNN) or recurrent neural networks (RNN), are used to encode byte sequences. The byte sequence is taken as input, processed through layers of the network, and a fixed-length vector is obtained as output. Specifically, a one-dimensional convolutional neural network is used, in which the convolution layer can learn the local patterns in the byte sequence, the pooling layer can aggregate these patterns, and finally a vector representation is obtained through the fully connected layer. Or a recurrent neural network, such as a long short-term memory network (LSTM) or a gated recurrent unit (GRU), is used to process the bytes in the byte sequence one by one, and the hidden state of the last time step is used as a vector representation.
[0097] After encoding each sub-coded text, the text features corresponding to each sub-coded text are obtained.
[0098] In step 140, each text feature is input into a trained multilingual text recognition model for text recognition, and a plurality of recognized texts are output. The trained multilingual text recognition model is trained based on multilingual training texts under preset encoding rules.
[0099] Please also read Figure 3 , Figure 3 It is a schematic diagram of the structure of the trained multilingual text recognition model provided in the embodiment of the present application.
[0100] First, the trained multilingual encoding model provided in this application is introduced. The trained multilingual encoding model includes two parts: a trained encoding model and a trained decoding model. The input of the trained encoding model is text features, and then the trained encoding model inputs the output attention features into the trained decoding model, and the trained decoding model outputs the recognized text.
[0101] Among them, the trained encoding model includes multiple sub-encoding models, the trained decoding model includes multiple sub-decoding models, and the number of sub-encoding models is greater than the number of sub-decoding models. This is because the encoded text generated after the original text of multiple languages is encoded according to the preset encoding rules has more characters than the original text. The trained encoding model has a heavier task in subsequent processing, and it is necessary to extract the relationship between different text features to generate the attention features corresponding to the text features. Therefore, there are more sub-encoding models in the trained encoding model. The main task of the trained decoding model is to decode the features output by the encoding model. The task is lighter than that of the encoding model, so the number of sub-decoding models in the trained decoding model is relatively small.
[0102] like Figure 3 As shown, in this application, each text feature is input into the first sub-encoding model, the output of the first sub-encoding model is the input of the second sub-encoding model, the output of the second sub-encoding model is the input of the third sub-encoding model, and so on. In the trained encoding model, except for the first sub-encoding model, in other sub-encoding models, the output of the previous sub-encoding model is the input of the next sub-encoding model. Each sub-encoding model contains an attention module, which adopts a self-attention mechanism to obtain attention features between different text features, and the last sub-encoding model outputs the attention feature.
[0103] In the decoding model, the input of the first sub-decoding model is the attention feature and the task text feature, the input of the second sub-decoding model is the output of the first sub-decoding model and the attention feature, the input of the third sub-decoding model is the output of the second sub-decoding model and the attention feature, and so on. In the trained decoding model, except for the first sub-decoding model, in other sub-decoding models, the output of the previous sub-decoding model is used as the input of the next sub-decoding model. The last sub-decoding model outputs the target attention feature between the task text feature and the text feature, and finally the corresponding recognition text can be determined according to the target attention feature.
[0104] In some implementations, each text feature is input into a trained multilingual text recognition model for text recognition, and a plurality of recognized texts are output, including:
[0105] (1.1) Determine a corresponding position code for each text feature, and combine each text feature with the position code corresponding to each text feature to generate a target text feature corresponding to each text feature;
[0106] (1.2) Input each target text feature into the trained multilingual text recognition model for text recognition, and output multiple recognized texts.
[0107] It is understandable that in the trained multilingual text recognition model, the trained encoding model is mainly based on the self-attention mechanism, which does not naturally consider the position order of words in the input sequence during the calculation process. The self-attention mechanism treats words equally regardless of their position in the sequence. However, in natural language processing tasks, the order of words is crucial to understanding the semantics of a sentence. For example, "I love you" and "You love me", the same three words have completely different meanings due to their different positions. Therefore, position encoding needs to be introduced to provide the model with position information so that the model can better understand and process the sequential nature of language.
[0108] Therefore, it is necessary to determine the corresponding position code for each text feature, and combine each text feature with the position code corresponding to each text feature to generate the target text feature corresponding to each text feature. For example, absolute position coding can be used, such as using sine and cosine position coding to position code each text feature. This coding method can provide different position information for words in different positions, and has a certain relative position relationship. For example, words in close positions will also have certain similarities in position coding.
[0109] In some implementations, determining a corresponding position code for each text feature includes:
[0110] (1.1.1) Determine the order of the sub-coded texts corresponding to each text feature in the coded text;
[0111] (1.1.2) Forward encode each text feature according to the arrangement order to obtain the first position code;
[0112] (1.1.3) Reverse encode each text feature according to the arrangement order to obtain the second position code.
[0113] Among them, the sub-encoded text corresponding to the text feature has a certain arrangement order in the encoded text, such as an arrangement order from left to right. Each text feature can be forward encoded according to the arrangement order to obtain the first position code. For example, each text feature is forward encoded in turn from left to right to obtain the first position code.
[0114] Then, each text feature is reversely encoded according to the arrangement order, for example, each text feature is reversely encoded from right to left to obtain a second position code.
[0115] Finally, each text feature, the first position code corresponding to each text feature, and the second position code are combined to generate the target text feature corresponding to each text feature. For example, if each text feature, the first position code corresponding to each text feature, and the second position code corresponding to each text feature are both vectors, each text feature, the first position code corresponding to each text feature, and the second position code corresponding to each text feature can be concatenated to obtain a new vector, which is the target text feature.
[0116] The advantage of doing this is that the attention relationship between text features can be obtained from both forward and reverse sequences, so that the attention relationship between different text features can be more deeply explored, making the attention features output by the trained encoding model more accurate.
[0117] Each target text feature is then input into the trained multilingual text recognition model for text recognition, and multiple recognized texts are output.
[0118] In some implementations, each target text feature is input into a trained multilingual text recognition model for text recognition, and a plurality of recognized texts are output, including:
[0119] (1.2.1) Input each target text feature into the trained encoding model and output the attention feature corresponding to each target text feature;
[0120] (1.2.1) Input the attention feature corresponding to each target text feature into the trained decoding model, and output the recognition text corresponding to the target text feature.
[0121] For example, each target text feature is input into the first sub-encoding model to obtain the sub-attention feature output by the first sub-encoding model; the sub-attention feature output by the first sub-encoding model is input into the next sub-encoding model to obtain the sub-attention feature output by the next sub-encoding model; the sub-attention feature output by the previous sub-encoding model is repeatedly input into the next sub-encoding model until the last sub-encoding model outputs the attention feature corresponding to each target text feature.
[0122] Finally, the task text and the task text features corresponding to the task text are obtained; the task text features and each attention feature are input into the trained decoding model, and the recognition text corresponding to the target text features is output. The task text can be understood as an input question, such as "Please extract the latest stock market information", which is a task text. By inputting the task text into the decoding model, the decoding model can obtain the attention relationship between the task text and the encoded text, specifically, by obtaining the attention relationship between the task text features and the attention features of the text features, thereby obtaining the attention features between the task text and the encoded text. According to the attention features, the important target encoded text can be screened out in the sub-encoded text, and then the recognition text is generated according to the target encoded text.
[0123] In the present application, the trained multilingual text recognition model is obtained based on the multilingual training text under the preset encoding rules. For example, the multilingual training text under the preset encoding rules is input into the multilingual text recognition model to determine the difference between the output predicted text and the real text, and the model parameters of the multilingual text recognition model are adjusted according to the difference, so as to implement the iteration of the multilingual text recognition model. When the difference between the predicted text and the real text meets the preset conditions, it is considered that the training of the multilingual text recognition model is completed, and the trained multilingual text recognition model supports text recognition processing of the encoded text under the preset encoding rules to obtain the recognized text.
[0124] In step 140 , the text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category.
[0125] After obtaining multiple recognized texts, the text category corresponding to each recognized text can be determined, and then the content of each recognized text can be extracted based on the text category to obtain the target text. The target text is similar to the summary text after summarizing the recognized text, which is equivalent to summarizing the main meaning of the recognized text with a paragraph of text content.
[0126] For example, if the recognized text is "Today, XXX company's stock appreciated by 5%, which is the largest stock price increase in recent times", and the text category of the recognized text is determined to be the stock market category, the target text is extracted, such as "XXX company's stock appreciated by 5%".
[0127] From the above content, it can be seen that in the present application, the text filtering and text screening of the original text in multiple languages are avoided first, and the original text is directly encoded under the preset encoding rules to obtain the encoded text. This is conducive to the trained multilingual text recognition model to obtain more text information, thereby more accurately extracting the corresponding text, and at the same time improving the efficiency of extracting the content of the original text in multiple languages.
[0128] In the present application, original texts in multiple languages are obtained, and the original texts are encoded using preset encoding rules common to multiple languages to obtain encoded texts; the encoded texts are divided and processed to obtain multiple sub-encoded texts; feature encoding is performed on each sub-encoded text to generate text features corresponding to each sub-encoded text; each text feature is input into a trained multilingual text recognition model for text recognition, and multiple recognized texts are output, wherein the trained multilingual text recognition model is trained based on multilingual training texts under preset encoding rules; the text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category. In this way, the original text of multiple languages is encoded by a preset encoding rule common to multiple languages to obtain an encoded text, and then the encoded text is divided into multiple sub-encoded texts. Since the encoded text is generated based on the preset encoding rule, the sub-encoded text has uniformity, and then the text features of each sub-encoded text are generated, and finally input into the trained multilingual recognition model for recognition, thereby outputting multiple recognized texts. Compared with the related art of directly extracting text content from multilingual texts through traditional text recognition models, the present application adopts preset encoding rules to unify multiple languages, and reduces the steps of text screening and text filtering for multilingual texts, which is conducive to improving the efficiency and accuracy of the multilingual text content extraction by the trained multilingual text recognition model. After that, the text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category. In this way, the target text is further extracted according to the text category of the recognized text, which can further improve the efficiency and accuracy of multilingual text content extraction.
[0129] See also Figure 4 , Figure 4 is another flow chart of the text extraction method provided in the embodiment of the present application. The text extraction method may include the following steps:
[0130] Step 201: obtaining original text in multiple languages, and encoding the original text using a preset encoding rule common to multiple languages to obtain an encoded text;
[0131] Step 202: determining a specific coded character corresponding to a specific character in the coded text;
[0132] Step 203: dividing the coded text according to the specific coded characters to obtain a plurality of sub-coded texts;
[0133] Step 204, determining the arrangement order of the sub-coded texts corresponding to each text feature in the coded text;
[0134] Step 205: forward encode each text feature according to the arrangement order to obtain a first position code;
[0135] Step 206: reversely encode each text feature according to the arrangement order to obtain a second position code;
[0136] Step 207: Combine each text feature, the first position code corresponding to each text feature, and the second position code to generate a target text feature corresponding to each text feature;
[0137] Step 208: input each target text feature into the first sub-encoding model to obtain the sub-attention feature output by the first sub-encoding model;
[0138] Step 209: input the sub-attention feature output by the first sub-coding model into the next sub-coding model to obtain the sub-attention feature output by the next sub-coding model;
[0139] Step 210: repeatedly input the sub-attention features output by the previous sub-encoding model into the next sub-encoding model until the last sub-encoding model outputs the attention features corresponding to each target text feature;
[0140] Step 211, obtaining a task text and a task text feature corresponding to the task text;
[0141] Step 212: Input the task text feature and each attention feature into the trained decoding model, and output the recognition text corresponding to the target text feature.
[0142] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the above text extraction method, which will not be repeated here.
[0143] See also Figure 5, the embodiment of the present application also provides a text extraction device, which can implement the above-mentioned text extraction method. In the embodiment of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0144] The text extraction device 300 comprises:
[0145] The acquisition module 310 is used to acquire original texts in multiple languages and encode the original texts using preset encoding rules common to multiple languages to obtain encoded texts;
[0146] A division module 320 is used to divide the coded text into multiple sub-coded texts;
[0147] The encoding module 330 is used to perform feature encoding on each sub-encoded text to generate text features corresponding to each sub-encoded text;
[0148] A recognition module 340 is used to input each text feature into a trained multilingual text recognition model for text recognition, and output a plurality of recognized texts, wherein the trained multilingual text recognition model is trained based on multilingual training texts under a preset encoding rule;
[0149] The extraction module 350 is used to determine the text category corresponding to each recognized text, and extract the target text from each recognized text according to the text category.
[0150] In some embodiments, the partitioning module 320 is used to determine a specific coded character corresponding to a specific character in the coded text;
[0151] The coded text is divided according to specific coded characters to obtain multiple sub-coded texts.
[0152] In some embodiments, the recognition module 340 includes a position encoding submodule 341 and a recognition submodule 342;
[0153] The position coding submodule 341 is used to determine a corresponding position coding for each text feature, and to combine each text feature with the position coding corresponding to each text feature to generate a target text feature corresponding to each text feature;
[0154] The recognition submodule 342 is used to input each target text feature into the trained multilingual text recognition model to perform text recognition and output a plurality of recognized texts.
[0155] In some embodiments, the position encoding submodule 341 is used to determine the arrangement order of the sub-encoded text corresponding to each text feature in the encoded text;
[0156] Forward encode each text feature according to the arrangement order to obtain the first position code;
[0157] Reversely encode each text feature according to the arrangement order to obtain the second position code;
[0158] Each text feature, the first position code corresponding to each text feature, and the second position code are combined to generate a target text feature corresponding to each text feature.
[0159] In some embodiments, the trained multilingual text recognition model includes a trained encoding model and a trained decoding model, the trained encoding model includes a plurality of trained sub-encoding models, the trained decoding model includes a plurality of trained sub-decoding models, and the number of the sub-encoding models is greater than the number of the sub-decoding models;
[0160] The recognition submodule 342 is used to input each target text feature into the trained encoding model and output the attention feature corresponding to each target text feature;
[0161] The attention feature corresponding to each target text feature is input into the trained decoding model, and the recognition text corresponding to the target text feature is output.
[0162] In some embodiments, the identification submodule 342 is used to input each target text feature into the first sub-encoding model to obtain a sub-attention feature output by the first sub-encoding model;
[0163] Input the sub-attention feature output by the first sub-encoding model into the next sub-encoding model to obtain the sub-attention feature output by the next sub-encoding model;
[0164] Repeatedly input the sub-attention features output by the previous sub-encoding model into the next sub-encoding model until the last sub-encoding model outputs the attention features corresponding to each target text feature.
[0165] In some implementations, the identification submodule 342 is used to obtain the task text and the task text features corresponding to the task text;
[0166] The task text features and each attention feature are input into the trained decoding model, and the recognized text corresponding to the target text features is output.
[0167] In the above embodiments, the description of each embodiment has its own emphasis. For the part that is not described in detail in a certain embodiment, please refer to the above text extraction method, which will not be repeated here.
[0168] As can be seen from the above, in the embodiment of the present application, the acquisition module 310 acquires original texts in multiple languages, and encodes the original texts through preset encoding rules common to multiple languages to obtain encoded texts; the division module 320 divides the encoded texts to obtain multiple sub-encoded texts; the encoding module 330 performs feature encoding on each sub-encoded text to generate text features corresponding to each sub-encoded text; the recognition module 340 inputs each text feature into a trained multilingual text recognition model for text recognition, and outputs multiple recognized texts, and the trained multilingual text recognition model is trained based on multilingual training texts under preset encoding rules; the extraction module 350 determines the text category corresponding to each recognized text, and extracts the target text from each recognized text according to the text category. In this way, the original text of multiple languages is encoded by a preset encoding rule common to multiple languages to obtain an encoded text, and then the encoded text is divided into multiple sub-encoded texts. Since the encoded text is generated based on the preset encoding rule, the sub-encoded text has uniformity, and then the text features of each sub-encoded text are generated, and finally input into the trained multilingual recognition model for recognition, thereby outputting multiple recognized texts. Compared with the related art of directly extracting text content from multilingual texts through traditional text recognition models, the present application adopts preset encoding rules to unify multiple languages, and reduces the steps of text screening and text filtering for multilingual texts, which is conducive to improving the efficiency and accuracy of the multilingual text content extraction by the trained multilingual text recognition model. After that, the text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category. In this way, the target text is further extracted according to the text category of the recognized text, which can further improve the efficiency and accuracy of multilingual text content extraction.
[0169] The embodiment of the present application also provides a computer device, the computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the above text extraction method when executing the computer program. The computer device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0170] See also Figure 6 , Figure 6 : is a schematic diagram of the structure of a computer device provided in an embodiment of the present application, wherein the computer device comprises:
[0171] The processor 401 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0172] The memory 402 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 402 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 402, and the processor 401 calls and executes the text extraction method of the embodiment of this application;
[0173] Input / output interface 403, used to implement information input and output;
[0174] Communication interface 404, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);
[0175] Bus 405 , which transmits information between various components of the device (e.g., processor 401 , memory 402 , input / output interface 403 , and communication interface 404 );
[0176] The processor 401 , the memory 402 , the input / output interface 403 and the communication interface 404 are connected to each other in communication within the device via the bus 405 .
[0177] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned text extraction method is implemented.
[0178] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0179] The text extraction method, device, computer equipment and storage medium proposed in the present application obtain original texts in multiple languages, and encode the original texts according to preset encoding rules common to multiple languages to obtain encoded texts; divide the encoded texts to obtain multiple sub-encoded texts; feature encode each sub-encoded text to generate text features corresponding to each sub-encoded text; input each text feature into a trained multilingual text recognition model for text recognition, and output multiple recognized texts, wherein the trained multilingual text recognition model is trained based on multilingual training texts under preset encoding rules; determine the text category corresponding to each recognized text, and extract the target text from each recognized text according to the text category. In this way, the original text of multiple languages is encoded by a preset encoding rule common to multiple languages to obtain an encoded text, and then the encoded text is divided into multiple sub-encoded texts. Since the encoded text is generated based on the preset encoding rule, the sub-encoded text has uniformity, and then the text features of each sub-encoded text are generated, and finally input into the trained multilingual recognition model for recognition, thereby outputting multiple recognized texts. Compared with the related art of directly extracting text content from multilingual texts through traditional text recognition models, the present application adopts preset encoding rules to unify multiple languages, and reduces the steps of text screening and text filtering for multilingual texts, which is conducive to improving the efficiency and accuracy of the multilingual text content extraction by the trained multilingual text recognition model. After that, the text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category. In this way, the target text is further extracted according to the text category of the recognized text, which can further improve the efficiency and accuracy of multilingual text content extraction.
[0180] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0181] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0182] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0183] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0184] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0185] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0186] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0187] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0188] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0189] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs. The non-company software tools or components that appear in the embodiments of the present application are only examples and do not represent actual use.
[0190] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A text extraction method, characterized in that: include: Acquire original texts in multiple languages, and encode the original texts using preset encoding rules common to the multiple languages to obtain encoded texts; Dividing the coded text to obtain a plurality of sub-coded texts; Performing feature encoding on each sub-encoded text to generate text features corresponding to each sub-encoded text; Inputting each text feature into a trained multilingual text recognition model for text recognition, and outputting a plurality of recognized texts, wherein the trained multilingual text recognition model is trained based on the multilingual training text under the preset encoding rule; The text category corresponding to each recognized text is determined, and the target text is extracted from each recognized text according to the text category.
2. The text extraction method according to claim 1, characterized in that: The coded text is divided to obtain a plurality of sub-coded texts, including: Determining in the coded text a specific coded character corresponding to a specific character; The coded text is divided according to the specific coded characters to obtain a plurality of sub-coded texts.
3. The text extraction method according to claim 1, characterized in that: The step of inputting each text feature into the trained multilingual text recognition model for text recognition and outputting a plurality of recognized texts includes: Determine a corresponding position code for each text feature, and combine each text feature with the position code corresponding to each text feature to generate a target text feature corresponding to each text feature; Each target text feature is input into the trained multilingual text recognition model for text recognition, and multiple recognized texts are output.
4. The text extraction method according to claim 3, characterized in that: Determining a corresponding position code for each text feature includes: Determine the arrangement order of the sub-coded texts corresponding to each text feature in the coded text; Forward encoding each of the text features according to the arrangement order to obtain a first position code; Reversely encode each of the text features according to the arrangement order to obtain a second position code; The step of combining each text feature with the position code corresponding to each text feature to generate a target text feature corresponding to each text feature includes: Each text feature, the first position code corresponding to each text feature, and the second position code are combined to generate a target text feature corresponding to each text feature.
5. The text extraction method according to claim 3, characterized in that: The trained multilingual text recognition model includes a trained encoding model and a trained decoding model, the trained encoding model includes a plurality of trained sub-encoding models, the trained decoding model includes a plurality of trained sub-decoding models, and the number of the sub-encoding models is greater than the number of the sub-decoding models; The step of inputting each target text feature into the trained multilingual text recognition model for text recognition and outputting a plurality of recognized texts includes: Input each target text feature into the trained encoding model, and output the attention feature corresponding to each target text feature; The attention feature corresponding to each target text feature is input into the trained decoding model, and the recognition text corresponding to the target text feature is output.
6. The text extraction method according to claim 5, characterized in that: The step of inputting each target text feature into the trained encoding model and outputting the attention feature corresponding to each target text feature comprises: Input each target text feature into the first sub-encoding model to obtain a sub-attention feature output by the first sub-encoding model; Inputting the sub-attention feature output by the first sub-encoding model into the next sub-encoding model to obtain the sub-attention feature output by the next sub-encoding model; Repeat the input of the sub-attention features output by the previous sub-encoding model into the next sub-encoding model until the last sub-encoding model outputs the attention features corresponding to each target text feature.
7. The text extraction method according to claim 5, characterized in that: The step of inputting the attention feature corresponding to each target text feature into the trained decoding model and outputting the recognition text corresponding to the target text feature comprises: Obtaining a task text and a task text feature corresponding to the task text; The task text feature and each attention feature are input into the trained decoding model, and the recognition text corresponding to the target text feature is output.
8. A text extraction device, characterized in that: include: An acquisition module is used to acquire original texts in multiple languages and encode the original texts according to preset encoding rules common to multiple languages to obtain encoded texts; A division module, used for dividing the coded text to obtain a plurality of sub-coded texts; An encoding module, used for performing feature encoding on each sub-encoded text to generate text features corresponding to each sub-encoded text; A recognition module, used for inputting each text feature into a trained multilingual text recognition model for text recognition, and outputting a plurality of recognized texts, wherein the trained multilingual text recognition model is trained based on the multilingual training text under the preset encoding rule; The extraction module is used to determine the text category corresponding to each recognized text, and extract the target text from each recognized text according to the text category.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the text extraction method according to any one of claims 1 to 7.
10. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the text extraction method according to any one of claims 1 to 7 is implemented.