Continuous character recognition method and device

By identifying and storing basic elements in electronic documents and assigning hyphen modification attributes according to preset conditions, the problem that hyphen is easily deleted during conversion or re-arrangement is solved, and the accurate recognition and processing of hyphens is achieved. .

CN119495103APending Publication Date: 2025-02-21ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311036850.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-16
Publication Date
2025-02-21

AI Technical Summary

Technical Problem

When converting layout electronic documents to stream electronic documents or re-typed, hyphens are easily deleted, resulting in difficulty in identifying.

Method used

By obtaining text lines in electronic documents, identifying and storing basic elements, such as text objects, vector path objects and image objects, determining the object to be identified, and assigning hyphen modification attributes when preset conditions are met.

Benefits of technology

Effectively identify and mark hyphens in electronic documents to ensure that hyphens are not deleted accidentally during conversion or re-type, and improve the accuracy of document processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119495103A_ABST
    Figure CN119495103A_ABST
Patent Text Reader

Abstract

The invention relates to a continuous character recognition method and device, and the method comprises the steps: obtaining an electronic document, and recognizing all text lines in the electronic document; for any text line, executing the following processing: acquiring a basic element in the text line, and storing the basic element as an object into an object group; determining a to-be-recognized object from the objects of the object group; and under the condition that the to-be-recognized object meets the preset character recognition condition, endowing the to-be-recognized object with character modification attributes. In this way, the continuous characters in the electronic document can be recognized, and subsequent special processing on the continuous characters is facilitated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a hyphen recognition method and device. Background Art

[0002] A hyphen is a punctuation mark used between two parts of a compound word or between the bytes of a word, especially at the end of a line or paragraph. A hyphen refers to a "dash", excluding overline and underline.

[0003] In the related art, when a layout electronic document is converted into a streaming electronic document, or when the layout electronic document is rearranged, hyphens may be deleted. Therefore, it is necessary to identify hyphens in the published electronic document so as to perform special processing on the hyphens. Summary of the invention

[0004] In order to solve the above-mentioned technical problem that hyphens may be deleted when a layout electronic document is converted into a streaming electronic document, or when a layout electronic document is rearranged, it is necessary to identify hyphens in a published electronic document and facilitate special processing of hyphens, the embodiment of the present application provides a hyphen recognition method, device, electronic device and storage medium. The specific technical solution is as follows:

[0005] In a first aspect of an embodiment of the present application, a hyphen recognition method is first provided, the method comprising:

[0006] Obtaining an electronic document, and identifying all text lines in the electronic document;

[0007] For any of the text lines, perform the following processing:

[0008] Obtaining basic elements in the text line, and storing the basic elements as objects in an object group;

[0009] Determining an object to be identified from the objects in the object group;

[0010] In the case that the object to be identified meets the preset hyphen identification condition, a hyphen modification attribute is given to the object to be identified.

[0011] In an optional embodiment, the basic elements include text objects, vector path objects and image objects;

[0012] The acquiring the basic elements in the text line and storing the basic elements as objects in the object group includes:

[0013] Acquire the text object, the vector path object and the image object in the text line;

[0014] The text object, the vector path object and the image object are respectively stored as objects in an object group.

[0015] In an optional implementation, after storing the text object, the vector path object, and the image object as objects in the object group, the method further includes:

[0016] Traversing the objects in the object group, searching for the text object, and determining the found text object as a target object;

[0017] Determining an average character width of the text line according to the characters included in all the target objects;

[0018] For any of the target objects, if the target object contains multiple characters, perform the following steps:

[0019] According to the average character width, any adjacent first character and second character in the target object are split to obtain a first text object and a second text object;

[0020] The first text object and the second text object are respectively stored in an object group as separate objects.

[0021] In an optional implementation, determining the average character width of the text line according to the characters included in all the target objects includes:

[0022] Counting the heights of all characters contained in the target objects, and counting the number of characters corresponding to the characters contained in all the target objects;

[0023] Accumulating the heights to obtain a total height, and determining an average character height of the text line according to the total height and the number of characters;

[0024] The average character height of the text line is determined as the average character width of the text line.

[0025] In an optional implementation, the step of splitting any adjacent first character and second character in the target object according to the average character width to obtain the first text object and the second text object includes:

[0026] For any adjacent first character and second character in the target object, the following processing is performed:

[0027] Determine the interval between adjacent first characters and second characters, and obtain the product of a preset first value and the average character width;

[0028] When the interval is greater than the product, the adjacent first character and second character are split into a first text object and a second text object.

[0029] In an optional implementation, determining the interval between adjacent first characters and second characters includes:

[0030] Obtaining a first X-axis coordinate value corresponding to the left boundary of the circumscribed rectangular frame of the first character;

[0031] Obtain a second X-axis coordinate value corresponding to the right boundary of the circumscribed rectangular frame of the second character;

[0032] A coordinate difference between the first X-axis coordinate value and the second X-axis coordinate value is obtained, and the coordinate difference is determined as an interval between adjacent first characters and second characters.

[0033] In an optional implementation, determining the object to be identified from the objects in the object group includes:

[0034] Traversing the objects in the object group, obtaining the third X-axis coordinate value corresponding to the left boundary of the circumscribed rectangular frame of the object;

[0035] sorting the objects in the object group according to the third X-axis coordinate value;

[0036] According to the sorting result, determining the Nth object, where N is a positive integer;

[0037] The Nth object is determined as the object to be identified.

[0038] In an optional implementation, determining the Nth object according to the ranking result includes:

[0039] According to the sorting result, determining whether the sorting orders of the objects in the object group are all different;

[0040] When the objects in the object group are sorted in different orders, the Nth object is determined according to the sorting result.

[0041] In an optional embodiment, the method further comprises:

[0042] In the case where the objects in the object group have the same sorting order, determining the objects with the same sorting order;

[0043] Obtaining a first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the objects in the same sorting order;

[0044] sorting the objects in the same sorting order again according to the first Y-axis coordinate value;

[0045] According to the sorting result and the result of the re-sorting, the Nth object is determined.

[0046] In an optional implementation, when the object to be identified meets a preset hyphen identification condition, assigning a hyphen modification attribute to the object to be identified includes:

[0047] In the case where the object to be identified is the text object, determining whether the Unicode of the text object satisfies a preset hyphen Unicode condition; in the case where the Unicode of the text object satisfies the preset hyphen Unicode condition, determining whether the context of the text object satisfies a preset hyphen semantic condition; in the case where the context of the text object satisfies the preset hyphen semantic condition, determining whether the position of the text object satisfies a preset hyphen position condition; in the case where the position of the text object satisfies the preset hyphen position condition, assigning a hyphen modification attribute to the text object;

[0048] In a case where the object to be identified is the vector path object, determine whether an instruction set for drawing the vector path object satisfies a preset hyphen instruction set condition; in a case where the instruction set for drawing the vector path object satisfies a preset hyphen instruction set condition, determine whether a context of the vector path object satisfies a preset hyphen semantic condition; in a case where the context of the vector path object satisfies a preset hyphen semantic condition, determine whether a position of the vector path object satisfies a preset hyphen position condition; in a case where the position of the vector path object satisfies a preset hyphen position condition, assign a hyphen modification attribute to the vector path object.

[0049] In an optional implementation, when the object to be identified is the text object, determining whether the Unicode of the text object satisfies a preset hyphen Unicode condition includes:

[0050] In the case where the object to be identified is the text object, determining whether the Unicode of the text object is a Unicode corresponding to a hyphen;

[0051] When the Unicode of the text object satisfies the preset hyphen Unicode condition, determining whether the context of the text object satisfies the preset hyphen semantic condition includes:

[0052] In the case that the Unicode of the text object is a Unicode corresponding to a hyphen, it is determined whether the context of the text object satisfies a preset hyphen semantic condition.

[0053] In an optional implementation, when the object to be identified is the vector path object, determining whether an instruction set for drawing the vector path object satisfies a preset hyphen instruction set condition includes:

[0054] In the case where the object to be identified is the vector path object, determining whether a first instruction exists in an instruction set for drawing the vector path object and whether a second instruction exists;

[0055] In the case where the instruction set for drawing the vector path object satisfies the preset hyphenation instruction set condition, determining whether the context of the vector path object satisfies the preset hyphenation semantic condition includes:

[0056] In a case where the first instruction exists but the second instruction does not exist in the instruction set for drawing the vector path object, it is determined whether a context of the vector path object satisfies a preset hyphen semantic condition.

[0057] In an optional implementation, when the first instruction exists but the second instruction does not exist in the instruction set for drawing the vector path object, determining whether the context of the vector path object satisfies a preset hyphen semantic condition includes:

[0058] In the case where the first instruction exists but the second instruction does not exist in the instruction set for drawing the vector path object, and the circumscribed rectangular frames of the vector path object all meet the following conditions, determining whether the context of the vector path object meets a preset hyphen semantic condition;

[0059] a*CharWidth<BBox.Width<b*CharWidth; BBox.Width>c*BBox.Height;

