Method, device and medium for automatically numbering and aligning tail notes and footnotes in bilingual scene

By extracting and converting automatic numbered footnotes and endnote ids in docx documents and adding custom number tags, the footnote and endnote number alignment problem in bilingual scenarios is solved, improving the accuracy of the document.

CN119227664APending Publication Date: 2024-12-31SICHUAN LAN-BRIDGE INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411569232.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-05
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In bilingual scenarios, in the original translation scenario of docx format documents, the automatically numbered footnotes and endnotes cannot be aligned during the export process, resulting in the automatic serial number of the original translation being inaccurate, affecting the accuracy of the document.

Method used

By extracting the reference tags for automatically numbered footnotes and endnotes in the docx document, get their ids, and convert them to strings, add the w:customMarkFollows tag to customize the number, insert it into the reference tags for footnotes and endnotes, move Except for automatic numbering.

Benefits of technology

While ensuring the accuracy of the serial number, the serial numbers of the original and translated text are aligned, improving the accuracy of document restoration in bilingual scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227664A_ABST
    Figure CN119227664A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of machine translation, and provides a method and a device for automatically numbering and aligning tail notes and footnotes in a bilingual scene and a medium. In the docx document analysis process, all footnotes and tail notes of automatic numbering are extracted, id of the footnotes and the tail notes are obtained, the id is converted into numbers, then the converted numbers are inserted in front of footnote and tail note texts in a text label mode, automatic numbers of the footnotes and the tail notes are removed, the numbers are set to be self-defined, and when translated texts are exported, the translated texts can be exported automatically. The serial numbers of the original text and the translated text are consistent. By adopting the technical scheme provided by the invention, the sequence numbers of the original text and the translated text are aligned while the accuracy of the sequence numbers is ensured, and the accuracy of document restoration in a bilingual scene is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of machine translation, and in particular, relates to a method, device and medium for automatically aligning endnote and footnote numbers in a bilingual scenario. Background Art

[0002] In the translation industry, the original-translation and translation-original scenarios of docx format documents are very common export scenarios. During the export process, if the footnotes and endnotes are automatically numbered (not explicit text in the underlying data, but rendered and displayed by the editor based on the ID), the automatic serial numbers of the original translation will not be aligned, resulting in reduced accuracy of document restoration in bilingual scenarios. For example: Figure 1 and 2 As shown in the figure, when exporting in two languages, both footnotes and endnotes use the automatic numbering style. At this time, the translation endnote and footnote numbering is 2 by the Word software, but the actual numbering required is 1, the same as the original text. Summary of the invention

[0003] The purpose of the present invention is to provide a method for automatically aligning endnote and footnote numbers in a bilingual scenario to solve the technical problems existing in the prior art.

[0004] In order to achieve the above object, the technical solution adopted by the present invention is as follows: A method for automatically aligning endnote and footnote numbers in a bilingual scenario includes the following steps: Step S1: extract all automatically numbered footnotes and endnote reference tags in the docx document; Step S2: Based on the reference tag, obtain the ID of the footnote and endnote: In the footnotes.xml and endnotes.xml files, each footnote and endnote has a unique ID, which starts from 0; Step S3: convert the IDs of footnotes and endnotes into corresponding strings; Step S4: Format tags: remove the automatic numbering of footnotes and endnotes, add w:customMarkFollows tags to footnotes and endnotes, and set the value to 1; Step S5: insert the character string obtained in step S3 in the form of a text tag before the reference tag of the footnote or endnote.

[0005] In one embodiment, the step S1 specifically comprises: (1) Based on the document.xml file, extract the reference tags of footnotes and endnotes: (11) Read the document.xml file of the docx document; (12) Based on the document.xml file, read the tag w:footnoteReference of the footnote reference and the tag w:endnoteReference of the endnote reference; (13) Determine whether the footnotes and endnotes are automatically numbered. If so, extract the tags of the footnote and endnote references; (2) Extract the reference tags of footnotes and endnotes based on the footnotes file footnotes.xml and the endnotes file endnotes.xml: (21) Read the separate footnotes file footnotes.xml and the endnotes file endnotes.xml in the docx document; (22) Read the reference tag w:footnoteRef of the footnote and the reference tag w:endnoteRef of the endnote based on the footnotes file footnotes.xml and the endnotes file endnotes.xml; (23) Determine whether the footnotes and endnotes are automatically numbered. If so, extract the reference tags of the footnotes and endnotes.

[0006] In one embodiment, step S3 specifically comprises: Step S3.1: Read the settings.xml file at the bottom of the docx document; Step S3.2: Get the reference tag w:endnotePr of the endnote and the reference tag w:footnoteP of the footnote; Step S3.3: Get w:numStart, and get the starting value numStart of the footnote and endnote; Step S3.4: Convert the footnote and endnote IDs into actual numbers according to the formula. The number calculation formula is: number = startPos + id, where startPos = numStart; Step S3.5: Get w:numFmt to obtain the formatting information of footnotes and endnotes; Step S3.6: Format the number in step S3.4 according to the formatting information obtained in step S3.5, thereby converting the IDs of the footnotes and endnotes into corresponding character strings.

