Document processing method and device

By identifying the corresponding text of hyperlinks in the layout electronic document, the problem of hyperlink recognition in the layout electronic document is solved, and the conversion effect and editability are improved.

CN119167897APending Publication Date: 2024-12-20ZHUHAI KINGSOFT OFFICE SOFTWARE +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310740513.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-20
Publication Date
2024-12-20

AI Technical Summary

Technical Problem

In the prior art, there is a lack of effective method for text recognition corresponding to hyperlinks in layout electronic documents, which leads to the inability to accurately identify the correspondence between hyperlinks and text when the layout electronic documents are transferred to the layout electronic documents, affecting the conversion effect and editability.

Method used

By obtaining text and comments in the layout electronic document, depositing them into text groups and comment groups, traversing the hyperlinks in the comment group, determining the target text based on the positional relationship between the hyperlink and the text, and saving them into the hyperlink group, identifying The text corresponding to the hyperlink. The specific steps include determining the positional relationship of the hyperlink and text, judging the color and arrangement method, assigning target attributes, dividing and modifying element processing to determine the target text of the hyperlink.

Benefits of technology

It effectively identifies the corresponding text of hyperlinks in the layout electronic document, improves the conversion effect and editability of the layout electronic document, and improves the readability during rearrangement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119167897A_ABST
    Figure CN119167897A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a document processing method and device, and the method comprises the steps: obtaining a format electronic document, and determining a text and an annotation in the format electronic document; storing the text into a text group, and storing a hyperlink of a standard protocol contained in the annotation into a first annotation group; traversing the hyperlink in the first annotation group, and executing the following processing: determining a target text corresponding to the hyperlink in the text of the text group according to a position relationship between the hyperlink and the text in the text group; and storing the target text into a hyperlink group corresponding to the hyperlink. According to the position relation between the hyperlink and the text, the text corresponding to the hyperlink can be recognized, the conversion effect of the format electronic document is improved, the editability of the format electronic document is improved, and the readability of the format electronic document during rearrangement is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a document processing method and device. Background Art

[0002] At present, most electronic documents are layout electronic documents mainly in PDF format converted from typesetting tools and layout documents. Layout electronic documents often need to reference external content or content in layout electronic documents. Generally, a hyperlink is added to add the reference target and the target path corresponding to the target. For example, if the reference is a web page, the target path is the address of the web page.

[0003] In the related art, in the scenario of converting a formatted electronic document to a streaming electronic document, it is necessary to identify the text corresponding to the hyperlink in the published electronic document so as to form a correspondence between the hyperlink and the specific text, which is convenient for the subsequent conversion of the formatted electronic document to the streaming electronic document. However, there is currently no effective solution for identifying the text corresponding to the hyperlink in the formatted electronic document. Summary of the invention

[0004] In order to solve the above technical problem that there is no effective solution for identifying the text corresponding to the hyperlink in the layout electronic document, the embodiment of the present invention provides a document processing 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 invention, a document processing method is first provided, the method comprising:

[0006] Acquire a layout electronic document, and determine text and annotations in the layout electronic document;

[0007] storing the text into a text group, and storing a hyperlink of the standard protocol contained in the annotation into a first annotation group;

[0008] Traverse the hyperlinks in the first annotation group and perform the following processing:

[0009] Determining a target text corresponding to the hyperlink in the text of the text group according to a positional relationship between the hyperlink and the text in the text group;

[0010] The target text is stored in a hyperlink group corresponding to the hyperlink.

[0011] In an optional implementation, determining the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group includes:

[0012] Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group;

[0013] Determining whether a positional relationship between a bounding rectangle frame of the text in the text group and a bounding rectangle frame of the hyperlink meets a preset first position requirement;

[0014] When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement, storing the text in the text group into a text verification group;

[0015] The texts in the text verification group are traversed, and when the text colors of the texts meet the preset color requirements, the texts are determined as the target texts corresponding to the hyperlinks.

[0016] In an optional implementation, the determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement includes:

[0017] Obtaining a first X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the hyperlink, and obtaining a second X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the text in the text group;

[0018] Obtain the third X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the hyperlink, and obtain the fourth X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the text in the text group;

[0019] Obtain the first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the hyperlink, and obtain the second Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the text in the text group;

[0020] Obtain the third Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the hyperlink, and obtain the fourth Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the text in the text group;

[0021] Determine whether the second X-axis coordinate value is less than or equal to the first X-axis coordinate value, whether the fourth X-axis coordinate value is greater than or equal to the third X-axis coordinate value, whether the second Y-axis coordinate value is less than or equal to the first Y-axis coordinate value, and whether the fourth Y-axis coordinate value is greater than or equal to the third Y-axis coordinate value;

[0022] When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement, storing the text in the text group into a text verification group comprises:

[0023] When the second coordinate value of the X-axis is less than or equal to the first coordinate value of the X-axis, the fourth coordinate value of the X-axis is greater than or equal to the third coordinate value of the X-axis, the first coordinate value of the Y-axis is less than or equal to the second coordinate value of the Y-axis, and the fourth coordinate value of the Y-axis is greater than or equal to the third coordinate value of the Y-axis, the text in the text group is stored in a text inspection group.

[0024] In an optional implementation, when the text color of the text meets a preset color requirement, determining the text as the target text corresponding to the hyperlink includes:

[0025] In the case that the text color of the text has a blue component, the text is determined as the target text corresponding to the hyperlink.

[0026] In an optional implementation, determining the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group includes:

[0027] Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group;

[0028] According to the arrangement of elements of the layout electronic document, determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement;

[0029] When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement, storing the text in the text group into a text verification group;

[0030] The texts in the text verification group are traversed, and when the text colors of the texts meet the preset color requirements, the texts are determined as the target texts corresponding to the hyperlinks.

[0031] In an optional implementation, judging whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement according to the arrangement of elements of the layout electronic document includes:

[0032] In the case where the arrangement of elements of the layout electronic document is horizontal arrangement, determining a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determining a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0033] Determine a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determine a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0034] Determine whether the first vertical projection intersects with the second vertical projection, and whether the second horizontal projection includes the first horizontal projection;

[0035] or,

[0036] In the case where the arrangement of elements of the layout electronic document is vertical arrangement, determining a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determining a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0037] Determine a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determine a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0038] Determine whether the first horizontal projection intersects with the second horizontal projection, and whether the second vertical projection includes the first vertical projection;

[0039] When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement, storing the text in the text group into a text verification group comprises:

[0040] When the first vertical projection intersects the second vertical projection and the second horizontal projection includes the first horizontal projection, storing the text in the text group into a text verification group;

[0041] or,

[0042] When the first horizontal projection intersects the second horizontal projection and the second vertical projection includes the first vertical projection, the text in the text group is stored in a text verification group.

[0043] In an optional implementation, determining the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group includes:

[0044] Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group;

[0045] According to the arrangement of elements of the layout electronic document, determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement;

[0046] When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement, storing the text in the text group into a text verification group;

[0047] The texts in the text verification group are traversed, and when the texts have a target attribute, the texts are determined as target texts corresponding to the hyperlink.

[0048] In an optional embodiment, before executing the method, the method further includes:

[0049] The texts in the text group are traversed, and when the texts have the underline modification attribute of the non-standard protocol or the underline modification attribute of the standard protocol, the target attribute is assigned to the texts.

[0050] In an optional implementation, after determining the text and annotations in the layout electronic document, the method further includes:

[0051] In the case where the annotation does not contain a target modification element of a standard protocol, identifying all text lines in the formatted electronic document;

[0052] For any of the text lines, traverse the basic elements in the text line, and store the basic elements that meet the preset modification element conditions as modification elements of the non-standard protocol into the second annotation group;

[0053] Traversing the modified elements of the non-standard protocol in the second annotation group, assigning corresponding modification attributes to the modified elements of the non-standard protocol, and obtaining target modified elements of the non-standard protocol;

[0054] Determine a first width range of the target modifying element of the non-standard protocol in the second annotation group, and determine a second text line where the target modifying element of the non-standard protocol in the second annotation group is located;

[0055] In the case where the first width range includes the width range of N texts in the second text line, assigning the modification attribute of the target modification element of the non-standard protocol in the second annotation group to the N texts, wherein N is a positive integer, and the modification attribute of the target modification element of the non-standard protocol includes the modification attribute of the underline of the non-standard protocol;

[0056] In the case where the annotation includes a target modifier element of a standard protocol, storing the target modifier element of the standard protocol into the second annotation group;

[0057] Determine a second width range of the target modifier element of the standard protocol in the second annotation group, and determine a third text line where the target modifier element of the standard protocol in the second annotation group is located;

[0058] When the second width range includes the width range of M texts in the third text line, the modification attributes of the target modification element of the standard protocol in the second annotation group are assigned to the M texts, wherein M is a positive integer and the modification attributes of the target modification element of the standard protocol include the modification attributes of the underline of the standard protocol.

[0059] In an optional implementation, determining the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group includes:

[0060] Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group;

[0061] According to the arrangement of elements of the layout electronic document, determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement;

[0062] In the case where the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement, the text in the text group is determined as the target text corresponding to the hyperlink.

[0063] In an optional implementation, judging whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement according to the arrangement of elements of the layout electronic document includes:

[0064] In the case where the arrangement of elements of the layout electronic document is horizontal arrangement, determining a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determining a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0065] Determine a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determine a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0066] Determine whether the first vertical projection and the second vertical projection intersect and whether the ratio between the intersecting projection length and the first vertical projection length is greater than a preset value, and whether the second horizontal projection includes the first horizontal projection;

[0067] or,

[0068] In the case where the arrangement of elements of the layout electronic document is vertical arrangement, determining a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determining a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0069] Determine a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determine a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0070] Determine whether the first horizontal projection and the second horizontal projection intersect and whether the ratio between the intersecting projection length and the first horizontal projection length is greater than a preset value, and whether the second vertical projection includes the first vertical projection;

[0071] When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement, determining the text in the text group as the target text corresponding to the hyperlink includes:

[0072] In the case where the first vertical projection intersects with the second vertical projection and the ratio of the intersecting projection length to the first vertical projection length is greater than a preset value, and the second horizontal projection includes the first horizontal projection, determining the text in the text group as the target text corresponding to the hyperlink;

[0073] or,

[0074] When the first horizontal projection intersects with the second horizontal projection and the ratio of the intersecting projection length to the first horizontal projection is greater than a preset value, and the second vertical projection contains the first vertical projection, the text in the text group is determined as the target text corresponding to the hyperlink.

[0075] In an optional implementation, the hyperlinks in the first annotation group are traversed, and the following processing is further performed:

[0076] Traversing the texts in the text group, and determining whether the text contents in the texts contain a preset first character;

[0077] In a case where the text content in the text includes the preset first character, segmenting the text content in the text according to the preset first character;

[0078] If the text content in the segmented text exists in the preset domain name set, storing the text in a text verification group;

[0079] Eliminating texts in the text verification group that do not meet the hyperlink requirements, and determining the remaining texts in the text verification group as target texts corresponding to the hyperlink;

[0080] Storing the target text in a hyperlink group corresponding to the hyperlink;

[0081] The text content of the remaining text in the text verification group is assigned to the jump address corresponding to the hyperlink.

[0082] In an optional implementation, the removing of texts that do not meet the hyperlink requirement from the text verification group includes:

[0083] Traverse the text in the text inspection group and perform the following processing:

[0084] In the case where the preset second character exists in the text, removing the text from the text inspection group;

[0085] Determining whether a preset third character exists in the text, and if the preset third character exists in the text, determining an appearance position of the preset third character in the text;

[0086] When the appearance position is a preset position, the text is removed from the text inspection group.

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

[0088] The hyperlink group corresponding to any of the hyperlinks is traversed, and the jump address of the hyperlink is assigned to the target text in the hyperlink group.

[0089] In a second aspect of an embodiment of the present invention, a document processing device is further provided, the device comprising:

[0090] A document acquisition module is used to acquire electronic documents of the layout;

[0091] A text and annotation determination module, used to determine the text and annotations in the formatted electronic document;

[0092] A text and annotation storage module, used for storing the text into a text group, and storing a hyperlink of a standard protocol contained in the annotation into a first annotation group;

[0093] A hyperlink traversal module is used to traverse the hyperlinks in the first annotation group and perform the following processing:

[0094] A text determination module, used for determining a target text corresponding to the hyperlink in the text of the text group according to a positional relationship between the hyperlink and the text in the text group;

[0095] The text storage module is used to store the target text into the hyperlink group corresponding to the hyperlink.

[0096] In an optional implementation, the text determination module specifically includes:

[0097] A first submodule for determining an outer rectangular frame is used to determine an outer rectangular frame of the hyperlink and an outer rectangular frame of the text in the text group;

[0098] A first position relationship determination submodule is used to determine whether the position relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement;

[0099] A text storage first submodule is used to store the text in the text group into a text verification group when the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement;

[0100] The first submodule for text determination is used to traverse the text in the text verification group, and when the text color of the text meets the preset color requirement, determine the text as the target text corresponding to the hyperlink.

[0101] In an optional implementation, the first submodule for determining positional relationship is specifically used for:

[0102] Obtaining a first X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the hyperlink, and obtaining a second X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the text in the text group;

[0103] Obtain the third X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the hyperlink, and obtain the fourth X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the text in the text group;

[0104] Obtain the first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the hyperlink, and obtain the second Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the text in the text group;

[0105] Obtain the third Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the hyperlink, and obtain the fourth Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the text in the text group;

[0106] Determine whether the second X-axis coordinate value is less than or equal to the first X-axis coordinate value, whether the fourth X-axis coordinate value is greater than or equal to the third X-axis coordinate value, whether the second Y-axis coordinate value is less than or equal to the first Y-axis coordinate value, and whether the fourth Y-axis coordinate value is greater than or equal to the third Y-axis coordinate value;

[0107] The text is stored in the first submodule specifically for:

[0108] When the second coordinate value of the X-axis is less than or equal to the first coordinate value of the X-axis, the fourth coordinate value of the X-axis is greater than or equal to the third coordinate value of the X-axis, the first coordinate value of the Y-axis is less than or equal to the second coordinate value of the Y-axis, and the fourth coordinate value of the Y-axis is greater than or equal to the third coordinate value of the Y-axis, the text in the text group is stored in a text inspection group.

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

[0110] In the case that the text color of the text has a blue component, the text is determined as the target text corresponding to the hyperlink.

[0111] In an optional implementation, the text determination module specifically includes:

[0112] A second submodule for determining an outer rectangular frame is used to determine an outer rectangular frame of the hyperlink and an outer rectangular frame of the text in the text group;

[0113] A second position relationship determination submodule is used to determine whether the position relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement according to the arrangement of elements of the layout electronic document;

[0114] A text storage second submodule is used to store the text in the text group into a text verification group when the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement;

[0115] The second text determination submodule is used to traverse the text in the text verification group, and when the text color of the text meets the preset color requirement, determine the text as the target text corresponding to the hyperlink.

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

[0117] In the case where the arrangement of elements of the layout electronic document is horizontal arrangement, determining a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determining a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0118] Determine a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determine a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0119] Determine whether the first vertical projection intersects with the second vertical projection, and whether the second horizontal projection includes the first horizontal projection;

[0120] or,

[0121] In the case where the arrangement of elements of the layout electronic document is vertical arrangement, determining a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determining a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0122] Determine a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determine a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0123] Determine whether the first horizontal projection intersects with the second horizontal projection, and whether the second vertical projection includes the first vertical projection;

[0124] The text is stored in the second submodule specifically for:

[0125] When the first vertical projection intersects the second vertical projection and the second horizontal projection includes the first horizontal projection, storing the text in the text group into a text verification group;

[0126] or,

[0127] When the first horizontal projection intersects the second horizontal projection and the second vertical projection includes the first vertical projection, the text in the text group is stored in a text verification group.

[0128] In an optional implementation, the text determination module is specifically used to:

[0129] Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group;

[0130] According to the arrangement of elements of the layout electronic document, determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement;

[0131] When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement, storing the text in the text group into a text verification group;

[0132] The texts in the text verification group are traversed, and when the texts have a target attribute, the texts are determined as target texts corresponding to the hyperlink.

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

[0134] The target attribute assigning module is used for traversing the texts in the text group, and assigning target attributes to the texts when the texts have the underline modification attribute of the non-standard protocol or the underline modification attribute of the standard protocol.

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

[0136] A modification attribute assignment module, used for identifying all text lines in the formatted electronic document when the annotation does not contain a target modification element of a standard protocol;

[0137] For any of the text lines, traverse the basic elements in the text line, and store the basic elements that meet the preset modification element conditions as modification elements of the non-standard protocol into the second annotation group;

[0138] Traversing the modified elements of the non-standard protocol in the second annotation group, assigning corresponding modification attributes to the modified elements of the non-standard protocol, and obtaining target modified elements of the non-standard protocol;

[0139] Determine a first width range of the target modifying element of the non-standard protocol in the second annotation group, and determine a second text line where the target modifying element of the non-standard protocol in the second annotation group is located;

[0140] In the case where the first width range includes the width range of N texts in the second text line, assigning the modification attribute of the target modification element of the non-standard protocol in the second annotation group to the N texts, wherein N is a positive integer, and the modification attribute of the target modification element of the non-standard protocol includes the modification attribute of the underline of the non-standard protocol;

[0141] In the case where the annotation includes a target modifier element of a standard protocol, storing the target modifier element of the standard protocol into the second annotation group;

[0142] Determine a second width range of the target modifier element of the standard protocol in the second annotation group, and determine a third text line where the target modifier element of the standard protocol in the second annotation group is located;

[0143] When the second width range includes the width range of M texts in the third text line, the modification attributes of the target modification element of the standard protocol in the second annotation group are assigned to the M texts, wherein M is a positive integer and the modification attributes of the target modification element of the standard protocol include the modification attributes of the underline of the standard protocol.

[0144] In an optional implementation, the text determination module specifically includes:

[0145] A third submodule for determining an outer rectangular frame is used to determine an outer rectangular frame of the hyperlink and an outer rectangular frame of the text in the text group;

[0146] A third position relationship determination submodule is used to determine whether the position relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement according to the arrangement of elements of the layout electronic document;

[0147] The third text determination submodule is used to determine the text in the text group as the target text corresponding to the hyperlink when the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement.

[0148] In an optional implementation, the position relationship determination third submodule is specifically used for:

[0149] In the case where the arrangement of elements of the layout electronic document is horizontal arrangement, determining a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determining a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0150] Determine a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determine a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0151] Determine whether the first vertical projection and the second vertical projection intersect and whether the ratio between the intersecting projection length and the first vertical projection length is greater than a preset value, and whether the second horizontal projection includes the first horizontal projection;

[0152] or,

[0153] In the case where the arrangement of elements of the layout electronic document is vertical arrangement, determining a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determining a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0154] Determine a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determine a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0155] Determine whether the first horizontal projection and the second horizontal projection intersect and whether the ratio between the intersecting projection length and the first horizontal projection length is greater than a preset value, and whether the second vertical projection includes the first vertical projection;

[0156] The text determination third submodule is specifically used for:

[0157] In the case where the first vertical projection intersects with the second vertical projection and the ratio of the intersecting projection length to the first vertical projection length is greater than a preset value, and the second horizontal projection includes the first horizontal projection, determining the text in the text group as the target text corresponding to the hyperlink;

[0158] or,

[0159] When the first horizontal projection intersects with the second horizontal projection and the ratio of the intersecting projection length to the first horizontal projection is greater than a preset value, and the second vertical projection contains the first vertical projection, the text in the text group is determined as the target text corresponding to the hyperlink.

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