[0060] ((LineBBox.Top+LineBBox.Bottom)-(BBox.Top+BBox.Bottom)) / d<e*CharWidth;

[0061] a is a preset second value, b is a preset third value, c is a preset fourth value, d is a preset fifth value, e is a preset sixth value, CharWidth is the average character width of the text line, BBox.Width is the width of the circumscribed rectangular box of the vector path object, BBox.Height is the height of the circumscribed rectangular box of the vector path object, LineBBox.Top is the second Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the text line, LineBBox.Bottom is the third Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the text line, BBox.Top is the fourth Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the vector path object, and BBox.Bottom is the fifth Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the vector path object.

[0062] In an optional implementation, the determining whether the context of the text object satisfies a preset hyphen semantic condition includes:

[0063] Finding a previous object of the text object, and if the previous object is a text object, determining whether the Unicode of the previous object is within a preset Unicode interval;

[0064] Finding the next object of the text object, and if the next object is a text object, determining whether the Unicode of the next object is within a preset Unicode interval;

[0065] When the context of the text object satisfies the preset hyphenation semantic condition, determining whether the position of the text object satisfies the preset hyphenation position condition includes:

[0066] When the Unicode of the previous object is within a preset Unicode interval and the Unicode of the next object is within a preset Unicode interval, it is determined whether the position of the text object satisfies a preset hyphen position condition.

[0067] In an optional implementation, the determining whether the context of the vector path object satisfies a preset hyphen semantic condition includes:

[0068] Finding a previous object of the vector path object, and if the previous object is a text object, determining whether the Unicode of the previous object is within a preset Unicode interval;

[0069] Finding the next object of the vector path object, and if the next object is a text object, determining whether the Unicode of the next object is within a preset Unicode interval;

[0070] When the context of the vector path object satisfies the preset hyphen semantic condition, determining whether the position of the vector path object satisfies the preset hyphen position condition includes:

[0071] When the Unicode of the previous object is in a preset Unicode interval and the Unicode of the next object is in a preset Unicode interval, it is determined whether the position of the vector path object satisfies a preset hyphen position condition.

[0072] In an optional implementation, the determining whether the position of the text object satisfies a preset hyphen position condition includes:

[0073] For any of the remaining objects in the object group, determining a first projection of a circumscribed rectangular frame of the object on the X-axis;

[0074] Determine a second projection of the circumscribed rectangular frame of the text object on the X-axis, and judge whether any of the first projections and the second projections do not intersect;

[0075] When the position of the text object satisfies a preset hyphen position condition, assigning a hyphen modification attribute to the text object includes:

[0076] In a case where neither the first projection nor the second projection intersects, a hyphen modifier attribute is assigned to the text object.

[0077] In an optional implementation, the determining whether the position of the vector path object satisfies a preset hyphen position condition includes:

[0078] For any of the remaining objects in the object group, determining a first projection of a circumscribed rectangular frame of the object on the X-axis;

[0079] Determine a second projection of the circumscribed rectangular frame of the vector path object on the X-axis, and determine whether any of the first projections and the second projections do not intersect;

[0080] When the position of the vector path object meets a preset hyphen position condition, assigning a hyphen modification attribute to the vector path object includes:

[0081] In a case where neither the first projection nor the second projection intersects, a hyphen modifier attribute is assigned to the vector path object.

[0082] In an optional implementation, after assigning the hyphen modifier attribute to the object to be identified, the method further includes:

[0083] When the electronic document is converted or rearranged, the following processing is performed for any of the objects to be identified:

[0084] Determining the layout position of the object to be identified;

[0085] When the typesetting position is at the end of a line, retaining the object to be identified;

[0086] When the typesetting position is not the end of a line, the object to be identified is deleted, and the elements behind the object to be identified are moved forward according to the width of the circumscribed rectangular frame of the object to be identified.

[0087] In a second aspect of the embodiments of the present application, a hyphen recognition device is further provided, the device comprising:

[0088] A document acquisition module, used to acquire electronic documents;

[0089] A text line recognition module, used to recognize all text lines in the electronic document;

[0090] The text line processing module is used to perform the following processing on any of the text lines:

[0091] An element acquisition module, used for acquiring basic elements in the text line, and storing the basic elements as objects in an object group;

[0092] An object determination module, used to determine an object to be identified from the objects in the object group;

[0093] The attribute assigning module is used to assign a hyphen modification attribute to the object to be identified when the object to be identified meets a preset hyphen identification condition.

[0094] In an optional embodiment, the basic elements include text objects, vector path objects and image objects;

[0095] The element acquisition module is specifically used for:

[0096] Acquire the text object, the vector path object and the image object in the text line;

[0097] The text object, the vector path object and the image object are respectively stored as objects in an object group.

[0098] In an optional embodiment, the device further comprises:

[0099] An object search module, used for traversing the objects in the object group, searching for the text object, and determining the found text object as a target object;

[0100] A width determination module, used for determining an average character width of the text line according to the characters included in all the target objects;

[0101] The object processing module is used to perform the following steps for any of the target objects when the target object contains multiple characters:

[0102] A character splitting module, used for splitting any adjacent first character and second character in the target object according to the average character width to obtain a first text object and a second text object;

[0103] The object storing module is used to store the first text object and the second text object into an object group as separate objects.

[0104] In an optional implementation, the width determination module is specifically configured to:

[0105] Counting the heights of all characters contained in the target objects, and counting the number of characters corresponding to the characters contained in all the target objects;

[0106] Accumulating the heights to obtain a total height, and determining an average character height of the text line according to the total height and the number of characters;

[0107] The average character height of the text line is determined as the average character width of the text line.

[0108] In an optional implementation, the character splitting module specifically includes:

[0109] The character processing submodule is used to perform the following processing on any adjacent first character and second character in the target object:

[0110] An interval determination submodule, used to determine the interval between adjacent first and second characters;

[0111] A product acquisition submodule, used to acquire the product of a preset first value and the average character width;

[0112] The character splitting submodule is used for splitting the adjacent first character and second character into a first text object and a second text object when the interval is greater than the product.

[0113] In an optional implementation, the interval determination submodule is specifically used to:

[0114] Obtaining a first X-axis coordinate value corresponding to the left boundary of the circumscribed rectangular frame of the first character;

[0115] Obtain a second X-axis coordinate value corresponding to the right boundary of the circumscribed rectangular frame of the second character;

[0116] A coordinate difference between the first X-axis coordinate value and the second X-axis coordinate value is obtained, and the coordinate difference is determined as an interval between adjacent first characters and second characters.

[0117] In an optional implementation, the object determination module specifically includes:

[0118] A first submodule for obtaining coordinate values ​​is used to traverse the objects in the object group and obtain a third X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the object;

[0119] an object sorting submodule, used for sorting the objects in the object group according to the third X-axis coordinate value;

[0120] The first object determination submodule is used to determine the Nth object according to the sorting result, where N is a positive integer;

[0121] The second object determination submodule is used to determine the Nth object as the object to be identified.

[0122] In an optional implementation, the object determination first submodule is specifically used for:

[0123] According to the sorting result, determining whether the sorting orders of the objects in the object group are all different;

[0124] When the objects in the object group are sorted in different orders, the Nth object is determined according to the sorting result.

[0125] In an optional implementation, the object determination module further includes:

[0126] The third object determination submodule is used to determine the objects with the same sorting order when the sorting orders of the objects in the object group are the same;

[0127] A second submodule for obtaining coordinate values ​​is used to obtain a first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular frame of the objects in the same sorting order;

[0128] An object re-sorting submodule, used for re-sorting the objects in the same sorting order according to the first Y-axis coordinate value;

[0129] The fourth object determination submodule is used to determine the Nth object according to the sorting result and the re-sorting result.

[0130] In an optional implementation, the attribute assignment module specifically includes:

[0131] A Unicode determination submodule, used for determining, when the object to be identified is the text object, whether the Unicode of the text object satisfies a preset hyphen Unicode condition;

[0132] A first context judgment submodule, configured to judge whether the context of the text object satisfies a preset hyphenation semantic condition when the Unicode of the text object satisfies a preset hyphenation Unicode condition;

[0133] A first position determination submodule, configured to determine whether the position of the text object satisfies a preset hyphenation position condition when the context of the text object satisfies a preset hyphenation semantic condition;

[0134] The first attribute assignment submodule is used to assign a hyphen modification attribute to the text object when the position of the text object meets a preset hyphen position condition;

[0135] An instruction set determination submodule, used for determining, when the object to be identified is the vector path object, whether an instruction set for drawing the vector path object satisfies a preset hyphen instruction set condition;

[0136] A second context judgment submodule, configured to judge whether the context of the vector path object satisfies a preset hyphenation semantic condition when the instruction set for drawing the vector path object satisfies a preset hyphenation instruction set condition;

[0137] A second position determination submodule, configured to determine whether the position of the vector path object satisfies a preset hyphen position condition when the context of the vector path object satisfies a preset hyphen semantic condition;

[0138] The second attribute assignment submodule is used to assign a hyphen modification attribute to the vector path object when the position of the vector path object meets a preset hyphen position condition.

[0139] In an optional implementation, the Unicode determination submodule is specifically used for:

[0140] In the case where the object to be identified is the text object, determining whether the Unicode of the text object is a Unicode corresponding to a hyphen;

[0141] The context judgment first submodule is specifically used for:

[0142] In the case that the Unicode of the text object is a Unicode corresponding to a hyphen, it is determined whether the context of the text object satisfies a preset hyphen semantic condition.

[0143] In an optional implementation, the instruction set determination submodule is specifically used to:

[0144] In the case where the object to be identified is the vector path object, determining whether a first instruction exists in an instruction set for drawing the vector path object and whether a second instruction exists;

[0145] The context determination second submodule is specifically used for:

[0146] In a case where the first instruction exists but the second instruction does not exist in the instruction set for drawing the vector path object, it is determined whether a context of the vector path object satisfies a preset hyphen semantic condition.

[0147] In an optional implementation, the context determination second submodule is specifically used for:

[0148] In the case where the first instruction exists but the second instruction does not exist in the instruction set for drawing the vector path object, and the circumscribed rectangular frames of the vector path object all meet the following conditions, determining whether the context of the vector path object meets a preset hyphen semantic condition;

[0149] a*CharWidth<BBox.Width<b*CharWidth; BBox.Width>c*BBox.Height;

[0150] ((LineBBox.Top+LineBBox.Bottom)-(BBox.Top+BBox.Bottom)) / d<e*CharWidth;

[0151] a is a preset second value, b is a preset third value, c is a preset fourth value, d is a preset fifth value, e is a preset sixth value, CharWidth is the average character width of the text line, BBox.Width is the width of the circumscribed rectangular box of the vector path object, BBox.Height is the height of the circumscribed rectangular box of the vector path object, LineBBox.Top is the second Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the text line, LineBBox.Bottom is the third Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the text line, BBox.Top is the fourth Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the vector path object, and BBox.Bottom is the fifth Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the vector path object.

[0152] In an optional implementation, the context determination first submodule is specifically used for:

[0153] Finding a previous object of the text object, and if the previous object is a text object, determining whether the Unicode of the previous object is within a preset Unicode interval;

[0154] Finding the next object of the text object, and if the next object is a text object, determining whether the Unicode of the next object is within a preset Unicode interval;

[0155] The first submodule of position determination is specifically used for:

[0156] When the Unicode of the previous object is within a preset Unicode interval and the Unicode of the next object is within a preset Unicode interval, it is determined whether the position of the text object satisfies a preset hyphen position condition.

[0157] In an optional implementation, the context determination second submodule is specifically used for:

[0158] Finding a previous object of the vector path object, and if the previous object is a text object, determining whether the Unicode of the previous object is within a preset Unicode interval;

[0159] Finding the next object of the vector path object, and if the next object is a text object, determining whether the Unicode of the next object is within a preset Unicode interval;

[0160] The second submodule of position determination is specifically used for:

[0161] When the Unicode of the previous object is in a preset Unicode interval and the Unicode of the next object is in a preset Unicode interval, it is determined whether the position of the vector path object satisfies a preset hyphen position condition.

[0162] In an optional implementation, the first position determination submodule is specifically used for:

[0163] For any of the remaining objects in the object group, determining a first projection of a circumscribed rectangular frame of the object on the X-axis;

[0164] Determine a second projection of the circumscribed rectangular frame of the text object on the X-axis, and judge whether any of the first projections and the second projections do not intersect;

[0165] The attribute is assigned to the first submodule specifically for:

[0166] In a case where neither the first projection nor the second projection intersects, a hyphen modifier attribute is assigned to the text object.

[0167] In an optional implementation, the second position determination submodule is specifically used for:

[0168] For any of the remaining objects in the object group, determining a first projection of a circumscribed rectangular frame of the object on the X-axis;

[0169] Determine a second projection of the circumscribed rectangular frame of the vector path object on the X-axis, and determine whether any of the first projections and the second projections do not intersect;

[0170] The attribute is assigned to the second submodule specifically for:

[0171] In a case where neither the first projection nor the second projection intersects, a hyphen modifier attribute is assigned to the vector path object.

[0172] In an optional embodiment, the device further comprises:

[0173] The hyphen processing module is used to perform the following processing on any of the objects to be identified when converting or rearranging the electronic document:

[0174] Determining the layout position of the object to be identified;

[0175] When the typesetting position is at the end of a line, retaining the object to be identified;

[0176] When the typesetting position is not the end of a line, the object to be identified is deleted, and the elements behind the object to be identified are moved forward according to the width of the circumscribed rectangular frame of the object to be identified.

[0177] In a third aspect of the embodiments of the present application, there is further provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0178] Memory, used to store computer programs;

[0179] The processor is used to implement any hyphen recognition method described in the first aspect when executing the program stored in the memory.

[0180] In a fourth aspect of the embodiments of the present application, a storage medium is further provided, wherein instructions are stored in the storage medium, and when the storage medium is run on a computer, the computer executes any hyphen recognition method described in the first aspect above.

[0181] In a fifth aspect of the embodiments of the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the hyphen recognition methods described above.

[0182] The technical solution provided by the embodiment of the present application obtains an electronic document and identifies all text lines in the electronic document. For any text line, the following processing is performed: basic elements in the text line are obtained, the basic elements are stored as objects in an object group, the object to be identified is determined from the objects in the object group, and when the object to be identified meets the preset hyphen recognition conditions, the hyphen modifier attribute is given to the object to be identified. By identifying all text lines in the electronic document, for any text line, the basic elements in the text line are stored as objects in an object group, the object to be identified is determined from the objects in the object group, and when the object to be identified meets the preset hyphen recognition conditions, the hyphen modifier attribute is given to the object to be identified, the recognition of hyphens in the electronic document can be completed, which facilitates the subsequent special processing of hyphens. BRIEF DESCRIPTION OF THE DRAWINGS

[0183] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0184] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0185] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.

[0186] Figure 1 A schematic diagram of an implementation flow of a hyphen recognition method shown in an embodiment of the present application;

[0187] Figure 2 It is a schematic diagram of an implementation process of another hyphen recognition method shown in an embodiment of the present application;

[0188] Figure 3 A schematic diagram of an implementation flow of a method for determining average character width shown in an embodiment of the present application;

[0189] Figure 4 A schematic diagram of an implementation flow of a character splitting method shown in an embodiment of the present application;

[0190] Figure 5 It is a structural schematic diagram of a hyphen recognition device shown in an embodiment of the present application;

[0191] Figure 6 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present application. DETAILED DESCRIPTION

[0192] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0193] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.

[0194] like Figure 1 FIG. 1 is a schematic diagram of an implementation flow of a hyphen recognition method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:

[0195] S101, obtaining an electronic document and identifying all text lines in the electronic document.

[0196] In an embodiment of the present application, an electronic document may be obtained, wherein the electronic document may be a formatted electronic document, such as a PDF document.

[0197] For an electronic document, all text lines in the electronic document may be identified, wherein all text lines in the electronic document may be identified by a line identifier.

[0198] S102, for any text line, execute the following processing.

[0199] S103, obtaining basic elements in the text line, and storing the basic elements as objects in the object group.

[0200] S104: Determine an object to be identified from the objects in the object group.

[0201] S105: When the object to be identified meets a preset hyphen identification condition, a hyphen modification attribute is assigned to the object to be identified.

[0202] In an embodiment of the present application, for any text line in an electronic document, the following processing is performed: basic elements in the text line are obtained, the basic elements are stored as objects in an object group, an object to be identified is determined from the objects in the object group, and when the object to be identified meets a preset hyphen recognition condition, a hyphen modification attribute is assigned to the object to be identified.

[0203] In this way, for any text line in the electronic document, the basic elements in the text line are stored as objects in the object group, the object to be identified is determined from the objects in the object group, and it is judged whether the object to be identified meets the preset hyphen recognition conditions. If the preset hyphen recognition conditions are met, the object to be identified is given a hyphen modification attribute, and the recognition of hyphens in the text line can be completed.

[0204] It should be noted that the basic elements can be understood to include text objects (Text, which can be referred to as text), vector path objects (Path, which can be referred to as line segments) and image objects (Image, which can be referred to as images), and the embodiments of the present application do not limit this.

[0205] For text objects, it contains text Unicode, character code CharCode, font information, color, bounding box BBox (Bounding Box) coordinates, etc.; vector path objects are usually composed of MoveTo (move but not draw), LineTo (move and draw a straight line), BezierTo (move and draw a Bezier curve), etc., and their StartPoint (coordinates before moving), EndPoint (coordinates after moving), color, bounding box BBox coordinates, etc. can be obtained; image objects contain RGB color information, bounding box BBox coordinates, etc.

[0206] For example, for any text line in a PDF document, the following processing is performed: basic elements in the text line are obtained, the basic elements are stored as objects in an object group, an object to be identified is determined from the objects in the object group, and when the object to be identified meets a preset hyphen identification condition, a hyphen modifier attribute is assigned to the object to be identified, and the value of the hyphen modifier attribute is hyphen.

[0207] In addition, it should be noted that for any text line in the electronic document, the following processing may be performed, that is, steps S103 to S105 may be performed. Of course, steps S103 to S105 may be performed for at least one text line in the electronic document, and steps S103 to S105 (i.e., hyphen recognition processing) need not be performed for all text lines in the electronic document, and this embodiment of the application is not limited to this.

[0208] Through the above description of the technical solution provided in the embodiment of the present application, by identifying all text lines in the electronic document, for any text line, the basic elements in the text line are stored as objects in the object group, and the object to be identified is determined from the objects in the object group. When the object to be identified meets the preset hyphen recognition conditions, the object to be identified is given a hyphen modification attribute, so that the recognition of hyphens in the electronic document can be completed, which facilitates the subsequent special processing of the hyphens.

[0209] In the embodiment of the present application, the hyphen may be a text-type hyphen (i.e., a standard-type hyphen), such as a text object "-" with a Unicode of 0x2d, or a non-text-type hyphen (i.e., a non-standard-type hyphen), such as a vector path object (Path) "-" drawn by an instruction. Therefore, in the process of identifying the hyphen, the basic elements such as the text object, the vector path object, and the image object in the electronic document need to be identified as objects.

[0210] Based on this, Figure 2 FIG. 1 is a schematic diagram of an implementation flow of another hyphen recognition method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:

[0211] S201, obtaining an electronic document and identifying all text lines in the electronic document.

[0212] In the embodiment of the present application, this step is similar to the above-mentioned step S101, and the embodiment of the present application will not be described one by one here.

[0213] S202, execute the following processing for any text line.

[0214] In the embodiment of the present application, for any text line in the electronic document, the following processing is performed, that is, steps S203 to S216 are performed.

[0215] S203, obtaining text objects, vector path objects and image objects in the text line.

[0216] S204, storing the text object, the vector path object and the image object as objects into an object group respectively.

[0217] In an embodiment of the present application, an electronic document can be parsed to obtain basic elements such as text objects, vector path objects, and image objects within a text line, and the basic elements such as text objects, vector path objects, and image objects can be stored as objects in an object group respectively.

[0218] It should be noted that the objects in the object group may be the above-mentioned text objects, may be vector path objects, or may be image objects, which means that the objects may be any of the above-mentioned basic elements, and the embodiments of the present application do not limit this.

[0219] In addition, in the embodiment of the present application, after basic elements such as text objects, vector path objects and image objects are stored as objects in the object group, the average character width of the text line can be determined to prepare for the subsequent hyphen recognition.

[0220] Based on this, Figure 3 FIG. 1 is a schematic diagram of an implementation flow of a method for determining an average character width provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:

[0221] S301, traversing objects in an object group, searching for a text object, and determining the found text object as a target object.

[0222] S302: Determine an average character width of a text line according to characters included in all target objects.

[0223] In the embodiment of the present application, for objects in an object group, traversing the objects in the object group, searching for text objects, and determining the found text objects as target objects means searching for all text objects in the object group.

[0224] For all target objects (ie, text objects), the average character width of the text line can be determined based on the characters included in all target objects, which means that the average character width of the text line is determined based on the characters included in all text objects in the object group.

[0225] If the average character width of a text line is determined directly based on the widths of characters included in all text objects in the object group, the average character width of the text line may be inaccurate.

[0226] For example, assuming that the text object contains the character "i", whose width is obviously narrower, if the width of the character "i" is involved in determining the average character width of the text line, it will affect the accuracy of the average character width of the text line.

[0227] Based on this, in an embodiment of the present application, the average character height of a text line can be determined according to the height of characters contained in all text objects in the object group, and the average character height of a text line can be determined as the average character width of the text line.

[0228] It should be noted that the heights of the characters contained in the text object are generally balanced, and the above-mentioned character "i" will not be obviously narrow in width. Therefore, the average character height of the text line can be used instead of the average character width of the text line.

[0229] To this end, the heights of the characters contained in all target objects (i.e., text objects, TextObject) are counted, and the number of characters corresponding to the characters contained in all target objects (i.e., text objects, TextObject) is counted. The heights are accumulated to obtain the total heights, and the average character height of the text line is determined based on the total heights and the number of characters (the total heights are divided by the number of characters to obtain the average character height of the text line), so that the average character height of the text line can be determined as the average character width of the text line, which means that the average character height of the text line is used instead of the average character width of the text line.

[0230] In addition, in the embodiments of the present application, for an electronic document, for example, the order of text objects in a layout electronic document may not be the order in which they are written. For example, in "ABC", it is possible that text object 1 (TextObject1) implements the "B" character, that is, text object 1 contains 1 character, and text object 2 (TextObject2) implements the "AC" character, that is, text object 2 contains 2 characters, so at this time, text object 2 (TextObject2) needs to be split into two text objects "A" and "C", otherwise, when converted into a streaming electronic document, the order "AC" in the streaming electronic document is before "B", so directly reading the Unicode in the text object in order becomes "ACB", not "ABC".

[0231] Therefore, for all target objects in the object group, that is, all text objects in the object group, when they contain multiple characters, any two adjacent characters can be split by using the average character width of the text line, and then the object group can be stored again as a separate object. Figure 4 As shown, it is a schematic diagram of an implementation flow of a character splitting method provided in an embodiment of the present application. The method is applied to an electronic device and may specifically include the following steps:

[0232] S401, for any target object, when the target object contains multiple characters, perform the following steps.

[0233] S402: splitting any adjacent first character and second character in the target object according to the average character width to obtain a first text object and a second text object.

[0234] S403: Store the first text object and the second text object into an object group as separate objects respectively.

[0235] In an embodiment of the present application, for all target objects (i.e., text objects) in an object group, when the target object (i.e., text object) contains multiple characters, the following steps are performed: according to the average character width, any adjacent first character and second character in the target object are split to obtain a first text object and a second text object, and the first text object and the second text object are respectively stored in the object group as separate objects.

[0236] It should be noted that for target objects containing multiple characters (i.e. text objects), not all of them need to be split. They need to meet certain conditions before they can be split. The reason for this is that the splitting operation involves memory allocation and release, which is time-consuming overall. In most cases, you can just use it as a whole without splitting.

[0237] Therefore, for the splitting of the target object (i.e., text object) containing multiple characters, specifically, the following processing can be performed for any adjacent first character and second character in the target object: determine the interval between the adjacent first character and the second character, and obtain the product of the preset first value and the average character width; when the interval is greater than the product, split the adjacent first character and the second character into a first text object and a second text object.

[0238] For example, in the case where the target object (i.e., TextObject) contains multiple characters, the following processing is performed for any adjacent first character and second character in the target object: determine the interval between the adjacent first character and second character, and obtain the product between f and the average character width (CharWidth); when the interval is greater than the product, split the adjacent first character and second character into a first text object (TextObject1) and a second text object (TextObject2).

[0239] Among them, for the interval between the adjacent first character and the second character, the first X-axis coordinate value corresponding to the left boundary of the circumscribed rectangular box of the first character can be obtained, the second X-axis coordinate value corresponding to the right boundary of the circumscribed rectangular box of the second character can be obtained, the coordinate difference between the first X-axis coordinate value and the second X-axis coordinate value can be obtained, and the coordinate difference can be determined as the interval between the adjacent first character and the second character.

[0240] For example, for all target objects (i.e., text objects, TextObject) in the object group, when any target object (i.e., text object, TextObject) contains multiple characters, the following steps are performed: for any adjacent first character and second character in the target object (TextObject), if the following conditions are met, they are split into a first text object (TextObject1) and a second text object (TextObject2), and are stored in the object group as objects again.

[0241] Next.BBox.left-Pre.BBox.right>f*CharWidth, Next.BBox.left is the first X-axis coordinate value corresponding to the left boundary of the circumscribed rectangular box of the first character, Pre.BBox.right is the second X-axis coordinate value corresponding to the right boundary of the circumscribed rectangular box of the second character, f is a preset first value (empirical value, usually in the range of 0 to 1), and CharWidth is the average character width of the text line.

[0242] S205 , traverse the objects in the object group, and obtain the third X-axis coordinate value corresponding to the left boundary of the circumscribed rectangular frame of the object.

[0243] S206: Sort the objects in the object group according to the third X-axis coordinate value.

[0244] In an embodiment of the present application, for objects in an object group (including the first text object and the second text object obtained by splitting as described above), the objects in the object group can be sorted to facilitate obtaining the actual typeset order of the objects in the object group within the text line.

[0245] Based on this, the objects in the object group (including the first text object and the second text object obtained by splitting as mentioned above) are traversed to obtain the third X-axis coordinate value corresponding to the left boundary of the circumscribed rectangular box of the object, and the objects in the object group are sorted according to the third X-axis coordinate value.

[0246] It should be noted that for specific sorting rules, for example, according to the third X-axis coordinate value, the objects in the object group (including the first text object and the second text object obtained by splitting as mentioned above) are sorted from small to large or from large to small, and the embodiments of the present application do not limit this.