[0007] In one implementation, the specific method of step S5 is as follows: insert a w:t tag in the reference, and set the string into the w:t tag.

[0008] In one embodiment, the reference indicates the location of the endnote and footnote references in the document.xml file.

[0009] The present invention also provides a computer-readable storage medium on which a computer program is stored. The computer program is executed by a processor to implement the method for automatically aligning endnote and footnote numbers in a bilingual scenario.

[0010] The present invention also provides a device for automatically aligning endnotes and footnotes in a bilingual scenario, comprising: a processor and a memory; the memory is used to store a computer program; the processor is connected to the memory and is used to execute the computer program stored in the memory, so that the device for automatically aligning endnotes and footnotes in a bilingual scenario executes the method for automatically aligning endnotes and footnotes in a bilingual scenario.

[0011] Compared with the prior art, the present invention has the following beneficial effects: In a word document, footnotes and endnotes with automatic numbering styles appear, and the serial numbers may be abnormal in bilingual scenarios. The technical solution provided by the present invention can align the serial numbers of the original text and the translation while ensuring the accuracy of the serial numbers, thereby improving the accuracy of document restoration in bilingual scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 Examples of prior art Figure 1 .

[0013] Figure 2 Examples of prior art Figure 2 .

[0014] Figure 3 This is an example diagram after processing by the present invention.

[0015] Figure 4 This is a schematic diagram of the process of Example 1 of the present invention.

[0016] Figure 5 This is a principle block diagram of Example 3 of the present invention. DETAILED DESCRIPTION

[0017] In order to enable those skilled in the art to have a clearer understanding and knowledge of the present invention, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described below are only used to explain the present invention, and are convenient for understanding. The technical solutions provided by the present invention are not limited to the technical solutions provided by the following embodiments, and the technical solutions provided by the embodiments should not limit the protection scope of the present invention.

[0018] It should be noted that the illustrations provided in the following embodiments are only used to illustrate the basic concept of the present invention in a schematic manner. Therefore, the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the form, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0019] Example 1 like Figure 3 and 4 As shown, this embodiment provides a method for automatically numbering and aligning endnotes and footnotes in a bilingual scenario. The design principle of the method is as follows: in the process of parsing a docx document, all automatically numbered footnotes and endnotes are extracted, the IDs of the footnotes and endnotes are obtained, the IDs are converted into numbers, and then the converted numbers are inserted before the footnote and endnote text in the form of text tags, and the automatic numbering of the footnotes and endnotes is removed, and the numbering is set to custom.

[0020] The specific steps of the method provided in this embodiment are as follows: 1. Step S1: Extract all automatically numbered footnotes and endnote reference tags in the docx document (1) The reference tag of the footnote exists in the document.xml file of the docx document. The tag of the footnote reference is: w:footnoteReference, and the tag of the endnote reference is: w:endnoteReference. If the tag does not contain text and there is no w:customMarkFollows tag; (2) There are separate footnote and comment files in the docx document, namely footnotes.xml and endnotes.xml. The reference tag of the footnote is: w:footnoteRef, and the reference tag of the endnote is: w:endnoteRef; If the tag does not contain text and there is no w:customMarkFollows tag; In the above two cases, it is determined that the footnotes and endnotes are automatically numbered, and the referenced tags of the footnotes and endnotes are extracted; if they are not automatically numbered, there is no need to add the w:customMarkFollows tag, and the value can be directly assigned.

[0021] 2. Step S2: Get the ID of footnotes and endnotes According to the referenced tag obtained in step S1 above, the ids of the footnotes and endnotes are obtained: in the footnotes.xml and endnotes.xml files, each footnote and endnote has a unique id, which starts from 0.

[0022] 3. Step S3: Convert the id into a corresponding string In this embodiment, the step specifically includes: Step S3.1: Read the settings.xml file at the bottom of the docx document; Step S3.2: Get the reference tag w:endnotePr of the endnote and the reference tag w:footnoteP of the footnote; Step S3.3: Get w:numStart, which means to identify the starting value of the number of the current endnote or footnote), and get the starting value numStart of the footnote and endnote; Step S3.4: Convert the id of the footnote and endnote into an actual number according to the formula, and the calculation formula of the number is: number = startPos + id, where startPos = numStart; Step S3.5: Get w:numFmt, which represents the formatting style of the current tag, such as dots, Arabic numerals, English letters, etc.), to obtain the formatting information of the footnote and endnote; Step S3.6: Format the number in step S3.4 according to the formatting information obtained in S3.5, thereby converting the id of the footnote and endnote into a corresponding string.

[0023] Step S4: Formatting Labels Remove the automatic numbering of footnotes and endnotes, add the w:customMarkFollows tag to the footnotes and endnotes, and set the value to 1; adding the above tag indicates that the current endnotes and footnotes need to use custom numbers.

[0024] 5. Step S5: Insert the string as a text tag before the reference tag of the footnote or endnote In this embodiment, the implementation method of this step is as follows: insert a w:t tag in the reference, and set the string to the w:t tag, wherein the reference represents the position of the endnote and footnote reference in the document.xml file.