[0161] A text content determination module, used for traversing the texts in the text group and determining whether the text contents in the texts contain a preset first character;

[0162] A text content segmentation module, configured to segment the text content in the text according to the preset first character when the text content in the text contains the preset first character;

[0163] A text processing module, used for storing the text into a text verification group when the text content in the segmented text exists in a preset domain name set;

[0164] A text elimination module, used to eliminate texts in the text verification group that do not meet the hyperlink requirements;

[0165] A remaining text determination module, used to determine the remaining text in the text verification group as the target text corresponding to the hyperlink;

[0166] A target text processing module, used for storing the target text into a hyperlink group corresponding to the hyperlink;

[0167] The text content assigning module is used to assign the text content of the remaining text in the text verification group to the jump address corresponding to the hyperlink.

[0168] In an optional implementation, the text removal module is specifically used to:

[0169] Traverse the text in the text inspection group and perform the following processing:

[0170] In the case where the preset second character exists in the text, removing the text from the text inspection group;

[0171] Determining whether a preset third character exists in the text, and if the preset third character exists in the text, determining an appearance position of the preset third character in the text;

[0172] When the appearance position is a preset position, the text is removed from the text inspection group.

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

[0174] The jump address assigning module is used to traverse the hyperlink group corresponding to any of the hyperlinks and assign the jump address of the hyperlink to the target text in the hyperlink group.

[0175] In a third aspect of an embodiment of the present invention, 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;

[0176] Memory, used to store computer programs;

[0177] The processor is used to implement any document processing method described in the first aspect when executing the program stored in the memory.

[0178] In a fourth aspect of the embodiments of the present invention, 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 document processing method described in the first aspect above.

[0179] In a fifth aspect of the embodiments of the present invention, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute any of the document processing methods described above.

[0180] The technical solution provided by the embodiment of the present invention obtains a layout electronic document, determines the text and annotations in the layout electronic document, stores the text in a text group, stores the hyperlinks of the standard protocol contained in the annotations in a first annotation group, traverses the hyperlinks in the first annotation group, and performs the following processing: according to the positional relationship between the hyperlink and the text in the text group, determines the target text corresponding to the hyperlink in the text of the text group, and stores the target text in the hyperlink group corresponding to the hyperlink. By determining the text and annotations in the layout electronic document, and storing them in the text group and the first annotation group respectively, traversing the hyperlinks in the first annotation group, according to the positional relationship between the hyperlink and the text in the text group, determining the target text corresponding to the hyperlink in the text of the text group, and storing it in the hyperlink group corresponding to the hyperlink, the text corresponding to the hyperlink can be identified according to the positional relationship between the hyperlink and the text, thereby improving the conversion effect of the layout electronic document, improving the editability of the layout electronic document, and improving the readability of the layout electronic document when it is rearranged. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0182] In order to more clearly illustrate the embodiments of the present invention 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.

[0183] Figure 1 A schematic diagram of an implementation flow of a document processing method shown in an embodiment of the present invention;

[0184] Figure 2 It is a schematic diagram of an implementation flow of another document processing method shown in an embodiment of the present invention;

[0185] Figure 3 It is a schematic diagram of an implementation flow of another document processing method shown in an embodiment of the present invention;

[0186] Figure 4 It is a schematic diagram of an implementation flow of another document processing method shown in an embodiment of the present invention;

[0187] Figure 5 It is a schematic diagram of an implementation flow of another document processing method shown in an embodiment of the present invention;

[0188] Figure 6 It is a schematic diagram of an implementation flow of another document processing method shown in an embodiment of the present invention;

[0189] Figure 7 It is a structural schematic diagram of a document processing device shown in an embodiment of the present invention;

[0190] Figure 8 It is a schematic diagram of the structure of an electronic device shown in an embodiment of the present invention. DETAILED DESCRIPTION

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

[0192] The key terms involved in the present invention are explained as follows: Annotation: An element that can associate elements such as notes, sounds, videos, etc. with layout electronic documents. It has basic attributes such as BBox (Bounding Box) and subtype. There are 25 standard annotation types.

[0193] A standard protocol can be understood to be one that complies with the specifications of, for example, PDF Reference 1.7. For example, a hyperlink in a subsequent standard protocol refers to a hyperlink that complies with the PDF Reference 1.7 specification. A non-standard protocol can be understood to be one that does not comply with the specifications of PDF Reference 1.7. For example, an underline in a subsequent non-standard protocol refers to an underline that does not comply with the PDF Reference 1.7 specification.

[0194] Basic elements: Text text element, including text Unicode, character code CharCode, font information, color, bounding box BBox (Bounding Box) coordinates, etc.; Path line segment element (vector element or path element), usually composed of MoveTo (move but not draw), LineTo (move and draw a straight line), BezierTo (move and draw a Bezier curve), etc., and its StartPoint (coordinates before moving), EndPoint (coordinates after moving), color, bounding box BBox coordinates, etc. can be obtained; Image picture element, including RGB color information, bounding box BBox coordinates, etc.

[0195] like Figure 1 FIG. 1 is a schematic diagram of an implementation flow of a document processing method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:

[0196] S101, obtaining a layout electronic document, and determining text and annotations in the layout electronic document.

[0197] In an embodiment of the present invention, a layout electronic document is obtained. The layout electronic document here can be a layout electronic document mainly in PDF format converted from a typesetting tool and a typesetting document. Of course, it is not limited to a layout electronic document. The above-mentioned layout electronic document can be replaced by a streaming electronic document, and the embodiment of the present invention does not limit this.

[0198] For a layout electronic document, the text and annotations (i.e., Annotations) in the layout electronic document may be determined. The layout electronic document may be parsed to obtain (all) texts and (all) annotations in the layout electronic document, where the number of texts and annotations is not limited in the embodiment of the present invention and may be one or more.

[0199] S102: Store the text into a text group, and store the hyperlink of the standard protocol contained in the annotation into a first annotation group.

[0200] In the embodiment of the present invention, for the annotations in the layout electronic document, when the annotations contain hyperlinks of the standard protocol, the hyperlinks of the standard protocol contained in the annotations are stored in a first annotation group, such as AnnoGroup. In addition, for the text in the layout electronic document, the text is stored in a text group, such as TextGroup.

[0201] S103, traverse the hyperlinks in the first annotation group and perform the following processing:

[0202] S104: Determine the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group.

[0203] S105, storing the target text into the hyperlink group corresponding to the hyperlink.

[0204] In the embodiment of the present invention, for a first annotation group, such as AnnoGroup, the hyperlinks in the first annotation group can be traversed, and the following processing can be performed: according to the positional relationship between the hyperlink and the text in the text group, the target text corresponding to the hyperlink in the text of the text group is determined, and the target text is stored in the hyperlink group corresponding to the hyperlink. In this way, the text corresponding to the hyperlink can be recognized.

[0205] In this way, the text corresponding to the hyperlink can be identified based on the positional relationship between the hyperlink and the text, and typesetting and hyperlink association can be achieved when converting the layout electronic document into a streaming electronic document. During the editing process of the layout electronic document, it can be determined whether the edited content needs to support hyperlink jumps, and the clickable jump area can be confirmed during the re-layout of the layout electronic document.

[0206] Through the above description of the technical solution provided by the embodiment of the present invention, by determining the text and annotations in the layout electronic document and storing them in the text group and the first annotation group respectively, traversing the hyperlinks in the first annotation group, and determining the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group, and storing it in the hyperlink group corresponding to the hyperlink, the text corresponding to the hyperlink can be identified according to the positional relationship between the hyperlink and the text, thereby improving the conversion effect of the layout electronic document, improving the editability of the layout electronic document, and improving the readability of the layout electronic document when it is rearranged.

[0207] Among them, in the embodiment of the present invention, for the layout electronic document, the inclusion relationship between the hyperlink and the text is found through observation and summary, either the blue text completely contains the hyperlink, or the hyperlink part contains the blue text, or the hyperlink part contains underlined text, or the hyperlink part contains ordinary text. Therefore, the positional relationship between the hyperlink and the text can be roughly divided into four situations: blue (it should be noted that this color is not a limitation of the present invention, and it can also be other colors (such as red), which is used to distinguish between hyperlink text and non-hyperlink text) text completely contains hyperlinks, the hyperlink part contains blue text, the hyperlink part contains underlined text, and the hyperlink part contains ordinary text (referring to the remaining text excluding the aforementioned blue text, underlined text, etc.). In addition, a more special situation is the text that does not intersect with the hyperlink but actually should belong to the hyperlink, such as the obvious features of URL or Email in ordinary text (for example, the ordinary text is www.baidu.com, which belongs to a URL. In theory, it should be displayed in blue and underlined below, but it is not displayed in the aforementioned way in the PDF document, which means that it is not displayed in the form of a hyperlink, but is displayed as a text. In this case, it is considered that it should belong to the hyperlink text). Each situation is explained below.

[0208] For cases where the blue text completely contains a hyperlink, refer to Figure 2 As shown in the method. Figure 2 FIG. 1 is a schematic diagram of an implementation flow of another document processing method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:

[0209] S201, obtaining a layout electronic document, and determining text and annotations in the layout electronic document.

[0210] In the embodiment of the present invention, this step is similar to the above step S101, and the embodiment of the present invention will not be described in detail here.

[0211] S202: Store the text into a text group, and store the hyperlink of the standard protocol contained in the annotation into a first annotation group.

[0212] In the embodiment of the present invention, this step is similar to the above step S102, and the embodiment of the present invention will not be described in detail here.

[0213] S203, traverse the hyperlinks in the first annotation group and perform the following processing:

[0214] S204, determining the circumscribed rectangular frame of the hyperlink and determining the circumscribed rectangular frame of the text in the text group.

[0215] S205: Determine whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement.

[0216] S206: When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement, the text in the text group is stored in a text verification group.

[0217] S207, traversing the text in the text inspection group, and determining the text as the target text corresponding to the hyperlink when the text color of the text meets the preset color requirement.

[0218] S208, storing the target text into the hyperlink group corresponding to the hyperlink.

[0219] In an embodiment of the present invention, for a first annotation group, such as AnnoGroup, the hyperlinks in the first annotation group can be traversed to perform the following processing: determine the circumscribed rectangular box of the hyperlink (such as AnnoBBox), and determine the circumscribed rectangular box of the text in the text group (such as TextBBox); determine whether the positional relationship between the circumscribed rectangular box of the text in the text group and the circumscribed rectangular box of the hyperlink meets a preset first position requirement; if the positional relationship between the circumscribed rectangular box of the text in the text group and the circumscribed rectangular box of the hyperlink meets the preset first position requirement, store the text in the text group into a text check group (such as CheckGroup); traverse the text in the text check group, and if the text color of the text meets the preset color requirement, determine the text as the target text corresponding to the hyperlink; store the target text in the hyperlink group corresponding to the hyperlink (such as LinkGroup).

[0220] Specifically, the above determination of whether the positional relationship between the circumscribed rectangular box of the text in the text group and the circumscribed rectangular box of the hyperlink meets the preset first position requirement is essentially to determine whether the circumscribed rectangular box of the text completely includes the circumscribed rectangular box of the hyperlink. Based on this, the first X-axis coordinate value corresponding to the left border of the circumscribed rectangular box of the hyperlink can be obtained, the second X-axis coordinate value corresponding to the left border of the circumscribed rectangular box of the text in the text group can be obtained, the third X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the hyperlink can be obtained, the fourth X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the text in the text group can be obtained, the first Y-axis coordinate value corresponding to the upper border of the circumscribed rectangular box of the hyperlink can be obtained, the second Y-axis coordinate value corresponding to the upper border of the circumscribed rectangular box of the text in the text group can be obtained, the third Y-axis coordinate value corresponding to the lower border of the circumscribed rectangular box of the hyperlink can be obtained, and the fourth Y-axis coordinate value corresponding to the lower border of the circumscribed rectangular box of the text in the text group can be obtained, and it can be determined whether the second X-axis coordinate value is less than or equal to the first X-axis coordinate value, whether the fourth X-axis coordinate value is greater than or equal to the third X-axis coordinate value, whether the second Y-axis coordinate value is less than or equal to the first Y-axis coordinate value, and whether the fourth Y-axis coordinate value is greater than or equal to the third Y-axis coordinate value.

[0221] Thus, when the circumscribed rectangular box of the text completely contains the circumscribed rectangular box of the hyperlink, that is, when the second coordinate value of the X-axis is less than or equal to the first coordinate value of the X-axis, the fourth coordinate value of the X-axis is greater than or equal to the third coordinate value of the X-axis, the first coordinate value of the Y-axis is less than or equal to the second coordinate value of the Y-axis, and the fourth coordinate value of the Y-axis is greater than or equal to the third coordinate value of the Y-axis, the text in the text group is stored in the text verification group.

[0222] In addition, a hyperlink is usually expressed in blue, so for text, if the text's composition color includes blue, it means that the text should correspond to a hyperlink. Therefore, the text color of the above text meets the preset color requirement, which actually means that the text color of the text has a blue component, so when the text color of the text has a blue component, the text is determined to be the target text corresponding to the hyperlink.

[0223] For example, obtain the first X-axis coordinate axis corresponding to the left border of the hyperlink's circumscribed rectangular box (for example, AnnoBBox.left), obtain the second X-axis coordinate axis corresponding to the left border of the circumscribed rectangular box of the text in the text group (for example, TextBBox.left), obtain the third X-axis coordinate value corresponding to the right border of the hyperlink's circumscribed rectangular box (for example, AnnoBBox.right), obtain the fourth X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the text in the text group (TextBBox.right), obtain the first Y-axis coordinate value corresponding to the upper border of the circumscribed rectangular box of the hyperlink (for example, AnnoBBox.top), obtain the second Y-axis coordinate value corresponding to the upper border of the circumscribed rectangular box of the text in the text group (TextBBox.top), obtain the third Y-axis coordinate value corresponding to the lower border of the circumscribed rectangular box of the hyperlink (AnnoBBox.bottom), and obtain the fourth Y-axis coordinate value corresponding to the lower border of the circumscribed rectangular box of the text in the text group (TextBBox.bottom).

[0224] Determine whether the second coordinate value of the X axis is less than or equal to the first coordinate value of the X axis, whether the fourth coordinate value of the X axis is greater than or equal to the third coordinate value of the X axis, whether the second coordinate value of the Y axis is less than or equal to the first coordinate value of the Y axis, and whether the fourth coordinate value of the Y axis is greater than or equal to the third coordinate value of the Y axis. If the second coordinate value of the X axis is less than or equal to the first coordinate value of the X axis, the fourth coordinate value of the X axis is greater than or equal to the third coordinate value of the X axis, the first coordinate value of the Y axis is less than or equal to the second coordinate value of the Y axis, and the fourth coordinate value of the Y axis is greater than or equal to the third coordinate value of the Y axis, as shown below, the text in the text group is stored in the text check group CheckGroup. Traverse the text in the text check group CheckGroup, and if the text color of the text has a blue component, determine the text as the target text corresponding to the hyperlink, and store the target text in the hyperlink group LinkGroup corresponding to the hyperlink.

[0225] TextBBox.left≤AnnoBBox.left;

[0226] TextBBox.right≥AnnoBBox.right;

[0227] TextBBox.top≤AnnoBBox.top;

[0228] TextBBox.bottom≥AnnoBBox.bottom.

[0229] Through the above description of the technical solution provided by the embodiment of the present invention, by determining the text and annotations in the layout electronic document, and storing them in the text group and the first annotation group respectively, traversing the hyperlinks in the first annotation group, it is determined whether the circumscribed rectangular box of the text in the text group completely contains the circumscribed rectangular box of the hyperlink. If the circumscribed rectangular box of the text in the text group completely contains the circumscribed rectangular box of the hyperlink, the text in the text group is stored in the text verification group, and the text in the text verification group is traversed. If the text color of the text has a blue component, it means that the circumscribed rectangular box of the blue text completely contains the circumscribed rectangular box of the hyperlink. At this time, the text is determined as the target text corresponding to the hyperlink and stored in the hyperlink group corresponding to the hyperlink. In this way, according to the positional relationship between the circumscribed rectangular box of the hyperlink and the circumscribed rectangular box of the text, the text corresponding to the hyperlink can be identified, thereby improving the conversion effect of the layout electronic document, improving the editability of the layout electronic document, and improving the readability of the layout electronic document when it is rearranged.

[0230] For cases where the hyperlink portion contains blue text, refer to Figure 3 As shown in the method. Figure 3 FIG. 1 is a schematic diagram of an implementation flow of another document processing method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:

[0231] S301, obtaining a layout electronic document, and determining text and annotations in the layout electronic document.

[0232] In the embodiment of the present invention, this step is similar to the above step S101, and the embodiment of the present invention will not be described in detail here.

[0233] S302: Store the text into a text group, and store the hyperlink of the standard protocol contained in the annotation into a first annotation group.

[0234] In the embodiment of the present invention, this step is similar to the above step S102, and the embodiment of the present invention will not be described in detail here.

[0235] S303, traverse the hyperlinks in the first annotation group and perform the following processing.

[0236] S304, determining the circumscribed rectangular frame of the hyperlink and determining the circumscribed rectangular frame of the text in the text group.

[0237] S305: judging, according to the arrangement of elements of the layout electronic document, whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement.

[0238] S306: When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement, the text in the text group is stored in a text verification group.

[0239] S307, traversing the text in the text inspection group, and determining the text as the target text corresponding to the hyperlink when the text color of the text meets the preset color requirement.

[0240] S308, storing the target text into the hyperlink group corresponding to the hyperlink.

[0241] In an embodiment of the present invention, for a first annotation group, such as AnnoGroup, the hyperlinks in the first annotation group can be traversed to perform the following processing: determine the circumscribed rectangular box of the hyperlink (such as AnnoBBox), and determine the circumscribed rectangular box of the text in the text group (such as TextBBox); determine whether the positional relationship between the circumscribed rectangular box of the text in the text group and the circumscribed rectangular box of the hyperlink meets a preset second position requirement based on the element arrangement method of the layout electronic document; if the positional relationship between the circumscribed rectangular box of the text in the text group and the circumscribed rectangular box of the hyperlink meets the preset second position requirement, store the text in the text group in a text check group (such as CheckGroup); traverse the text in the text check group, and if the text color of the text meets the preset color requirement, determine the text as the target text corresponding to the hyperlink; store the target text in a hyperlink group (such as LinkGroup) corresponding to the hyperlink.

[0242] Specifically, the above-mentioned determination of whether the positional relationship between the bounding rectangle of the text in the text group and the bounding rectangle of the hyperlink meets the preset second position requirement is essentially to determine whether the bounding rectangle of the hyperlink partially contains the bounding rectangle of the text. Accordingly, when the element arrangement mode of the layout electronic document is horizontal arrangement, the first vertical projection of the bounding rectangle of the text in the text group in the vertical direction can be determined, the second vertical projection of the bounding rectangle of the hyperlink in the vertical direction can be determined, the first horizontal projection of the bounding rectangle of the text in the text group in the horizontal direction can be determined, the second horizontal projection of the bounding rectangle of the hyperlink in the horizontal direction can be determined, and it can be determined whether the first vertical projection intersects with the second vertical projection and whether the second horizontal projection contains the first horizontal projection. Thus, when the first vertical projection intersects with the second vertical projection and the second horizontal projection contains the first horizontal projection, the text in the text group is stored in the text inspection group.

[0243] Alternatively, when the arrangement of elements of the layout electronic document is vertical, determine the first horizontal projection of the bounding rectangle of the text in the text group in the horizontal direction, determine the second horizontal projection of the bounding rectangle of the hyperlink in the horizontal direction, determine the first vertical projection of the bounding rectangle of the text in the text group in the vertical direction, determine the second vertical projection of the bounding rectangle of the hyperlink in the vertical direction, and determine whether the first horizontal projection intersects with the second horizontal projection and whether the second vertical projection includes the first vertical projection. Thus, when the first horizontal projection intersects with the second horizontal projection and the second vertical projection includes the first vertical projection, the text in the text group is stored in the text verification group.

[0244] It should be noted that, for the first vertical projection and the second vertical projection, if there is an intersection between the two, it means that the first vertical projection intersects with the second vertical projection, and the first horizontal projection intersects with the second horizontal projection similarly. For the second horizontal projection and the first horizontal projection, it is considered that the coordinate range of the first horizontal projection is entirely or mostly within the coordinate range of the second horizontal projection, which means that the second horizontal projection contains the first horizontal projection, and the second vertical projection is similar to the first vertical projection. In addition, for the first vertical projection, assuming that the X-axis coordinate values ​​corresponding to the left and right boundaries of the circumscribed rectangular box of the text are 5 and 12 respectively, then the first vertical projection on the horizontal X-axis is (5, 12), and the remaining projections are similar.

[0245] Through the above description of the technical solution provided by the embodiment of the present invention, by determining the text and annotations in the layout electronic document, and storing them in the text group and the first annotation group respectively, traversing the hyperlinks in the first annotation group, judging whether the circumscribed rectangular frame of the hyperlink partially contains the circumscribed rectangular frame of the text in the text group, if the circumscribed rectangular frame of the hyperlink partially contains the circumscribed rectangular frame of the text in the text group, storing the text in the text group in the text verification group, traversing the text in the text verification group, if the text color of the text has a blue component, it means that the circumscribed rectangular frame of the hyperlink partially contains the circumscribed rectangular frame of the blue text, at this time, the text is determined as the target text corresponding to the hyperlink, and stored in the hyperlink group corresponding to the hyperlink, so that according to the positional relationship between the circumscribed rectangular frame of the hyperlink and the circumscribed rectangular frame of the text, the text corresponding to the hyperlink can be identified, thereby improving the conversion effect of the layout electronic document, improving the editability of the layout electronic document, and improving the readability of the layout electronic document when it is rearranged.

[0246] For cases where the hyperlink contains underlined text, refer to Figure 4 As shown in the method. Figure 4 FIG. 1 is a schematic diagram of an implementation flow of another document processing method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:

[0247] S401, obtaining a layout electronic document, and determining text and annotations in the layout electronic document.

[0248] In the embodiment of the present invention, this step is similar to the above step S101, and the embodiment of the present invention will not be described in detail here.

[0249] S402: Store the text into a text group, and store the hyperlink of the standard protocol contained in the annotation into a first annotation group.

[0250] In the embodiment of the present invention, this step is similar to the above-mentioned step S102, and the embodiment of the present invention will not be described in detail here.

[0251] S403, traverse the hyperlinks in the first annotation group and perform the following processing.

[0252] S404, determining the circumscribed rectangular frame of the hyperlink and determining the circumscribed rectangular frame of the text in the text group.

[0253] S405: judging, according to the arrangement of elements of the layout electronic document, whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement.

[0254] S406: When the positional relationship between the circumscribed rectangular box of the text in the text group and the circumscribed rectangular box of the hyperlink meets a preset second position requirement, the text in the text group is stored in a text verification group.

[0255] S407, traversing the text in the text verification group, and in the case where the text has a target attribute, determining the text as the target text corresponding to the hyperlink.

[0256] S408, storing the target text into the hyperlink group corresponding to the hyperlink.

[0257] In an embodiment of the present invention, for a first annotation group, such as AnnoGroup, the hyperlinks in the first annotation group can be traversed to perform the following processing: determine the bounding rectangle of the hyperlink (such as AnnoBBox), and determine the bounding rectangle of the text in the text group (such as TextBBox); determine whether the positional relationship between the bounding rectangle of the text in the text group and the bounding rectangle of the hyperlink meets the preset second position requirement according to the element arrangement mode of the layout electronic document; if the positional relationship between the bounding rectangle of the text in the text group and the bounding rectangle of the hyperlink meets the preset second position requirement, store the text in the text group in a text check group (such as CheckGroup); traverse the text in the text check group, and if the text has a target attribute, determine the text as the target text corresponding to the hyperlink; store the target text in the hyperlink group corresponding to the hyperlink (such as LinkGroup). Among them, for the processing of determining whether the positional relationship between the bounding rectangle of the text in the text group and the bounding rectangle of the hyperlink meets the preset second position requirement, the above processing can be referred to.

[0258] Among them, after executing the above-mentioned step S401, it can also be determined whether the annotations in the layout electronic document contain the target modifying elements of the standard protocol (such as the underline of the standard protocol, the wavy underline of the standard protocol, and the strikethrough of the standard protocol). When the annotations do not contain the target modifying elements of the standard protocol, all text lines in the layout electronic document are identified, and for any text line, the basic elements in the text line (such as text, line segments, pictures, etc.) are traversed, and the basic elements that meet the preset modifying element conditions are used as the modifying elements of the non-standard protocol (here, the modifying elements of the non-standard protocol are essentially still basic elements, and they can be called the modifying elements of the non-standard protocol in the true sense only after being assigned corresponding modifying attributes, such as the underline of the non-standard protocol, the wavy underline of the non-standard protocol, the strikethrough of the non-standard protocol, etc.) are stored in the second annotation group, the modifying elements of the non-standard protocol in the second annotation group are traversed, and the modifying elements of the non-standard protocol are assigned corresponding modifying attributes to obtain the target modifying elements of the non-standard protocol (such as the underline of the non-standard protocol, the wavy underline of the non-standard protocol, and the strikethrough of the non-standard protocol).

[0259] Determine the first width range of the target modifier element of the non-standard protocol in the second annotation group, and determine the second text line where the target modifier element of the non-standard protocol in the second annotation group is located; when the first width range includes the width range of N texts in the second text line, assign the modifier attribute of the target modifier element of the non-standard protocol in the second annotation group to the N texts, wherein N is a positive integer, and the modifier attribute of the target modifier element of the non-standard protocol includes the modifier attribute of the underline of the non-standard protocol. It should be noted that the inclusion here means that the first width range intersects with the width range of the text in the second text line, and the intersection (for example, the intersection of the first width range (2, 8) and the width range of the text (5, 9) is (5, 8)) is greater than the product of the preset second threshold (for example, 0.5) and the length of the text in the second text line (for example, the coordinate range of the text (2, 8), whose length is 8-2=6), and the embodiment of the present invention is not limited to this.

[0260] In addition, when the annotation contains the target modifier element of the standard protocol, the target modifier element of the standard protocol is stored in the second annotation group; the second width range of the target modifier element of the standard protocol in the second annotation group is determined, and the third text line where the target modifier element of the standard protocol in the second annotation group is located is determined; when the second width range includes the width range of M texts in the third text line, the modification attributes of the target modifier element of the standard protocol in the second annotation group are assigned to the M texts, wherein M is a positive integer, and the modification attributes of the target modifier element of the standard protocol include the modification attributes of the underline of the standard protocol.

[0261] After the above processing, the text in the layout electronic document may have, for example, the underline modification attribute of the standard protocol or the underline modification attribute of the non-standard protocol, so the text in the text group is traversed, and when the text has the underline modification attribute of the non-standard protocol or the underline modification attribute of the standard protocol, the target attribute (for example, Text.Underline=True) is assigned to the text. The text in the text verification group is subsequently traversed, and when the text has the target attribute, the text is determined as the target text corresponding to the hyperlink; the target text is stored in the hyperlink group (for example, LinkGroup) corresponding to the hyperlink.

[0262] Through the above description of the technical solution provided by the embodiment of the present invention, by determining the text and annotations in the layout electronic document, and storing them in the text group and the first annotation group respectively, traversing the hyperlinks in the first annotation group, it is determined whether the outer rectangular frame of the hyperlink partially contains the outer rectangular frame of the text in the text group, if the outer rectangular frame of the hyperlink partially contains the outer rectangular frame of the text in the text group, the text in the text group is stored in the text verification group, and the text in the text verification group is traversed. When the text has a target attribute, it means that the outer rectangular frame of the hyperlink partially contains underlined text. At this time, the text is determined as the target text corresponding to the hyperlink and stored in the hyperlink group corresponding to the hyperlink. In this way, according to the positional relationship between the outer rectangular frame of the hyperlink and the outer rectangular frame of the text, the text corresponding to the hyperlink can be identified, thereby improving the conversion effect of the layout electronic document, improving the editability of the layout electronic document, and improving the readability of the layout electronic document when it is rearranged.

[0263] For cases where the hyperlink contains normal text, refer to Figure 5 As shown in the method. Figure 5 FIG. 1 is a schematic diagram of an implementation flow of another document processing method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:

[0264] S501, obtaining a layout electronic document, and determining text and annotations in the layout electronic document.

[0265] In the embodiment of the present invention, this step is similar to the above step S101, and the embodiment of the present invention will not be described in detail here.

[0266] S502: Store the text into a text group, and store the hyperlink of the standard protocol contained in the annotation into a first annotation group.

[0267] In the embodiment of the present invention, this step is similar to the above-mentioned step S102, and the embodiment of the present invention will not be described in detail here.

[0268] S503, traverse the hyperlinks in the first annotation group and perform the following processing:

[0269] S504, determining the circumscribed rectangular frame of the hyperlink and determining the circumscribed rectangular frame of the text in the text group.

[0270] S505: judging, according to the arrangement of elements of the layout electronic document, whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement.

[0271] S506: When the positional relationship between the circumscribed rectangular box of the text in the text group and the circumscribed rectangular box of the hyperlink meets a preset third position requirement, the text in the text group is determined as the target text corresponding to the hyperlink.

[0272] S507, storing the target text into the hyperlink group corresponding to the hyperlink.