[0247] For example, objects (Object) in an object group (ObjectGroup) are traversed, and objects (Object) in the object group (ObjectGroup) are sorted from small to large according to the third X-axis coordinate value (Object.BBox.left) corresponding to the left boundary of the circumscribed rectangular box of the object (Object).

[0248] S207, determining the Nth object according to the sorting result, where N is a positive integer.

[0249] S208: Determine the Nth object as the object to be identified.

[0250] In an embodiment of the present application, the objects in the object group are sorted, so that the Nth object can be determined according to the sorting result, where N is a positive integer, and the Nth object is determined as the object to be identified.

[0251] Among them, for the hyphen, when performing the word breaking function, it generally appears at the end of the line, so for the Nth object, when the sorting rule is from small to large, it can be the last object, which means that the last object is determined as the object to be identified.

[0252] For example, according to the third X-axis coordinate value (Object.BBox.left) mentioned above, the objects (Object) in the object group (ObjectGroup) are sorted from small to large, and the last object (Object) is determined as the object to be identified.

[0253] In addition, for the sorting result, it can be determined whether the sorting order of the objects in the object group is different based on the sorting result. If the sorting order of the objects in the object group is different, the Nth object is determined based on the sorting result.

[0254] When the sorting order of the objects in the object group is the same, it means that the sorting order of the objects in the object group is not the actual typesetting order in the text line, and needs to be sorted again.

[0255] Based on this, when the objects in the object group have the same sorting order, determine the objects with the same sorting order; obtain the first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the objects with the same sorting order; sort the objects with the same sorting order again according to the first Y-axis coordinate value; and determine the Nth object based on the sorting result and the result of the re-sorting.

[0256] For example, traverse the objects (Object) in the object group (ObjectGroup), assuming that there are object 1, object 2, object 3, and object 4, and sort the objects (Object) in the object group (ObjectGroup) from small to large according to the third X-axis coordinate value (Object.BBox.left) corresponding to the left boundary of the circumscribed rectangular box of the object (Object). The sorting result can be shown in Table 1 below.

[0257] Object Sort order Subject 1 1 Subject 2 2 Subject 3 3 Subject 4 3

[0258] Table 1

[0259] It can be seen from Table 1 above that the objects in the object group have the same sorting order, that is, the sorting order of the above objects 3 and 4 is the same, both 3, and they need to be sorted again. In this way, objects 3 and 4 with the same sorting order can be determined, and the first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of object 3 and the first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of object 4 are obtained. According to the first Y-axis coordinate value, objects 3 and 4 are sorted again from small to large. Assuming that the re-sorting order of object 3 is 1 and the re-sorting order of object 4 is 2, at this time, according to the sorting results of Table 1 above and the results of the re-sorting of objects 3 and 4, it can be known that the last object is object 4, and at this time, object 4 can be determined as the object to be identified.

[0260] S209: When the object to be identified is a text object, determine whether the Unicode of the text object satisfies a preset hyphen Unicode condition.

[0261] S210: When the Unicode of the text object satisfies a preset hyphen Unicode condition, determine whether the context of the text object satisfies a preset hyphen semantic condition.

[0262] S211: When the context of the text object satisfies a preset hyphenation semantic condition, determine whether the position of the text object satisfies a preset hyphenation position condition.

[0263] S212: When the position of the text object meets a preset hyphen position condition, assign a hyphen modification attribute to the text object.

[0264] In the embodiment of the present application, for the object to be identified, if the object to be identified is not a text object or a vector path object, the recognition of hyphens can be terminated, which means that the hyphen recognition process is terminated for the text line.

[0265] When the object to be identified is a text object, determine whether the Unicode of the text object satisfies a preset hyphenation Unicode condition; when the Unicode of the text object satisfies the preset hyphenation Unicode condition, determine whether the context of the text object satisfies a preset hyphenation semantic condition; when the context of the text object satisfies the preset hyphenation semantic condition, determine whether the position of the text object satisfies a preset hyphenation position condition; when the position of the text object satisfies the preset hyphenation position condition, assign a hyphen modification attribute to the text object.

[0266] Specifically, when the object to be identified is a text object, determine whether the Unicode of the text object is the Unicode corresponding to the hyphen. When the Unicode of the text object is the Unicode corresponding to the hyphen, determine whether the context of the text object meets the preset hyphen semantic condition.

[0267] For example, when the object to be identified is a text object, determine whether the Unicode of the text object is the Unicode corresponding to a hyphen (0x2d). When the Unicode of the text object is the Unicode corresponding to a hyphen, determine whether the context of the text object meets the preset hyphen semantic condition.

[0268] It should be noted that, in the case where the Unicode of the text object is the Unicode corresponding to the hyphen, the text object (i.e., the last object) may be a hyphen, but it cannot be completely distinguished from the subtraction operator only from the Unicode. Among them, the Unicode of the subtraction operator is the same as the Unicode of the hyphen, and they cannot be distinguished because of the same Unicode. Therefore, in the case where the Unicode of the text object is the Unicode corresponding to the hyphen, additional analysis of its context is required to further identify whether the text object is a hyphen.

[0269] Specifically, the previous object of the text object is searched, and if the previous object is a text object, it is determined whether the Unicode of the previous object is within a preset Unicode interval; the next object of the text object is searched, and if the next object is a text object, it is determined whether the Unicode of the next object is within a preset Unicode interval.

[0270] For example, if the text object is the last object in the object group, then find the previous object of the text object, that is, the second to last object in the object group. If the second to last object in the object group is a text object, determine whether the Unicode of the second to last object in the object group is located in the Latin interval or the Cyrillic interval. Find the next object of the text object, that is, the first object in the object group of the next text line. If it is a text object, determine whether its Unicode is located in the Latin interval or the Cyrillic interval.

[0271] It should be noted that the Unicode standard protocol specifies the ranges of some languages, for example, the Latin range is 0x00 to 0x7F, but this embodiment of the present application does not limit this.

[0272] In addition, when the Unicode of the previous object of the text object is within the preset Unicode interval, and the Unicode of the next object of the text object is within the preset Unicode interval, it is determined whether the position of the text object satisfies the preset hyphen position condition. If the position of the text object satisfies the preset hyphen position condition, the text object is assigned a hyphen modifier attribute.

[0273] Among them, judging whether the position of the text object meets the preset hyphen position condition can be specifically performed by determining, for any remaining object in the object group, a first projection of the circumscribed rectangular box of the object on the X-axis; determining a second projection of the circumscribed rectangular box of the text object on the X-axis, and judging whether any of the first projections and the second projections do not intersect; thereby, in the case that any of the first projections and the second projections do not intersect, assigning a hyphen modifier attribute to the text object.

[0274] It should be noted that the first projection on the X-axis generally considers the interval composed of the left and right boundaries of the circumscribed rectangular box of any other object in the object group, such as (1, 3), and the second projection on the X-axis generally considers the interval composed of the left and right boundaries of the circumscribed rectangular box of the text object, such as (2, 5). It can be seen that the first projection intersects with the second projection, and the intersecting part is (2, 3), while (1, 4) and (4, 5) do not intersect.

[0275] In addition, it is determined here whether any of the first projections and the second projections do not intersect. In the case that any of the first projections and the second projections do not intersect, a hyphen modifier attribute is given to the text object in order to avoid confusion with other characters such as a strikethrough, and "=" drawn by instructions, etc., to ensure that there is no other content above and below the hyphen.

[0276] S213: When the object to be identified is a vector path object, determine whether an instruction set for drawing the vector path object satisfies a preset hyphen instruction set condition.

[0277] S214: When the instruction set for drawing the vector path object meets the preset hyphenation instruction set condition, determine whether the context of the vector path object meets the preset hyphenation semantic condition.

[0278] In an embodiment of the present application, when the object to be identified is a vector path object, it is determined whether the instruction set for drawing the vector path object satisfies the preset hyphenation instruction set condition; when the instruction set for drawing the vector path object satisfies the preset hyphenation instruction set condition, it is determined whether the context of the vector path object satisfies the preset hyphenation semantic condition.

[0279] Specifically, when the object to be identified is a vector path object, it is determined whether there is a first instruction in the instruction set for drawing the vector path object and there is no second instruction, wherein the first instruction exists in the instruction set for drawing the vector path object and there is no second instruction, characterizing the vector path object as a straight line, satisfying the requirement that the drawing of a hyphen must be a straight line, thereby, when the first instruction exists in the instruction set for drawing the vector path object and there is no second instruction, it is determined whether the context of the vector path object satisfies the preset hyphen semantic condition.

[0280] It should be noted that, when the first instruction does not exist or the second instruction exists in the instruction set for drawing the vector path object, the recognition of the hyphen is terminated at this time, because the drawing of the hyphen must be a straight line.

[0281] For example, when the object to be identified is a vector path object, determine whether there is a LineTo (move and draw a straight line) instruction and no BesizerTo (move and draw a Bezier curve) instruction in the instruction set for drawing the vector path object. If there is no LineTo instruction or there is a BesizerTo instruction in the instruction set for drawing the vector path object, hyphen recognition ends. When there is a LineTo instruction and no BesizerTo instruction in the instructions for drawing the vector path object, determine whether the context of the vector path object meets the preset hyphen semantic conditions.

