CN115630636A - Text recognition method and device - Google Patents
Text recognition method and device Download PDFInfo
- Publication number
- CN115630636A CN115630636A CN202211312156.4A CN202211312156A CN115630636A CN 115630636 A CN115630636 A CN 115630636A CN 202211312156 A CN202211312156 A CN 202211312156A CN 115630636 A CN115630636 A CN 115630636A
- Authority
- CN
- China
- Prior art keywords
- text
- target
- recognized
- template
- recognition template
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 60
- 230000000007 visual effect Effects 0.000 claims abstract description 39
- 230000014509 gene expression Effects 0.000 claims description 38
- 238000000605 extraction Methods 0.000 claims description 8
- 239000000463 material Substances 0.000 abstract description 9
- 238000012545 processing Methods 0.000 description 11
- 238000010586 diagram Methods 0.000 description 7
- 230000008569 process Effects 0.000 description 7
- 230000006854 communication Effects 0.000 description 6
- 238000004891 communication Methods 0.000 description 5
- 238000012015 optical character recognition Methods 0.000 description 5
- 238000003058 natural language processing Methods 0.000 description 3
- 238000004590 computer program Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012552 review Methods 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000008676 import Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 239000004984 smart glass Substances 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/20—Natural language analysis
- G06F40/279—Recognition of textual entities
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/10—Text processing
- G06F40/166—Editing, e.g. inserting or deleting
- G06F40/186—Templates
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Computational Linguistics (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Character Input (AREA)
Abstract
The application provides a text recognition method and a text recognition device, wherein the text recognition method comprises the following steps: acquiring a text to be recognized and a text identifier of the text to be recognized; inquiring a target text recognition template corresponding to the text to be recognized in a text recognition template base based on the text identification; under the condition that a target text recognition template is not inquired, receiving visual marking operation aiming at a text to be recognized; generating a target text recognition template based on the visual marking operation; and extracting target text information of the text to be recognized according to the target text recognition template, and adding the target text recognition template to a text recognition template library. According to the method, the text recognition template library is set, when the recognition template is not inquired in the template library, the user creates the corresponding text recognition template through visual marking operation, and then performs text recognition, so that the problem of slow recognition caused by numerous types and quantity of texts to be recognized is solved, manpower and material resources are saved, and the recognition efficiency of the texts to be recognized is improved.
Description
Technical Field
The application relates to the technical field of text recognition, in particular to a text recognition method. The application also relates to a text recognition apparatus, a computing device, and a computer-readable storage medium.
Background
Natural language processing is an important direction in the fields of computer science and artificial intelligence, researches various theories and methods for realizing effective communication between people and computers by using natural language, identifies and extracts contents in texts, is an important branch of the field of natural language processing, and can solve various technical problems in the field of natural language processing by a deep learning technology.
In some fields, some files with fixed formats are usually processed, and required information is extracted from the content of the files and stored, but in some scenes, the number of the files with fixed formats is huge, the files are various, and at present, the files are processed in a manual processing mode, the information is extracted from the files, and manpower and material resources are consumed. At present, a way of recognizing texts by matching with a computer is also developed, but at present, a way of recognizing texts by a computer is usually full-text extraction, which has too much redundant information for a scene only needing some of the information, and also needs to consume manpower and material resources to delete the recognized contents.
Therefore, a more convenient and fast way to extract the relevant text content from the file with a fixed format is needed.
Disclosure of Invention
In view of this, the embodiment of the present application provides a text recognition method. The present application is also directed to a text recognition apparatus, a computing device, and a computer-readable storage medium to solve the above-mentioned problems in the prior art.
According to a first aspect of embodiments of the present application, there is provided a text recognition method, including:
acquiring a text to be recognized and a text identifier of the text to be recognized;
inquiring a target text recognition template corresponding to the text to be recognized in a text recognition template base based on the text identification;
under the condition that the target text recognition template is not inquired, receiving a visual marking operation aiming at the text to be recognized;
generating the target text recognition template based on the visual marking operation;
and extracting target text information of the text to be recognized according to the target text recognition template, and adding the target text recognition template to the text recognition template library.
According to a second aspect of embodiments of the present application, there is provided a text recognition apparatus including:
the device comprises an acquisition module, a recognition module and a recognition module, wherein the acquisition module is configured to acquire a text to be recognized and a text identifier of the text to be recognized;
the query module is configured to query a target text recognition template corresponding to the text to be recognized in a text recognition template library based on the text identification;
the receiving module is configured to receive a visual marking operation for the text to be recognized under the condition that the target text recognition template is not inquired;
a generation module configured to generate the target text recognition template based on the visual marking operation;
and the recognition module is configured to extract target text information of the text to be recognized according to the target text recognition template and add the target text recognition template to the text recognition template library.
According to a third aspect of embodiments herein, there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the text recognition method when executing the computer instructions.
According to a fourth aspect of embodiments of the present application, there is provided a computer-readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the text recognition method.
The text recognition method comprises the steps of obtaining a text to be recognized and a text identifier of the text to be recognized; inquiring a target text recognition template corresponding to the text to be recognized in a text recognition template base based on the text identification; under the condition that the target text recognition template is not inquired, receiving a visual marking operation aiming at the text to be recognized; generating the target text recognition template based on the visual marking operation; and extracting target text information of the text to be recognized according to the target text recognition template, and adding the target text recognition template to the text recognition template library.
According to the text recognition template library, the recognition templates corresponding to the appeared texts are collected in the text recognition templates, when the texts to be recognized need to be recognized, whether the corresponding text recognition templates exist or not is firstly inquired in the text recognition template library, when the texts are not inquired, the corresponding text recognition templates can be created by a user aiming at the texts to be recognized through visual marking operation, then the texts are recognized, the text recognition templates are stored simultaneously, the subsequent texts to be recognized of the same type are convenient to recognize, the problem that the texts to be recognized are slow to recognize due to the fact that the texts are numerous and numerous is solved, manpower and material resources are saved, and the recognition efficiency of the texts to be recognized is improved.
Drawings
Fig. 1 is a flowchart of a text recognition method according to an embodiment of the present application;
FIG. 2 is a schematic view of a visual markup page provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of a text markup template generated based on a text markup box of a user's markup according to an embodiment of the present application;
fig. 4 is a flowchart of a process of a text recognition method applied to a trademark official document according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a text recognition apparatus according to an embodiment of the present application;
fig. 6 is a block diagram of a computing device according to an embodiment of the present application.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present application. This application is capable of implementation in many different ways than those herein set forth and of similar import by those skilled in the art without departing from the spirit of this application and is therefore not limited to the specific implementations disclosed below.
The terminology used in the one or more embodiments of the present application is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of the present application. As used in one or more embodiments of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used in one or more embodiments of the present application refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that, although the terms first, second, etc. may be used herein in one or more embodiments to describe various information, these information should not be limited by these terms. These terms are only used to distinguish one type of information from another. For example, a first aspect may be termed a second aspect, and, similarly, a second aspect may be termed a first aspect, without departing from the scope of one or more embodiments of the present application. The word "if," as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination," depending on the context.
In the field of text processing, recognizing the content of a text is a scene which is frequently encountered by us, namely reading the content which is needed by us from a document, and recognizing the content in the document by scanning the document or by OCR, but recognizing by OCR usually scans the content of a full text and screens the needed information from the scanned full text content. This results in a waste of resources, sometimes a very large number of documents being processed, and further increases the workload.
In view of this, in the present application, a text recognition method is provided, and the present application relates to a text recognition apparatus, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
Fig. 1 shows a flowchart of a text recognition method according to an embodiment of the present application, which specifically includes the following steps:
step 102: and acquiring a text to be recognized and a text identifier of the text to be recognized.
According to the text identification method provided by the application, the applied scenes are a large quantity of text processing scenes, the formats of the texts are numerous, but the formats of the texts of the same type are fixed, and content information required by a user needs to be identified from the texts, for example, by taking an official document identification system as an example, the acquired official documents can be patent official documents, trademark official documents and the like, the official documents can be understood as official texts, and after the user obtains the official documents, the user needs to extract information required by the user from the official documents, such as information of an applicant, an application number, a document sending date, official document contents and the like. When some users process a large number of official documents, the problems of text recognition can be solved by consuming a large amount of manpower and material resources in the face of official document types with various formats, and the working efficiency is low.
The core of the embodiment of the application lies in recognizing the text, and for different language types (such as chinese, english, japanese, and the like), the process of recognizing the text is basically the same, and the following embodiment of the application is described in detail by taking the recognition of the chinese text as an example.
The text to be recognized specifically refers to text to be subjected to text recognition, such as a patent official document and a trademark official document downloaded from an official website, an official document mailed by an official, an electronic version document scanned in an electronic terminal, and the like.
The text identifier may specifically refer to an identifier for identifying a text type of the text to be recognized, and in an actual application, the text identifier may be a file name of the text to be recognized, for example, a "preliminary examination bulletin", and the text identifier may also be an identifier in the text to be recognized, for example, a text identifier "× 18784812578 BFBH" for determining the text is included in the text to be recognized.
After the user acquires the text to be recognized, the text identifier of the text to be recognized can be acquired by scanning the file name of the text to be recognized or the identification code in the text to be recognized.
In practical applications, the identification code of the text to be recognized is usually displayed at a specific position in the text to be recognized, such as the upper right corner of the text, the lower part of the text title, and the like, and the identification code is displayed at the specific position in the form of a barcode, which may be a two-dimensional code, a barcode, and the like.
In a specific embodiment provided by the present application, taking a text identifier as an example of the identification code, acquiring the text identifier of the text to be recognized includes:
scanning a text page of the text to be identified to obtain a text bar code of the text to be identified;
and analyzing the text bar code to obtain a text identifier corresponding to the text to be recognized.
After the text to be recognized is obtained, the text page of the text to be recognized can be scanned, and the text barcode of the text to be recognized is obtained at a specific position. After the text bar code is obtained, the text bar code can be analyzed, so that a text identifier corresponding to the text bar code in the text to be recognized, namely an identification code corresponding to the text to be recognized, is obtained.
In a specific embodiment provided by the present application, taking the text to be recognized as the "primary examination bulletin" as an example, the text mark corresponding to the text to be recognized is the "primary examination bulletin".
Step 104: and inquiring a target text recognition template corresponding to the text to be recognized in a text recognition template base based on the text identification.
The text recognition template library is specifically a database for storing text recognition templates, where the text recognition template library stores recognition templates corresponding to different types of texts, for example, a text recognition template 1 corresponds to a text type 1, and a text recognition template 2 corresponds to a text type 2, and so on.
In practical application, a text recognition template corresponding to each type of text is generated in a template generating mode through manual marking, the text recognition template is stored in a text recognition template library, when a new text to be recognized arrives, whether a target text recognition template corresponding to the text to be recognized exists or not is inquired in the text recognition template library according to a text identifier corresponding to the text to be recognized, if the target text recognition template exists, the text to be recognized is recognized through the target text recognition template, and if the target text recognition template does not exist, a user needs to establish the target text recognition template corresponding to the text to be recognized through a visual marking mode through the method provided by the application.
Based on the above, the target text recognition template specifically refers to a target text recognition template corresponding to the text to be recognized, and when the text type of the text to be recognized is type 1, the target text recognition template is the text recognition template 1; when the text type of the text to be recognized is type 2, the target text recognition template is a text recognition template 2 … ….
In practical application, the text identification specifically refers to identification information of a text to be identified, wherein only part of the content indicates the text type of the text to be identified, and the text identification template library comprises at least one text identification template and a template matching expression corresponding to each text identification template; that is, each text recognition template and the template matching expression corresponding to each text recognition template are stored in the text recognition template library, and the template matching expression is used for matching with the text identifier, so that whether the corresponding target text recognition template exists in the text recognition template library or not is determined.
Specifically, querying a target text recognition template corresponding to the text to be recognized in a text recognition template library based on the text identifier includes:
performing template matching according to a template matching expression in the text recognition template library and the text identification;
under the condition that a target template matching expression corresponding to the text identification is matched, determining a text recognition template corresponding to the target template matching expression as a target text recognition template corresponding to the text to be recognized;
and under the condition that the target template matching expression corresponding to the text identification is not matched, determining that the target text recognition template corresponding to the text to be recognized is not inquired in a text recognition template library.
In practical application, after the text identifier of the text to be recognized is obtained, the text identifier may be template-matched with each template matching expression in the text recognition template library, that is, the text identifier is respectively matched with each template matching expression, whether the text identifier can satisfy the template matching expression is judged, if the template matching expression matched with the text identifier exists in the text recognition template library, it is indicated that a target text recognition template corresponding to the text to be recognized exists in the text recognition template library, otherwise, it is indicated that the target text recognition template corresponding to the text to be recognized is not stored in the template library to be recognized.
Specifically, taking the text identifier corresponding to the text to be recognized as the initial examination bulletin as an example, the text recognition template a corresponding to the initial examination bulletin is saved in the text recognition template library, and the template matching expression corresponding to the text recognition template a is the initial examination bulletin, then the text recognition template a is determined as the target text recognition template corresponding to the text to be recognized by sequentially comparing the text identifier and the template matching expression in the text recognition template library, and finally, the text identifier and the template matching expression are successfully matched with the initial examination bulletin.
In another specific embodiment provided by the present application, taking a text identifier corresponding to a text to be recognized as "× 18784812578 BFBH", sequentially comparing the text identifier with template matching expressions stored in a text recognition template library, finding that there is no template matching expression successfully matching with the text identifier, and then indicating that there is no target text recognition template corresponding to the text to be recognized in the text recognition template library, that is, the text type of the text to be recognized is the first occurrence, and a text recognition template corresponding to the text to be recognized is not created in the text recognition template library.
Step 106: and receiving a visual marking operation aiming at the text to be recognized under the condition that the target text recognition template is not inquired.
After the operation processing in the above steps, it can be determined whether a target text recognition template corresponding to the text to be recognized exists in the text recognition template library. If the target text recognition template is found not to exist in the text recognition template library after being inquired, the text type corresponding to the text to be recognized is a text type which is not processed before, at the moment, a text recognition template corresponding to the text type needs to be created for the text type, and when the text to be recognized with the same type comes later, the created text recognition template can be used for performing text recognition on the text type.
In practical application, a developer is required to create a corresponding text recognition template for a text to be recognized according to the requirements of service personnel, the developer is different from the field in which the service personnel are responsible, the developer is responsible for creating the text recognition template, the service personnel informs technicians of required information, and multiple communications between the developer and the service personnel are required, so that the information which needs to be extracted from the text to be recognized is determined, manpower and material resources are consumed in the communication process, and the efficiency of creating one text recognition template is low.
In order to improve the creation efficiency of the text recognition template, the text recognition method provided by the application can provide a visual marking operation mode for business personnel, the business personnel directly performs visual operation in the text to be recognized, and the text recognition template corresponding to the text to be recognized is created based on the visual operation, so that the communication between the business personnel and technical personnel is reduced, and the business processing efficiency is improved.
Specifically, the receiving of the visual marking operation for the text to be recognized includes:
receiving marking operation of a user for the text to be recognized;
and generating at least one text marking box in the text to be recognized based on the marking operation.
In the text recognition method provided by the application, a technician may provide a marking tool for a text to be recognized, and a service person may load the text to be recognized through the marking tool, perform marking operation on the text to be recognized, and generate a text marking box corresponding to the marking operation on the text to be recognized, see fig. 2, where fig. 2 shows a schematic view of a visual marking page provided in an embodiment of the application. As shown in fig. 2, a page of a text to be recognized is shown, a user may perform a marking operation on the text to be recognized, specifically, information that the user wishes to extract may be marked by a text marking box, where a dashed box in fig. 2 is the text marking box, and taking fig. 2 as an example, the user wishes to extract information such as "date of posting", "applicant", "contact details", "text content" and the like in the text to be recognized. Therefore, the user can generate at least one text marking box in the text to be recognized in a form of marking the content of the information.
As described in the foregoing steps, in practical applications, there is also a case where a target text recognition template corresponding to a text to be recognized exists in a text recognition template library, and based on this, in another specific embodiment provided in the present application, the method further includes:
and under the condition that the target text recognition template is inquired, extracting target text information of the text to be recognized according to the target text recognition template.
When a target text recognition template corresponding to the text to be recognized exists in the text recognition template library, the target text information in the text to be recognized may be extracted according to the target text recognition template, where the target text information specifically refers to the target text information that the user wishes to extract from the text to be recognized, such as the information of "date of issue of text", "applicant", "contact information", "text content" and the like mentioned in the above embodiments. The detailed steps for extracting the target text information of the text to be recognized according to the target text recognition template are described in detail later, and are not described again here.
Step 108: and generating the target text recognition template based on the visual marking operation.
In practical application, a user can perform a visual marking operation through a marking tool, so that a corresponding target text recognition template is generated in the marking tool according to the visual operation.
Specifically, the generating the target text recognition template based on the visual marking operation includes:
and generating the target text identification template according to the at least one text mark box.
In actual operation, the visual marking operation of the user specifically refers to a text marking box generated in the marking tool, that is, the user may generate at least one text marking box in the marking tool for the visual marking operation of the text to be recognized, and after the marking of the user is completed, a corresponding target text recognition template may be generated based on the text marking box marked by the user, see fig. 3, and fig. 3 shows a text recognition template schematic diagram generated based on the text marking box marked by the user according to an embodiment of the present application.
Step 110: and extracting target text information of the text to be recognized according to the target text recognition template, and adding the target text recognition template to the text recognition template library.
After the target text identification template is obtained, the target text information in the text to be recognized can be extracted according to the target text identification template. It should be noted that after the target text recognition template is obtained, the target text recognition template needs to be added to the text recognition template library, and when the same type of text to be recognized is received again, the text recognition template can be used for text recognition.
Specifically, as described in the above steps, the target text recognition template includes at least one text label box;
correspondingly, extracting the target text information of the text to be recognized according to the target text recognition template comprises the following steps:
determining mark position information corresponding to each text mark box;
and extracting target text information corresponding to each text mark box in the text to be recognized based on each mark position information.
And determining the position information of the marking frame corresponding to each text marking frame, and extracting the target text information corresponding to each marking frame from the text to be recognized according to the position information of the marking frame.
Specifically, extracting target text information corresponding to each text mark box in the text to be recognized based on each mark position information includes:
determining target mark position information in each mark position information;
determining a target identification position area in the text to be identified according to the target mark position information;
and extracting target text information corresponding to the target identification position area.
In practical application, the target text information corresponding to each mark position information is respectively extracted, and according to the processing capacity of the terminal, when the processing capacity of the terminal is stronger, a plurality of mark position information can be identified in parallel; when the processing capacity of the terminal is insufficient, each mark position can be identified in turn.
Here, we explain by taking a mark position information as an example, that is, a target mark position information is determined in the mark position information, the target mark position information specifically refers to position information to be identified, in practical application, the target mark position information is area information corresponding to a mark frame, and a specific representation form may be a certain vertex coordinate plus the length and width of the mark frame, for example, (x, y, a, b) where (x, y) may be understood as the coordinate of the upper left corner of the mark frame, and a and b may be understood as the length and width of the mark frame; the target mark position information may also be expressed as coordinates of two vertices of a diagonal line, for example, (x 1, y1, x2, y 2), where (x 1, y 1) may be understood as the coordinates of the upper left corner of the mark frame and (x 2, y 2) may be understood as the coordinates of the lower right corner of the mark frame.
And determining a target recognition position area corresponding to the target mark position information in the text to be recognized according to the target mark position information, namely determining the area in the text to be recognized for text recognition.
After the target recognition area is determined, the text in the target recognition area can be extracted, so as to obtain the target text information corresponding to the target recognition position area.
In practical application, the text to be recognized has two formats, one is an electronic version of text, and the text content and the text position information of each character can be determined in the electronic version of text; one is to scan the version of the text, that is, after receiving the paper version of the document, the paper version of the document is converted into a picture format by scanning, and then the picture format is identified, so as to obtain the target text information in the text.
The following explains the recognition processes of the above two formats of texts to be recognized respectively,
when the text to be recognized is the text of the electronic edition, the text of the electronic edition is read, each character in the text of the electronic edition and the character position information corresponding to each character in the text can be obtained, after the target recognition area is determined, whether the corresponding character is in the target recognition area can be determined by judging whether the character position information is in the target recognition area, and on the basis, the character of which the character position information is in the target recognition area is extracted and can be used as the target text information corresponding to the target recognition area.
When the text to be recognized is the text of the scanned version, the target recognition area is mapped onto the text to be recognized, the area where the text recognition is needed is marked, the content in the target recognition area is recognized through an OCR (optical character recognition) technology, and the target text information in the target recognition area is extracted.
In practical applications, in order to improve the recognition accuracy, the range of the target recognition area is usually larger than the range of the text portion in the area, and redundant information is usually extracted, for example, taking the "applicant" information in fig. 2 as an example, the target recognition area will "applicant: the area of company a is marked and when identified, the area of company a will also be marked as "applicant: company a "is identified, but the user only needs to target text information for" company a "in the content, without saving the previous" applicant: accordingly, extracting target text information corresponding to the target recognition location area includes:
identifying initial text information corresponding to the target identification position area;
target text information is determined from the initial text information based on a text extraction expression.
In the process of extracting the target recognition position area, initial text information corresponding to the area is first extracted from the target recognition position area, where the initial text information specifically refers to all information obtained by recognition from the target recognition position area, and is shown as "applicant: company A ".
When the region is marked, the information corresponding to the region is marked as "applicant" in advance, that is, the target text information may be determined from the initial text region according to the text extraction expression corresponding to the region, specifically, taking "applicant" as an example, the text extraction expression corresponding to the region is "applicant: "the applicant: "thereafter, applicants: "the following text information" company a "is taken as the target text information.
The information in each recognition position area in the text to be recognized can be extracted through the target text recognition template, so that target text information corresponding to the text to be recognized is obtained.
After the obtained target text information, the user needs to persist the target text information for subsequent data processing and data analysis, and therefore, the method further includes:
and saving the target text information.
In practical application, the target text information can be stored in a corresponding database, excel table and other files for persistent storage according to actual conditions, so that the information can be referred in the follow-up process.
The text identification method comprises the steps of obtaining a text to be identified and a text identifier of the text to be identified; inquiring a target text recognition template corresponding to the text to be recognized in a text recognition template base based on the text identification; under the condition that the target text recognition template is not inquired, receiving a visual marking operation aiming at the text to be recognized; generating the target text recognition template based on the visual marking operation; and extracting target text information of the text to be recognized according to the target text recognition template, and adding the target text recognition template to the text recognition template library. According to the method, the text recognition template base is arranged, the recognition templates corresponding to the appeared texts are collected in the text recognition templates, when the texts to be recognized need to be recognized, whether the corresponding text recognition templates exist or not is inquired in the text recognition template base, when the texts to be recognized do not exist, the corresponding text recognition templates can be created by a user through visual marking operation aiming at the texts to be recognized, then the texts are recognized, meanwhile, the text recognition templates are stored, the subsequent texts to be recognized of the same type are convenient to recognize, the problem that the recognition is slow due to the fact that the texts to be recognized are numerous in type and quantity is solved, manpower and material resources are saved, and the recognition efficiency of the texts to be recognized is improved.
The following text recognition method is further described with reference to fig. 4 by taking the application of the text recognition method provided by the present application to the trademark official document as an example. Fig. 4 shows a processing flow chart of a text recognition method applied to a trademark official document according to an embodiment of the present application, which specifically includes the following steps:
step 402: and acquiring the text of the official document to be identified.
In one embodiment provided herein, trademark official text a is obtained.
Step 404: and scanning the text page of the official document text to be identified to obtain the text bar code of the official document text to be identified.
In one embodiment provided by the present application, the text page of the trademark official document a is scanned to obtain the text barcode located in the upper left corner of the trademark official document a.
Step 406: and analyzing the text bar code to obtain a text identifier corresponding to the text of the official document to be identified.
In a specific embodiment provided by the application, the text bar code is analyzed to obtain a text identifier "16115616bhfs54646546.Bhfs" corresponding to the trademark official document a.
Step 408: and carrying out template matching according to a template matching expression in the text recognition template library and the text identification.
In a specific embodiment provided by the present application, the text identifier is sequentially matched with template matching expressions in a text recognition template library, and it is determined whether a target template matching expression corresponding to the text identifier exists.
Step 410: and receiving marking operation of a user for the text of the official document to be recognized under the condition that the target template matching expression corresponding to the text identification is not matched.
In a specific embodiment provided by the present application, taking the target template matching expression not queried as an example, entering a marking page, receiving a marking operation of a user on the page for a trademark official document a, and simultaneously recording a template matching expression "BHFS (BHFS) (-BHFS") for the trademark official document a, and simultaneously recording a name of a text recognition template library corresponding to the trademark official document a as a "reject review decision book".
Step 412: and generating at least one text marking box in the text of the official text to be recognized based on the marking operation.
In a specific embodiment provided by the present application, a user marks required text information in the form of a mark box in the mark page, and generates text box extraction information corresponding to the text mark box every time a text mark box is marked, for example, if the marked text mark box is applicant information, the text box extraction information corresponding to the text mark box is "applicant".
Step 414: and generating the target text identification template according to the at least one text mark box, and storing the target text identification template into a text identification template library.
In a specific embodiment provided by the present application, after the marking is completed, a target text identification template corresponding to the trademark official document a may be generated according to the text marking box generated on the marking page, and the target text identification template and the template matching expression "BHFS" (BHFS) "and the text recognition template library name" reject review decision "are correspondingly stored in the text recognition template library.
Step 416: and determining mark position information corresponding to each text mark box in the target text mark template.
In a specific embodiment provided by the present application, the mark position information corresponding to each text mark box may be determined according to the position of each text mark box in the target text identification template.
Step 418: and determining the corresponding recognition position area of each mark position information in the text of the official document to be recognized.
In a specific embodiment provided by the application, an identification position area corresponding to each marking position information is determined according to each marking position information in the trademark official document A.
Step 420: and extracting target text information corresponding to each recognition position area.
In a specific embodiment provided by the application, the target text information in each recognition position area is respectively extracted through OCR recognition.
Step 422: and saving the target text information to the official document database.
In one embodiment provided by the present application, the extracted target text information is saved in a official document database.
According to the method, the text recognition template base is arranged, the recognition templates corresponding to the appeared texts are collected in the text recognition templates, when the texts to be recognized need to be recognized, whether the corresponding text recognition templates exist or not is firstly inquired in the text recognition template base, when the texts to be recognized do not exist, the corresponding text recognition templates can be created by a user through visual marking operation aiming at the texts to be recognized, then the texts are recognized, meanwhile, the text recognition templates are stored, the subsequent texts to be recognized of the same type are convenient to recognize, the problem that the recognition is slow due to the fact that the texts to be recognized are numerous in type and quantity is solved, manpower and material resources are saved, and the recognition efficiency of the texts to be recognized is improved.
Corresponding to the above method embodiment, the present application further provides a text recognition apparatus embodiment, and fig. 5 shows a schematic structural diagram of a text recognition apparatus provided in an embodiment of the present application. As shown in fig. 5, the apparatus includes:
an obtaining module 502 configured to obtain a text to be recognized and a text identifier of the text to be recognized;
a query module 504 configured to query a target text recognition template corresponding to the text to be recognized in a text recognition template library based on the text identification;
a receiving module 506, configured to receive a visual marking operation for the text to be recognized in a case that the target text recognition template is not queried;
a generation module 508 configured to generate the target text recognition template based on the visual marking operation;
a recognition module 510 configured to extract target text information of the text to be recognized according to the target text recognition template, and add the target text recognition template to the text recognition template library.
Optionally, the obtaining module 502 is further configured to:
scanning a text page of the text to be identified to obtain a text bar code of the text to be identified;
and analyzing the text bar code to obtain a text identifier corresponding to the text to be recognized.
Optionally, the text recognition template library includes at least one text recognition template and a template matching expression corresponding to each text recognition template;
the query module 504, further configured to:
performing template matching according to a template matching expression in the text recognition template library and the text identification;
under the condition that a target template matching expression corresponding to the text identification is matched, determining a text recognition template corresponding to the target template matching expression as a target text recognition template corresponding to the text to be recognized;
and under the condition that the target template matching expression corresponding to the text identification is not matched, determining that the target text recognition template corresponding to the text to be recognized is not inquired in a text recognition template library.
Optionally, the receiving module 506 is further configured to:
receiving marking operation of a user for the text to be recognized;
and generating at least one text marking box in the text to be recognized based on the marking operation.
Optionally, the generating module 508 is further configured to:
and generating the target text identification template according to the at least one text mark box.
Optionally, the identifying module 510 is further configured to:
and under the condition that the target text recognition template is inquired, extracting target text information of the text to be recognized according to the target text recognition template.
Optionally, the target text recognition template includes at least one text mark box;
the identification module 510 is further configured to:
determining mark position information corresponding to each text mark box;
and extracting target text information corresponding to each text mark box in the text to be recognized based on each mark position information.
Optionally, the identifying module 510 is further configured to:
determining target mark position information in each mark position information;
determining a target identification position area in the text to be identified according to the target mark position information;
and extracting target text information corresponding to the target identification position area.
Optionally, the identifying module 510 is further configured to:
identifying initial text information corresponding to the target identification position area;
target text information is determined from the initial text information based on a text extraction expression.
Optionally, the apparatus further comprises:
a saving module configured to save the target text information.
The text recognition device obtains a text to be recognized and a text identifier of the text to be recognized; inquiring a target text recognition template corresponding to the text to be recognized in a text recognition template base based on the text identification; under the condition that the target text recognition template is not inquired, receiving a visual marking operation aiming at the text to be recognized; generating the target text recognition template based on the visual marking operation; and extracting target text information of the text to be recognized according to the target text recognition template, and adding the target text recognition template to the text recognition template library. Through the device that this application provided, text recognition template storehouse has been set up, collect the recognition template that the text that has appeared corresponds in text recognition template, when waiting to discern the text and need discerning, whether have corresponding text recognition template in the inquiry of text recognition template storehouse earlier, when not inquiring, can be treated discerning the text by the user and pass through visual mark operation, establish corresponding text recognition template, carry out text recognition again, keep this text recognition template simultaneously, be convenient for follow-up text recognition of waiting to discern of the same type, the problem that the recognition is slow that has solved to treat that the discernment text type is numerous and bring is solved, manpower and materials have been saved, the recognition efficiency of waiting to discern the text has been improved.
The above is a schematic scheme of a text recognition apparatus of the present embodiment. It should be noted that the technical solution of the text recognition apparatus and the technical solution of the text recognition method belong to the same concept, and for details that are not described in detail in the technical solution of the text recognition apparatus, reference may be made to the description of the technical solution of the text recognition method.
Fig. 6 illustrates a block diagram of a computing device 600 provided according to an embodiment of the present application. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is coupled to the memory 610 via a bus 630 and a database 650 is used to store data.
Computing device 600 also includes access device 640, access device 640 enabling computing device 600 to communicate via one or more networks 660. Examples of such networks include a Public Switched Telephone Network (PSTN), a Local Area Network (LAN), a Wide Area Network (WAN), a Personal Area Network (PAN), or a combination of communication networks such as the internet. The Access device 640 may include one or more of any type of Network interface (e.g., a Network interface controller) that may be wired or Wireless, such as an IEEE802.11 Wireless Local Area Network (WLAN) Wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an ethernet interface, a Universal Serial Bus (USB) interface, a cellular Network interface, a bluetooth interface, a Near Field Communication (NFC) interface, and so forth.
In one embodiment of the application, the above-described components of computing device 600, as well as other components not shown in fig. 6, may also be connected to each other, such as by a bus. It should be understood that the block diagram of the computing device architecture shown in FIG. 6 is for purposes of example only and is not limiting as to the scope of the present application. Those skilled in the art may add or replace other components as desired.
Computing device 600 may be any type of stationary or mobile computing device, including a mobile Computer or mobile computing device (e.g., tablet Computer, personal digital assistant, laptop Computer, notebook Computer, netbook, etc.), mobile phone (e.g., smartphone), wearable computing device (e.g., smartwatch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop Computer or Personal Computer (PC). Computing device 600 may also be a mobile or stationary server.
Wherein the steps of the text recognition method are implemented by processor 620 when executing the computer instructions.
The above is an illustrative scheme of a computing device of the present embodiment. It should be noted that the technical solution of the computing device and the technical solution of the text recognition method belong to the same concept, and details that are not described in detail in the technical solution of the computing device can be referred to the description of the technical solution of the text recognition method.
An embodiment of the present application also provides a computer readable storage medium storing computer instructions, which when executed by a processor, implement the steps of the text recognition method as described above.
The above is an illustrative scheme of a computer-readable storage medium of the present embodiment. It should be noted that the technical solution of the storage medium belongs to the same concept as the technical solution of the text recognition method, and for details that are not described in detail in the technical solution of the storage medium, reference may be made to the description of the technical solution of the text recognition method.
The foregoing description of specific embodiments of the present application has been presented. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
The computer instructions comprise computer program code which may be in source code form, object code form, an executable file or some intermediate form, or the like. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that, for the sake of simplicity, the above-mentioned method embodiments are described as a series of acts or combinations, but those skilled in the art should understand that the present application is not limited by the described order of acts, as some steps may be performed in other orders or simultaneously according to the present application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The preferred embodiments of the present application disclosed above are intended only to aid in the explanation of the application. Alternative embodiments are not exhaustive and do not limit the invention to the precise embodiments described. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the application and its practical application, to thereby enable others skilled in the art to best understand the application and its practical application. The application is limited only by the claims and their full scope and equivalents.
Claims (13)
1. A text recognition method, comprising:
acquiring a text to be recognized and a text identifier of the text to be recognized;
inquiring a target text recognition template corresponding to the text to be recognized in a text recognition template base based on the text identification;
under the condition that the target text recognition template is not inquired, receiving a visual marking operation aiming at the text to be recognized;
generating the target text recognition template based on the visual marking operation;
and extracting target text information of the text to be recognized according to the target text recognition template, and adding the target text recognition template to the text recognition template library.
2. The method of claim 1, wherein obtaining a text identification of the text to be recognized comprises:
scanning a text page of the text to be identified to obtain a text bar code of the text to be identified;
and analyzing the text bar code to obtain a text identifier corresponding to the text to be recognized.
3. The method of claim 1, wherein the library of text recognition templates includes at least one text recognition template and a template matching expression corresponding to each text recognition template;
inquiring a target text recognition template corresponding to the text to be recognized in a text recognition template library based on the text identification, wherein the method comprises the following steps:
performing template matching according to a template matching expression in the text recognition template library and the text identification;
under the condition that a target template matching expression corresponding to the text identification is matched, determining a text recognition template corresponding to the target template matching expression as a target text recognition template corresponding to the text to be recognized;
and under the condition that the target template matching expression corresponding to the text identification is not matched, determining that the target text recognition template corresponding to the text to be recognized is not inquired in a text recognition template library.
4. The method of claim 1, wherein receiving a visual marking operation for the text to be recognized comprises:
receiving marking operation of a user for the text to be recognized;
and generating at least one text marking box in the text to be recognized based on the marking operation.
5. The method of claim 4, wherein generating the target text recognition template based on the visual marking operation comprises:
and generating the target text identification template according to the at least one text mark box.
6. The method of claim 1, wherein the method further comprises:
and under the condition that the target text recognition template is inquired, extracting target text information of the text to be recognized according to the target text recognition template.
7. The method of claim 1 or 6, wherein the target text recognition template includes at least one text markup box therein;
extracting target text information of the text to be recognized according to the target text recognition template, wherein the method comprises the following steps:
determining mark position information corresponding to each text mark box;
and extracting target text information corresponding to each text mark box in the text to be recognized based on each mark position information.
8. The method of claim 7, wherein extracting target text information corresponding to each text mark box in the text to be recognized based on each mark position information comprises:
determining target mark position information in each mark position information;
determining a target identification position area in the text to be identified according to the target mark position information;
and extracting target text information corresponding to the target identification position area.
9. The method of claim 8, wherein extracting target text information corresponding to the target recognition location area comprises:
identifying initial text information corresponding to the target identification position area;
target text information is determined from the initial text information based on a text extraction expression.
10. The method of claim 1 or 6, further comprising:
and saving the target text information.
11. A text recognition apparatus, comprising:
the device comprises an acquisition module, a recognition module and a recognition module, wherein the acquisition module is configured to acquire a text to be recognized and a text identifier of the text to be recognized;
the query module is configured to query a target text recognition template corresponding to the text to be recognized in a text recognition template library based on the text identification;
a receiving module configured to receive a visual marking operation for the text to be recognized in the case that the target text recognition template is not queried;
a generation module configured to generate the target text recognition template based on the visual marking operation;
and the recognition module is configured to extract target text information of the text to be recognized according to the target text recognition template and add the target text recognition template to the text recognition template library.
12. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor implements the steps of the method of any one of claims 1-10 when executing the computer instructions.
13. A computer-readable storage medium storing computer instructions, which when executed by a processor, perform the steps of the method of any one of claims 1 to 10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211312156.4A CN115630636A (en) | 2022-10-25 | 2022-10-25 | Text recognition method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211312156.4A CN115630636A (en) | 2022-10-25 | 2022-10-25 | Text recognition method and device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115630636A true CN115630636A (en) | 2023-01-20 |
Family
ID=84907296
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211312156.4A Pending CN115630636A (en) | 2022-10-25 | 2022-10-25 | Text recognition method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115630636A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117669529A (en) * | 2024-02-01 | 2024-03-08 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and medium |
-
2022
- 2022-10-25 CN CN202211312156.4A patent/CN115630636A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117669529A (en) * | 2024-02-01 | 2024-03-08 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and medium |
CN117669529B (en) * | 2024-02-01 | 2024-04-30 | 腾讯科技(深圳)有限公司 | Data processing method, device, equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110807454B (en) | Text positioning method, device, equipment and storage medium based on image segmentation | |
CN110765740B (en) | Full-type text replacement method, system, device and storage medium based on DOM tree | |
CN109271616B (en) | Intelligent extraction method based on bibliographic characteristic value of standard literature | |
CN108197119A (en) | The archives of paper quality digitizing solution of knowledge based collection of illustrative plates | |
CN111191614A (en) | Document classification method and device | |
Akinbade et al. | An adaptive thresholding algorithm-based optical character recognition system for information extraction in complex images | |
CN115630636A (en) | Text recognition method and device | |
CN113326413A (en) | Webpage information extraction method, system, server and storage medium | |
CN114022891A (en) | Method, device and equipment for extracting key information of scanned text and storage medium | |
CN111881900B (en) | Corpus generation method, corpus translation model training method, corpus translation model translation method, corpus translation device, corpus translation equipment and corpus translation medium | |
CN114491010A (en) | Training method and device of information extraction model | |
CN114579796B (en) | Machine reading understanding method and device | |
TWM590730U (en) | Document management system base on AI | |
CN115455143A (en) | Document processing method and device | |
CN115391567A (en) | Fan standard operation knowledge graph construction method and device and operation machine | |
CN114863435A (en) | Text extraction method and device | |
CN114495138A (en) | Intelligent document identification and feature extraction method, device platform and storage medium | |
CN114373068A (en) | Industry-scene OCR model implementation system, method and equipment | |
CN113947510A (en) | Real estate electronic license management system based on file format self-adaptation | |
CN112000974A (en) | Electronic signature method and device for document | |
CN113971810A (en) | Document generation method, device, platform, electronic equipment and storage medium | |
CN112348022A (en) | Free-form document identification method based on deep learning | |
CN105847122A (en) | Advertising mail recognition method and device | |
CN112149679A (en) | Method and device for extracting document elements based on OCR character recognition | |
JP2000268040A (en) | Information classifying system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |