A method, device, medium, equipment and product for recognizing a Bengali compound character form
By filtering target Bengali character sequences and executing the longest matching algorithm, the accuracy and efficiency issues of Bengali compound glyph recognition are solved, achieving efficient and accurate compound glyph recognition and display, suitable for resource-constrained devices.
Patent Information
- Application Number
- CN202611127214.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-28
- Publication Date
- 2026-11-06
AI Technical Summary
Existing technologies struggle to balance accuracy and processing efficiency in recognizing Bengali compound glyphs, especially when there are many compound glyph combinations and dynamic input, which can easily lead to recognition errors or missing display.
By filtering target Bengali character sequences that meet the criteria for recognizing compound glyphs from the string to be recognized, and executing the longest matching algorithm, the target Bengali compound glyphs are determined. Then, by combining the preset glyph encoding mapping table for replacement and vowel adjustment, the recognition accuracy and efficiency are improved.
While reducing computational load, it improves the accuracy and completeness of Bengali complex glyph recognition, reduces display anomalies, and is suitable for resource-constrained devices.
Smart Images

Figure CN123048824A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital processing technology, and in particular to a method, apparatus, medium, device, and product for recognizing compound Bengali characters. Background Technology
[0002] Bengali typically employs a compound glyph mechanism and a vowel-dependent mechanism when written and displayed. When processing Bengali text for display, if the characters are output one by one in the character encoding order, it is easy to cause the compound glyphs to be not recognized correctly or to display in an abnormal order.
[0003] In existing technologies, OpenType complex text layout technology is typically used to achieve glyph replacement and glyph positioning for complex scripts such as Bengali. This approach generally relies on font tables such as GSUB / GPOS and complex text layout engines, and can achieve relatively complete complex text display effects. However, this approach usually requires a large amount of RAM and storage space, resulting in low processing efficiency.
[0004] Other solutions employ Unicode pre-combined characters or predefined compound glyph encodings for display processing, directly calling the corresponding compound glyphs from existing encodings. However, Bengali has a large number of compound glyph combinations, and Unicode predefined or existing glyph encodings cannot cover all combinations. Furthermore, they have poor recognition capabilities for dynamically input character combinations. That is, when the input text contains undefined consonant combinations or long compound combinations, these solutions are prone to problems such as being unable to recognize, incorrectly splitting, or displaying missing characters.
[0005] Some schemes use static string lookup tables to match and replace the input text. These schemes are relatively simple to implement, but they usually match in a fixed order or according to the first-hit principle. When both shorter and longer compound glyph strings exist in the glyph table, if the shorter string is matched first and replaced immediately, the longer compound glyph, which should be recognized as a whole, may be incorrectly split, thus reducing the accuracy of Bengali compound glyph recognition.
[0006] In summary, existing technologies struggle to balance accuracy and processing efficiency in Bengali complex glyph recognition. Summary of the Invention
[0007] The purpose of this invention is to propose a method, apparatus, medium, device, and product for recognizing Bengali compound glyphs. By determining the target Bengali character sequence that meets the recognition conditions from the string to be recognized, and performing the longest matching algorithm on each target Bengali character sequence, the target Bengali compound glyphs in the target Bengali character sequence are determined, thereby improving the processing efficiency and accuracy of Bengali compound glyph recognition.
[0008] To achieve the above objectives, a first aspect of the present invention provides a method for recognizing compound Bengali characters, the method comprising: Obtain the string to be recognized, and determine the target Bengali character sequence that meets the composite glyph recognition conditions from the string to be recognized; The longest matching algorithm is performed on each of the target Bengali character sequences to determine the target Bengali compound glyphs in each of the target Bengali character sequences.
[0009] In this embodiment, by filtering target Bengali character sequences that meet the conditions for recognizing compound glyphs from the string to be recognized, and performing the longest matching algorithm only on the target Bengali character sequences, the accuracy of Bengali compound glyph recognition is improved while reducing the computational load of compound glyph recognition.
[0010] Further, determining the target Bengali character sequence that satisfies the composite glyph recognition condition from the string to be recognized includes: The string to be identified is decoded to obtain the encoded value of each character in the string to be identified; Based on the encoding values of each character in the string to be identified, the Bengali characters in the string to be identified are segmented into character sequences to obtain several Bengali character sequences; The encoding length of each Bengali character sequence is determined, and the Bengali character sequences whose encoding length is greater than a preset encoding length threshold are identified as target Bengali character sequences.
[0011] This embodiment can accurately distinguish between Bengali and non-Bengali character segments in the string to be identified, and filter out short character sequences that do not meet the conditions for compound glyph recognition, thereby improving the processing efficiency of subsequent compound glyph recognition.
[0012] Further, based on the encoding values of each character in the string to be identified, the Bengali characters in the string to be identified are segmented into character sequences to obtain several Bengali character sequences, including: According to the order of the characters in the string to be identified, the encoded values of each character in the string to be identified are identified sequentially; When the encoding value of the current character is within the preset Bengali encoding range, and the encoding value of the previous character is not within the preset Bengali encoding range, the current character is determined as the first character of the current Bengali character sequence; Starting from the first character of the current Bengali character sequence, the encoding values of subsequent characters are identified sequentially until the first non-Bengali character whose encoding value is not within the preset Bengali encoding range is identified; The preceding character of the first non-Bengali character is determined as the last character of the current Bengali character sequence, and based on the first character and the last character, the corresponding consecutive Bengali characters are extracted from the string to be identified to obtain a Bengali character sequence; Continue recognizing characters following the first non-Bengali character until all characters in the string to be recognized have been recognized, resulting in several Bengali character sequences.
[0013] In this embodiment, several consecutive Bengali character sequences are extracted from a multilingual mixed string, thereby improving the accuracy of subsequent Bengali character sequence recognition.
[0014] Further, the step of performing the longest matching algorithm on each of the target Bengali character sequences to determine the target Bengali compound glyphs in each of the target Bengali character sequences includes: Take any of the target Bengali character sequences as the target character sequence to be matched; According to the order of the characters in the target character sequence to be matched, each character in the target character sequence to be matched is determined as the starting point of the candidate substring, and each character after the starting point of the candidate substring is determined as the ending point of the candidate substring. Based on the starting point and ending point of each candidate substring, the corresponding candidate character substring is extracted from the target character sequence to be matched. Each candidate character substring is matched with a Bengali compound glyph string in a preset compound glyph string table; when a candidate character substring is found that matches a preset Bengali compound glyph string in the preset compound glyph string table, the character length of each successfully matched candidate character substring is determined. The longest matching candidate character substring is identified as the target Bengali compound glyph in the target character sequence to be matched.
[0015] In this embodiment, the longest matching candidate character substring is identified as the target Bengali compound glyph, which avoids shorter compound glyph strings from covering longer ones, thereby improving the completeness and accuracy of recognizing complex Bengali compound glyphs.
[0016] Furthermore, it also includes: Based on a preset glyph encoding mapping table, the target Bengali compound glyphs are replaced with the corresponding target glyph encodings to generate an initial output character sequence; Detect whether there are unit-dependent vowels in the initial output character sequence; If the unit-dependent vowel exists, the consonant character associated with the unit-dependent vowel is determined, and the unit-dependent vowel is adjusted to precede the associated consonant character to update the target Bengali compound glyph.
[0017] This embodiment can improve the display abnormality problem caused by the inconsistency between the storage order and display order of unit-dependent vowels.
[0018] Furthermore, it also includes: Detect whether there are bigram dependent vowels in the initial output character sequence; If the binary dependent vowel exists, the binary dependent vowel is split into a left vowel component and a right vowel component to update the target Bengali compound glyph.
[0019] This embodiment can improve the processing accuracy of Bengali character sequences containing bigram-dependent vowels.
[0020] To achieve the above objectives, a second aspect of the present invention also provides a Bengali complex glyph recognition device for implementing the Bengali complex glyph recognition method described in any of the first aspects, the device comprising: A Bengali character sequence filtering module is used to acquire a string to be identified and to determine a target Bengali character sequence that meets the composite glyph recognition conditions from the string to be identified. The Bengali compound glyph recognition module is used to perform the longest matching algorithm on each of the target Bengali character sequences to determine the target Bengali compound glyphs in each of the target Bengali character sequences.
[0021] A third aspect of the present invention also provides a computer-readable storage medium comprising a stored computer program; wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform a Bengali compound glyph recognition method as described in any of the first aspects above.
[0022] A fourth aspect of the present invention also provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements a Bengali compound glyph recognition method as described in any of the first aspects above.
[0023] The fifth aspect of the present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a Bengali compound glyph recognition method as described in any of the first aspects above. Attached Figure Description
[0024] Figure 1 This is a flowchart of a preferred embodiment of a Bengali compound glyph recognition method provided in the first aspect of the present invention; Figure 2 This is a flowchart of a preferred embodiment of a Bengali compound glyph recognition method provided in the first aspect of the present invention, which is a vowel-dependent detection flowchart. Figure 3 This is a structural block diagram of a preferred embodiment of a Bengali compound glyph recognition device provided in the second aspect of the present invention; Figure 4 This is a structural block diagram of a preferred embodiment of a terminal device provided in the fourth aspect of the present invention. Detailed Implementation
[0025] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0026] It should be noted that the data involved in this invention (including but not limited to data used for analysis, data stored, data displayed, etc.) are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of related data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0027] In this embodiment of the invention, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplarily" or "for example" in this invention should not be construed as being more preferred or advantageous than other embodiments or designs. Rather, the use of the words "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.
[0028] In this invention description, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first," "second," "third," etc., may explicitly or implicitly include one or more of that feature. In this invention description, unless otherwise stated, "a plurality of" means two or more. In this invention description, the term "comprising" and its variations are open-ended, meaning "including but not limited to." The term "based on" means "at least partially based on." The term "according to" means "at least partially according to." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments."
[0029] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0030] In the description of this invention, it should be noted that, unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this specification is for the purpose of describing specific embodiments only and is not intended to limit the invention. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0031] The following explains some related technical terms involved in the embodiments of the present invention: Bengali is a Brahmi script, characterized by its complex glyphic mechanism and vowel-dependent mechanism.
[0032] (1) Compound glyph mechanism: The compound glyph mechanism refers to the ability of multiple consonant characters to combine into a single visual glyph under specific combination relationships. There are many compound glyph combinations in Bengali. Therefore, if the characters are output one by one in the character encoding order during the text display process, the compound glyphs may not be accurately presented.
[0033] (2) Vowel-dependent mechanism: The vowel-dependent mechanism refers to the fact that vowel markers are not always displayed as independent characters, but are usually attached to the front, back, top, or bottom of consonant characters or compound glyphs. Since the storage order of the vowel-dependent characters may not be consistent with the actual rendering order, their relative positions need to be adjusted according to the type of the vowel-dependent character during the display process.
[0034] The technical solution of the present invention will be further described below with reference to specific embodiments: The first aspect of this invention provides a method for recognizing compound Bengali characters, see [link to relevant documentation]. Figure 1 The diagram shown is a flowchart of a preferred embodiment of a Bengali compound glyph recognition method provided in the first aspect of the present invention. The method includes steps S1 to S2, as follows: Step S1: Obtain the string to be recognized, and determine the target Bengali character sequence that meets the composite glyph recognition conditions from the string to be recognized; The string to be recognized may include Bengali characters or non-Bengali characters, such as English characters, numeric characters, punctuation marks, or characters from other languages. After acquiring the string to be recognized, the device can perform character recognition on the string and filter out character sequences that may form Bengali compound glyphs from the string as the target Bengali character sequence.
[0035] In one example, the electronic device identifies Bengali characters in the string to be identified based on the encoding values of each character, and divides consecutively appearing Bengali characters into Bengali character sequences. For Bengali character sequences that do not meet the conditions for compound glyph recognition, compound glyph recognition processing is not performed, while for Bengali character sequences that meet the conditions for compound glyph recognition, they are identified as the target Bengali character sequence.
[0036] It should be noted that the composite character recognition conditions can be set according to the actual application scenario. The specific composite character recognition conditions can be configured according to the device performance, the coverage of the character table, the display requirements or the encoding rules. This embodiment of the invention does not impose specific limitations on this.
[0037] Understandably, by first determining the target Bengali character sequence, we can avoid directly performing compound glyph matching on the entire string to be recognized, thereby reducing the interference of non-Bengali characters on the compound glyph recognition process.
[0038] Step S2: Perform the longest matching algorithm on each of the target Bengali character sequences to determine the target Bengali compound glyphs in each of the target Bengali character sequences.
[0039] Specifically, after determining the target Bengali character sequence, compound glyph matching is performed on each target Bengali character sequence. For any target Bengali character sequence, multiple candidate character combinations are determined from the target Bengali character sequence, and each candidate character combination is matched with preset compound glyph data; when there are multiple matching candidate character combinations, the candidate character combination with the longest character length is selected from the multiple matching candidate character combinations according to the longest matching principle, as the target Bengali compound glyph.
[0040] In one example, a target Bengali character sequence may contain both short and long compound glyph combinations. If the first-hit method is used for recognition, the shorter compound glyph combination may be identified first, causing the longer compound glyph combination to be broken down. Based on this, this embodiment of the invention uses a longest matching algorithm to prioritize the longer matching result, thereby improving the completeness of Bengali compound glyph recognition.
[0041] It should be noted that the longest matching algorithm can be implemented using character-by-character expansion matching, candidate substring enumeration matching, lookup table-based matching, trie-based matching, or other methods that can determine the longest matching result. This embodiment of the invention does not impose specific limitations on this method. Any algorithm that can determine the longest matching result among multiple successfully matched candidate character combinations can be used as the longest matching algorithm in this embodiment of the invention.
[0042] In this embodiment, by filtering target Bengali character sequences that meet the conditions for recognizing compound glyphs from the string to be recognized, and performing the longest matching algorithm only on the target Bengali character sequences, invalid matching of non-Bengali characters or character sequences that do not meet the conditions for forming compound glyphs can be avoided. This reduces the computational load of compound glyph recognition while improving the accuracy of Bengali compound glyph recognition.
[0043] In another preferred embodiment, determining the target Bengali character sequence that satisfies the composite glyph recognition condition from the string to be recognized includes: The string to be identified is decoded to obtain the encoded value of each character in the string to be identified; Based on the encoding values of each character in the string to be identified, the Bengali characters in the string to be identified are segmented into character sequences to obtain several Bengali character sequences; The encoding length of each Bengali character sequence is determined, and the Bengali character sequences whose encoding length is greater than a preset encoding length threshold are identified as target Bengali character sequences.
[0044] The process of decoding the string to be identified includes performing UTF-8 decoding on each character in the string to obtain the Unicode encoding value corresponding to each character. Further, based on the Unicode encoding value of each character, it is determined whether the corresponding character belongs to the Bengali language. Specifically, when the Unicode encoding value of a character is within a preset Bengali encoding range, the character is determined to be a Bengali character; when the Unicode encoding value of a character is not within the preset Bengali encoding range, the character is determined to be a non-Bengali character.
[0045] Before processing the string to be recognized, an input buffer, an output buffer, or an intermediate buffer is allocated, and a pointer indicating the current reading position is initialized. As the pointer moves along the order of the string to be recognized, the encoded value of each character is read sequentially, and Bengali characters and non-Bengali characters are classified and processed according to the encoded value.
[0046] In one example, identified Bengali characters are written to an intermediate buffer, and identified non-Bengali characters are used as delimiters or delimiters. If at least one Bengali character is detected in the string to be identified, a Bengali character detection flag can be set, and character sequence segmentation can continue; if no Bengali character is detected, the string to be identified can be returned directly without performing subsequent compound glyph recognition processing.
[0047] Furthermore, after obtaining several Bengali character sequences, the encoding length of each Bengali character sequence is determined. If the encoding length of a Bengali character sequence is greater than a preset encoding length threshold, it indicates that the Bengali character sequence may contain character combinations that can form compound glyphs, and it is identified as the target Bengali character sequence; if the encoding length of a Bengali character sequence is less than or equal to the preset encoding length threshold, it can be considered that the Bengali character sequence does not meet the compound glyph recognition condition, and it is processed as an ordinary character sequence.
[0048] It is understood that the non-Bengali characters in this embodiment may include English characters, numeric characters, punctuation marks, space characters, or characters from other languages. Non-Bengali characters can serve as segmentation boundaries during character sequence segmentation, enabling consecutive Bengali characters to be extracted into independent Bengali character sequences.
[0049] This embodiment can accurately distinguish between Bengali and non-Bengali character segments in the string to be identified, and filter out short character sequences that do not meet the conditions for compound glyph recognition, thereby improving the processing efficiency of subsequent compound glyph recognition.
[0050] In another preferred embodiment, based on the encoding values of each character in the string to be identified, the Bengali characters in the string to be identified are segmented into a character sequence to obtain several Bengali character sequences, including: According to the order of the characters in the string to be identified, the encoded values of each character in the string to be identified are identified sequentially; When the encoding value of the current character is within the preset Bengali encoding range, and the encoding value of the previous character is not within the preset Bengali encoding range, the current character is determined as the first character of the current Bengali character sequence; Starting from the first character of the current Bengali character sequence, the encoding values of subsequent characters are identified sequentially until the first non-Bengali character whose encoding value is not within the preset Bengali encoding range is identified; The preceding character of the first non-Bengali character is determined as the last character of the current Bengali character sequence, and based on the first character and the last character, the corresponding consecutive Bengali characters are extracted from the string to be identified to obtain a Bengali character sequence; Continue recognizing characters following the first non-Bengali character until all characters in the string to be recognized have been recognized, resulting in several Bengali character sequences.
[0051] In one example, the string to be identified includes a non-Bengali character segment, a first Bengali character segment, a non-Bengali delimiter character, and a second Bengali character segment. When the first Bengali character in the first Bengali character segment is scanned, since its preceding character is a non-Bengali character, this first Bengali character is identified as the first character of the current Bengali character sequence. The scanning continues until a non-Bengali delimiter character is scanned, at which point the preceding character of that non-Bengali delimiter character can be identified as the last character, thus extracting the Bengali character sequence corresponding to the first Bengali character segment.
[0052] It should be noted that if the current character is the first character in the string to be recognized, and the encoding value of the current character is within the preset Bengali encoding range, then the current character is directly determined as the first character of the current Bengali character sequence. If, when recognizing from a certain first character, no first non-Bengali character is recognized until the end of the string to be recognized, then the last character in the string to be recognized can be determined as the last character of the current Bengali character sequence.
[0053] In this embodiment, several consecutive Bengali character sequences are extracted from a multilingual mixed string, thereby improving the accuracy of subsequent Bengali character sequence recognition.
[0054] In yet another preferred embodiment, the step of performing a longest matching algorithm on each of the target Bengali character sequences to determine the target Bengali compound glyphs in each of the target Bengali character sequences includes: Take any of the target Bengali character sequences as the target character sequence to be matched; According to the order of the characters in the target character sequence to be matched, each character in the target character sequence to be matched is determined as the starting point of the candidate substring, and each character after the starting point of the candidate substring is determined as the ending point of the candidate substring. Based on the starting point and ending point of each candidate substring, the corresponding candidate character substring is extracted from the target character sequence to be matched. Each candidate character substring is matched with a Bengali compound glyph string in a preset compound glyph string table; when a candidate character substring is found that matches a preset Bengali compound glyph string in the preset compound glyph string table, the character length of each successfully matched candidate character substring is determined. The longest matching candidate character substring is identified as the target Bengali compound glyph in the target character sequence to be matched.
[0055] The preset compound glyph string table stores several Bengali compound glyph strings. These Bengali compound glyph strings can be strings formed by combining multiple Bengali consonant characters or Bengali consonant characters with connectors. The number and specific content of the compound glyph strings stored in the preset compound glyph string table can be set according to font resources, the target display language range, or device display requirements.
[0056] The preset composite glyph string table is also associated with a preset glyph encoding mapping table. Specifically, each Bengali composite glyph string in the preset composite glyph string table can correspond to a target glyph encoding, and the Bengali composite glyph string and the target glyph encoding are associated through the same table entry index, mapping key value, or other association methods. Thus, when a candidate character substring successfully matches a Bengali composite glyph string in the preset composite glyph string table, the corresponding matching index is recorded so that the corresponding target glyph encoding can be determined subsequently based on the matching index.
[0057] In one example, the longest match length, longest match start position, longest match end position, and match index are first initialized to record the longest match result. Then, starting from the first character in the target character sequence to be matched, each character is used as the starting point of a candidate substring, and the ending point of each candidate substring is determined sequentially after the starting point, thus obtaining multiple candidate character substrings. For any candidate character substring, it is compared with each Bengali compound glyph string in the preset compound glyph string table; if the comparison result shows that the candidate character substring is completely consistent with a certain Bengali compound glyph string, then the candidate character substring is determined to be a successful match, and the character length of the candidate character substring is determined. If the character length of the candidate character substring is greater than the currently recorded longest match length, then the longest match length, longest match start position, longest match end position, and corresponding match index are updated. After traversal is completed, the candidate character substring corresponding to the longest match length is determined as the target Bengali compound glyph.
[0058] It should be noted that if no matching candidate character substring is obtained after traversing the target character sequence to be matched, it is considered that there is no target Bengali compound character that matches the preset compound character string table in the target character sequence to be matched, and the corresponding compound character replacement process is skipped, or the corresponding character sequence is output as a normal Bengali character sequence.
[0059] It is understood that the longest matching algorithm in this embodiment is used to determine the longest candidate character substring among multiple successfully matched candidate character substrings. Its implementation method is adapted to the device's processing power, the size of the character table, or the storage space. For example, when the size of the composite character string table is small, an item-by-item comparison method is used; when the size of the composite character string table is large, an index table or a trie method can be used to improve the matching efficiency.
[0060] In this embodiment, the longest matching candidate character substring is identified as the target Bengali compound glyph, which avoids shorter compound glyph strings from covering longer ones, thereby improving the completeness and accuracy of recognizing complex Bengali compound glyphs.
[0061] In yet another preferred embodiment, it further includes: Based on a preset glyph encoding mapping table, the target Bengali compound glyphs are replaced with the corresponding target glyph encodings to generate an initial output character sequence; Detect whether there are unit-dependent vowels in the initial output character sequence; If the unit-dependent vowel exists, the consonant character associated with the unit-dependent vowel is determined, and the unit-dependent vowel is adjusted to precede the associated consonant character to update the target Bengali compound glyph.
[0062] In one example, when replacing a target Bengali glyph with its corresponding target glyph encoding, a replacement flag can be checked first. If the replacement flag is true, the glyph replacement process is performed; if the replacement flag is false, the glyph replacement process can be skipped, and subsequent dependent vowel detection and position adjustment processes can continue.
[0063] In one example, when performing compound glyph replacement processing, the compound glyph identifier is first written to the output buffer, then the target glyph encoding is read from the preset glyph encoding mapping table, and the target glyph encoding is converted to UTF-8 format and written to the output buffer.
[0064] In one implementation, the UTF-8 encoding corresponding to the target glyph occupies three bytes, and can be written to the output buffer in a preset byte order. The output format includes: a composite glyph identifier and the encoded bytes corresponding to the target glyph, for example, represented as "[composite glyph identifier] [Unicode high byte][Unicode low byte]". In another implementation, the target glyph encoding can also be split into high and low bytes before being written to the output buffer; the specific writing format can be determined according to the encoding parsing rules of the device display module.
[0065] After completing the encoding replacement of the target Bengali glyph, the current processing position can be updated. Specifically, the current position can be updated to the sum of the current position and the maximum matching length, thereby skipping characters that have already undergone glyph replacement; at the same time, the maximum matching length can be reset to zero so that subsequent character sequences can continue to be recognized and processed.
[0066] The initial output character sequence may include at least one of the following: ordinary Bengali characters, target glyph encoding corresponding to the target Bengali compound glyph, vowel-dependent characters, and non-Bengali characters. After generating the initial output character sequence, the presence of vowel-dependent characters can be further detected, and the character output order can be adjusted according to the type of vowel-dependent characters.
[0067] In one example, see Figure 2 This is a flowchart of a preferred embodiment of a Bengali compound character recognition method provided in the first aspect of the present invention, which is a vowel detection process. First, the vowel type is detected; when the detection result is a single vowel, the vowel-consonant position is swapped; when the detection result is a diphthong, it is split into left and right parts; when the detection result is a normal character, it is output as is; and then the corresponding processing result is written to the output buffer.
[0068] Specifically, for unit-dependent vowels, they can be adjusted to precede their associated consonant character. When a unit-dependent vowel is detected, the consonant character to which the unit-dependent vowel is attached can be determined, and the output positions of the unit-dependent vowel and the associated consonant character can be swapped, so that the position of the unit-dependent vowel in the output buffer is before the associated consonant character.
[0069] It should be noted that the associated consonant characters can be consonant characters adjacent to the unit-dependent vowel, or they can be the basic consonant combinations corresponding to the target Bengali compound glyph formed after compound glyph recognition.
[0070] Understandably, by first replacing the target Bengali compound glyph with the target glyph encoding, and then adjusting the position of the unit dependent vowels, the compound glyph recognition result and the vowel display order adjustment result can work together on the final output character sequence, thereby reducing display anomalies caused by inconsistencies between the storage order and rendering order of dependent vowels.
[0071] This embodiment can improve the display abnormality problem caused by the inconsistency between the storage order and display order of unit-dependent vowels.
[0072] In yet another preferred embodiment, it further includes: Detect whether there are bigram dependent vowels in the initial output character sequence; If the binary dependent vowel exists, the binary dependent vowel is split into a left vowel component and a right vowel component to update the target Bengali compound glyph.
[0073] Here, a binary dependent vowel refers to a dependent vowel that needs to be distributed on both sides of the associated consonant character or the target Bengali compound glyph during display. When a binary dependent vowel is detected in the initial output character sequence, it can be split into a left vowel component and a right vowel component according to a preset binary dependent vowel splitting rule.
[0074] In one example, see Figure 2 As shown, when the detected vowel type is a diphthong, the diphthong is split into left and right parts; the split left vowel component and right vowel component are written into the output buffer.
[0075] Specifically, the left vowel component is positioned before the associated consonant character or the target Bengali glyph during display, while the right vowel component is positioned after the associated consonant character or the target Bengali glyph during display. By splitting the binary dependent vowel into left and right parts, the output of the binary dependent vowel can better conform to the actual display rules of Bengali characters.
[0076] In one example, when the initial output character sequence includes a binary dependent vowel, it can be split into a left vowel component and a right vowel component according to a preset splitting rule, and then adjusted to the sides of the associated consonant character or the target Bengali compound glyph, respectively.
[0077] It is understandable that when there are no big-dependent vowels in the initial output character sequence, big-dependent vowel splitting can be skipped, and the corresponding character or glyph encoding can be written to the output buffer in the current output order.
[0078] This embodiment can improve the processing accuracy of Bengali character sequences containing bigram-dependent vowels.
[0079] In another preferred embodiment, the performance of the Bengali complex glyph recognition method provided by this invention was verified, and the embodiment of this invention was compared with the OpenType complex text layout scheme and the static matching scheme. The OpenType complex text layout scheme is based on a complex text layout engine such as Harf Buzz; the static matching scheme is based on a fixed string lookup table for first-hit replacement. This invention is based on encoding range recognition, target Bengali character sequence filtering, longest match, and vowel-dependent adjustment. As shown in Table 1, compared to the OpenType complex text layout scheme, the proposed solution does not require loading a complete complex text layout engine or dynamically parsing complex font tables such as GSUB / GPOS, thus significantly reducing code size and memory usage. Under the above example test conditions, the code size of this invention is approximately 8KB, and the RAM usage is less than 10KB. Compared to the OpenType complex text layout scheme, resource usage is reduced by more than 90%, which can meet the operational constraints of resource-constrained devices such as embedded devices and wearable devices.
[0080] Table 1: Performance Comparison Table A second aspect of the present invention provides a Bengali complex glyph recognition device for implementing a Bengali complex glyph recognition method as described in any of the first aspects of the present invention. (See also...) Figure 3 The diagram shown is a structural block diagram of a preferred embodiment of a Bengali compound glyph recognition device provided in the second aspect of the present invention. The device includes: The Bengali character sequence filtering module 11 is used to obtain the string to be identified and determine the target Bengali character sequence that meets the compound glyph recognition conditions from the string to be identified; The Bengali compound glyph recognition module 12 is used to perform the longest matching algorithm on each of the target Bengali character sequences to determine the target Bengali compound glyphs in each of the target Bengali character sequences.
[0081] It should be noted that the Bengali compound glyph recognition device provided in the second aspect of the present invention can realize all the processes of the Bengali compound glyph recognition method described in the first aspect above. The functions and technical effects of each module and unit in the device are the same as those of the Bengali compound glyph recognition method described in the first aspect above, and will not be repeated here.
[0082] A third aspect of the present invention also provides a computer-readable storage medium comprising a stored computer program; wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform a Bengali compound glyph recognition method as described in any of the first aspects of the present invention.
[0083] The fourth aspect of the present invention also provides a terminal device, see [link to documentation]. Figure 4 The diagram shown is a structural block diagram of a preferred embodiment of a terminal device provided in the fourth aspect of the present invention. The terminal device includes a processor 10, a memory 20, and a computer program stored in the memory 20 and configured to be executed by the processor 10. When the processor 10 executes the computer program, it implements a Bengali compound character recognition method as described in any of the above embodiments.
[0084] Preferably, the computer program can be divided into one or more modules / units (such as computer program 1, computer program 2, ...), and the one or more modules / units are stored in the memory 20 and executed by the processor 10 to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device.
[0085] The processor 10 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor 10 may be any conventional processor. The processor 10 is the control center of the terminal device, connecting various parts of the terminal device through various interfaces and lines.
[0086] The memory 20 mainly includes a program storage area and a data storage area. The program storage area can store the operating system, applications required for at least one function, etc., while the data storage area can store related data, etc. Furthermore, the memory 20 can be a high-speed random access memory, or a non-volatile memory, such as a plug-in hard drive, a smart media card (SMC), a secure digital card (SD), and a flash card, or other volatile solid-state storage devices.
[0087] It should be noted that the aforementioned terminal device may include, but is not limited to, processors and memory. Those skilled in the art will understand that the above content is merely an example describing the structure of the terminal device and does not constitute a limitation on the structure of the aforementioned terminal device. The aforementioned terminal device may include more or fewer components than those described above, or combine certain components, or different components.
[0088] A fifth aspect of the present invention also provides a computer program product, including a computer program that, when executed by a processor 10, implements a Bengali compound glyph recognition method as described in any of the first aspects of the present invention.
[0089] Through the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software plus necessary hardware platforms, and of course, it can also be implemented entirely by hardware. Based on this understanding, all or part of the technical solution of the present invention that contributes to the background technology can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM (Read-Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of the present invention.
[0090] It should be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, in the accompanying drawings of the device embodiments provided in this application, the connection relationships between modules indicate that they have communication connections, which can be specifically implemented as one or more communication buses or signal lines. Those skilled in the art can understand and implement this without any creative effort.
[0091] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for recognizing compound Bengali characters, characterized in that, include: Obtain the string to be recognized, and determine the target Bengali character sequence that meets the composite glyph recognition conditions from the string to be recognized; The longest matching algorithm is performed on each of the target Bengali character sequences to determine the target Bengali compound glyphs in each of the target Bengali character sequences.
2. The Bengali compound glyph recognition method as described in claim 1, characterized in that, The step of determining the target Bengali character sequence that meets the composite glyph recognition conditions from the string to be recognized includes: The string to be identified is decoded to obtain the encoded value of each character in the string to be identified; Based on the encoding values of each character in the string to be identified, the Bengali characters in the string to be identified are segmented into character sequences to obtain several Bengali character sequences; The encoding length of each Bengali character sequence is determined, and the Bengali character sequences whose encoding length is greater than a preset encoding length threshold are identified as target Bengali character sequences.
3. The Bengali compound glyph recognition method as described in claim 2, characterized in that, The method involves segmenting the Bengali characters in the string to be identified based on their encoding values, resulting in several Bengali character sequences, including: According to the order of the characters in the string to be identified, the encoded values of each character in the string to be identified are identified sequentially; When the encoding value of the current character is within the preset Bengali encoding range, and the encoding value of the previous character is not within the preset Bengali encoding range, the current character is determined as the first character of the current Bengali character sequence; Starting from the first character of the current Bengali character sequence, the encoding values of subsequent characters are identified sequentially until the first non-Bengali character whose encoding value is not within the preset Bengali encoding range is identified; The preceding character of the first non-Bengali character is determined as the last character of the current Bengali character sequence, and based on the first character and the last character, the corresponding consecutive Bengali characters are extracted from the string to be identified to obtain a Bengali character sequence; Continue recognizing characters following the first non-Bengali character until all characters in the string to be recognized have been recognized, resulting in several Bengali character sequences.
4. The Bengali compound glyph recognition method as described in claim 1, characterized in that, The step of performing the longest matching algorithm on each of the target Bengali character sequences to determine the target Bengali compound glyphs in each of the target Bengali character sequences includes: Take any of the target Bengali character sequences as the target character sequence to be matched; According to the order of the characters in the target character sequence to be matched, each character in the target character sequence to be matched is determined as the starting point of the candidate substring, and each character after the starting point of the candidate substring is determined as the ending point of the candidate substring. Based on the starting point and ending point of each candidate substring, the corresponding candidate character substring is extracted from the target character sequence to be matched. Each candidate character substring is matched with a Bengali compound glyph string in a preset compound glyph string table; when a candidate character substring is found that matches a preset Bengali compound glyph string in the preset compound glyph string table, the character length of each successfully matched candidate character substring is determined. The longest matching candidate character substring is identified as the target Bengali compound glyph in the target character sequence to be matched.
5. The Bengali compound glyph recognition method as described in claim 1, characterized in that, Also includes: Based on a preset glyph encoding mapping table, the target Bengali compound glyphs are replaced with the corresponding target glyph encodings to generate an initial output character sequence; Detect whether there are unit-dependent vowels in the initial output character sequence; If the unit-dependent vowel exists, the consonant character associated with the unit-dependent vowel is determined, and the unit-dependent vowel is adjusted to precede the associated consonant character to update the target Bengali compound glyph.
6. The Bengali compound glyph recognition method as described in claim 5, characterized in that, Also includes: Detect whether there are bigram dependent vowels in the initial output character sequence; If the binary dependent vowel exists, the binary dependent vowel is split into a left vowel component and a right vowel component to update the target Bengali compound glyph.
7. A Bengali complex glyph recognition device for implementing a Bengali complex glyph recognition method as described in any one of claims 1 to 6, the device comprising: A Bengali character sequence filtering module is used to acquire a string to be identified and to determine a target Bengali character sequence that meets the composite glyph recognition conditions from the string to be identified. The Bengali compound glyph recognition module is used to perform the longest matching algorithm on each of the target Bengali character sequences to determine the target Bengali compound glyphs in each of the target Bengali character sequences.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program; wherein, when the computer program is executed, it controls the device on which the computer-readable storage medium is located to perform a Bengali compound glyph recognition method as described in any one of claims 1 to 6.
9. A terminal device, characterized in that, The method includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor, when executing the computer program, implements a Bengali compound glyph recognition method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, The method includes a computer program that, when executed by a processor, implements a Bengali compound glyph recognition method as described in any one of claims 1 to 6.