[0282] In addition, when the first instruction exists but the second instruction does not exist in the instruction set for drawing the vector path object, the circumscribed rectangular frame of the vector path object also needs to meet certain conditions. Only then can it be determined whether the context of the vector path object meets the preset hyphen semantic conditions.

[0283] Specifically, when the first instruction exists in the instruction set for drawing the vector path object and the second instruction does not exist, and the circumscribed rectangular frames of the vector path object all meet the following conditions, it is determined whether the context of the vector path object meets the preset hyphen semantic condition;

[0284] a*CharWidth<BBox.Width<b*CharWidth; BBox.Width>c*BBox.Height;

[0285] ((LineBBox.Top+LineBBox.Bottom)-(BBox.Top+BBox.Bottom)) / d<e*CharWidth;

[0286] a is a preset second value (for example, a value range of 0 to 1, an empirical value), b is a preset third value (for example, a value range of 0 to 1, an empirical value), c is a preset fourth value (for example, a positive integer, an empirical value), d is a preset fifth value (for example, a positive integer, an empirical value), e is a preset sixth value (for example, a value range of 0 to 1, an empirical value), CharWidth is the average character width of the text line, BBox.Width is the width of the bounding rectangle of the vector path object, BBox.Height is the height of the bounding rectangle of the vector path object, LineBBox.Top is the second Y-axis coordinate value corresponding to the upper boundary of the bounding rectangle of the text line, LineBBox.Bottom is the third Y-axis coordinate value corresponding to the lower boundary of the bounding rectangle of the text line, BBox.Top is the fourth Y-axis coordinate value corresponding to the upper boundary of the bounding rectangle of the vector path object, and BBox.Bottom is the fifth Y-axis coordinate value corresponding to the lower boundary of the bounding rectangle of the vector path object.

[0287] It should be noted that, for a hyphen, its width is slightly smaller than a character width, so the circumscribed rectangular box of the vector path object must meet the following conditions, for example, the above condition can be a*CharWidth<BBox.Width<b*CharWidth. In addition, in the case of horizontal typesetting of electronic documents, the width of the hyphen is much larger than the height, so the circumscribed rectangular box of the vector path object must also meet the following conditions, for example, the above condition can be BBox.Width>c*BBox.Height. In addition, for a hyphen, it is generally located near the center of the line height of the text line, so the circumscribed rectangular box of the vector path object must also meet the following conditions, for example, the above condition can be ((LineBBox.Top+LineBBox.Bottom)-(BBox.Top+BBox.Bottom)) / d<e*CharWidth.

[0288] It should be noted that, if the first instruction exists but the second instruction does not exist in the instruction set for drawing a vector path object, and the bounding rectangle of the vector path object meets the above conditions, the vector path object (i.e., the last object) may be a hyphen, but it cannot be completely distinguished from a dash “—”, a Chinese character “—”, etc. in appearance. Therefore, additional analysis of its context is required to further identify whether the vector path object is a hyphen.

[0289] Specifically, the previous object of the vector path object is searched, and if the previous object is a text object, it is determined whether the Unicode of the previous object is in a preset Unicode interval, and the next object of the vector path object is searched, and if the next object is a text object, it is determined whether the Unicode of the next object is in a preset Unicode interval, so that if the Unicode of the previous object is in the preset Unicode interval and the Unicode of the next object is in the preset Unicode interval, it is determined whether the position of the vector path object meets the preset hyphen position condition. Among them, the context analysis of the vector path object refers to the context analysis of the text object mentioned above, and the embodiments of the present application will not be repeated here one by one.

[0290] S215: When the context of the vector path object satisfies the preset hyphen semantic condition, determine whether the position of the vector path object satisfies the preset hyphen position condition.

[0291] S216: When the position of the vector path object meets a preset hyphen position condition, assign a hyphen modification attribute to the vector path object.

[0292] In an embodiment of the present application, when the context of the vector path object satisfies the preset hyphen semantic condition, it is determined whether the position of the vector path object satisfies the preset hyphen position condition. When the position of the vector path object satisfies the preset hyphen position condition, the vector path object is assigned a hyphen modifier attribute.

[0293] Specifically, when the Unicode of the previous object of the vector path object is in a preset Unicode interval and the Unicode of the next object of the vector path object is in the preset Unicode interval, it is determined whether the position of the vector path object meets the preset hyphen position condition.

[0294] For example, when the vector path object is the last object in the object group, the Unicode of the second-to-last object in the object group is in the Latin interval or the Cyrillic interval, and the Unicode of the first-ranked object in the object group of the next text line is in the Latin interval or the Cyrillic interval, it is determined whether the position of the vector path object meets the preset hyphen position condition. If the position of the vector path object meets the preset hyphen position condition, the vector path object is assigned a hyphen modification attribute.

[0295] Among them, judging whether the position of the vector path object meets the preset hyphen position condition can be specifically performed by determining, for any remaining object in the object group, a first projection of the circumscribed rectangular frame of the object on the X-axis; determining a second projection of the circumscribed rectangular frame of the vector path object on the X-axis, and judging whether any of the first projections and the second projections do not intersect; thereby, in the case that any of the first projections and the second projections do not intersect, assigning a hyphen modifier attribute to the vector path object.

[0296] It should be noted that the first projection on the X-axis generally considers the interval composed of the left and right boundaries of the circumscribed rectangular box of any other object in the object group, such as (1, 3), and the second projection on the X-axis generally considers the interval composed of the left and right boundaries of the circumscribed rectangular box of the vector path object, such as (2, 5). It can be seen that the first projection intersects with the second projection, and the intersecting part is (2, 3), while (1, 4) and (4, 5) do not intersect.

[0297] In addition, it is determined here whether any of the first projections and the second projections do not intersect. In the case that any of the first projections and the second projections do not intersect, a hyphen modifier attribute is given to the vector path object in order to avoid confusion with other characters such as a strikethrough, and "=" drawn by instructions, etc., to ensure that there is no other content above and below the hyphen.

[0298] In the embodiment of the present application, for an electronic document, for any text line in the electronic document, after the above processing, it is possible to identify the hyphen in the text line, that is, the above-mentioned object to be identified (text object or vector path object) endowed with the hyphen modifier attribute. In this way, multiple objects to be identified endowed with the hyphen modifier attribute can be obtained.

[0299] Based on this, for an electronic document, such as a layout electronic document, when the layout electronic document is converted (converted into a streaming electronic document) or rearranged, the following processing is performed for any object to be identified (i.e., an object to be identified with a hyphen modification attribute):

[0300] Determine the layout position of the object to be recognized; if the layout position is the end of a line, retain the object to be recognized; if the layout position is not the end of a line, delete the object to be recognized, and move the elements behind the object to be recognized forward according to the width of the bounding rectangle of the object to be recognized (meaning that the elements behind the object to be recognized are moved forward by the same number of units as the width of the bounding rectangle of the object to be recognized).

[0301] Through the above description of the technical solution provided in the embodiment of the present application, the text objects in the text line are split and sorted, and the actual typesetting order in the text line is obtained. The object to be identified is determined according to the typesetting order, and it is judged whether the object to be identified may be a hyphen through the information such as the external rectangular box, the Unicode, the instruction set, etc. In addition, the position relationship and the contextual semantic features are combined to judge whether the object to be identified is a hyphen or other characters. The hyphens of text objects and non-text objects, that is, the hyphens of vector path objects, can be quickly identified, thereby improving the accuracy of hyphen recognition, and improving the effect of conversion of electronic documents (such as layout electronic documents), improving the editability of electronic documents, and improving the readability of electronic documents when they are rearranged.

[0302] Corresponding to the above method embodiment, the present application embodiment also provides a hyphen recognition device, such as Figure 5 As shown, the device may include: a document acquisition module 510, a text line recognition module 520, a text line processing module 530, an element acquisition module 540, an object determination module 550, and an attribute assignment module 560.

[0303] The document acquisition module 510 is used to acquire electronic documents;

[0304] A text line identification module 520, used to identify all text lines in the electronic document;

[0305] The text line processing module 530 is used to perform the following processing on any of the text lines:

[0306] An element acquisition module 540 is used to acquire basic elements in the text line and store the basic elements as objects in an object group;

[0307] An object determination module 550 is used to determine an object to be identified from the objects in the object group;

[0308] The attribute assigning module 560 is used to assign a hyphen modification attribute to the object to be identified if the object to be identified meets a preset hyphen identification condition.

[0309] In an optional embodiment, the basic elements include text objects, vector path objects and image objects;

[0310] The element acquisition module is specifically used for:

[0311] Acquire the text object, the vector path object and the image object in the text line;

[0312] The text object, the vector path object and the image object are respectively stored as objects in an object group.

[0313] In an optional embodiment, the device further comprises:

[0314] An object search module, used for traversing the objects in the object group, searching for the text object, and determining the found text object as a target object;

[0315] A width determination module, used for determining an average character width of the text line according to the characters included in all the target objects;