[0025] Through the above technical solution, the restored footnotes and endnotes are numbered correctly, and the numbers of the original text and the translation are aligned; Figure 1 Based on the example, after being processed by the method provided in this embodiment, the restored text with correct footnote and endnote numbers and aligned numbers of the original text and the translation can be obtained, such as Figure 3 shown.

[0026] Example 2 This embodiment provides a computer-readable storage medium, on which a computer program is stored, and the computer program is executed by a processor to implement the method for automatically aligning endnote and footnote numbers in a bilingual scenario provided in Embodiment 1. A person of ordinary skill in the art can understand that all or part of the steps of implementing the method provided in Embodiment 1 can be completed by hardware related to the computer program, and the above-mentioned computer program can be stored in a computer-readable storage medium, and when the program is executed, the steps of the method provided in Embodiment 1 are executed; and the above-mentioned storage medium includes: ROM, RAM, magnetic disk or optical disk, etc., various media that can store program codes.

[0027] Example 3 like Figure 5 As shown, this embodiment provides an automatic endnote and footnote numbering alignment device in a bilingual scenario, including: a processor and a memory; the memory is used to store a computer program; the processor is connected to the memory, and is used to execute the computer program stored in the memory, so that the automatic endnote and footnote numbering alignment device in a bilingual scenario performs the automatic endnote and footnote numbering alignment method in a bilingual scenario provided by Example 1.

[0028] Specifically, the memory includes: ROM, RAM, disk, USB flash drive, memory card or CD and other media that can store program codes.

[0029] Preferably, the processor can be a general-purpose processor, including a central processing unit, a network processor, etc.; it can also be a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component.

[0030] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.

Claims

1. A method for automatically aligning endnote and footnote numbers in a bilingual scenario, characterized in that: The following steps are involved: Step S1: extract all automatically numbered footnotes and endnote reference tags in the docx document; Step S2: Based on the reference tag, obtain the ID of the footnote and endnote: In the footnotes.xml and endnotes.xml files, each footnote and endnote has a unique ID, which starts from 0; Step S3: convert the IDs of footnotes and endnotes into corresponding strings; Step S4: Format tags: remove the automatic numbering of footnotes and endnotes, add w:customMarkFollows tags to footnotes and endnotes, and set the value to 1; Step S5: insert the character string obtained in step S3 in the form of a text tag before the reference tag of the footnote or endnote.

2. The method for automatically aligning endnote and footnote numbers in a bilingual scenario according to claim 1 is characterized in that: The step S1 specifically includes: (1) Based on the document.xml file, extract the reference tags of footnotes and endnotes: (11) Read the document.xml file of the docx document; (12) Based on the document.xml file, read the tag w:footnoteReference of the footnote reference and the tag w:endnoteReference of the endnote reference; (13) Determine whether the footnotes and endnotes are automatically numbered. If so, extract the tags of the footnote and endnote references; (2) Based on the footnotes file footnotes.xml and the endnotes file endnotes.xml, extract the reference tags of footnotes and endnotes: (21) Read the separate footnotes file footnotes.xml and endnotes file endnotes.xml in the docx document; (22) Based on the footnotes file footnotes.xml and the endnotes file endnotes.xml, read the reference tag w:footnoteRef of the footnote and the reference tag w:endnoteRef of the endnote; (23) Determine whether the footnotes and endnotes are automatically numbered. If so, extract the reference tags of the footnotes and endnotes.

3. The method for automatically aligning endnote and footnote numbers in a bilingual scenario according to claim 2 is characterized in that: The step S3 specifically includes: Step S3.1: Read the settings.xml file at the bottom of the docx document; Step S3.2: Get the reference tag w:endnotePr of the endnote and the reference tag w:footnoteP of the footnote; Step S3.3: Get w:numStart, and get the starting value numStart of the footnote and endnote; Step S3.4: Convert the footnote and endnote IDs into actual numbers according to the formula. The number calculation formula is: number = startPos + id, where startPos = numStart; Step S3.5: Get w:numFmt to obtain the formatting information of footnotes and endnotes; Step S3.6: Format the number in step S3.4 according to the formatting information obtained in step S3.5, thereby converting the IDs of the footnotes and endnotes into corresponding character strings.

4. The method for automatically aligning endnote and footnote numbers in a bilingual scenario according to claim 3 is characterized in that: The specific method of step S5 is as follows: insert a w:t tag in the reference, and set the string into the w:t tag.

5. The method for automatically aligning endnote and footnote numbers in a bilingual scenario according to claim 4 is characterized in that: The references indicate the locations of endnote and footnote references in the document.xml file.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer program is executed by a processor to implement the method for automatic numbering alignment of endnotes and footnotes in a bilingual scenario according to any one of claims 1 to 5.

7. A device for automatically aligning endnote and footnote numbers in a bilingual scenario, characterized in that: include: Processor and memory; The memory is used to store a computer program; the processor is connected to the memory and is used to execute the computer program stored in the memory, so that the device for automatically aligning the numbering of endnotes and footnotes in a bilingual scenario performs the method for automatically aligning the numbering of endnotes and footnotes in a bilingual scenario as described in any one of claims 1 to 5.