String processing method and module
The method and module for syntactic processing of character strings address the robustness issue in traditional methods by filtering based on regular expressions and character probabilities, enhancing accuracy and efficiency in handling errors, particularly in optical character recognition.
Patent Information
- Application Number
- FR2024006774
- Authority / Receiving Office
- FR · FR
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2025-12-26
AI Technical Summary
Traditional string processing methods lack robustness in handling errors, particularly in optical character recognition, limiting their effectiveness in practical applications with complex textual data.
A method and module for syntactic processing of character strings that filter candidate strings based on a correspondence with a regular expression, considering individual character probabilities and error patterns to enhance accuracy and efficiency.
The method significantly reduces error risk and processing volume, optimizing efficiency and speed by ensuring only likely matches are processed, effectively handling errors in character recognition and improving applications like text recognition and database searches.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Title of the invention: String processing method and module technical field
[0001] This disclosure falls within the field of word processing. More specifically, it relates to a method for syntactically processing a string of characters acquired by an electronic device and a corresponding module. Previous technique
[0002] Traditional methods of automatic string processing often focus on an exact recognition of the characters to be processed without robustness to errors, for example the common errors observed in particular in optical character recognition results, limiting their effectiveness in various practical applications.
[0003] In this context and faced with the increasing complexity of textual data processed by digital systems, there is a need for a mechanism capable of efficiently managing errors in character string recognition. Summary
[0004] This disclosure improves the situation.
[0005] A method, at least partially automatic, is proposed for syntactic processing of a string of characters acquired by an electronic device, the method comprising filtering a plurality of candidate strings of characters obtained from said acquired string of characters according to a correspondence between a regular expression and at least one of the candidate strings of characters.
[0006] The proposed method can help, at least in certain embodiments, to improve (for example, significantly) the accuracy and efficiency of applications as varied as text recognition, data entry, data validation, database searching, and the automatic processing of documents with specific formats (for example, legal or medical documents). The proposed method can, in particular, be used in any application requiring the robust identification of a string of characters, that is, even in the presence of potential input or recognition errors. By filtering candidate strings according to their correspondence with a regular expression, the proposed method limits (for example, minimizes) the risk of error by considering only the strings that are most likely to match the expected expression.This optimizes processing by reducing the volume of unnecessary data processed, thus increasing processing efficiency and speed. The matching, also called... Matching, compatibility, or concordance refers to the degree of similarity (or correspondence) between a candidate string and a pattern defined by a regular expression or motif. The term "matching" can also be used to represent the concept of correspondence. Matching can be total or partial, depending on the matching criteria used to evaluate the relationship. For example, a total match means that the candidate string fully satisfies the criteria defined by the regular expression (i.e., satisfies all the criteria), while a partial match indicates that the string satisfies some of the criteria but has slight, acceptable deviations, such as minor typos or formatting variations.
[0007] According to another aspect, a syntax processing module for a string of characters acquired by an electronic device is proposed, configured to filter a plurality of candidate strings obtained from said acquired string of characters according to a correspondence between a regular expression and at least one of the candidate strings of characters.
[0008] According to another aspect, a computer program is proposed that includes instructions for implementing all or part of a process as defined herein when this program is executed by a processor. According to another aspect, a non-transient, computer-readable recording medium is proposed on which such a program is recorded.
[0009] The features described in the following paragraphs may optionally be implemented independently of each other or in combination with each other:
[0010] In one example, the process further includes a selection, in a database, of an entry representing the acquired string of characters, based on a similarity between said entry and a candidate string of characters resulting from the filtering.
[0011] This feature can enable the precise and reliable identification of the acquired character string. A possible application example concerns customer database management. For instance, implementing the method before initiating a database search to identify an account associated with a given telephone number or email address can help filter out incorrect entries. This ensures that only strings precisely matching the desired formats are considered in the search, thus limiting (or even avoiding) superfluous or erroneous queries and improving the speed and efficiency of database search operations.
[0012] In one example, the filtering takes into account a number of candidate strings.
[0013] Limiting the number of strings to be processed contributes to efficient management of system resources. This principle is useful in applications such as call centers or automated response systems, where there is a need for rapid identification of the most probable request among a large number of simultaneous interactions, to help provide a quick and accurate response to a user.
[0014] In one example, the filtering takes into account at least one individual probability of occurrence of at least one character of at least one of the candidate strings.
[0015] In one example, the filtering takes into account an overall probability score of one of the candidate character strings, said overall probability score being based on individual probabilities of occurrence of at least some of the characters of said string.
[0016] Taking into account individual probabilities of occurrence for all or part of the acquired characters makes it possible to rectify errors effectively without requiring a partial or complete re-acquisition of the string of characters, particularly in environments where typographical or recognition errors are frequent, for example the automatic transcription of a spelled term, the verification of serial numbers inscribed on products, or the detection and correction of common input errors in a computer code.
[0017] In one example, the individual probability of occurrence of a given character is provided with at least one of the candidate character strings as a result of parsing the character string acquired by a parser.
[0018] In one example, the individual probability of occurrence of a given character takes into account at least one known or expected error value between the given character and at least one replacement character.
[0019] Taking into account (for example, predetermined) values for errors between characters makes it possible to anticipate and automatically correct typical errors, such as those often encountered in inputs generated by speech recognition or optical character recognition interfaces. For example, in voice command applications, this makes it possible to significantly reduce errors in understanding voice commands due to inaccurate pronunciations and / or varying accents. When the probability is provided by the parser, it can be particularly well-suited to dynamic contexts where the characteristics of the text and / or the background of the characters may vary, such as in optical character recognition of characters appearing in video subtitles. On the other hand, the use of predetermined values (constant or configurable) may be more appropriate for applications where errors follow more predictable patterns. constants, as in data entry correction. Computer input errors depend in particular on the written language and the input method. For example, with OCR, typical errors include confusion between '0', zero, and '0', and the capital letter 'O'. In dictaphones, errors due to phonetic similarity, such as between "vert" (green), "vers" (towards), and "verre" (glass), are frequent. For keyboard input, errors are often related to the proximity of keys, such as between 'r' and 'f'.
[0020] In one example, the regular expression is either previously specified or is an extension of a previously specified regular expression proposal.
[0021] The specification or extension of regular expressions offers adaptability to various applications, for example the recognition of missing parts of strings of characters appearing on a damaged document, the filtering of content on social networks where it is desirable to identify and moderate different potential variations in particular by substitution of characters of certain words or expressions, bioinformatics for the search for specific genetic patterns or computer security for the detection of patterns in network traffic that could indicate malicious activity.
[0022] In one example, the plurality of candidate strings includes at least a first candidate string and a second candidate string obtained from processing the first candidate string.
[0023] For example, if an initial string does not match the specified regular expression, a second string is generated from the first and compared again. If this second string also fails to achieve a required match, a third can be generated from one of the two previous strings. This iterative process can be continued until a sufficient number of matches are found and / or for a specified number of attempts. This approach can help not only to increase (e.g., maximize) the chances of finding an exact match between a regular expression and a candidate string, but also to reduce operational costs by avoiding, for example, the processing of large amounts of unlikely data. Brief description of the drawings
[0024] Other features, details and advantages will become apparent from reading the detailed description below and from analyzing the accompanying drawings, in which: Fig. 1
[0025] [Fig.1] shows an example of a syntax processing system. Fig. 2
[0026] [Fig.2] shows a table representing fictitious examples of probabilities occurrence for each character of an example string of characters acquired by a parser. Fig. 3
[0027] [Fig.3] shows a table presenting examples of replacement characters possible for each character in a sample string acquired by a parser, as well as fictional examples of occurrence probabilities associated with each replacement character. Fig. 4
[0028] [Fig.4] shows a probability matrix establishing fictitious examples of percentages of known errors between different characters in the character set. Description of the implementation methods
[0029] In the description that follows, identical reference numerals designate identical elements or elements having similar functions.
[0030] One aspect of the technique proposed in this document is a method for syntactic processing of a string of characters acquired by an electronic device, the method comprising filtering a plurality of candidate strings obtained from said acquired string of characters according to a correspondence between a regular expression and at least one of the candidate strings of characters.
[0031] Another aspect of the proposed technique is a syntax processing module for a string of characters acquired by an electronic device, configured to filter a plurality of candidate strings obtained from said acquired string of characters according to a correspondence between a regular expression and at least one of the candidate strings of characters.
[0032] Any suitable hardware and / or software may be used for the practical implementation of said module. Generally, although aspects of the proposed technique may be described in this document as a process, device, system, procedure, or method, it should be noted that the proposed technique may also cover computer memory that can be connected to a processor, possibly connected to a communication interface. This memory stores instructions which, when executed by such a processor, enable the implementation of the processes, devices, systems, procedures, or methods described in this document. Unless otherwise specified, a processor herein means any processing unit capable of executing instructions and calculations.This definition includes, but is not limited to, physical or virtual processors of any architecture, such as central processing units (CPUs). Graphics processing units (GPUs), application-specific integrated circuits (ASICs), and field-programmable logic arrays (FPGAs) are all examples of processors. A processor can be designed to perform general or specific tasks and can be integrated into various devices and systems to accomplish data processing operations.
[0033] Some specific terms are now clarified for a better understanding of the proposed technique.
[0034] A character is a minimal unit of text typically represented by a symbol, a letter, or a number. For example, 'A' is a character representing a letter of the Latin alphabet, '9' is a numeric character, and '#' is a special character used in various computer contexts. The Unicode computer standard consists of a repertoire of nearly 150,000 characters covering more than 150 writing systems.
[0035] A string is a sequence of characters used to represent text or data in a computer program. For example, 'Hello' is a string of characters corresponding to a word, '12345' is a string of characters composed of digits.
[0036] An acquired string of characters refers to any string of characters obtained via an electronic device, for example through methods such as keyboard input, speech recognition, a software probe, AI content generation, or optical character recognition (OCR). This could refer, for example, to a string acquired by OCR from a scanned document or a password entered in an online form.
[0037] The terms "regular expression," "rational expression," "pattern," or in English "regular expression" or "pattern" are often used interchangeably in certain contexts. In the context of this document, these terms are also used interchangeably to refer to a sequence or combination of characters that defines a pattern for purposes such as recognizing, searching, or replacing portions of text. It can, in particular, be used for searching for pattern matches in texts.
[0038] A pattern generally refers to a fixed sequence or a simple rule that can be used to recognize strings of characters. A pattern can be as simple as a specific sequence of characters or a set of very basic rules for identifying expected formats, for example, "\d{5}(-\d{4})?" represents the US zip code format or "l\d{10}" represents a series of 11 digits that begins with a 1. A regular expression or a "glob" pattern uses special syntax to define not only simple patterns but also, where appropriate, more complex operations such as repetitions, optional choices, and groupings. In this respect, regular expressions allow for flexible and advanced pattern searching within a text. The choice of defining a pattern via a simple pattern, a "glob" pattern, or a regular expression is an implementation choice dependent on the intended application and its associated needs.
[0039] Syntactic processing refers to an analysis of the formal structure of a string of characters to verify its conformity to one or more rules or patterns. This analysis can be applied to the grammar of a language but also to abstract structures not linked to a specific language, such as data formats or codes.
[0040] To designate syntactic processing not linked to any language, reference is made in this document to structural pattern processing. Structural pattern processing can, for example, be applied to the recognition and / or validation of telephone numbers, email addresses, URLs, IP addresses, MAC addresses, postal codes, identity card numbers, social security numbers, registration numbers, credit card numbers, bank account details, license plates, social network identifiers, invoice numbers, receipt numbers, document references, product codes, serial numbers, software license keys, geographical coordinates, order numbers, genomic sequences, numeric series, etc., based on predefined structural rules, for example, obeying a predefined pattern such as a combination of letters and numbers in a particular order.Such structural rules can, for example, be obtained by accessing a configuration file.
[0041] In contrast to syntactic processing, semantic processing analyzes the meaning and interpretation of words and sentences beyond their structure. It focuses on understanding content and context.
[0042] Similarity measures how closely two strings are related. It can be quantified using various metrics, of which the Levenshtein distance is a common example. The Levenshtein distance between two strings is the minimum number of simple modifications (insertion, deletion, replacement of a character) required to change one string into the other. The smaller the distance, the more similar the strings are considered to be. The Levenshtein distance is 0 when two strings are identical. For example, the distance between 'chat' and 'chat' is 0, indicating an exact match. A low Levenshtein distance indicates high similarity. For example, the distance between 'chat' and 'chats' is 1, because only one insertion is required. A higher distance indicates less similarity.For example, the distance between 'cat' and 'dog' is 3 (replace 'a' with 'i', replace 't' with 'e' and add 'n'), indicating a lower similarity.
[0043] Filtering, in the context of data processing, refers to the process of sorting and selecting certain entities while excluding others, based on predefined criteria. This process can be used to isolate elements that meet particular specifications, or to exclude those that do not, in order to obtain a more relevant dataset or one that conforms to the needs of a given application.
[0044] Filtering strings based on an exact match with a regular expression allows, for example, retaining only the strings that match one of a set of specific date formats, such as 'DD / MM / YYYY', 'DD.MM.YYYY', 'DD-MM-YYYY', or 'DDMMYYYY', while eliminating all other non-conforming strings. In this document, the strings thus retained are also referred to as filtered or filtered strings. In cases where flexibility is desired, filtering can also be based on similarity, using, for example, the Levenshtein distance to tolerate minor errors such as typos or character transpositions. For example, a date entered as '12 / 09 / 2022' could be accepted even if it is entered slightly incorrectly, such as '12-092022' or '12 / 09 / 202'.These strings, although imperfect, would still be considered filtered or filtered strings, as they are close enough to the required formats to be functional.
[0045] A module is a software and / or hardware component configured to perform one or more specific functions, possibly within a larger computer system.
[0046] The proposed technique is particularly useful in fields requiring high accuracy in text recognition, such as data entry, automated document management, transcription or automated response services where it is desirable to implement a search mechanism that is robust to errors regardless of their origin, for example, errors in input, transcription or recognition.
[0047] Methods based on context analysis enable the retrieval of information from a text provided by a document parser, which may, for example, be displayed on a screen or selected by a user. In this context, language analysis models make it possible to determine a context associated with a user's query and to propose solutions without requiring the user to explicitly formulate a search. In some cases, the search context may be linked to the detection of keywords entered by the user. The context analysis may contain a language model, which provides it with a certain robustness against detection errors caused by the document parser.
[0048] However, these methods are not suitable when the search does not concern a common or known word as entered in a dictionary but rather a particular pattern such as an invoice number or a serial number whose exact expression is a priori unknown but whose general structure is nevertheless known (for example a number, or a reference, composed of 5 letters and 6 numbers).
[0049] Furthermore, it is possible that the text provided by the document analyzer may contain errors of various origins, for example errors related to its capture, such as an omission of a character or an incorrect identification of a particular character (for example a "0", zero, detected instead of an "o", the lowercase letter "o").
[0050] One of the objectives of the proposed technique is to provide a robust pattern detection mechanism or service for these types of errors.
[0051] A robust solution consists of comparing the word set of a reference database to the word set provided by the document parser using a distance measurement algorithm such as a Levenshtein distance and its derivatives. However, in this case, the number of distance tests to be performed is significant. The computation has a quadratic complexity of O(n x m), where n is the number of words in the database and m is the number of words provided by the document parser. The complexity of this computation makes it costly in terms of processor resources and processing time.
[0052] Compared to the robust solution mentioned, the proposed technique is advantageous, in particular, because it allows the strings provided by the parser to be filtered beforehand, before being compared to the strings stored in the database, and because it helps to correct potential errors in the strings provided by the parser. This reduces the number of irrelevant strings to be compared while increasing the chances of finding the correct string in the database. Furthermore, the proposed technique can ensure, at least in certain embodiments, a high level of quality and accuracy in the recognition performed.
[0053] It is present refers to [Fig.1], which illustrates an example of a syntax processing system comprising: a pattern acquisition module 1, a pattern extension module 2, an image acquisition module 3, an image conversion module 4, an acquired string extension module 5, a filtering module 6, a dictionary 7, and an output module 8.
[0054] The pattern acquisition module 1 is configured to obtain, define, create, determine, receive, or configure one or more patterns intended to serve as a basis for identifying one or more relevant strings of characters in processed textual information. A pattern may also be understood to mean a regular expression or a syntactic structure. Module 1 may be implemented as a user interface allowing users to manually define patterns or as an automated software component capable of generating patterns based on predefined criteria. In some cases, it may include machine learning capabilities to adapt patterns based on previous examples and the results obtained. Module 1 may also receive at least some of the patterns and / or criteria from another electronic device (server, database, terminal) via a communication interface.
[0055] The pattern extension module 2 is configured to extend this pattern or these patterns to cover possible variants, thereby increasing the flexibility and scope of the search. For example, an initial pattern can be adjusted to include common spelling variants or typical typing errors. Module 2 can be implemented as an automated algorithm that generates variations of patterns based on linguistic rules or common error statistics. In some cases, this module can be integrated with Module 1 to form an extended pattern acquisition module, where pattern extensions are generated dynamically during their definition.
[0056] The image acquisition module 3 is configured to obtain, acquire or import An image, such as a screenshot, or any type of image file that displays a document or surface containing text information to be processed. The image serves as the data source for Module 4. Module 3 may include real-time image capture capabilities from cameras or scanners, or it may be configured to import existing image files. It may also include image preprocessing features, such as cropping or filtering to improve character recognition quality.
[0057] Module 4, the image-to-acquired character string conversion module, is configured to use optical character recognition (OCR) to convert captured images into plain text. It identifies visual characters and digitizes them to obtain an acquired character string.
[0058] Modules 3 and 4 can be replaced and / or supplemented by other types of text analyzers, such as a speech recognition module to convert audio recordings into text or handwriting recognition modules to convert handwritten notes into digital text. The OCR algorithm can can also be adjusted for different types of languages and characters, including non-Latin scripts or for different fonts and character formats.
[0059] Module 5, which extends the acquired character string, is configured to extend the character string provided by Module 4 to include possible variations. This may involve adding alternative characters based on their probabilities of occurrence and / or correcting typical errors identified during OCR analysis. Module 5 may include spelling and / or grammar correction algorithms, as well as probabilistic models for predicting the most likely character substitutions. This module may also be combined with Module 4 in an integrated system for obtaining a plurality of so-called "candidate" character strings, comprising both the acquired string and derived strings.Module 5 can also be configured to provide probabilities of occurrence for at least one of the characters in the string provided by Module 4, and for at least one (e.g., each) of those characters, one or more alternative characters with associated probabilities of occurrence. For example, for an acquired string, Module 5 might indicate that the character '0' has an 80% probability of being correct, but that it could also be '0' with a 15% probability, or 'Q' with a 5% probability. These probabilities of occurrence can be used to generate extended strings by taking into account the alternative characters and their respective probabilities of occurrence. Note that this extension is described as an illustrative example; candidate strings can be obtained in various ways that do not necessarily involve an extension Module 5.For example, several 4 modules can be used in parallel, each providing a respective candidate string, which, after deduplication, yields a set of distinct candidate strings.
[0060] The filtering module 6 is configured to obtain or determine a match between the character string provided by module 4 (extended by module 5) and the pattern provided by module 1 (optionally extended by module 2). It searches for exact or near-exact matches to filter the plurality of character strings based on their correspondence with the pattern provided by module 1 (optionally extended by module 2). Module 6 can use various similarity measurement algorithms, such as NFA or Thompson NFA.
[0061] Dictionary 7 is a database, for example stored on at least one computer memory, configured to store entries, for example references or examples of validated strings and / or patterns. It is used to process the string(s) filtered by module 6 and identify an exact or close match with the references stored in the dictionary. The dictionary can be static, containing pre-loaded data, or dynamic. It grows with new entries as the system learns and processes new strings of characters. It can also be shared across a network to allow access to a centralized database.
[0062] The output module 8 is configured to generate a final output associated with the acquired string. This output is based at least on the string(s) filtered by module 6 (for example, it could be the output of module 6 directly) and optionally on a selection, from dictionary 7, of at least one entry associated with the acquired string, based on a similarity between said entry and a candidate string resulting from the filtering. Module 8 can produce various forms of output, such as reports, data files, real-time alerts, or graphical visualizations. It can also include export capabilities to other systems or databases for later use.Module 8 can use various similarity measurement algorithms, such as Levenshtein distance, Jaccard distance, and / or neural network-based methods to evaluate the similarity between filtered strings and strings from the dictionary. It can also incorporate advanced filtering features, such as adaptive similarity thresholds or context-based weightings.
[0063] A feedback loop can be provided to adjust the system parameters in real time, basing the adjustments on the results obtained. For example, if a string is not found in dictionary 7, the system can send information back to previous modules to refine the patterns or similarity algorithms. The feedback loop can include machine learning components to continuously improve the accuracy of the process, or performance analysis modules to identify and correct inefficiencies in data processing.
[0064] In an example implementation of the system in [Fig. 1], a pattern is provided to the pattern-getting module 1. For this purpose, a regular expression is specified to module 1 by a user using a human-machine interface. An example of a regular expression denoted / [A,B,C]{3] / is understood as representing a string of characters comprising a series of three consecutive characters, each representing the letter A, the letter B, or the letter C. The strings AAB1024, CBA4802, and ABC5678 all provide an exact match to this example of a regular expression. In addition to the regular expression, the user can also specify various markers representing search instructions or parameters. For example, in a known manner, the regular expression can carry the marker 'g' indicating to perform a global search within a provided text and return all found matches.
[0065] In parallel, Module 4 provides a set of character strings representing a sequence of words displayed on a screen. An example of such a set of character strings is "the reference is AB(5678)". In this example, none of the character strings in the set exactly matches the regular expression / [A,B,C] {3} / because Module 4 mistakenly decoded the character "(" instead of the character "C". Module 4 can also provide a probability of occurrence for each of the characters in the character string 'AB(5678)'. As an example, an array of dummy numbers representing these probabilities of occurrence is shown in [Fig. 2]. Module 4 can also provide, for each of the characters in the character string 'AB(5678)', at least one replacement character and an associated probability of occurrence.As an example, a table 11 containing dummy data representing a replacement character for each character in the string 'AB(5678' and the probabilities of occurrence associated with each of these replacement characters is shown in [Fig.3]. .
[0066] The probabilities of occurrence of the characters from the parser can also be obtained from a source separate from the parser. For example, they can be provided in the form of fixed values that have been previously calculated and / or stored.
[0067] Figure 4 shows an example of a probability matrix that can be established from statistical correspondence data, for example, using machine learning algorithms with a large number of varied training samples. This matrix represents percentages of known errors (from, for example, such training) between a character from a character set and other characters from that set (for example, all other characters from that set). The character set can, for example, potentially include the lowercase and uppercase Latin alphabet, digits, and special characters. For example, the letter "O" can be tested against "0" with a 3% error, and the letter "C" against "(" with a 10% error. The probability matrix has a height and a width corresponding to the number of elements in the set.The columns represent acquired characters, and the rows represent potential replacement characters.
[0068] In an example embodiment, probabilities of occurrence provided by separate sources can be taken into account jointly. For example, a consolidated probability of occurrence of a character can be calculated as the average of the values obtained from the different sources.
[0069] The replacement characters allow, in combination with the characters of the acquired character string 'AB(5678'), to construct a plurality of character strings derived from this acquired character string.
[0070] The individual probability of occurrence of the characters also allows a score to be calculated, as a function of these probabilities, for at least one string of characters, namely both the acquired one and a string constructed from the acquired one. It is thus possible to make a list of candidate character strings from the characters provided by the parser and to order the list by ranking the candidate character strings according to their score (for example by ranking them by decreasing score in embodiments where a first string more probable than a second string is assigned a higher score than that of the second string, or by ranking them by increasing score in embodiments where a first string more probable than a second string is assigned a lower score than that of the second string).
[0071] Depending on the embodiment, various scoring methods can be used. The simplest method is to calculate the score as the average of the probabilities of occurrence of the characters that make up the string. For example, as illustrated in [Fig. 2], if a string consists of characters each having an individual probability of occurrence, the score is the arithmetic mean of these probabilities. In some cases, it may be useful to weight the probabilities of occurrence according to the relative importance of the characters in a specific context. For example, certain characters might have a higher weight if they are known to be critical for the correct recognition of the string. Another method is to use a cumulative score where penalties are applied for each replaced character.For example, if a replacement character has a significantly lower probability of occurrence than the original character, a proportional penalty could be applied. A combination of the aforementioned methods can also be used: for example, a weighted average could be combined with penalties to obtain a final score that is more representative of the overall reliability of the candidate string.
[0072] By way of illustration, continuing with the example of Figures 2 and 3, and limiting ourselves for each character of the acquired character string to a single corresponding replacement character, it is possible to classify the candidate character strings according to the general principle set out below, where CH1 designates the acquired character string 'AB(5678', the other candidate character strings are respectively designated by CH2, CH3, etc..., and each character string is associated with a score, global to the string, corresponding to the arithmetic mean of the probabilities of occurrence of the characters which constitute it.
[0073] For the acquired character string, it is possible to sort its characters according to the difference between the probability pCHl[i] of each character CHl[i] and the probability pRemp(CHl[i]) of its replacement character Remp(CHl[i]) (this difference The probability pCHl[i] - pRemp(CHl[i]) is also referred to hereafter as the replacement probability. For example, the characters of the acquired string can be sorted from the smallest probability difference to the largest. In this example, the order of the characters to be interchanged is given by PCARACTERES = [(7, A), (8, 5), (B, 6)].
[0074] We begin by interchanging the first character PCARACTERES[0] which is This generates two candidate strings, each associated with a corresponding overall score: AB(5678 - 73% ABC5678 - 72%.
[0075] Next, for each character string obtained, the character exchange is repeated with the second character, PCARACTERES[1], which is '7'. This generates a total of four candidate character strings that can be classified as follows: CH1: AB(5678 - 73% CH2: ABC5678 - 72% CH3: AB(56L8 - 67% CH4: ABC56L8 - 66%.
[0076] Finally, for each string obtained, we continue with the next character, replacing PCARACTERES [2], the A with the E. This generates a total of eight candidate strings: CH1: AB(5678 - 73% CH2: ABC5678 - 72% CH3: AB(56L8 - 67% CH4: ABC56L8 - 66% CH5: EBC5678 - 65% CH6: EBC56L8 - 64% CH7: EB(5678 - 63% CH8: EB(56L8 - 62%.
[0077] Thus, by generating and ordering the treatments with the probabilities of replacing the characters of the candidate strings according to their overall decreasing score, it is possible to establish a list where the candidate string with the highest score (i.e. the most probable overall) is the first to be compared to the defined pattern.
[0078] In the example provided, successive individual substitutions of characters by the substitution characters provided allow at most to obtain a list of 256 candidate character strings ranked by decreasing score, from: CH1 : AB(5678 - 73% up to CH256 : EBCS6LB' - 16%.
[0079] In this ordered list, it can be stipulated that the string CH1 with the highest score (AB(5678 - 73%)) is the first to be compared with the regular expression defined by module 1 (possibly extended by module 2). If this string does not exactly match the pattern, it can be stipulated that the next string CH2 in the list is compared with the regular expression, and so on until a match is found or all strings have been evaluated. This process ensures that the most probable string is evaluated first, thus optimizing resources and increasing the probability of finding a correct match quickly.
[0080] It may also be provided that the candidate strings are generated on the fly on the basis of one or more criteria.
[0081] For example, it may be planned to: First, compare the string CH1 'AB(5678') with the regular expression; the result of the comparison indicates no exact match in this case. Then, generate the string CH2 'ABC5678' and compare it with the regular expression; the result of the comparison indicates an exact match this time. to stop generating new strings and to keep the CH2 string 'ABC5678' as a filtered candidate string.
[0082] The criterion used in this example is that an exact match with the regular expression must be found to stop the generation and comparison of the strings, or in other words, to successively repeat the generation and comparison until an exact match is found and stop the generation and comparison when an exact match is found.
[0083] Several alternative criteria are conceivable for deciding whether or not to continue comparing strings with the regular expression and / or for deciding whether or not to continue generating new strings.
[0084] For example, one or a combination of the following criteria may be taken into account: a number of strings to generate and / or compare less than or equal to a first number (representing, for example, a maximum number of strings to generate and / or compare) a value of the overall probability score of an acquired or generated string greater than or equal to (less than or equal to depending on the embodiment) a first value (for example, constant and / or predefined, acting as a threshold), a measure of similarity, particularly for applications not requiring an exact match with the regular expression, A processing time for generating and comparing strings (which must, for example, remain less than or equal to a first, constant and / or predefined duration, acting as a threshold), and a system resource utilization rate, such as CPU or memory usage.
[0085] These criteria can be taken into account as thresholds or more flexibly, depending on the application's needs. For example, strings could be generated until a first value (used, for example, as a threshold) of the overall probability score is reached, or until all available possibilities are exhausted. The criteria can be adjusted, for example, dynamically, to find an optimal balance between accuracy and efficiency.
[0086] When obtaining an exact match with the regular expression is not retained as a criterion for stopping the comparison of candidate strings, it is possible to obtain, at the end of the filtering, for a string obtained from the parser, a plurality of filtered candidate strings.
[0087] As an alternative, it is possible to provide for preprocessing the regular expression, / [A,B,C]{3] / . For example, the regular expression can be transformed into an extended regular expression / [A,B,C]{2,3] / which encompasses any string containing a sequence of two or three consecutive letters from among A, B, and C. Such an approach is useful when the parser, for example an OCR parser, may fail to detect the first letter of a string 'ABC5678' and thus mistakenly acquires the string 'BC5678'. It can then be provided, when the detected string contains only a sequence of two consecutive letters from among A, B, and C, for the generation of additional strings by adding a third letter to the sequence. The addition can be made only at the beginning or end of the sequence or exhaustively at all possible positions.
[0088] Even in the case of cumulative errors, for example in the case of acquisition of a string of characters 'B(5678', the processes proposed above can help to correct the errors and successfully reconstruct the correct string of characters 'ABC5678'.
[0089] A scenario is now considered in which one or more filtered candidate strings are obtained as a result of the filtering.
[0090] To check if this or these candidate string(s) is / are referenced in dictionary 7, one possibility is to use the Levenshtein distance to compare in turn the dictionary references with each of the filtered candidate strings.
[0091] Let us take as an example an invoice management system where it is necessary to identify an invoice number appearing in an OCR-processed document. Suppose that the OCR analyzer provides 100 possible versions of the character string corresponding to the invoice number. With a classic method based on exact similarity, it would be necessary to perform a million similarity calculations to compare each version provided by the OCR with the 10,000 references present in the dictionary.
[0092] Furthermore, it is possible that none of the 100 strings provided by the parser will exactly match a reference in the dictionary. In this case, the conventional method would fail to recognize a reference that is nevertheless present, leading to errors in invoice processing.
[0093] The proposed technique frequently makes it possible to retain only a small number of character strings through filtering, for example 3 or 4 out of the 100 possible strings provided by the OCR analyzer. Thus, in the example considered, the number of similarity measurements to be performed is reduced proportionally, which represents a significant gain in terms of resource usage.
[0094] Furthermore, the proposed technique makes it possible to generate strings derived from a string acquired by the OCR analyzer. Tests applied to the search for references in a database resulted in a success rate of 98%, demonstrating the robustness of the proposed technique to errors originating from the OCR analyzer. Industrial application
[0095] These technical solutions can be applied to a wide range of industries requiring accurate and efficient processing of character strings. Examples of applications include, but are not limited to, information verification in the banking sector, processing of patient records and examination results in the medical field, order and delivery data management in e-commerce, and the management of official documents in public administration. These technical solutions can also be integrated into content management systems, customer service platforms, word processing applications, data analysis software, voice command interfaces, machine translation systems, and so on.
[0096] This disclosure is not limited to the examples described above, which are only examples, but encompasses all the variations that a person skilled in the art may consider in the context of the protection sought.
Claims
Demands
1. A method, at least partially automatic, for syntactic processing of a string of characters acquired by an electronic device (4, 5), the method comprising: filtering a plurality of candidate strings of characters obtained from said acquired string of characters according to a correspondence between a regular expression and at least one of the candidate strings of characters.
2. A method according to claim 1, further comprising: a selection, in a database (1, 2), of an entry associated with the acquired string of characters, based on a similarity between said entry and a candidate string of characters resulting from the filtering.
3. A method according to any one of the preceding claims, wherein the filtering takes into account a number of candidate strings obtained.
4. A method according to any one of the preceding claims, wherein the filtering takes into account at least one individual probability of occurrence of at least one character of at least one of the candidate strings.
5. A method according to any one of claims 1 to 3, wherein the filtering takes into account an overall probability score of one of the candidate character strings, said overall probability score taking into account individual probabilities of occurrence of at least some of the characters of said string.
6. A method according to the preceding claim, wherein the probability of individual occurrence of a character is provided with at least one of the candidate character strings as a result of parsing the character string acquired by a parser (4, 5).
7. A method according to claim 5, wherein the probability of individual occurrence of a character takes into account at least one known or expected error value between the character and at least one replacement character.
8. A method according to any one of the preceding claims, wherein the regular expression is previously specified or is an extension of a previously specified regular expression proposal.
9. A method according to any one of the preceding claims, wherein the plurality of candidate strings comprises at least a first candidate string and a second candidate string obtained from processing the first candidate string.
10. Syntax processing module (6) of a string of characters acquired by an electronic device (4, 5), configured to: filter a plurality of candidate strings obtained from said acquired string of characters according to a correspondence between a regular expression and at least one of the candidate strings of characters.
Citation Information
Patent Citations
Document character string code matching method and device based on similarity
CN114168809A
Accelerated regular expression evaluation using positional information
US20140297262A1