[0316] The object processing module is used to perform the following steps for any of the target objects when the target object contains multiple characters:

[0317] A character splitting module, used for splitting any adjacent first character and second character in the target object according to the average character width to obtain a first text object and a second text object;

[0318] The object storing module is used to store the first text object and the second text object into an object group as separate objects.

[0319] In an optional implementation, the width determination module is specifically configured to:

[0320] Counting the heights of all characters contained in the target objects, and counting the number of characters corresponding to the characters contained in all the target objects;

[0321] Accumulating the heights to obtain a total height, and determining an average character height of the text line according to the total height and the number of characters;

[0322] The average character height of the text line is determined as the average character width of the text line.

[0323] In an optional implementation, the character splitting module specifically includes:

[0324] The character processing submodule is used to perform the following processing on any adjacent first character and second character in the target object:

[0325] An interval determination submodule, used to determine the interval between adjacent first and second characters;

[0326] A product acquisition submodule, used to acquire the product of a preset first value and the average character width;

[0327] The character splitting submodule is used for splitting the adjacent first character and second character into a first text object and a second text object when the interval is greater than the product.

[0328] In an optional implementation, the interval determination submodule is specifically used to:

[0329] Obtaining a first X-axis coordinate value corresponding to the left boundary of the circumscribed rectangular frame of the first character;

[0330] Obtain a second X-axis coordinate value corresponding to the right boundary of the circumscribed rectangular frame of the second character;

[0331] A coordinate difference between the first X-axis coordinate value and the second X-axis coordinate value is obtained, and the coordinate difference is determined as an interval between adjacent first characters and second characters.

[0332] In an optional implementation, the object determination module specifically includes:

[0333] A first submodule for obtaining coordinate values ​​is used to traverse the objects in the object group and obtain a third X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the object;

[0334] an object sorting submodule, used for sorting the objects in the object group according to the third X-axis coordinate value;

[0335] The first object determination submodule is used to determine the Nth object according to the sorting result, where N is a positive integer;

[0336] The second object determination submodule is used to determine the Nth object as the object to be identified.

[0337] In an optional implementation, the object determination first submodule is specifically used for:

[0338] According to the sorting result, determining whether the sorting orders of the objects in the object group are all different;

[0339] When the objects in the object group are sorted in different orders, the Nth object is determined according to the sorting result.

[0340] In an optional implementation, the object determination module further includes:

[0341] The third object determination submodule is used to determine the objects with the same sorting order when the sorting orders of the objects in the object group are the same;

[0342] A second submodule for obtaining coordinate values ​​is used to obtain a first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular frame of the objects in the same sorting order;

[0343] An object re-sorting submodule, used for re-sorting the objects in the same sorting order according to the first Y-axis coordinate value;

[0344] The fourth object determination submodule is used to determine the Nth object according to the sorting result and the re-sorting result.

[0345] In an optional implementation, the attribute assignment module specifically includes:

[0346] A Unicode determination submodule, used for determining, when the object to be identified is the text object, whether the Unicode of the text object satisfies a preset hyphen Unicode condition;

[0347] A first context judgment submodule, configured to judge whether the context of the text object satisfies a preset hyphenation semantic condition when the Unicode of the text object satisfies a preset hyphenation Unicode condition;

[0348] A first position determination submodule, configured to determine whether the position of the text object satisfies a preset hyphenation position condition when the context of the text object satisfies a preset hyphenation semantic condition;

[0349] The first attribute assignment submodule is used to assign a hyphen modification attribute to the text object when the position of the text object meets a preset hyphen position condition;

[0350] An instruction set determination submodule, used for determining, when the object to be identified is the vector path object, whether an instruction set for drawing the vector path object satisfies a preset hyphen instruction set condition;

[0351] A second context judgment submodule, configured to judge whether the context of the vector path object satisfies a preset hyphenation semantic condition when the instruction set for drawing the vector path object satisfies a preset hyphenation instruction set condition;

[0352] A second position determination submodule, configured to determine whether the position of the vector path object satisfies a preset hyphen position condition when the context of the vector path object satisfies a preset hyphen semantic condition;

[0353] The second attribute assignment submodule is used to assign a hyphen modification attribute to the vector path object when the position of the vector path object meets a preset hyphen position condition.

[0354] In an optional implementation, the Unicode determination submodule is specifically used for:

[0355] In the case where the object to be identified is the text object, determining whether the Unicode of the text object is a Unicode corresponding to a hyphen;

[0356] The context judgment first submodule is specifically used for:

[0357] In the case that the Unicode of the text object is a Unicode corresponding to a hyphen, it is determined whether the context of the text object satisfies a preset hyphen semantic condition.

[0358] In an optional implementation, the instruction set determination submodule is specifically used to:

[0359] In the case where the object to be identified is the vector path object, determining whether a first instruction exists in an instruction set for drawing the vector path object and whether a second instruction exists;

[0360] The context determination second submodule is specifically used for:

[0361] In a case where the first instruction exists but the second instruction does not exist in the instruction set for drawing the vector path object, it is determined whether a context of the vector path object satisfies a preset hyphen semantic condition.

[0362] In an optional implementation, the context determination second submodule is specifically used for:

[0363] In the case where the first instruction exists but the second instruction does not exist in the instruction set for drawing the vector path object, and the circumscribed rectangular frames of the vector path object all meet the following conditions, determining whether the context of the vector path object meets a preset hyphen semantic condition;

[0364] a*CharWidth<BBox.Width<b*CharWidth; BBox.Width>c*BBox.Height;

[0365] ((LineBBox.Top+LineBBox.Bottom)-(BBox.Top+BBox.Bottom)) / d<e*CharWidth;

[0366] a is a preset second value, b is a preset third value, c is a preset fourth value, d is a preset fifth value, e is a preset sixth value, CharWidth is the average character width of the text line, BBox.Width is the width of the circumscribed rectangular box of the vector path object, BBox.Height is the height of the circumscribed rectangular box of the vector path object, LineBBox.Top is the second Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the text line, LineBBox.Bottom is the third Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the text line, BBox.Top is the fourth Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the vector path object, and BBox.Bottom is the fifth Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the vector path object.

[0367] In an optional implementation, the context determination first submodule is specifically used for:

[0368] Finding a previous object of the text object, and if the previous object is a text object, determining whether the Unicode of the previous object is within a preset Unicode interval;

[0369] Finding the next object of the text object, and if the next object is a text object, determining whether the Unicode of the next object is within a preset Unicode interval;

[0370] The first submodule of position determination is specifically used for:

[0371] When the Unicode of the previous object is within a preset Unicode interval and the Unicode of the next object is within a preset Unicode interval, it is determined whether the position of the text object satisfies a preset hyphen position condition.

[0372] In an optional implementation, the context determination second submodule is specifically used for:

[0373] Finding a previous object of the vector path object, and if the previous object is a text object, determining whether the Unicode of the previous object is within a preset Unicode interval;

[0374] Finding the next object of the vector path object, and if the next object is a text object, determining whether the Unicode of the next object is within a preset Unicode interval;

[0375] The second submodule of position determination is specifically used for:

[0376] When the Unicode of the previous object is in a preset Unicode interval and the Unicode of the next object is in a preset Unicode interval, it is determined whether the position of the vector path object satisfies a preset hyphen position condition.

[0377] In an optional implementation, the first position determination submodule is specifically used for:

[0378] For any of the remaining objects in the object group, determining a first projection of a circumscribed rectangular frame of the object on the X-axis;

[0379] Determine a second projection of the circumscribed rectangular frame of the text object on the X-axis, and judge whether any of the first projections and the second projections do not intersect;

[0380] The attribute is assigned to the first submodule specifically for:

[0381] In a case where neither the first projection nor the second projection intersects, a hyphen modifier attribute is assigned to the text object.

[0382] In an optional implementation, the second position determination submodule is specifically used for:

[0383] For any of the remaining objects in the object group, determining a first projection of a circumscribed rectangular frame of the object on the X-axis;

[0384] Determine a second projection of the circumscribed rectangular frame of the vector path object on the X-axis, and determine whether any of the first projections and the second projections do not intersect;

[0385] The attribute is assigned to the second submodule specifically for:

[0386] In a case where neither the first projection nor the second projection intersects, a hyphen modifier attribute is assigned to the vector path object.

[0387] In an optional embodiment, the device further comprises:

[0388] The hyphen processing module is used to perform the following processing on any of the objects to be identified when converting or rearranging the electronic document:

[0389] Determining the layout position of the object to be identified;

[0390] When the typesetting position is at the end of a line, retaining the object to be identified;

[0391] When the typesetting position is not the end of a line, the object to be identified is deleted, and the elements behind the object to be identified are moved forward according to the width of the circumscribed rectangular frame of the object to be identified.

[0392] The present application also provides an electronic device, such as Figure 6 As shown, it includes a processor 61, a communication interface 62, a memory 63 and a communication bus 64, wherein the processor 61, the communication interface 62, and the memory 63 communicate with each other through the communication bus 64.

[0393] Memory 63, used for storing computer programs;

