System and module for processing a character string
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 text recognition and data processing.
Patent Information
- Application Number
- PCT/EP2025/067253
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-06-24
- Filing Date
- 2025-06-19
- Publication Date
- 2026-01-02
AI Technical Summary
Traditional string processing methods lack robustness to errors, particularly in optical character recognition, limiting their effectiveness in practical applications.
A method and module for syntactic processing of character strings that filters candidate strings based on a correspondence with a regular expression, considering individual character probabilities and error probabilities to enhance accuracy and efficiency.
This approach significantly improves the accuracy and efficiency of text recognition and data processing by reducing unnecessary data processing, correcting errors, and optimizing resource usage.
Smart Images

Figure EP2025067253_02012026_PF_FP_ABST
Abstract
Description
Description Title: String Processing Method and Module technical field
[0001] This disclosure falls within the domain of word processing. More specifically, it concerns 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 accurate character recognition without robustness to errors, for example the common errors observed especially 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 handling errors in character string recognition. Summary
[0004] This disclosure improves the situation.
[0005] A method is proposed, at least partially automatic, for the syntactic processing of a string of characters acquired by an electronic device, the method comprising a filtering of 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 some embodiments, to significantly improve 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 (e.g., legal or medical documents). The proposed method can be used in any application requiring robust string identification, even in the presence of potential input or recognition errors. By filtering candidate strings based on their matching to a regular expression, the proposed method limits (e.g., minimizes) the risk of error by considering only the strings most likely to match the expected expression.This optimizes processing by reducing the volume of unnecessary data processed, thus increasing processing efficiency and speed. Matching, also called adequacy, compatibility, or concordance, refers to the degree of concordance (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. A match 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 tolerated discrepancies, such as minor typos or format variations.
[0007] According to another aspect, a syntactic processing module is proposed 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 based on a correspondence between a regular expression and at least one of the candidate strings.
[0008] In another aspect, a computer program is proposed that includes instructions for implementing all or part of a process as defined herein when executed by a processor. In 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 string. A possible application is in customer database management. For example, implementing this process before initiating a database search to identify an account associated with a given phone 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) unnecessary or erroneous queries and improving the speed and efficiency of database searches.
[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 system resource management. 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 from 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 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 character string, 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 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) error values between characters allows for the anticipation and automatic correction of typical errors, such as those often encountered in inputs generated by speech recognition or optical character recognition (OCR) interfaces. For example, in voice command applications, this significantly reduces 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 background characters may vary, such as in OCR for video subtitles.Conversely, using predetermined values (constant or configurable) may be more appropriate for applications where errors follow more consistent patterns, such as in input correction. Computer input errors depend, among other things, on the written language and the input method. For example, in OCR, typical errors include confusing '0' (zero) with 'O' (the capital letter 'O'). In dictaphones, errors due to phonetic similarity, such as between "vert" (green), "vers" (towards), and "verre" (glass), are common. For keyboard input, errors are often related to the proximity of keys, such as between 'r' and 't'.
[0020] In one example, the regular expression is either specified beforehand 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 including by substitution of characters of certain words or phrases, 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 doesn't match the specified regular expression, a second string is generated from the first and compared again. If this second string also fails to find a match, a third can be generated from one of the previous two. This iterative process can continue 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 upon reading the detailed description below and analyzing the attached drawings, on 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 of 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 possible replacement characters for each character in a sample string acquired by a parser, along with fictional examples of occurrence probabilities associated with each replacement character. Fig. 4
[0028] [Fig. 4] shows a probability matrix establishing fictional examples of known error percentages between different characters in the character set. Description of the implementation methods
[0029] In the description that follows, identical reference numbers denote 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.
[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 based on a match between a regular expression and at least one of the candidate strings.
[0032] Any suitable hardware and / or software may be used for the practical implementation of this 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 encompass computer memory that can be connected to a processor, which may be connected to a communication interface. This memory stores instructions that, 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 refers to 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). A processor can be designed to perform general or specific tasks and can be integrated into various devices and systems to perform 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 refers to any string of characters obtained via an electronic device, for example through methods such as keyboard input, speech recognition, software probing, 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 into an online form.
[0037] The terms "regular expression," "rational expression," "pattern," or in English "regular expression" or "pattern," are often used interchangeably in some 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 model for purposes such as recognizing, searching for, or replacing portions of text. It can notably be used for finding pattern matches in texts.
[0038] A pattern generally refers to a fixed sequence or 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 very basic set of rules for identifying expected formats; for example, "\d{5}(-\d{4})?" represents the US zip code format, or "1 \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 way, 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 that depends on the intended application and its associated requirements.
[0039] Syntactic processing refers to the 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 tied to a specific language, such as data formats or codes.
[0040] To refer to syntactic processing not tied to any particular language, this document uses the term "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 media identifiers, invoice numbers, receipt numbers, document references, product codes, serial numbers, software license keys, geographic coordinates, order numbers, genomic sequences, numeric series, etc., based on predefined structural rules, for example, following a predefined pattern such as a combination of letters and numbers in a specific 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, or 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 'cat' and 'cat' is 0, indicating an exact match. A low Levenshtein distance indicates high similarity. For example, the distance between 'cat' and 'cats' is 1, since only one insertion is needed. A higher distance indicates less similarity. For example, the distance between 'cat' and 'dog' is 3 (replace 'a' with ï, replace 't' with 'e', and add 'n'), indicating lower similarity.
[0043] In the context of data processing, filtering 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 specific requirements, 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, keeping 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-compliant 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 instance, 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, input, transcription or recognition errors.
[0047] Context-based methods enable information retrieval within text provided by a document analyzer, which may, for example, be displayed on a screen or selected by a user. In this context, language analysis models determine the context associated with a user's query and suggest 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 can incorporate a language model, which provides robustness against detection errors caused by the document analyzer.
[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 contains 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 involves comparing the word set in 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, this requires a significant number of distance tests. The computation has a quadratic complexity of O(n*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 expensive in terms of both processor resources and processing time.
[0052] Compared to the robust solution mentioned earlier, the proposed technique is advantageous, particularly because it allows for pre-filtering the strings provided by the parser before comparing them to the strings stored in the database, and because it helps 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 some embodiments, a high level of quality and accuracy in the recognition performed.
[0053] It is present refers to Figure 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-to-acquired string conversion module 4, an acquired string extension module 5, a filtering module 6, a dictionary 7, and an output module 8.
[0054] 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 identification One or more relevant strings of characters within processed text information. A pattern can also be understood as a regular expression or a syntactic structure. Module 1 can 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 results. Module 1 can 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 the pattern(s) 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 pattern variations 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 as they are defined.
[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 depicts a document or surface containing text information to be processed. The image serves as the data source for Module 4. Module 3 can include real-time image capture capabilities from cameras or scanners, or it can be configured to import existing image files. It can also include image preprocessing features, such as cropping or filtering, to improve character recognition quality.
[0057] Module 4, the image-to-acquired 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 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 to text or handwriting recognition modules to convert handwritten notes into digital text. The OCR algorithm 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, the Acquired String Extension Module, is configured to extend the character string provided by Module 4 to include possible variations. This can involve adding alternative characters based on their probabilities of occurrence and / or correcting typical errors identified during OCR analysis. Module 5 can include spelling and / or grammar correction algorithms, as well as probabilistic models to predict the most likely character substitutions. This module can 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 of the character string provided by module 4 and, for at least one (e.g., each) character in question, one or more alternative characters with associated probabilities of occurrence. For example, for an acquired string, module 5 might indicate that the character 'O' 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 character 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 character 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 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 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, such as 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 near-exact match with the references stored in the dictionary. The dictionary can be static, containing pre-loaded data, or dynamic, growing with new entries as the system learns and processes new strings. 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 that entry and a candidate string resulting from the filtering. Module 8 can produce various output formats, 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 weighting.
[0063] A feedback loop can be implemented to adjust system parameters in real time, basing 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 process accuracy, or performance analysis modules to identify and correct inefficiencies in data processing.
[0064] In an example implementation of the system in Figure 1, a pattern is provided to the pattern-getting module 1. For this, a regular expression is specified to module 1 by a user via a human-machine interface. An example regular expression denoted / [A,B,C]{3} / is understood to represent a string of characters consisting of 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 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 strings representing a sequence of words displayed on a screen. An example of such a set is "the reference is AB(5678)". In this example, none of the 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 character in the string 'AB(5678)'. As an example, an array of dummy numbers representing these probabilities is shown in Figure 2. Module 4 can also provide, for each character in the string 'AB(5678)', at least one replacement character and its associated probability of occurrence.As an example, a table 11 compiling fictitious 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 Figure 3.
[0066] The probabilities of occurrence of characters from the parser can also be obtained from a source separate from the parser. For example, they can be provided as fixed values that have been previously calculated and / or stored.
[0067] Figure 4 shows an example of a probability matrix that can be constructed 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 such training, for example) between a character from a character set and other characters from that set (for example, all other characters in that set). The character set might, for example, include The set potentially includes lowercase and uppercase Latin letters, numbers, and special characters. For example, the letter "O" can be tested against "0" with a 3% margin of error, and the letter "C" against "(" with a 10% margin of error. The probability matrix has a height and width corresponding to the number of elements in the set. The columns represent known characters, and the rows represent potential replacement characters.
[0068] In an example implementation, probabilities of occurrence provided by separate sources can be considered together. 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 string 'AB(5678'), the construction of a plurality of strings derived from this acquired string.
[0070] Furthermore, the individual probability of occurrence of characters allows for the calculation of a score, based on these probabilities, for at least one string of characters, namely both the acquired string and a string constructed from the acquired string. It is thus possible to create a list of candidate strings from the characters provided by the parser and to order the list by ranking the candidate strings according to their score (for example, by ranking them in descending order of score in embodiments where a first string that is more probable than a second string is assigned a higher score than that second string, or by ranking them in ascending order of score in embodiments where a first string that is more probable than a second string is assigned a lower score than that 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 Figure 2, if a string consists of characters each with 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] As an illustration, continuing with the example of Figures 2 and 3, and limiting ourselves for each character of the acquired string to a single corresponding replacement character, it is possible to classify the candidate strings according to the general principle explained below. afterwards, where CH1 designates the acquired string of characters 'AB(5678', the other candidate strings of characters are respectively designated by CH2, CH3, etc..., and each string of characters 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 string, it is possible to sort its characters according to the difference between the probability pCH1[i] of each character CH1[i] and the probability pRemp(CH1[i]) of its replacement character Remp(CH1[i]) (this difference in probability pCH1[i] - pRemp(CH1[i]) is also called the replacement probability hereafter). For example, the characters of the acquired string can be sorted from the smallest difference in probability 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 start 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 with the provided substitution characters allow us to obtain a maximum list of 256 candidate strings ranked by decreasing score, from: CH1: AB(5678 - 73% up to CH256: EBCS6LB' - 16%.
[0079] In this ordered list, it can be expected that the string CH1 with the highest score (AB(5678 - 73%)) will be 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, the next string CH2 in the list can be 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 likely string is evaluated first, thus optimizing resources and increasing the probability of finding a correct match quickly.
[0080] It can also be provided that candidate strings are generated on the fly based on 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 indicating no exact match in this case, then generate the string CH2 'ABC5678' and compare it with the regular expression, the result of the comparison this time indicating an exact match, and stop generating new strings and keep the string CH2 '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 character 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 be generated and / or compared less than or equal to a first number (representing, for example, a maximum number of strings to be generated and / or compared); a value for 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, a constant and / or predefined value acting as a threshold); a similarity measure, particularly for applications not requiring a match exact with the regular expression, a processing time for the generation and comparison of strings (which must, for example, remain less than or equal to a first duration, constant and / or predefined, acting as a threshold), a rate of use of system resources, such as CPU or memory occupancy.
[0085] These criteria can be applied as thresholds or more flexibly, depending on the application's needs. For example, strings could be generated until a first value (used, for instance, 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 used as a criterion for stopping the comparison of candidate strings, it is possible to obtain, after filtering, for a string obtained from the parser, a plurality of filtered candidate strings.
[0087] As an alternative, it is possible to preprocess the regular expression, Z[A,B,C]{3} / . For example, the regular expression can be transformed into an extended regular expression / [A,B,C]{2,3} / that encompasses any string containing a sequence of two or three consecutive letters from A, B, and C. This approach is useful when the parser, for example, an OCR analyzer, might fail to detect the first letter of a string like 'ABC5678' and thus mistakenly acquires the string 'BC5678'. Then, when the detected string contains only a sequence of two consecutive letters from A, B, and C, it is possible to generate 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 across all possible positions.
[0088] Even in the case of cumulative errors, for example in the case of acquiring 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's take as an example an invoice management system where it's necessary to identify an invoice number appearing in an "OCR-processed" document (i.e., appearing in the result of an OCR analysis of the document). Suppose 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 calculations of similarity 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 standard method would fail to recognize a reference that is nevertheless present, leading to errors in invoice processing.
[0093] The proposed technique often allows us 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 proportionally reduced, which represents a significant gain in terms of resource usage.
[0094] Furthermore, the proposed technique allows for the generation of derived strings from a string acquired by the OCR analyzer. Tests applied to reference searches in a database resulted in a 98% success rate, demonstrating the robustness of the proposed technique to errors originating from the OCR analyzer. Industrial application
[0095] These technical solutions can be applied across 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 patient records and test results in the medical field, managing order and delivery data in e-commerce, and managing 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 more.
[0096] This disclosure is not limited to the examples described above, which are merely 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 character string, based on a similarity between said entry and a candidate character string 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.
11. A computer program comprising instructions for carrying out all or part of a method according to at least one of claims 1 to 9, when said program is executed by a processor.
12. Non-transient, computer-readable recording medium on which such a computer program is recorded, comprising instructions for carrying out all or part of a method according to at least one of claims 1 to 9, when said program is executed by a processor.
Citation Information
Patent Citations
Document character string code matching method and device based on similarity
CN114168809A
Auto-correction of pattern defined strings
US10963717B1
Accelerated regular expression evaluation using positional information
US20140297262A1