[0273] In an embodiment of the present invention, for a first annotation group, such as AnnoGroup, the hyperlinks in the first annotation group can be traversed to perform the following processing: determine the circumscribed rectangular box of the hyperlink (such as AnnoBBox), and determine the circumscribed rectangular box of the text in the text group (such as TextBBox); determine whether the positional relationship between the circumscribed rectangular box of the text in the text group and the circumscribed rectangular box of the hyperlink meets a preset third position requirement based on the element arrangement method of the layout electronic document; when the positional relationship between the circumscribed rectangular box of the text in the text group and the circumscribed rectangular box of the hyperlink meets the preset third position requirement, determine the text in the text group as the target text corresponding to the hyperlink; and store the target text in the hyperlink group corresponding to the hyperlink (such as LinkGroup).

[0274] Specifically, the above judgment of whether the positional relationship between the bounding rectangle of the text in the text group and the bounding rectangle of the hyperlink meets the preset third position requirement is essentially to judge whether the bounding rectangle of the hyperlink partially contains the bounding rectangle of the ordinary text. Accordingly, when the element arrangement mode of the layout electronic document is horizontal arrangement, the first vertical projection of the bounding rectangle of the text in the text group in the vertical direction is determined, and the second vertical projection of the bounding rectangle of the hyperlink in the vertical direction is determined; the first horizontal projection of the bounding rectangle of the text in the text group in the horizontal direction is determined, and the second horizontal projection of the bounding rectangle of the hyperlink in the horizontal direction is determined; it is judged whether the first vertical projection intersects with the second vertical projection and whether the ratio between the intersecting projection length and the first vertical projection length is greater than a preset value, and whether the second horizontal projection contains the first horizontal projection. Therefore, when the first vertical projection intersects with the second vertical projection and the ratio between the intersecting projection length and the first vertical projection length is greater than a preset value, and the second horizontal projection contains the first horizontal projection, the text in the text group is determined as the target text corresponding to the hyperlink.

[0275] Alternatively, when the arrangement of elements of the layout electronic document is vertical, determine the first horizontal projection of the bounding rectangle of the text in the text group in the horizontal direction, and determine the second horizontal projection of the bounding rectangle of the hyperlink in the horizontal direction; determine the first vertical projection of the bounding rectangle of the text in the text group in the vertical direction, and determine the second vertical projection of the bounding rectangle of the hyperlink in the vertical direction; judge whether the first horizontal projection intersects with the second horizontal projection and whether the ratio between the intersecting projection length and the first horizontal projection length is greater than a preset value, and whether the second vertical projection includes the first vertical projection. Thus, when the first horizontal projection intersects with the second horizontal projection and the ratio between the intersecting projection length and the first horizontal projection is greater than a preset value, and the second vertical projection includes the first vertical projection, the text in the text group is determined as the target text corresponding to the hyperlink.

[0276] For example, when the arrangement of elements of the layout electronic document is horizontal arrangement (i.e., the text is laid out horizontally), determine the first vertical projection of the bounding rectangle TextBBox of the text in the text group in the vertical direction, and determine the second vertical projection of the bounding rectangle AnnoBBox of the hyperlink in the vertical direction; determine the first horizontal projection of the bounding rectangle TextBBox of the text in the text group in the horizontal direction, and determine the second horizontal projection of the bounding rectangle AnnoBBox of the hyperlink in the horizontal direction; determine whether the first vertical projection intersects with the second vertical projection and whether the ratio between the intersecting projection length and the first vertical projection length is greater than 0.8, and whether the second horizontal projection contains the first horizontal projection. Thus, when the first vertical projection intersects with the second vertical projection and the ratio between the intersecting projection length and the first vertical projection length is greater than 0.8, and the second horizontal projection contains the first horizontal projection, the text in the text group is determined as the target text corresponding to the hyperlink.

[0277] Through the above description of the technical solution provided by the embodiment of the present invention, by determining the text and annotations in the layout electronic document and storing them in the text group and the first annotation group respectively, traversing the hyperlinks in the first annotation group, it is determined whether the outer rectangular frame of the hyperlink partially contains the outer rectangular frame of the text in the text group. If the outer rectangular frame of the hyperlink partially contains the outer rectangular frame of the text in the text group, it means that the outer rectangular frame of the hyperlink partially contains the outer rectangular frame of the ordinary text. At this time, the text is determined as the target text corresponding to the hyperlink and stored in the hyperlink group corresponding to the hyperlink. In this way, according to the positional relationship between the outer rectangular frame of the hyperlink and the outer rectangular frame of the text, the text corresponding to the hyperlink can be identified, thereby improving the conversion effect of the layout electronic document, improving the editability of the layout electronic document, and improving the readability of the layout electronic document when it is rearranged.

[0278] For text that does not intersect with a hyperlink but should actually belong to a hyperlink, you can match the text with the hyperlink to complete the hyperlink repair. Figure 6 As shown in the method. Figure 6 FIG. 1 is a schematic diagram of an implementation flow of another document processing method provided by an embodiment of the present invention. The method is applied to an electronic device and may specifically include the following steps:

[0279] S601, obtaining a layout electronic document, and determining text and annotations in the layout electronic document.

[0280] S602: Store the text into a text group, and store the hyperlink of the standard protocol contained in the annotation into a first annotation group.

[0281] S603, traverse the hyperlinks in the first annotation group and perform the following processing:

[0282] S604, traversing the texts in the text group, and determining whether the text contents in the texts contain a preset first character.

[0283] S605: When the text content in the text includes a preset first character, segment the text content in the text according to the preset first character.

[0284] S606: When the text content in the segmented text exists in the preset domain name set, the text is stored in a text verification group.

[0285] S607, eliminating texts in the text verification group that do not meet the hyperlink requirement, and determining the remaining texts in the text verification group as target texts corresponding to the hyperlink.

[0286] S608, storing the target text into the hyperlink group corresponding to the hyperlink.

[0287] S609, assigning the text content of the remaining text in the text verification group to the jump address corresponding to the hyperlink.

[0288] In an embodiment of the present invention, for a first annotation group, such as AnnoGroup, the hyperlinks in the first annotation group can be traversed to perform the following processing: traverse the text in the text group to determine whether the text content (usually referring to Unicode) in the text contains a preset first character; in the case where the text content in the text contains the preset first character, segment the text content in the text according to the preset first character; in the case where the text content in the segmented text exists in a preset domain name set, store the text in a text verification group; eliminate the text in the text verification group that does not meet the hyperlink requirements, and determine the remaining text in the text verification group as the target text corresponding to the hyperlink; store the target text in the hyperlink group corresponding to the hyperlink; and assign the text content of the remaining text in the text verification group to the jump address corresponding to the hyperlink.

[0289] Among them, the elimination of text that does not meet the hyperlink requirements in the text verification group can follow the following processing: traverse the text in the text verification group and perform the following processing: if there is a preset second character in the text, eliminate the text from the text verification group; determine whether there is a preset third character in the text, and if there is a preset third character in the text, determine the appearance position of the preset third character in the text; if the appearance position is the preset position, eliminate the text from the text verification group.

[0290] For example, for the first annotation group, such as AnnoGroup, the hyperlinks in the first annotation group can be traversed, and the following processing is performed: the text in the text group is traversed to determine whether the text content in the text contains the preset first character ".". If the text content in the text does not contain the first character ".", it is considered that it does not have the characteristics of a hyperlink, and filtering is performed at this time. If the text content in the text contains the preset first character ".", the text content in the text is segmented according to the preset first character ".", and it is determined whether the text content in the segmented text exists in the preset domain name set. If the text content in the segmented text exists in the preset domain name set, the text is stored in the text check group CheckGroup;

[0291] Traverse the text in the text inspection group and perform the following processing: if there is a preset second character (such as non-English, non-Arabic numbers and or uncommon half-angle symbols, etc., where commonly used half-angle symbols such as "?", " / ", ":", etc.) in the text, remove the text from the text inspection group; determine whether there is a preset third character ":" in the text, and if there is a preset third character ":" in the text, determine the appearance position of the preset third character ":" in the text; if the appearance position is the first or second position, remove the text from the text inspection group. In this way, the remaining text in the text inspection group is determined as the target text corresponding to the hyperlink; the target text is stored in the hyperlink group LinkGroup corresponding to the hyperlink; the text content of the remaining text in the text inspection group (such as a domain name address or an email address) is assigned to the jump address corresponding to the hyperlink. Among them, for domain names such as http: / / , https: / / , ftp: / / , mg: / / , etc., ":" appears at least in the third or fourth position, so if the appearance position is the first or second position, it means that it does not belong to a hyperlink, and the text is removed from the text inspection group.

[0292] After the above processing, all the hyperlinks in the first annotation group have corresponding hyperlink groups, in which the target text corresponding to the hyperlink is stored. The hyperlink group corresponding to any hyperlink can be traversed to assign the jump address of the hyperlink to the target text in the hyperlink group.

[0293] Through the above description of the technical solution provided by the embodiment of the present invention, by determining the text and annotations in the layout electronic document and storing them in the text group and the first annotation group respectively, traversing the hyperlinks in the first annotation group, searching the text group for the text with significant features of URL or Email, determining it as the target text corresponding to the hyperlink, and storing it in the hyperlink group corresponding to the hyperlink, the text corresponding to the hyperlink can be identified according to the positional relationship between the circumscribed rectangular box of the hyperlink and the circumscribed rectangular box of the text, thereby improving the conversion effect of the layout electronic document, improving the editability of the layout electronic document, and improving the readability of the layout electronic document when it is rearranged.

[0294] Corresponding to the above method embodiment, the embodiment of the present invention also provides a document processing device, such as Figure 7 As shown, the apparatus may include: a document acquisition module 710 , a text and annotation determination module 720 , a text and annotation storage module 730 , a hyperlink traversal module 740 , a text determination module 750 , and a text storage module 760 .

[0295] The document acquisition module 710 is used to acquire the electronic document in the format;

[0296] The text and annotation determination module 720 is used to determine the text and annotations in the formatted electronic document;