[0394] The processor 61 is used to execute the program stored in the memory 63 to implement the following steps:

[0395] An electronic document is obtained, and all text lines in the electronic document are identified; for any of the text lines, the following processing is performed: basic elements in the text line are obtained, and the basic elements are stored as objects in an object group; an object to be identified is determined from the objects in the object group; and a hyphen modification attribute is given to the object to be identified if the object to be identified meets a preset hyphen recognition condition.

[0396] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0397] The communication interface is used for communication between the above electronic device and other devices.

[0398] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0399] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0400] In another embodiment provided in the present application, a storage medium is provided, in which instructions are stored. When the instructions are executed on a computer, the computer executes the hyphen recognition method described in any one of the above embodiments.

[0401] In another embodiment provided by the present application, a computer program product including instructions is also provided, and when the computer is run on the computer, the computer is enabled to execute any hyphen recognition method described in the above embodiments.

[0402] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a storage medium, or transmitted from one storage medium to another storage medium, for example, the computer instructions may be transmitted from a website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The storage medium may be any available medium that a computer can access or a data storage device such as a server or a data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0403] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0404] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0405] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A hyphen recognition method, characterized in that: The method comprises: Obtaining an electronic document, and identifying all text lines in the electronic document; For any of the text lines, perform the following processing: Obtaining basic elements in the text line, and storing the basic elements as objects in an object group; Determining an object to be identified from the objects in the object group; In the case that the object to be identified meets the preset hyphen identification condition, a hyphen modification attribute is given to the object to be identified.

2. The method according to claim 1, characterized in that The basic elements include text objects, vector path objects and image objects; The acquiring the basic elements in the text line and storing the basic elements as objects in the object group includes: Acquire the text object, the vector path object and the image object in the text line; storing the text object, the vector path object and the image object as objects in an object group respectively; After storing the text object, the vector path object and the image object as objects in the object group respectively, the method further includes: Traversing the objects in the object group, searching for the text object, and determining the found text object as a target object; Determining an average character width of the text line according to the characters included in all the target objects; For any of the target objects, if the target object contains multiple characters, perform the following steps: According to the average character width, any adjacent first character and second character in the target object are split to obtain a first text object and a second text object; The first text object and the second text object are respectively stored in an object group as separate objects.

3. The method according to claim 2, characterized in that The step of determining the average character width of the text line according to the characters included in all the target objects includes: Counting the heights of all characters contained in the target objects, and counting the number of characters corresponding to the characters contained in all the target objects; Accumulating the heights to obtain a total height, and determining an average character height of the text line according to the total height and the number of characters; Determining the average character height of the text line as the average character width of the text line; The step of splitting any adjacent first character and second character in the target object according to the average character width to obtain a first text object and a second text object includes: For any adjacent first character and second character in the target object, the following processing is performed: Determine the interval between adjacent first characters and second characters, and obtain the product of a preset first value and the average character width; When the interval is greater than the product, the adjacent first character and second character are split into a first text object and a second text object.

4. The method according to any one of claims 1 to 3, characterized in that: The step of determining the object to be identified from the objects in the object group includes: Traversing the objects in the object group, obtaining the third X-axis coordinate value corresponding to the left boundary of the circumscribed rectangular frame of the object; sorting the objects in the object group according to the third X-axis coordinate value; According to the sorting result, determining the Nth object, where N is a positive integer; The Nth object is determined as the object to be identified.

5. The method according to claim 4, characterized in that Determining the Nth object according to the sorting result includes: According to the sorting result, determining whether the sorting orders of the objects in the object group are all different; When the objects in the object group are sorted in different orders, determining the Nth object according to the sorting result; In the case that the objects in the object group have the same sorting order, determining the objects with the same sorting order; Obtaining a first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the objects in the same sorting order; sorting the objects in the same sorting order again according to the first Y-axis coordinate value; According to the sorting result and the result of the re-sorting, the Nth object is determined.

6. The method according to claim 2, characterized in that When the object to be identified meets the preset hyphen identification condition, assigning the object to be identified a hyphen modification attribute includes: In the case where the object to be identified is the text object, determining whether the Unicode of the text object satisfies a preset hyphen Unicode condition; in the case where the Unicode of the text object satisfies the preset hyphen Unicode condition, determining whether the context of the text object satisfies a preset hyphen semantic condition; in the case where the context of the text object satisfies the preset hyphen semantic condition, determining whether the position of the text object satisfies a preset hyphen position condition; in the case where the position of the text object satisfies the preset hyphen position condition, assigning a hyphen modification attribute to the text object; In a case where the object to be identified is the vector path object, determine whether an instruction set for drawing the vector path object satisfies a preset hyphen instruction set condition; in a case where the instruction set for drawing the vector path object satisfies a preset hyphen instruction set condition, determine whether a context of the vector path object satisfies a preset hyphen semantic condition; in a case where the context of the vector path object satisfies a preset hyphen semantic condition, determine whether a position of the vector path object satisfies a preset hyphen position condition; in a case where the position of the vector path object satisfies a preset hyphen position condition, assign a hyphen modification attribute to the vector path object.

7. The method according to claim 6, characterized in that When the object to be identified is the text object, determining whether the Unicode of the text object satisfies a preset hyphen Unicode condition includes: In the case where the object to be identified is the text object, determining whether the Unicode of the text object is a Unicode corresponding to a hyphen; When the Unicode of the text object satisfies the preset hyphen Unicode condition, determining whether the context of the text object satisfies the preset hyphen semantic condition includes: In the case where the Unicode of the text object is a Unicode corresponding to a hyphen, determining whether the context of the text object satisfies a preset hyphen semantic condition; When the object to be identified is the vector path object, determining whether the instruction set for drawing the vector path object satisfies a preset hyphen instruction set condition includes: In the case where the object to be identified is the vector path object, determining whether a first instruction exists in an instruction set for drawing the vector path object and whether a second instruction exists; In the case where the instruction set for drawing the vector path object satisfies the preset hyphenation instruction set condition, determining whether the context of the vector path object satisfies the preset hyphenation semantic condition includes: When the first instruction exists in the instruction set for drawing the vector path object and the second instruction does not exist, it is determined whether the context of the vector path object satisfies a preset hyphen semantic condition.

8. The method according to claim 6, characterized in that The determining whether the context of the text object satisfies a preset hyphen semantic condition includes: Finding a previous object of the text object, and if the previous object is a text object, determining whether the Unicode of the previous object is within a preset Unicode interval; Finding the next object of the text object, and if the next object is a text object, determining whether the Unicode of the next object is within a preset Unicode interval; When the context of the text object satisfies the preset hyphenation semantic condition, determining whether the position of the text object satisfies the preset hyphenation position condition includes: When the Unicode of the previous object is within a preset Unicode interval and the Unicode of the next object is within a preset Unicode interval, determining whether the position of the text object satisfies a preset hyphen position condition; The determining whether the context of the vector path object satisfies a preset hyphen semantic condition includes: Finding a previous object of the vector path object, and if the previous object is a text object, determining whether the Unicode of the previous object is within a preset Unicode interval; Finding the next object of the vector path object, and if the next object is a text object, determining whether the Unicode of the next object is within a preset Unicode interval; When the context of the vector path object satisfies the preset hyphen semantic condition, determining whether the position of the vector path object satisfies the preset hyphen position condition includes: When the Unicode of the previous object is in a preset Unicode interval and the Unicode of the next object is in a preset Unicode interval, it is determined whether the position of the vector path object satisfies a preset hyphen position condition.

9. The method according to claim 6, characterized in that The determining whether the position of the text object satisfies a preset hyphen position condition includes: For any of the remaining objects in the object group, determining a first projection of a circumscribed rectangular frame of the object on the X-axis; Determine a second projection of the circumscribed rectangular frame of the text object on the X-axis, and judge whether any of the first projections and the second projections do not intersect; When the position of the text object satisfies a preset hyphen position condition, assigning a hyphen modification attribute to the text object includes: In the case that any of the first projections and the second projections do not intersect, assigning a hyphen modifier attribute to the text object; The determining whether the position of the vector path object satisfies a preset hyphen position condition includes: For any of the remaining objects in the object group, determining a first projection of a circumscribed rectangular frame of the object on the X-axis; Determine a second projection of the circumscribed rectangular frame of the vector path object on the X-axis, and determine whether any of the first projections and the second projections do not intersect; When the position of the vector path object meets a preset hyphen position condition, assigning a hyphen modification attribute to the vector path object includes: In a case where neither the first projection nor the second projection intersects, a hyphen modifier attribute is assigned to the vector path object.

10. A hyphen recognition device, characterized in that: The device comprises: A document acquisition module, used to acquire electronic documents; A text line recognition module, used to recognize all text lines in the electronic document; The text line processing module is used to perform the following processing on any of the text lines: An element acquisition module, used for acquiring basic elements in the text line, and storing the basic elements as objects in an object group; An object determination module, used to determine an object to be identified from the objects in the object group; The attribute assigning module is used to assign a hyphen modification attribute to the object to be identified when the object to be identified meets a preset hyphen identification condition.