[0297] A text and annotation storage module 730, used for storing the text into a text group, and storing a hyperlink of a standard protocol contained in the annotation into a first annotation group;

[0298] The hyperlink traversal module 740 is used to traverse the hyperlinks in the first annotation group and perform the following processing:

[0299] A text determination module 750, configured to determine a target text corresponding to the hyperlink in the text of the text group according to a positional relationship between the hyperlink and the text in the text group;

[0300] The text storage module 760 is used to store the target text into the hyperlink group corresponding to the hyperlink.

[0301] In an optional implementation, the text determination module specifically includes:

[0302] A first submodule for determining an outer rectangular frame is used to determine an outer rectangular frame of the hyperlink and an outer rectangular frame of the text in the text group;

[0303] A first position relationship determination submodule is used to determine whether the position relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement;

[0304] A text storage first submodule is used to store the text in the text group into a text verification group when the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement;

[0305] The first submodule for text determination is used to traverse the text in the text verification group, and when the text color of the text meets the preset color requirement, determine the text as the target text corresponding to the hyperlink.

[0306] In an optional implementation, the first submodule for determining positional relationship is specifically used for:

[0307] Obtaining a first X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the hyperlink, and obtaining a second X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the text in the text group;

[0308] Obtain the third X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the hyperlink, and obtain the fourth X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the text in the text group;

[0309] Obtain the first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the hyperlink, and obtain the second Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the text in the text group;

[0310] Obtain the third Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the hyperlink, and obtain the fourth Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the text in the text group;

[0311] Determine whether the second X-axis coordinate value is less than or equal to the first X-axis coordinate value, whether the fourth X-axis coordinate value is greater than or equal to the third X-axis coordinate value, whether the second Y-axis coordinate value is less than or equal to the first Y-axis coordinate value, and whether the fourth Y-axis coordinate value is greater than or equal to the third Y-axis coordinate value;

[0312] The text is stored in the first submodule specifically for:

[0313] When the second coordinate value of the X-axis is less than or equal to the first coordinate value of the X-axis, the fourth coordinate value of the X-axis is greater than or equal to the third coordinate value of the X-axis, the first coordinate value of the Y-axis is less than or equal to the second coordinate value of the Y-axis, and the fourth coordinate value of the Y-axis is greater than or equal to the third coordinate value of the Y-axis, the text in the text group is stored in a text inspection group.

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

[0315] In the case that the text color of the text has a blue component, the text is determined as the target text corresponding to the hyperlink.

[0316] In an optional implementation, the text determination module specifically includes:

[0317] A second submodule for determining an outer rectangular frame is used to determine an outer rectangular frame of the hyperlink and an outer rectangular frame of the text in the text group;

[0318] A second position relationship determination submodule is used to determine whether the position relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement according to the arrangement of elements of the layout electronic document;

[0319] A text storage second submodule is used to store the text in the text group into a text verification group when the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement;

[0320] The second text determination submodule is used to traverse the text in the text verification group, and when the text color of the text meets the preset color requirement, determine the text as the target text corresponding to the hyperlink.

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

[0322] In the case where the arrangement of elements of the layout electronic document is horizontal arrangement, determining a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determining a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0323] Determine a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determine a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0324] Determine whether the first vertical projection intersects with the second vertical projection, and whether the second horizontal projection includes the first horizontal projection;

[0325] or,

[0326] In the case where the arrangement of elements of the layout electronic document is vertical arrangement, determining a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determining a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0327] Determine a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determine a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0328] Determine whether the first horizontal projection intersects with the second horizontal projection, and whether the second vertical projection includes the first vertical projection;

[0329] The text is stored in the second submodule specifically for:

[0330] When the first vertical projection intersects the second vertical projection and the second horizontal projection includes the first horizontal projection, storing the text in the text group into a text verification group;

[0331] or,

[0332] When the first horizontal projection intersects the second horizontal projection and the second vertical projection includes the first vertical projection, the text in the text group is stored in a text verification group.

[0333] In an optional implementation, the text determination module is specifically used to:

[0334] Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group;

[0335] According to the arrangement of elements of the layout electronic document, determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement;

[0336] When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement, storing the text in the text group into a text verification group;

[0337] The texts in the text verification group are traversed, and when the texts have a target attribute, the texts are determined as target texts corresponding to the hyperlink.

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

[0339] The target attribute assigning module is used for traversing the texts in the text group, and assigning target attributes to the texts when the texts have the underline modification attribute of the non-standard protocol or the underline modification attribute of the standard protocol.

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

[0341] A modification attribute assignment module, used for identifying all text lines in the formatted electronic document when the annotation does not contain a target modification element of a standard protocol;

[0342] For any of the text lines, traverse the basic elements in the text line, and store the basic elements that meet the preset modification element conditions as modification elements of the non-standard protocol into the second annotation group;

[0343] Traversing the modified elements of the non-standard protocol in the second annotation group, assigning corresponding modification attributes to the modified elements of the non-standard protocol, and obtaining target modified elements of the non-standard protocol;

[0344] Determine a first width range of the target modifying element of the non-standard protocol in the second annotation group, and determine a second text line where the target modifying element of the non-standard protocol in the second annotation group is located;

[0345] In the case where the first width range includes the width range of N texts in the second text line, assigning the modification attribute of the target modification element of the non-standard protocol in the second annotation group to the N texts, wherein N is a positive integer, and the modification attribute of the target modification element of the non-standard protocol includes the modification attribute of the underline of the non-standard protocol;

[0346] In the case where the annotation includes a target modifier element of a standard protocol, storing the target modifier element of the standard protocol into the second annotation group;

[0347] Determine a second width range of the target modifier element of the standard protocol in the second annotation group, and determine a third text line where the target modifier element of the standard protocol in the second annotation group is located;

[0348] When the second width range includes the width range of M texts in the third text line, the modification attributes of the target modification element of the standard protocol in the second annotation group are assigned to the M texts, wherein M is a positive integer and the modification attributes of the target modification element of the standard protocol include the modification attributes of the underline of the standard protocol.

[0349] In an optional implementation, the text determination module specifically includes:

[0350] A third submodule for determining an outer rectangular frame is used to determine an outer rectangular frame of the hyperlink and an outer rectangular frame of the text in the text group;

[0351] A third position relationship determination submodule is used to determine whether the position relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement according to the arrangement of elements of the layout electronic document;

[0352] The third text determination submodule is used to determine the text in the text group as the target text corresponding to the hyperlink when the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement.

[0353] In an optional implementation, the position relationship determination third submodule is specifically used for:

[0354] In the case where the arrangement of elements of the layout electronic document is horizontal arrangement, determining a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determining a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0355] Determine a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determine a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0356] Determine whether the first vertical projection and the second vertical projection intersect and whether the ratio between the intersecting projection length and the first vertical projection length is greater than a preset value, and whether the second horizontal projection includes the first horizontal projection;

[0357] or,

[0358] In the case where the arrangement of elements of the layout electronic document is vertical arrangement, determining a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determining a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction;

[0359] Determine a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determine a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction;

[0360] Determine whether the first horizontal projection and the second horizontal projection intersect and whether the ratio between the intersecting projection length and the first horizontal projection length is greater than a preset value, and whether the second vertical projection includes the first vertical projection;

[0361] The text determination third submodule is specifically used for:

[0362] In the case where the first vertical projection intersects with the second vertical projection and the ratio of the intersecting projection length to the first vertical projection length is greater than a preset value, and the second horizontal projection includes the first horizontal projection, determining the text in the text group as the target text corresponding to the hyperlink;

[0363] or,

[0364] When the first horizontal projection intersects with the second horizontal projection and the ratio of the intersecting projection length to the first horizontal projection is greater than a preset value, and the second vertical projection contains the first vertical projection, the text in the text group is determined as the target text corresponding to the hyperlink.

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

[0366] A text content determination module, used for traversing the texts in the text group and determining whether the text content in the texts contains a preset first character;

[0367] A text content segmentation module, configured to segment the text content in the text according to the preset first character when the text content in the text contains the preset first character;

[0368] A text processing module, used for storing the text into a text verification group when the text content in the segmented text exists in a preset domain name set;

[0369] A text elimination module, used to eliminate texts that do not meet the hyperlink requirements in the text verification group;

[0370] A remaining text determination module, used to determine the remaining text in the text verification group as the target text corresponding to the hyperlink;

[0371] A target text processing module, used for storing the target text into a hyperlink group corresponding to the hyperlink;

[0372] The text content assigning module is used to assign the text content of the remaining text in the text verification group to the jump address corresponding to the hyperlink.

[0373] In an optional implementation, the text removal module is specifically used to:

[0374] Traverse the text in the text inspection group and perform the following processing:

[0375] In the case where the preset second character exists in the text, removing the text from the text inspection group;

[0376] Determining whether a preset third character exists in the text, and if the preset third character exists in the text, determining an appearance position of the preset third character in the text;

[0377] When the appearance position is a preset position, the text is removed from the text inspection group.

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

[0379] The jump address assigning module is used to traverse the hyperlink group corresponding to any of the hyperlinks and assign the jump address of the hyperlink to the target text in the hyperlink group.

[0380] The embodiment of the present invention further provides an electronic device, such as Figure 8 As shown, it includes a processor 81, a communication interface 82, a memory 83 and a communication bus 84, wherein the processor 81, the communication interface 82, and the memory 83 communicate with each other through the communication bus 84.

[0381] A memory 83, for storing computer programs;

[0382] The processor 81 is used to execute the program stored in the memory 83 to implement the following steps:

[0383] Acquire a layout electronic document, and determine the text and annotations in the layout electronic document; store the text in a text group, and store the hyperlinks of the standard protocol contained in the annotations in a first annotation group; traverse the hyperlinks in the first annotation group, and perform the following processing: determine the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group; store the target text in the hyperlink group corresponding to the hyperlink.

[0384] 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.

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

[0386] 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.

[0387] 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.

[0388] In another embodiment of the present invention, a storage medium is provided. The storage medium stores instructions. When the instructions are executed on a computer, the computer executes the document processing method described in any one of the above embodiments.

[0389] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the document processing method described in any one of the above embodiments.

[0390] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by 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 invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a storage medium, or transmitted from one storage medium to another storage medium. For example, the computer instructions can be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can 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 hard disk Solid State Disk (SSD)), etc.

[0391] 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.

[0392] 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.

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

Claims

1. A document processing method, It is characterized in that The method comprises: Acquire a layout electronic document, and determine text and annotations in the layout electronic document; storing the text into a text group, and storing a hyperlink of the standard protocol contained in the annotation into a first annotation group; Traverse the hyperlinks in the first annotation group and perform the following processing: Determining a target text corresponding to the hyperlink in the text of the text group according to a positional relationship between the hyperlink and the text in the text group; The target text is stored in a hyperlink group corresponding to the hyperlink.

2. The method according to claim 1, It is characterized in that The step of determining the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group includes: Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group; Determining whether a positional relationship between a bounding rectangle frame of the text in the text group and a bounding rectangle frame of the hyperlink meets a preset first position requirement; When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement, storing the text in the text group into a text verification group; The texts in the text verification group are traversed, and when the text colors of the texts meet the preset color requirements, the texts are determined as the target texts corresponding to the hyperlinks.

3. The method according to claim 2, It is characterized in that The determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement includes: Obtaining a first X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the hyperlink, and obtaining a second X-axis coordinate value corresponding to a left boundary of a circumscribed rectangular frame of the text in the text group; Obtain the third X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the hyperlink, and obtain the fourth X-axis coordinate value corresponding to the right border of the circumscribed rectangular box of the text in the text group; Obtain the first Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the hyperlink, and obtain the second Y-axis coordinate value corresponding to the upper boundary of the circumscribed rectangular box of the text in the text group; Obtain the third Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the hyperlink, and obtain the fourth Y-axis coordinate value corresponding to the lower boundary of the circumscribed rectangular box of the text in the text group; Determine whether the second X-axis coordinate value is less than or equal to the first X-axis coordinate value, whether the fourth X-axis coordinate value is greater than or equal to the third X-axis coordinate value, whether the second Y-axis coordinate value is less than or equal to the first Y-axis coordinate value, and whether the fourth Y-axis coordinate value is greater than or equal to the third Y-axis coordinate value; When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset first position requirement, storing the text in the text group into a text verification group comprises: When the second coordinate value of the X-axis is less than or equal to the first coordinate value of the X-axis, the fourth coordinate value of the X-axis is greater than or equal to the third coordinate value of the X-axis, the first coordinate value of the Y-axis is less than or equal to the second coordinate value of the Y-axis, and the fourth coordinate value of the Y-axis is greater than or equal to the third coordinate value of the Y-axis, the text in the text group is stored in a text inspection group.

4. The method according to claim 1, It is characterized in that The step of determining the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group includes: Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group; According to the arrangement of elements of the layout electronic document, determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement; When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement, storing the text in the text group into a text verification group; The texts in the text verification group are traversed, and when the text colors of the texts meet the preset color requirements, the texts are determined as the target texts corresponding to the hyperlinks.

5. The method according to claim 4, It is characterized in that The step of judging, based on the arrangement of elements of the layout electronic document, whether a positional relationship between a circumscribed rectangular frame of the text in the text group and a circumscribed rectangular frame of the hyperlink meets a preset second position requirement includes: In the case where the arrangement of elements of the layout electronic document is horizontal arrangement, determining a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determining a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction; Determine a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determine a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction; Determine whether the first vertical projection intersects with the second vertical projection, and whether the second horizontal projection includes the first horizontal projection; or, In the case where the arrangement of elements of the layout electronic document is vertical arrangement, determining a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determining a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction; Determine a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determine a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction; Determine whether the first horizontal projection intersects with the second horizontal projection, and whether the second vertical projection includes the first vertical projection; When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement, storing the text in the text group into a text verification group comprises: When the first vertical projection intersects the second vertical projection and the second horizontal projection includes the first horizontal projection, storing the text in the text group into a text verification group; or, When the first horizontal projection intersects the second horizontal projection and the second vertical projection includes the first vertical projection, the text in the text group is stored in a text verification group.

6. The method according to claim 1, It is characterized in that After determining the text and annotations in the layout electronic document, the method further includes: In the case where the annotation does not contain a target modification element of a standard protocol, identifying all text lines in the formatted electronic document; For any of the text lines, traverse the basic elements in the text line, and store the basic elements that meet the preset modification element conditions as modification elements of the non-standard protocol into the second annotation group; Traversing the modified elements of the non-standard protocol in the second annotation group, assigning corresponding modification attributes to the modified elements of the non-standard protocol, and obtaining target modified elements of the non-standard protocol; Determine a first width range of the target modifying element of the non-standard protocol in the second annotation group, and determine a second text line where the target modifying element of the non-standard protocol in the second annotation group is located; In the case where the first width range includes the width range of N texts in the second text line, assigning the modification attribute of the target modification element of the non-standard protocol in the second annotation group to the N texts, wherein N is a positive integer, and the modification attribute of the target modification element of the non-standard protocol includes the modification attribute of the underline of the non-standard protocol; In the case where the annotation includes a target modifier element of a standard protocol, storing the target modifier element of the standard protocol into the second annotation group; Determine a second width range of the target modifier element of the standard protocol in the second annotation group, and determine a third text line where the target modifier element of the standard protocol in the second annotation group is located; In the case where the second width range includes the width range of M texts in the third text line, assigning the modification attribute of the target modification element of the standard protocol in the second annotation group to the M texts, wherein M is a positive integer, and the modification attribute of the target modification element of the standard protocol includes the modification attribute of the underline of the standard protocol; Traversing the texts in the text group, and assigning a target attribute to the texts if the texts have an underline modification attribute of a non-standard protocol or an underline modification attribute of a standard protocol; The step of determining the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group includes: Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group; According to the arrangement of elements of the layout electronic document, determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement; When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset second position requirement, storing the text in the text group into a text verification group; The texts in the text verification group are traversed, and when the texts have a target attribute, the texts are determined as target texts corresponding to the hyperlink.

7. The method according to claim 1, It is characterized in that The step of determining the target text corresponding to the hyperlink in the text of the text group according to the positional relationship between the hyperlink and the text in the text group includes: Determine the bounding rectangle of the hyperlink, and determine the bounding rectangle of the text in the text group; According to the arrangement of elements of the layout electronic document, determining whether the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement; In the case where the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement, the text in the text group is determined as the target text corresponding to the hyperlink.

8. The method according to claim 7, It is characterized in that The step of judging, based on the arrangement of elements of the layout electronic document, whether a positional relationship between a bounding rectangle of the text in the text group and a bounding rectangle of the hyperlink meets a preset third position requirement includes: In the case where the arrangement of elements of the layout electronic document is horizontal arrangement, determining a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determining a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction; Determine a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determine a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction; Determine whether the first vertical projection and the second vertical projection intersect and whether the ratio between the intersecting projection length and the first vertical projection length is greater than a preset value, and whether the second horizontal projection includes the first horizontal projection; or, In the case where the arrangement of elements of the layout electronic document is vertical arrangement, determining a first horizontal projection of a circumscribed rectangular frame of the text in the text group in the horizontal direction, and determining a second horizontal projection of a circumscribed rectangular frame of the hyperlink in the horizontal direction; Determine a first vertical projection of a circumscribed rectangular frame of the text in the text group in the vertical direction, and determine a second vertical projection of a circumscribed rectangular frame of the hyperlink in the vertical direction; Determine whether the first horizontal projection and the second horizontal projection intersect and whether the ratio between the intersecting projection length and the first horizontal projection length is greater than a preset value, and whether the second vertical projection includes the first vertical projection; When the positional relationship between the circumscribed rectangular frame of the text in the text group and the circumscribed rectangular frame of the hyperlink meets a preset third position requirement, determining the text in the text group as the target text corresponding to the hyperlink includes: In the case where the first vertical projection intersects with the second vertical projection and the ratio of the intersecting projection length to the first vertical projection length is greater than a preset value, and the second horizontal projection includes the first horizontal projection, determining the text in the text group as the target text corresponding to the hyperlink; or, When the first horizontal projection intersects with the second horizontal projection and the ratio of the intersecting projection length to the first horizontal projection is greater than a preset value, and the second vertical projection contains the first vertical projection, the text in the text group is determined as the target text corresponding to the hyperlink.

9. The method according to claim 1, It is characterized in that The hyperlinks in the first annotation group are traversed, and the following processing is further performed: Traversing the texts in the text group, and determining whether the text contents in the texts contain a preset first character; In a case where the text content in the text includes the preset first character, segmenting the text content in the text according to the preset first character; If the text content in the segmented text exists in the preset domain name set, storing the text in a text verification group; Eliminating texts in the text verification group that do not meet the hyperlink requirements, and determining the remaining texts in the text verification group as target texts corresponding to the hyperlink; Storing the target text in a hyperlink group corresponding to the hyperlink; Assigning the text content of the remaining text in the text verification group to the jump address corresponding to the hyperlink; The method further comprises: The hyperlink group corresponding to any of the hyperlinks is traversed, and the jump address of the hyperlink is assigned to the target text in the hyperlink group.

10. A document processing device, It is characterized in that The device comprises: A document acquisition module is used to acquire electronic documents of the layout; A text and annotation determination module, used to determine the text and annotations in the formatted electronic document; A text and annotation storage module, used for storing the text into a text group, and storing a hyperlink of a standard protocol contained in the annotation into a first annotation group; A hyperlink traversal module is used to traverse the hyperlinks in the first annotation group and perform the following processing: A text determination module, used for determining a target text corresponding to the hyperlink in the text of the text group according to a positional relationship between the hyperlink and the text in the text group; The text storage module is used to store the target text into the hyperlink group corresponding to the hyperlink.