Method, device, computer equipment and storage medium for counting the number of words in a translation manuscript
By combining the sub-item processing of translated documents and automated recognition technology, the problem of non-text content processing in science and engineering documents is solved, accurate word count statistics and automated processing are achieved, and the statistical efficiency and accuracy of translated documents are improved.
Patent Information
- Application Number
- CN202411597605.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2044-11-11
AI Technical Summary
When processing science and engineering translation documents, it is difficult to automatically identify and process non-text content, such as pictures, formulas, graphics and references, resulting in inaccurate word count statistics.
By obtaining the translated documents to be counted, performing sub-item processing of text, headers, footers, pictures and graphics, and applying a deduplication algorithm based on MD5 Hash value, using image translation recognition model and OCR technology to automatically process image text, supporting complex graphics text statistics.
It realizes accurate word count statistics for translated documents, solves the problems of reference recognition, header and footer deduplication, image translation status recognition and complex graphic text statistics, and improves the accuracy and automation efficiency of statistical results.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a word counting method, and more specifically to a translation manuscript word counting method, device, computer equipment and storage medium. Background Art
[0002] Word count of translated documents is an important part of translation work, especially when it comes to science and engineering documents. Due to their particularity, word count needs to consider multiple aspects; existing word count methods include Microsoft Word word count, AnyCount word count, and PractiCount and Invoice word count; among them, Microsoft Word word count is based on the real-time word count function built into Microsoft Word, allowing users to check the word count at any time when editing a document. Users can choose to count the words of the entire document or only the selected part. This function can count the number of characters, paragraphs, and pages with or without spaces. However, Word cannot recognize text in pictures or graphics, cannot process text embedded in pictures, and cannot automatically count the content of headers and footers. In addition, the reference recognition function in Word does not include artificial intelligence technology and cannot automatically generate statistical reports. AnyCount supports word counts in multiple file formats, including Word, Excel, PowerPoint, PDF, HTML, RTF, and TXT, and can handle common office and web documents. It can automatically count the text content of embedded objects such as tables, text boxes, headers and footers in documents, ensuring that all visible text is counted. AnyCount can also generate detailed word count reports, allowing users to view the specific word count distribution in the document and support export to formats such as Excel. However, AnyCount still has shortcomings in identifying duplicate content in headers and footers, determining whether images are translated, and identifying references. PractiCount supports multiple file formats, including Word, Excel, PowerPoint, PDF, HTML, and TXT, and is suitable for translation companies and freelance translators. In addition to word count, PractiCount can also perform flexible statistics by number of characters, lines, and pages. However, it cannot automatically extract or count the text content in images, especially when dealing with technical diagrams, flow charts, and data charts that are common in science and engineering documents, which requires manual intervention. PractiCount also lacks deduplication capabilities, especially the failure to effectively handle duplicate content in headers and footers, which may lead to repeated word counts.
[0003] It can be seen that the word count of science and engineering translation manuscripts is special, mainly because these manuscripts often contain pictures, graphics, references and other complex structures. At present, the existing technology still has significant shortcomings when processing non-text content (such as pictures, formulas, graphics and references) in science and engineering translation manuscripts, mainly including the following problems:
[0004] The processing of references in science and engineering translations often depends on the specific circumstances of the translation needs. Some references may need to be translated, while others may not. Existing word count tools are usually unable to automatically identify and distinguish these references and their translation needs, and rely entirely on manual intervention, which not only increases the workload, but may also lead to inaccurate statistical results due to omissions.
[0005] In science and engineering translation documents, the content in headers and footers (such as titles, dates, and page numbers) is often repeated, and these parts often do not need to be translated or only need to be translated once. Existing word count tools often cannot intelligently remove duplicates when processing headers and footers, resulting in repeated content being counted multiple times, causing word count inflation. How to effectively identify repeated content in headers and footers and remove duplicates is a major shortcoming of current tools.
[0006] In science and engineering translation documents, not all images containing text (such as technical diagrams and flow charts) may need to be translated. Existing technologies have difficulty automatically identifying which images have been translated and which have not.
[0007] To count the number of words in an image, you usually need to rely on OCR technology. Although some word counting tools have OCR functions, these tools are often not optimized for Chinese, resulting in poor recognition of Chinese characters.
[0008] The text content (such as text, legends, and labels) in complex graphics (such as flowcharts, technical schematics, and structure diagrams) contained in science and engineering translation documents needs to be considered during translation and word count. However, existing word count tools are often unable to automatically identify and extract the text embedded in these graphics, especially for vector graphics or other non-standard formats. The text in different types of graphic formats (such as SVG, Visio, and SmartArt) is deeply embedded, and existing tools have difficulty in directly obtaining these texts, resulting in reliance on manual intervention, which affects the efficiency and accuracy of automated counting.
[0009] Therefore, it is necessary to design a new method to solve the problems of reference identification, header and footer deduplication, and whether the image has been translated; to automatically process the statistics of image text in the file, and to support the statistics of text in various complex graphics. Summary of the invention
[0010] The purpose of the present invention is to overcome the defects of the prior art and provide a translation manuscript word count method, device, computer equipment and storage medium.
[0011] To achieve the above object, the present invention adopts the following technical solution: a translation manuscript word count method, comprising:
[0012] Get the translation documents to be counted;
[0013] The translation manuscript to be counted is divided into text, header and footer, picture, and graphic to obtain the sub-item results;
[0014] Performing word count on the text in the sub-item results to obtain a first statistical result;
[0015] Applying a deduplication algorithm based on the sum of MD5 Hash values to the headers and footers in the sub-item results, and counting the number of non-repeated header and footer characters to obtain a second statistical result;
[0016] Using an image translation recognition model to identify whether the image in the sub-item results is translated, and using OCR recognition technology to perform text recognition on the translated image, and counting the number of words on the recognition result to obtain a third statistical result;
[0017] The graphics in the sub-item results are counted by using a corresponding statistical strategy to obtain a fourth statistical result. When the graphic type is a general graphic including AutoShape and SmartArt, the Office API is used to directly count the words; when the graphic type is a Visio graphic, an EMF format preview of the Visio graphic is obtained and the preview is converted into a PNG format, and the number of words is counted by using OCR recognition; when the graphic category is a graphic group, each sub-graphic is recursively traversed, and the number of words of the sub-graphics is added;
[0018] The first statistical result, the second statistical result, the third statistical result and the fourth statistical result are summed to obtain the total number of words in the translated manuscript;
[0019] Output the total number of words in the translation document.
[0020] A further technical solution is: the translation manuscript to be counted is divided into text, header and footer, picture, and graphic to obtain the sub-item results, including:
[0021] Determining the content of the text, header and footer of the translation manuscript to be counted;
[0022] Determine whether the format of the translation document to be counted is XML format;
[0023] If the format of the translation document to be counted is not in XML format, copying the translation document to be counted and converting it into XML format;
[0024] The translation document to be counted is parsed using the API of the OpenXML SDK library to obtain the images in the document;
[0025] If the format of the translation document to be counted is XML format, executing the API of the OpenXML SDK library to parse the translation document to be counted to obtain the pictures in the document;
[0026] The content of the graphic is determined for the translation document to be counted.
[0027] A further technical solution is: performing word count on the text in the sub-item results to obtain a first statistical result includes:
[0028] Calculating the number of words in the string using a custom statistical rule for the text in the sub-item result to obtain the total number of words in the string;
[0029] Using the Office word count function to count the words in the text of the sub-item results to obtain a word count result;
[0030] Using a large language model in combination with prompt words to identify the text in the sub-item results to obtain references and translations, and counting the corresponding words according to the references and translations to obtain a word count result of the document;
[0031] The total number of words in the character string, the word count result, and the word count result of the document are summed to obtain a first statistical result.
[0032] A further technical solution is: applying a deduplication algorithm based on the sum of MD5 Hash values to the headers and footers in the sub-item results, counting the number of non-repeated header and footer characters to obtain a second statistical result, including:
[0033] Extract key elements of each header and footer in the sub-item results to obtain a first extraction result;
[0034] Compare the number of first extraction results of each header to determine the headers with the same number of first extraction results and the headers with different numbers of first extraction results;
[0035] Calculate the MD5 Hash value of each header with the same number of extraction results, and determine the corresponding total Hash value;
[0036] When the corresponding total Hash values are the same, the headers with the same number of the first extraction results are determined, only one of the headers is retained, and the retained header and the headers with different numbers from the first extraction results are combined to form a non-repeated header;
[0037] Extracting key elements of each footer from the header and footer of the sub-item results to obtain a second proposed result;
[0038] Compare the number of the second extraction results of each footer to determine the footers with the same number of second extraction results and the footers with different numbers of second extraction results;
[0039] Calculate the MD5 Hash value of each of the footers with the same number of the second extraction results, and determine the corresponding total Hash value;
[0040] When the corresponding total hash values are the same, the footers with the same number of second extraction results are determined, only one of the headers is retained, and the retained footer is combined with the footers with different numbers of second extraction results to form a non-repeated footer;
[0041] The word count of the text in the non-repeated header and the non-repeated footer is counted, and the statistical results are accumulated to obtain a second statistical result.
[0042] A further technical solution is: the image translation recognition model is used to identify whether the image in the sub-item result is translated, and the OCR recognition technology is used to perform text recognition on the translated image, and the word count of the recognition result is performed to obtain a third statistical result, including:
[0043] Inputting the image value in the sub-item result into the deep learning model determines whether the image has been translated;
[0044] If the image has been translated, the image is used as the translated image;
[0045] Using OCR recognition technology to perform text recognition on the translated image, and counting the number of words on the recognition result to obtain a third statistical result;
[0046] If the image is not translated, inputting the image into an image translation recognition model for translation to obtain a translated image;
[0047] The image translation recognition model is obtained by training a binary classification model based on deep learning by using translated images and untranslated images as sample sets.
[0048] A further technical solution is: the translated image is subjected to text recognition using OCR recognition technology, and the word count of the recognition result is performed to obtain a third statistical result, including:
[0049] Performing OCR recognition on the translated image to obtain a text area list;
[0050] Counting the number of words in each text area in the text area list respectively, and summing up the results of the respective counting to obtain the number of words in the picture;
[0051] The word counts of all pictures are added up to obtain the third statistical result.
[0052] The further technical solution is: when the type of the graphic is a Visio graphic, the number of words in the Visio graphic is counted by using EMF format conversion and OCR recognition, including:
[0053] When the type of the graphic is a Visio graphic, a preview image of the Visio graphic in EMF format is obtained and the preview image is converted into a PNG format;
[0054] The preview image after format conversion is recognized by using OCR text recognition technology and the text in the image is counted to obtain a fourth statistical result.
[0055] The present invention also provides a translation manuscript word count device, comprising:
[0056] A document acquisition unit, used to acquire the translation document to be counted;
[0057] An itemization unit is used to itemize the translation manuscript to be counted into text, header and footer, picture, and graphic to obtain itemization results;
[0058] A text word count unit, used for counting the word count of the text in the sub-item result to obtain a first statistical result;
[0059] A header and footer word count counting unit, used for applying a deduplication algorithm based on the sum of MD5 Hash values to the headers and footers in the sub-item results, counting the number of unique header and footer words to obtain a second statistical result;
[0060] A picture word count unit, configured to use a picture translation recognition model to identify whether the picture in the sub-item result is translated, and use an OCR recognition technology to perform text recognition on the translated picture, and count the words of the recognition result to obtain a third statistical result;
[0061] A graphic word count unit is used to count the words of the graphics in the sub-item results using a corresponding statistical strategy to obtain a fourth statistical result. When the graphic type is a general graphic including AutoShape and SmartArt, the Office API is used to directly count the words; when the graphic type is a Visio graphic, an EMF format preview of the Visio graphic is obtained and the preview is converted into a PNG format, and the OCR recognition is used to count the words; when the graphic category is a graphic group, each sub-graphic is recursively traversed and the word counts of the sub-graphics are added;
[0062] A summing unit, used for summing the first statistical result, the second statistical result, the third statistical result and the fourth statistical result to obtain the total number of words in the translated manuscript;
[0063] The output unit is used to output the total number of words in the translated manuscript.
[0064] The present invention further provides a computer device, which includes a memory and a processor. The memory stores a computer program, and the processor implements the above method when executing the computer program.
[0065] The present invention also provides a storage medium, wherein the storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0066] Compared with the prior art, the beneficial effects of the present invention are as follows: the present invention effectively identifies references and applies a deduplication algorithm to solve the problem of repeated statistics of headers and footers by processing the statistical translation manuscripts in separate items. The image translation recognition model and OCR technology are used to automatically process the statistics of image texts in the file, while supporting accurate statistics of the texts in various complex graphics. Finally, the results of each item are summarized to provide the total number of words in the translation manuscript to ensure the accuracy and comprehensiveness of the statistical results; solve the problems of reference identification, deduplication of headers and footers, and identification of whether the image has been translated; automatically process the statistics of image texts in the file, and support the statistics of the texts in various complex graphics.
[0067] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0069] Figure 1A flowchart of a method for counting the number of words in a translation document provided by an embodiment of the present invention;
[0070] Figure 2 A schematic block diagram of a translation document word count device provided by an embodiment of the present invention;
[0071] Figure 3 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0072] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions 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.
[0073] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0074] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0075] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0076] See also Figure 1 , Figure 1A schematic flow chart of a translation manuscript word count method provided for an embodiment of the present invention. The translation manuscript word count method is applied to a Windows desktop client and is provided in the form of an Office system plug-in. Through automated word count and real-time feedback, the user's manual operation and inspection steps are significantly reduced, and the convenience of use is improved. The user interface is based on the Office system, so the user does not need to learn a new operation interface or process, and can directly operate in a familiar environment, reducing the learning cost and operation difficulty, and shortening the adaptation time. Through the optimized word count method, the present invention can quickly process complex documents containing a large amount of text, pictures, graphics, Visio diagrams and references. Compared with the existing word count method, the processing speed is increased by more than 200%, significantly reducing the user's manual operation. The method of this embodiment can accurately identify and exclude repeated header and footer content, accurately identify hidden text in the manuscript, determine whether the picture is translated, and identify references and their translation status. These functions significantly improve the accuracy of word count and avoid errors caused by repeated or omitted statistics. It supports multiple document formats such as Word, Excel, PowerPoint, etc., has a wide range of applicability, and can adapt to different types of translation projects. The design based on the Office platform enables it to directly process native Office document formats, avoiding the problem of content loss or format confusion caused by document format conversion. It can be easily integrated with the company's existing IT system without large-scale system adjustments or additional technical support, allowing companies to quickly deploy the system and integrate it into existing workflows and management processes.
[0077] Figure 1 FIG. 1 is a flow chart of a method for counting the number of words in a translation document provided by an embodiment of the present invention. Figure 2 As shown, the method includes the following steps S110 to S180.
[0078] S110, obtaining the translation document to be counted.
[0079] In this embodiment, the translation manuscripts to be counted generally refer to translation files that have not been subjected to word count or related processing. These manuscripts may include the original text to be translated and its corresponding translation content, involving text, graphics, pictures and other elements that may be included. When performing translation work, word count is an important step because it directly affects the project's quotation, time management and resource allocation.
[0080] In this case, the main characteristics of the translation documents to be counted include:
[0081] Contains multiple elements: A document contains not only text content, but also images, tables, graphics and other elements.
[0082] Pending status: The manuscript has not yet been processed by word count or other related quality control processes.
[0083] There may be duplicate content: During the translation process, headers, footers and other formatting elements may be repeated, which need to be removed during statistics.
[0084] Need for accuracy: When performing statistics, one needs to ensure accuracy in calculations to avoid errors due to omissions or duplications.
[0085] By treating translation manuscripts statistically, translators can better understand the workload and thus conduct effective project management and resource allocation.
[0086] S120, dividing the translation manuscript to be counted into text, header and footer, picture, and graphic to obtain a result of the division.
[0087] In this embodiment, the itemized results refer to the specific results obtained after classifying and counting the contents in the manuscript according to different categories when processing the translation manuscript to be counted.
[0088] In one embodiment, the above-mentioned step S120 may include steps S121 - S125 .
[0089] S121, determining the text, header and footer contents of the translation manuscript to be counted.
[0090] In this embodiment, when the translation document to be counted is a word document, it is necessary to determine the content of the header and footer; if the translation document to be counted is not a word document, it does not involve all the content of the header and footer, including determining the header and footer and counting the number of words in the header and footer.
[0091] Specifically, through the API provided by Office, the system extracts all sections in the translation document to be counted; the system checks each section in the document one by one to determine whether it contains header or footer information; if a section does not have a header or footer, the system will skip the section; if a section contains a header or footer, the system saves the header and footer of the section as a header and footer document.
[0092] S122, determining whether the format of the translation document to be counted is XML format;
[0093] S123: If the format of the translation document to be counted is not in XML format, copy the translation document to be counted and convert it into XML format.
[0094] To ensure the security of the original document, the system will create a copy of the document to be translated so that format conversion can be performed on the copy.
[0095] S124, using the API of the OpenXML SDK library to parse the document to be translated, so as to obtain the pictures in the document.
[0096] If the format of the translation document to be counted is already in XML format, the system will use the API of the OpenXML SDK library to parse the document; the OpenXML SDK can directly read the structure of the Word document, including text, images, styles and other contents.
[0097] During the parsing process, the system will traverse all elements in the XML document, looking for images (usually embedded Base64 encoding or links); all extracted image information (including format, location, size, etc.) will be stored for subsequent statistics or processing.
[0098] If the format of the translation document to be counted is XML format, execute step S124;
[0099] S125, determining the content of the graphic for the translation manuscript to be counted.
[0100] In this embodiment, the system searches for all graphic objects (such as flow charts, diagrams, etc.) in the document, which usually involves parsing the nested XML elements of the graphics.
[0101] The OpenXML SDK also provides methods for parsing these graphic objects.
[0102] Statistical graphic information: Determine the number and type of graphics and record their related information (such as name, location, size, style, etc.) for display and analysis in subsequent reports.
[0103] All extracted graphical information will be stored in a specific data structure for subsequent use, such as statistical analysis or report generation.
[0104] Through the above steps, the system can efficiently extract and process the text, headers and footers, pictures and graphics in the translation documents to be counted. This method ensures the comprehensiveness and accuracy of the document content, and provides a solid foundation for subsequent translation and statistical analysis.
[0105] S130: Count the number of words in the text in the sub-item results to obtain a first statistical result.
[0106] In this embodiment, the first statistical result refers to the total word count of the text. The text includes the text in the main text, text box, footnote, endnote, comment, and remarks. The statistical methods of the text are different in Word, Excel, and PowerPoint. In addition, the references in the text need to be identified and the word count needs to be calculated.
[0107] In one embodiment, the above-mentioned step S130 may include steps S131 - S134 .
[0108] S131. Calculate the number of characters in the character string using a custom statistical rule for the text in the sub-item result to obtain the total number of characters in the character string.
[0109] In this embodiment, the total number of characters in the character string refers to the total number of characters in all character strings in the text.
[0110] Specifically, the character string word count method is to count the number of words in a character string according to the custom counting rules, and the general character word count method is used for each subsequent link that needs to count the number of words. The word count items that need to be counted are shown in Table 1 below.
[0111] Table 1. Word count items to be counted
[0112] Serial number Statistics Remark 1 Number of characters Unicode characters, including spaces 2 Number of characters excluding spaces Unicode characters, excluding spaces 3 Chinese characters 4 Number of non-Chinese words 5 Total Word Count
[0113] The following describes the statistical methods for each item (expressed in C# code, with input text as text):
[0114] Get the length of the string text by int Characters = text.Length; to calculate the total number of characters it contains. This method directly uses the Length property of the string.
[0115] The number of characters excluding spaces is calculated through int CharactersNoSpaces = text.Replace(" ", "").Length;. Here, the code first replaces all spaces in the string with empty strings through the Replace method, and then calculates the length of the replaced string to obtain the total number of characters excluding spaces.
[0116] Count the number of Chinese characters through int ChineseWords = Regex.Matches(text, @"[\u4e00-\u9fff]").Count. Using the regular expression @"[\u4e00-\u9fff]", this line of code extracts all Chinese characters from text and counts their total number. \u4e00-\u9fff represents Chinese characters in the Unicode range.
[0117] The number of non-Chinese characters is counted through int NonChineseCharacters = Characters – ChineseWords. This line obtains the number of non-Chinese characters by subtracting the number of Chinese characters from the total number of characters.
[0118] The total word count is relatively complex because it needs to handle multiple languages. The following code uses regular expressions to extract words in different languages and calculate the total number:
[0119] Initialize the counter: Create an integer variable count and initialize it to 0. This will be used to count the total number of characters and punctuation marks in different languages.
[0120] Define the regular expression:
[0121] Chinese characters: Use the regular expression @"[\u4e00-\u9fff]" to create chineseRegex, which matches all Chinese characters.
[0122] Japanese characters: Use the regular expression @"[\u3040-\u30ff\u31f0-\u31ff\u3400-\u4dbf\u4e00-\u9fff]" to create japaneseRegex, which matches Japanese characters, including hiragana, katakana, and kanji.
[0123] Korean characters: Use the regular expression @"[\uac00-\ud7af]" to create koreanRegex, which is used to match Korean characters (Hangul).
[0124] Latin words: Use the regular expression @"\b[\p{L}]+\b" to create latinWordRegex, which is used to match words in Latin letters and is suitable for English, French, German, etc.
[0125] Punctuation: Use the regular expression @"[\p{P}]" to create punctuationRegex, which matches all punctuation characters.
[0126] Count the number of various characters:
[0127] Count Chinese characters: Use the chineseRegex.Matches(input) method to find all matching Chinese characters in the input string input and add the number found to count.
[0128] Count Japanese characters: Use the japaneseRegex.Matches(input) method to find all matching Japanese characters in the input string and add the number to count.
[0129] Count Korean characters: Use the koreanRegex.Matches(input) method to find all matching Korean characters in the input string and add the number to count.
[0130] Count Latin words: Use the latinWordRegex.Matches(input) method to find all matching Latin words in the input string and add the number to count.
[0131] Count punctuation marks: Use the punctuationRegex.Matches(input) method to find all matching punctuation marks in the input string and add the number to count.
[0132] Return the total number: Finally, return the variable count, which contains the total number of all types of characters and punctuation marks after counting.
[0133] S132, using Office word count function to count the words in the text of the sub-item results to obtain a word count result.
[0134] In this embodiment, in a Word document, text statistics include the main text content (including tables), text boxes, footnotes, endnotes and comments. The API provided by Microsoft Office can directly count the number of words in these parts.
[0135] In Excel, text refers to the content in each cell. Office also provides an API for counting the number of words in each cell. Therefore, you only need to traverse all cells in each worksheet and add up the counted results.
[0136] In a PowerPoint presentation, text includes the text box content, notes, and comments in each slide. The API provided by Office can directly count the number of words in the text box, notes, and comments by simply adding up the statistical results of each part.
[0137] S133, using a large language model in combination with prompt words to identify the text in the sub-item results to obtain references and translations, and counting the corresponding word counts based on the references and translations to obtain a document word count statistical result.
[0138] In this embodiment, the document is divided into multiple paragraphs, and each paragraph is input into a large language model together with a prompt word for analysis, so as to improve the recognition efficiency and accuracy of references.
[0139] First, the document to be analyzed is broken down into multiple paragraphs so that it can be analyzed paragraph by paragraph. This processing method ensures that the large language model can focus on the content of each paragraph, thereby improving the accuracy of recognition.
[0140] Each paragraph is input into the large language model along with a set of carefully designed prompt words. The purpose of these prompt words is to guide the model to pay attention to whether the paragraph contains references and whether it is translated. For example, the prompt word template is as follows:
[0141] Is the following text a reference? If so, please determine whether it has been translated into Chinese. Please output the result in JSON format.
[0142] text;
[0143] {insert text to be analyzed};
[0144] Model output.
[0145] After receiving the input, the large language model returns a result in JSON format based on its built-in knowledge and training data. The result contains two main fields:
[0146] is_reference: Boolean value indicating whether the paragraph is a reference.
[0147] is_translated: A Boolean value indicating whether the reference has been translated into Chinese.
[0148] Output example:
[0149] json
[0150] {
[0151] "is_reference": true,
[0152] "is_translated": false
[0153] };
[0154] The task of reference identification is relatively simple, and the parameter scale of the large language model is not high. Therefore, the method of this embodiment chooses to use the open source Llama 3.1-7B model. This model not only has a small parameter scale and fast inference speed, but also consumes less system resources, which is very suitable for the needs of this scenario.
[0155] By identifying references in an automated way, the time and effort of manual review is reduced, thereby improving work efficiency. By utilizing the natural language processing capabilities of the large language model, it is possible to more accurately determine whether a document is a reference and its translation status, reducing the errors that may be caused by manual judgment. Due to the small scale of the selected model parameters and the fast inference speed, the system consumes low resources at runtime and can run efficiently on a variety of devices. This method can be widely used in various types of documents, has good adaptability, and can support document processing needs in a variety of fields. Due to the use of open source models, this technology can be easily integrated into existing document management systems or document processing software to enhance their functions.
[0156] S134, summing up the total number of words in the character string, the word count result, and the word count result of the document to obtain a first statistical result.
[0157] The total number of characters in the character string, the character count result and the document character count result are summed to form a first statistical result.
[0158] S140: Apply a deduplication algorithm based on the addition of MD5 Hash values to the headers and footers in the sub-item results, and count the number of non-repeated header and footer characters to obtain a second statistical result.
[0159] In this embodiment, the second statistical result refers to the number of non-repeating header and footer characters.
[0160] In one embodiment, the above-mentioned step S140 may include steps S141 - S149 .
[0161] S141. Extract key elements of each header and footer in the sub-item results to obtain a first extraction result.
[0162] In this embodiment, the first extraction result refers to the key elements in the header, including text, pictures and tables. The table is finally split into text and picture sets by cell, forming a set E containing all elements: E={T1, T2, ..., Tn, I1, I2, ..., Im}; where Ti represents the i-th text, Ij represents the j-th picture, and there are a total of n+m elements.
[0163] Extracting key elements helps to understand and analyze the content of the header; forming a standardized set of elements facilitates subsequent processing and comparison; splitting the table ensures that information is not lost, allowing text and images to be processed separately.
[0164] S142: Compare the number of first extraction results of each header to determine headers with the same number of first extraction results and headers with different numbers of first extraction results.
[0165] Compare the quantity of the extracted header elements to distinguish between headers with the same quantity and headers with different quantities.
[0166] Identifying similar headers helps reduce redundant data and provides a basis for subsequent duplication judgments.
[0167] In this embodiment, a pairwise comparison method may be used to determine the final result.
[0168] S143, calculating the MD5 Hash value of each of the headers with the same number of extraction results, and determining the corresponding total Hash value.
[0169] In this embodiment, the MD5 Hash value of each preprocessed element is calculated to form a Hash value set: H = {H(T1), H(T2), ..., H(Tn), H(I1), H(I2), ..., H(Im)};
[0170] Add the MD5 Hash values of all elements to get a total hexadecimal sequence SH:
[0171] SH=H(T1)+H(T2)+…+H(Tn)+H(I1)+H(I2)+…+H(Im).
[0172] Since addition is commutative, the order of elements in a set does not affect the SH value.
[0173] Hash values can effectively identify identical content and avoid directly comparing large amounts of data; they can enhance data processing efficiency and improve overall performance.
[0174] S144. When the corresponding total Hash values are the same, determine the headers with the same number of the first extraction results, retain only one of the headers, and combine the retained header and the headers with a different number from the first extraction results to form a non-repeated header.
[0175] In this embodiment, if the total Hash values are the same, only one header is retained and the other headers are discarded, forming a non-repeated header, further reducing redundant data and keeping the result concise, reducing the complexity of subsequent processing and improving the manageability of data.
[0176] S145. Extract key elements of each footer of the header and footer in the sub-item results to obtain a second proposed result.
[0177] In this embodiment, similar to step S141, key elements are extracted from each footer to obtain a second extraction result.
[0178] Ensure that the key information of the footer is also effectively extracted and managed; make the processing flow of the footer and header consistent to facilitate overall structured analysis.
[0179] S146. Compare the number of the second extraction results of each footer to determine footers with the same number of second extraction results and footers with different numbers of second extraction results.
[0180] In this embodiment, the extracted footer elements are compared in quantity to determine the footers with the same quantity and the footers with different quantities, similar to step S142, to reduce redundant information, provide a data basis for subsequent processing, and enhance the flexibility of the system.
[0181] S147, calculating MD5 Hash values for the footers with the same number of second extraction results respectively, and determining the corresponding total Hash value.
[0182] In this embodiment, the MD5 Hash value is calculated for the second extraction result of each footer to form a total Hash value, and the efficiency of data comparison is improved by calculating the Hash value, ensuring the integrity and accuracy of the data and facilitating subsequent data processing.
[0183] S148. When the corresponding total Hash values are the same, determine the footers with the same number of second extraction results, retain only one of the headers, and combine the retained footer with the footer with a different number of second extraction results to form a non-repeated footer.
[0184] In this embodiment, if the total hash value of the footers is the same, only one footer is retained. This also reduces data redundancy and maintains the efficiency of processing results. This helps system management and optimizes data storage.
[0185] S149, counting the number of words in the texts in the non-repeated headers and the non-repeated footers, and accumulating the statistical results to obtain a second statistical result.
[0186] In this embodiment, the word count of the texts in the non-repeated headers and footers is performed, and the statistical results are accumulated.
[0187] Efficiently extract, compare and manage header and footer information in documents to ensure data accuracy and consistency, reduce redundancy and improve processing efficiency. By using MD5 Hash values for data comparison, storage and processing performance are further optimized, and deduplication algorithms are applied to check whether headers and footers in documents are repeated. Because there may be multiple sections in a document that use the same header and footer, deduplication can prevent duplicate statistics.
[0188] Specifically, the core goal of the header and footer deduplication algorithm is to ensure that each header and footer is counted only once to avoid duplicate processing. The content of headers and footers is usually not only text, but may also contain images or other elements, so the deduplication method based entirely on text may have limitations. The method of this embodiment proposes a header and footer deduplication algorithm based on Hash fingerprints and can be adapted to situations that contain not only text, but also pictures and other elements.
[0189] S150, using an image translation recognition model to identify whether the image in the sub-item results is translated, and using OCR recognition technology to perform text recognition on the translated image, and performing word count on the recognition result to obtain a third statistical result.
[0190] In this embodiment, the third statistical result refers to the number of words in the text in the picture.
[0191] Specifically, the system needs to obtain the currently opened document for subsequent processing. The document can be in multiple formats, such as Word, PowerPoint, etc. The system obtains the document object through relevant document processing libraries (such as Microsoft OfficeInterop, PDF library, etc.) and prepares to perform format judgment and processing. Determine the format of the document to determine the subsequent processing flow. Use the API provided by Office to determine whether the document is in XML format. If it is not in XML format, the system copies the document to a temporary directory and converts it to XML format. This step ensures that the OpenXML SDK can be used for subsequent operations because the SDK specializes in processing XML format documents. The conversion process usually involves parsing and rebuilding the document structure to comply with the XML standard. Extract all images from the document for subsequent OCR recognition. Use the API of the OpenXML SDK to parse the document, extract all images from the document and save them to a temporary directory. In this step, the size of the extracted images remains the original size to ensure the accuracy of OCR recognition. Because in some cases, users may scale the images, affecting the recognition effect. Maintaining the original size is crucial for subsequent text extraction.
[0192] In one embodiment, the above-mentioned step S150 may include steps S151 - S154 .
[0193] S151, judging whether the picture has been translated in the deep learning model of the picture input value in the sub-item result;
[0194] In this embodiment, it is determined whether the extracted image contains translated text to decide whether to perform OCR recognition. Specifically, a trained deep learning model is used to analyze the extracted image to identify whether the text therein has been translated. If the image is determined to be translated, the step of OCR recognition and text extraction is performed; if it is not translated, this step is skipped directly. The training process of this model involves a large number of annotated translated images to ensure the accuracy and reliability of the model in practical applications.
[0195] S152: If the image has been translated, use the image as a translated image;
[0196] S153, performing text recognition on the translated image using OCR recognition technology, and performing word count on the recognition result to obtain a third statistical result.
[0197] Specifically, OCR technology is used to recognize text in images. The recognition result of OCR is usually a list of text areas. When counting words, special attention should be paid to not directly connect the contents of all text areas and then count them. Instead, the word count should be performed on each text area one by one, and then the statistical results of each area should be summed up. The word count method usually follows the standard string word count method, that is, counting the number of characters in the text, including spaces and punctuation marks.
[0198] In one embodiment, the above-mentioned step S153 may include steps S1531 - S1533 .
[0199] S1531, performing OCR recognition on the translated image to obtain a text area list;
[0200] S1532, respectively counting the number of words in each text area in the text area list, and summing up the respective counting results to obtain the number of words in the picture;
[0201] S1533, summing up the word counts of all pictures to obtain a third statistical result.
[0202] The word counts of all extracted images are summed up to obtain the total word count and total number of images. The results of this step can provide users with statistical information about the image content in the document, which is instructive for the analysis and subsequent processing of the document.
[0203] S154: If the image is not translated, input the image into an image translation recognition model for translation to obtain a translated image, and execute step S153.
[0204] The image translation recognition model is obtained by training a binary classification model based on deep learning by using translated images and untranslated images as sample sets.
[0205] Specifically, a standard binary classification dataset is created, including two categories of images: "translated" and "untranslated". Through manual classification, the existing images are sorted into corresponding folders to form a directory structure of training set, test set and validation set. Data augmentation techniques such as random rotation, scaling and cropping are applied to the training set to increase data diversity and improve the generalization ability of the model.
[0206] Accurate data classification ensures that the model can learn effectively, while data augmentation increases the diversity of training samples, making the model more robust and able to maintain high recognition accuracy when facing unseen images.
[0207] Next, we use the YOLOv8 pre-trained model for transfer learning and fine-tune the model to adapt to the specific image translation recognition task. We adjust hyperparameters (such as learning rate, batch size, training cycle, etc.) to optimize model performance. After training, we use the validation set to evaluate the performance of the model and output performance indicators such as accuracy and F1 score to judge the model effect.
[0208] Using pre-trained models can significantly reduce training time and improve the initial performance of the model. By continuously evaluating and adjusting hyperparameters, you can ensure that the model achieves optimal performance on specific tasks and increase its reliability in practical applications.
[0209] Finally, after training and evaluation, the optimized YOLOv8 model is exported to ONNX format, which is convenient for integration and deployment on different systems and platforms.
[0210] The versatility of the ONNX format allows the model to run easily in a variety of environments, supports cross-platform applications, improves the practicality and flexibility of the model, and facilitates subsequent integration into actual application systems.
[0211] The above steps ensure the construction of an efficient image translation and recognition model. From data preparation to model training and final deployment, each step is carefully designed to improve model performance and adaptability, laying a solid foundation for the final application.
[0212] The entire step S150 systematically realizes the text extraction and statistics of the images in the document by combining document format recognition, image extraction, deep learning model judgment and OCR recognition technologies. The efficiency and accuracy of this method provide strong support for processing and analyzing document content.
[0213] S160. Count the number of words in the graphics in the sub-item results using a corresponding statistical strategy to obtain a fourth statistical result. When the graphic type is a general graphic including AutoShape and SmartArt, the Office API is used to directly count the number of words. When the graphic type is a Visio graphic, a preview image of the Visio graphic in EMF format is obtained and the preview image is converted into a PNG format, and the number of words is counted using OCR recognition. When the graphic category is a graphic group, each sub-graphic is recursively traversed and the number of words in the sub-graphics is added.
[0214] In this embodiment, general graphics focus on AutoShape and Smart Art 2 types. For AutoShape graphics, Office provides an API to directly count the number of words in the text of the graphics. For Smart Art graphics, you only need to simply traverse each node and count directly.
[0215] In order to facilitate the processing of complex Smart Art graphics, multiple closely related graphics are combined to form a graphic group. A graphic group can be treated as a single graphic and combined into a more complex graphic, forming a tree structure logically. Therefore, it is necessary to use a recursive traversal method to process it.
[0216] In this embodiment, not all users have Visio software installed on their computers, so it is not possible to open the Visio graphics embedded in the Office file by calling the third-party Visio software. In the XML-formatted Office document, the preview of the Visio graphics is saved in the file compression package in the EMF (Enhanced Metafile Format) image format, so the number of words in the Visio graphics can be counted by obtaining the EMF image, converting the EMF image into PNG format, and then performing OCR text recognition. EMF is a vector graphics format that can be scaled losslessly and will not lose clarity or produce pixelation due to enlargement or reduction, which is beneficial to subsequent OCR processing.
[0217] In summary, the corresponding statistical strategy is determined according to the type of graphics (such as AutoShape, Smart Art, Visio).
[0218] Statistical strategies include:
[0219] Smart Art graphics and AutoShape graphics: directly call the API provided by Office to obtain the number of words in the text of the graphic.
[0220] Combine graphics: Use recursive traversal to access each sub-graphic in the Smart Art graphic and add up the number of text words in each sub-graphic.
[0221] Visio graphics: Since Visio software may not be installed on the user's computer, word count is performed using EMF format conversion and OCR recognition.
[0222] By selecting the corresponding statistical strategy according to different graphic types, the accuracy and efficiency of word count can be improved; using the API to directly count the words of AutoShape graphics can quickly get the results; the recursive traversal method for Smart Art graphics can handle more complex graphic structures to ensure that all text content is accurately counted; for Visio graphics, EMF conversion and OCR recognition can be used to count words without Visio software, which increases the applicability of the system;
[0223] In one embodiment, when the graphic type is a Visio graphic, a preview image of the Visio graphic in EMF format is obtained and converted into a PNG format, and the number of words is counted using OCR recognition, including steps S161 to S162.
[0224] Step S161: When the graphic type is a Visio graphic, a preview image of the Visio graphic in EMF format is obtained and the preview image is converted into a PNG format.
[0225] In this embodiment, after identifying that the graphic type is a Visio graphic, the corresponding EMF file is extracted from the Office document; and the EMF file is converted into a PNG format using an image processing library.
[0226] EMF is a lossless vector graphics format. After conversion to PNG, it is convenient for subsequent OCR processing. PNG format maintains the clarity and details of the image, ensuring that OCR technology can effectively recognize text.
[0227] Step S162: The preview image after format conversion is recognized by using OCR text recognition technology and the text in the image is counted to obtain a fourth statistical result.
[0228] In this embodiment, the OCR technology is applied to the converted PNG image to recognize the text content in the image; the number of words in the recognized text is counted to obtain a final word count result.
[0229] OCR technology can convert text in images into editable and processable digital text, ensuring the accuracy of word counts; through automated recognition and counting, it can significantly improve work efficiency and reduce the need for manual intervention.
[0230] Appropriate word count strategies are adopted for different types of graphics to ensure accurate and efficient word counts for simple AutoShape graphics, complex Smart Art graphics, and Visio graphics. This process not only improves the convenience and accuracy of operation, but also increases the compatibility of the system, enabling it to be used flexibly in a variety of user environments.
[0231] S170, summing up the first statistical result, the second statistical result, the third statistical result and the fourth statistical result to obtain the total number of words in the translated manuscript.
[0232] In this example, a variable (eg, totalWordCount) is created to store the total word count.
[0233] The first statistical result, the second statistical result, the third statistical result and the fourth statistical result are added together; when performing the summation, a list or an array may be used to store each statistical result for the convenience of subsequent operations.
[0234] By using simple addition operations, the total number of words in the translated document can be quickly obtained, which is convenient for subsequent processing; using lists or arrays to store statistical results not only makes the code more concise, but also facilitates future expansion and maintenance (such as when adding more statistical parts).
[0235] S180: Output the total number of words in the translated manuscript.
[0236] In this embodiment, a suitable output method (such as a console, file, or user interface) is selected to display the total number of words. In order to make the output results clearer and easier to read, formatting can be performed. For example, some prompt information or formatted numbers are added to the output; clearly outputting the total number of words can help users quickly understand the scale of the translation manuscript, which is helpful for evaluating the workload or performing subsequent processing. The output to a file provides persistent storage of data, which is convenient for subsequent reference and record management. Through formatted output, users can understand the results more intuitively and improve the user experience.
[0237] Steps S170 and S180 integrate the word count results of each part of the translation document into a total word count through simple addition operations and effective output methods. This process not only improves work efficiency, but also provides users with clear information for subsequent analysis and decision-making. Through reasonable data structure and output format, the maintainability of the system and user experience can be further enhanced.
[0238] In the method of this embodiment, by introducing a large language model (LLM), such as GPT-4, the ability to identify and extract references can be improved. The large language model can understand and generate natural language, and has the ability to understand context, and can more accurately parse complex document formats and diverse citation styles. Specifically, the semantic understanding ability of the large language model is used to extract reference information from the text. The model can recognize common citation formats, such as APA, MLA, Chicago, etc. Through context analysis, the large language model can effectively distinguish between references and texts to avoid misidentification. The model can be fine-tuned using annotated document data to make it more suitable for reference formats in specific fields. The accuracy and efficiency of reference recognition are improved, especially when dealing with multiple document formats. The need for manual intervention is reduced, saving time and improving productivity.
[0239] In the method of this embodiment, a Hash fingerprint algorithm is used to solve the problem of deduplication of headers and footers; the Hash fingerprint algorithm is used to identify and remove duplicate headers and footers to ensure the uniqueness and neatness of the document content.
[0240] Generate a unique hash value for each page header and footer, usually using algorithms such as MD5 or SHA-256. When processing a document, first check the hash value of each header and footer. If duplicate hash values are found, mark them as duplicate content and filter them out.
[0241] It effectively eliminates duplicate information, reduces redundant parts of documents, and improves the clarity of content. When processing a large number of documents, it can quickly identify and remove duplicate headers and footers, improving processing efficiency.
[0242] In the method of this embodiment, the accumulated picture data is used to train an image recognition model to solve the problem of identifying whether an image has been translated; specifically, by collecting and accumulating image data, a special image recognition model is trained to determine whether the image content has been translated.
[0243] Collect a large amount of image data before and after translation, and annotate them to distinguish which images have been translated. Use deep learning techniques such as convolutional neural networks (CNN) to train the annotated data so that the model can learn how to identify the features of translated and untranslated images.
[0244] Automatically determine the translation status of images, reduce the workload of manual review, improve the efficiency of translation workflow, and ensure the integrity of translation.
[0245] In the method of this embodiment, an OCR text recognition library is integrated to automatically process the statistical problem of text in images in documents; specifically, by integrating optical character recognition (OCR) technology, text information on images in documents is automatically extracted and statistical analysis is performed.
[0246] Use open source OCR libraries (such as PaddleOCR) integrated into the system to perform text recognition on images. The recognized text is stored and counted to calculate the number of words in each image.
[0247] It realizes the automatic recognition and statistics of text contained in images, greatly improving work efficiency, reducing manual input errors and improving data accuracy.
[0248] In the method of this embodiment, the function of counting text in various complex graphics including Visio and Smart Art is supported. Specifically, the capability of the extended solution supports the extraction and counting of text content from complex graphics such as Visio and Smart Art. A parser is developed or integrated to recognize complex graphic files of different formats and extract text information therein. The extracted text content is counted and the number of words and other related information are recorded.
[0249] Enhanced the comprehensiveness of document analysis, ensuring comprehensive statistics of text content even in complex graphics. Improved user flexibility and efficiency when processing multiple document formats.
[0250] The method of this embodiment effectively solves the problems of reference identification, header and footer deduplication, image translation status identification, automatic statistics of image text, and text statistics in complex graphics. Combining a large language model, Hash fingerprint algorithm, image recognition model, OCR technology, and support for complex graphics, the automation and accuracy of document processing are improved, greatly improving work efficiency.
[0251] The above-mentioned translation manuscript word count method, by processing the statistical translation manuscripts in separate items, effectively identifies references and applies a deduplication algorithm to solve the problem of repeated statistics of headers and footers. Using the image translation recognition model and OCR technology, the statistics of image text in the file are automatically processed, and the accurate statistics of the text in various complex graphics are supported. Finally, the results of each item are summarized to provide the total word count of the translation manuscript to ensure the accuracy and comprehensiveness of the statistical results; solve the problems of reference identification, deduplication of headers and footers, and identification of whether the image has been translated; automatically process the statistics of image text in the file, and support the statistics of the text in various complex graphics.
[0252] Figure 2 FIG. 3 is a schematic block diagram of a translation document word count device 300 provided in an embodiment of the present invention. Figure 2As shown, corresponding to the above translation manuscript word count method, the present invention also provides a translation manuscript word count device 300. The translation manuscript word count device 300 includes a unit for executing the above translation manuscript word count method, and the device can be configured in a server. Figure 3 The translation document word count device 300 includes a document acquisition unit 301, an itemization unit 302, a text word count unit 303, a header and footer word count unit 304, a picture word count unit 305, a graphic word count unit 306, a summing unit 307 and an output unit 308.
[0253] The document acquisition unit 301 is used to acquire the translation document to be counted; the itemization unit 302 is used to itemize the translation document to be counted into text, header and footer, picture, and graphic to obtain itemization results; the text word count unit 303 is used to count the text in the itemization results to obtain a first statistical result; the header and footer word count unit 304 is used to apply a deduplication algorithm based on the addition of MD5 Hash values to the header and footer in the itemization results, and count the number of non-repeated header and footer words to obtain a second statistical result; the picture word count unit 305 is used to use a picture translation recognition model to identify whether the picture in the itemization results is translated, and use OCR recognition technology to perform text recognition on the translated picture, and count the words of the recognition result to obtain a third statistical result; the graphic word count unit 306 is used to use a corresponding statistical strategy to count the words of the graphics in the itemization results to obtain a fourth statistical result. When the graphic type is a general graphic including AutoShape and SmartArt, Office The API directly counts the number of words; when the graphic type is a Visio graphic, obtain a preview image of the Visio graphic in EMF format and convert the preview image into PNG format, and use OCR recognition to count the number of words; when the graphic category is a graphic group, recursively traverse each sub-graphics and add the number of words in the sub-graphics; a summing unit 307 is used to sum the first statistical result, the second statistical result, the third statistical result and the fourth statistical result to obtain the total number of words in the translated document; an output unit 308 is used to output the total number of words in the translated document.
[0254] In one embodiment, the sub-item unit 302 includes:
[0255] The first determination subunit is used to determine the content of the text, header and footer of the translation document to be counted; the format judgment subunit is used to determine whether the format of the translation document to be counted is XML format; if the format of the translation document to be counted is XML format, then execute the API of the OpenXML SDK library to parse the translation document to be counted to obtain the image in the document; the copy subunit is used to copy the translation document to be counted and convert it into XML format if the format of the translation document to be counted is not XML format; the parsing subunit is used to parse the translation document to be counted using the API of the OpenXML SDK library to obtain the image in the document; the content determination subunit is used to determine the content of the graphics of the translation document to be counted.
[0256] In one embodiment, the text word count unit 303 includes:
[0257] The total word count subunit of the string is used to calculate the word count in the string by using a custom statistical rule for the text in the sub-item result to obtain the total word count of the string; the word count subunit is used to count the word count of the text in the sub-item result by using the Office word count function to obtain the word count result; the document word count subunit is used to use a large language model in combination with a prompt word method to identify the text in the sub-item result to obtain references and translations, and count the corresponding word counts according to the references and translations to obtain the document word count result; the summation subunit is used to sum the total word count of the string, the word count result and the document word count result to obtain a first statistical result.
[0258] In one embodiment, the header and footer word count unit 304 includes:
[0259] The first extraction subunit is used to extract the key elements of each header and footer in the sub-item results to obtain a first extraction result; the first comparison subunit is used to compare the quantity of the first extraction results of each header, determine the headers with the same number of first extraction results and the headers with different numbers of first extraction results; the first total value determination subunit is used to calculate the MD5 Hash value of the headers with the same number of extraction results and determine the corresponding total Hash value; the first deduplication subunit is used to determine the headers with the same number of first extraction results when the corresponding total Hash values are the same, retain only one of the headers, and combine the retained header and the headers with different numbers from the first extraction result to form a non-repeated header; the second extraction subunit is used to extract the key elements of each footer in the header and footer in the sub-item results to obtain a second extraction result; the second comparison subunit is used to compare the quantity of the second extraction results of each footer, determine the footers with the same number of second extraction results and the footers with different numbers of second extraction results; the second total value calculation subunit is used to calculate the MD5 hash value of the footers with the same number of second extraction results Hash value, and determine the corresponding total Hash value; the second deduplication subunit is used to determine the footers with the same number of second extraction results when the corresponding total Hash values are the same, retain only one of the headers, and combine the retained footer with the footers with different numbers of second extraction results to form a non-repeated footer; the accumulation subunit is used to count the number of words in the non-repeated headers and non-repeated footers, and accumulate the statistical results to obtain a second statistical result.
[0260] In one embodiment, the picture word count unit 305 includes:
[0261] The translation judgment subunit is used to input the image in the sub-item result into the deep learning model to determine whether the image has been translated; the determination subunit is used to use the image as the translated image if the image has been translated; the translated image statistics subunit is used to use the OCR recognition technology to perform text recognition on the translated image, and count the number of words on the recognition result to obtain a third statistical result; the translation subunit is used to input the image into the image translation recognition model for translation if the image has not been translated to obtain the translated image; wherein the image translation recognition model is obtained by training a binary classification model based on deep learning by using the translated images and the untranslated images as sample sets.
[0262] In one embodiment, the translated picture statistics subunit includes:
[0263] The recognition module is used to perform OCR recognition on the translated image to obtain a text area list; the word count totaling module is used to count the number of words in each text area in the text area list respectively, and sum up the results of the respective statistics to obtain the number of words in the image; the all-image word count totaling module is used to sum up the number of words in all images to obtain a third statistical result.
[0264] In one embodiment, the graphic word count unit 306 is also used to obtain a preview image of the Visio graphic in EMF format and convert the preview image into PNG format when the graphic type is a Visio graphic; the preview image after format conversion is recognized using OCR text recognition technology and the text in the graphic is counted to obtain a fourth statistical result.
[0265] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned translation document word count device 300 and each unit can refer to the corresponding description in the above-mentioned method embodiment, and for the convenience and brevity of description, it will not be repeated here.
[0266] The above-mentioned translation manuscript word count device 300 can be implemented in the form of a computer program. The computer program can be used in Figure 3 Runs on the computer device shown.
[0267] See also Figure 3 , Figure 3 5 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 may be a server, wherein the server may be an independent server or a server cluster composed of multiple servers.
[0268] See also Figure 3 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
[0269] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, and when the program instructions are executed, the processor 502 can execute a method for counting the number of words in a translation document.
[0270] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0271] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a method for counting the number of words in a translation document.
[0272] The network interface 505 is used to communicate with other devices over the network. Figure 3 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0273] The processor 502 is used to run the computer program 5032 stored in the memory to implement the following steps:
[0274] Obtain the translation manuscript to be counted; divide the translation manuscript to be counted into text, header and footer, picture, and graphic to obtain the sub-item results; count the number of words in the text in the sub-item results to obtain the first statistical result; apply MD5-based A de-duplication algorithm based on hash value addition is used to count the number of non-repeated header and footer words to obtain a second statistical result; a picture translation recognition model is used to identify whether the picture in the sub-item result is translated, and the translated picture is recognized by OCR recognition technology for text recognition, and the recognition result is counted to obtain a third statistical result; a corresponding statistical strategy is used to count the words of the graphics in the sub-item result to obtain a fourth statistical result. When the graphic type is a general graphic including AutoShape and SmartArt, the OfficeAPI is used to directly count the words; when the graphic type is a Visio graphic, an EMF format preview of the Visio graphic is obtained and the preview is converted into a PNG format, and the OCR recognition is used to count the words; when the graphic category is a graphic group, each sub-graphic is recursively traversed and the word counts of the sub-graphics are added; the first statistical result, the second statistical result, the third statistical result and the fourth statistical result are summed to obtain the total number of words in the translated manuscript; and the total number of words in the translated manuscript is output.
[0275] In one embodiment, when the processor 502 implements the step of dividing the translation document to be counted into text, header and footer, picture, and graphic to obtain the itemized result, the processor 502 specifically implements the following steps:
[0276] Determine the contents of the text, header and footer of the translation document to be counted; determine whether the format of the translation document to be counted is XML format; if the format of the translation document to be counted is not XML format, copy the translation document to be counted and convert it into XML format; use the API of the OpenXML SDK library to parse the translation document to be counted to obtain the picture in the document; if the format of the translation document to be counted is XML format, execute the API of the OpenXML SDK library to parse the translation document to be counted to obtain the picture in the document; determine the content of the graphic of the translation document to be counted.
[0277] In one embodiment, when the processor 502 implements the step of performing word count on the text in the sub-item result to obtain the first statistical result, the processor 502 specifically implements the following steps:
[0278] The text in the sub-item results is used to calculate the number of words in the string using a custom statistical rule to obtain the total number of words in the string; the text in the sub-item results is used to count the number of words using the Office word count function to obtain a word count result; the text in the sub-item results is recognized using a large language model in combination with prompt words to obtain references and translations, and the corresponding number of words is counted according to the references and translations to obtain a document word count result; the total number of words in the string, the word count result and the document word count result are summed to obtain a first statistical result.
[0279] In one embodiment, when the processor 502 implements the step of applying a deduplication algorithm based on the sum of MD5Hash values to the headers and footers in the sub-item results to count the number of non-repeated header and footer characters to obtain the second statistical result, the processor 502 specifically implements the following steps:
[0280] Extract key elements of each header and footer in the sub-item results to obtain a first extraction result; compare the quantity of the first extraction results of each header to determine the headers with the same quantity as the first extraction results and the headers with different quantities as the first extraction results; calculate MD5 Hash values for the headers with the same quantity as the extraction results, and determine the corresponding total Hash value; when the corresponding total Hash values are the same, determine the headers with the same quantity as the first extraction results, retain only one of the headers, and combine the retained header and the headers with different quantities as the first extraction result to form a non-repeated header; extract key elements of each footer in the header and footer in the sub-item results to obtain a second extraction result; compare the quantity of the second extraction results of each footer to determine the footers with the same quantity as the second extraction results and the footers with different quantities as the second extraction results; calculate MD5 Hash values for the footers with the same quantity as the second extraction results. Hash value, and determine the corresponding total Hash value; when the corresponding total Hash values are the same, determine the footers with the same number of second extraction results, retain only one of the headers, and combine the retained footer with the footer with a different number of second extraction results to form a non-repeated footer; count the number of words in the non-repeated headers and non-repeated footers, and add up the statistical results to obtain a second statistical result.
[0281] In one embodiment, when the processor 502 implements the step of using the picture translation recognition model to identify whether the picture in the sub-item result is translated, and using the OCR recognition technology to perform text recognition on the translated picture, and performing word count on the recognition result to obtain the third statistical result, the following steps are specifically implemented:
[0282] Inputting the image in the sub-item result into the deep learning model determines whether the image has been translated; if the image has been translated, the image is used as the translated image; performing text recognition on the translated image using OCR recognition technology, and counting the number of words on the recognition result to obtain a third statistical result; if the image has not been translated, inputting the image into the image translation recognition model for translation to obtain a translated image;
[0283] The image translation recognition model is obtained by training a binary classification model based on deep learning by using translated images and untranslated images as sample sets.
[0284] In one embodiment, when the processor 502 implements the step of using the OCR recognition technology to perform text recognition on the translated image and counting the number of words on the recognition result to obtain the third statistical result, the processor 502 specifically implements the following steps:
[0285] Perform OCR recognition on the translated image to obtain a text area list; count the number of words in each text area in the text area list respectively, and sum up the results of the respective statistics to obtain the number of words in the image; sum up the number of words in all images to obtain a third statistical result.
[0286] In one embodiment, when the processor 502 implements the step of using EMF format conversion and OCR recognition to count the number of words in the Visio graphic when the graphic type is a Visio graphic, the processor 502 specifically implements the following steps:
[0287] When the type of the graphic is a Visio graphic, a preview image of the Visio graphic in EMF format is obtained and converted into a PNG format; the preview image after format conversion is recognized using OCR text recognition technology and the text in the graphic is counted to obtain a fourth statistical result.
[0288] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0289] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0290] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein when the computer program is executed by a processor, the processor executes the following steps:
[0291] Obtain the translation manuscript to be counted; divide the translation manuscript to be counted into text, header and footer, picture, and graphic to obtain the sub-item results; count the number of words in the text in the sub-item results to obtain the first statistical result; apply MD5-based A de-duplication algorithm based on hash value addition is used to count the number of non-repeated header and footer words to obtain a second statistical result; a picture translation recognition model is used to identify whether the picture in the sub-item result is translated, and the translated picture is recognized by OCR recognition technology for text recognition, and the recognition result is counted to obtain a third statistical result; a corresponding statistical strategy is used to count the words of the graphics in the sub-item result to obtain a fourth statistical result. When the graphic type is a general graphic including AutoShape and SmartArt, the OfficeAPI is used to directly count the words; when the graphic type is a Visio graphic, an EMF format preview of the Visio graphic is obtained and the preview is converted into a PNG format, and the OCR recognition is used to count the words; when the graphic category is a graphic group, each sub-graphic is recursively traversed and the word counts of the sub-graphics are added; the first statistical result, the second statistical result, the third statistical result and the fourth statistical result are summed to obtain the total number of words in the translated manuscript; and the total number of words in the translated manuscript is output.
[0292] In one embodiment, when the processor executes the computer program to implement the step of dividing the translation document to be counted into text, header and footer, picture, and graphic to obtain the itemized result, the processor specifically implements the following steps:
[0293] Determine the contents of the text, header and footer of the translation document to be counted; determine whether the format of the translation document to be counted is XML format; if the format of the translation document to be counted is not XML format, copy the translation document to be counted and convert it into XML format; use the API of the OpenXML SDK library to parse the translation document to be counted to obtain the picture in the document; if the format of the translation document to be counted is XML format, execute the API of the OpenXML SDK library to parse the translation document to be counted to obtain the picture in the document; determine the content of the graphic of the translation document to be counted.
[0294] In one embodiment, when the processor executes the computer program to implement the step of counting the number of words in the text in the sub-item results to obtain the first statistical result, the processor specifically implements the following steps:
[0295] The text in the sub-item results is used to calculate the number of words in the string using a custom statistical rule to obtain the total number of words in the string; the text in the sub-item results is used to count the number of words using the Office word count function to obtain a word count result; the text in the sub-item results is recognized using a large language model in combination with prompt words to obtain references and translations, and the corresponding number of words is counted according to the references and translations to obtain a document word count result; the total number of words in the string, the word count result and the document word count result are summed to obtain a first statistical result.
[0296] In one embodiment, when the processor executes the computer program to implement the step of applying a deduplication algorithm based on the sum of MD5 Hash values to the headers and footers in the sub-item results, and counting the number of non-repeated header and footer characters to obtain a second statistical result, the processor specifically implements the following steps:
[0297] Extract key elements of each header and footer in the sub-item results to obtain a first extraction result; compare the quantity of the first extraction results of each header to determine the headers with the same quantity as the first extraction results and the headers with different quantities as the first extraction results; calculate MD5 Hash values for the headers with the same quantity as the extraction results, and determine the corresponding total Hash value; when the corresponding total Hash values are the same, determine the headers with the same quantity as the first extraction results, retain only one of the headers, and combine the retained header and the headers with different quantities as the first extraction result to form a non-repeated header; extract key elements of each footer in the header and footer in the sub-item results to obtain a second extraction result; compare the quantity of the second extraction results of each footer to determine the footers with the same quantity as the second extraction results and the footers with different quantities as the second extraction results; calculate MD5 Hash values for the footers with the same quantity as the second extraction results. Hash value, and determine the corresponding total Hash value; when the corresponding total Hash values are the same, determine the footers with the same number of second extraction results, retain only one of the headers, and combine the retained footer with the footer with a different number of second extraction results to form a non-repeated footer; count the number of words in the non-repeated headers and non-repeated footers, and add up the statistical results to obtain a second statistical result.
[0298] In one embodiment, when the processor executes the computer program to implement the step of using the picture translation recognition model to identify whether the picture in the sub-item result is translated, and using the OCR recognition technology to perform text recognition on the translated picture, and counting the number of words on the recognition result to obtain the third statistical result, the following steps are specifically implemented:
[0299] Inputting the image in the sub-item result into the deep learning model determines whether the image has been translated; if the image has been translated, the image is used as the translated image; performing text recognition on the translated image using OCR recognition technology, and counting the number of words on the recognition result to obtain a third statistical result; if the image has not been translated, inputting the image into the image translation recognition model for translation to obtain a translated image;
[0300] The image translation recognition model is obtained by training a binary classification model based on deep learning by using translated images and untranslated images as sample sets.
[0301] In one embodiment, when the processor executes the computer program to implement the step of using OCR recognition technology to perform text recognition on the translated image and counting the number of words on the recognition result to obtain the third statistical result, the following steps are specifically implemented:
[0302] Perform OCR recognition on the translated image to obtain a text area list; count the number of words in each text area in the text area list respectively, and sum up the results of the respective statistics to obtain the number of words in the image; sum up the number of words in all images to obtain a third statistical result.
[0303] In one embodiment, when the processor executes the computer program to implement the step of using EMF format conversion and OCR recognition to count the number of words in the Visio graphic when the type of the graphic is a Visio graphic, the processor specifically implements the following steps:
[0304] When the type of the graphic is a Visio graphic, a preview image of the Visio graphic in EMF format is obtained and converted into a PNG format; the preview image after format conversion is recognized using OCR text recognition technology and the text in the graphic is counted to obtain a fourth statistical result.
[0305] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.
[0306] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0307] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0308] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0309] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.
[0310] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for counting the number of words in a translation manuscript, characterized in that: include: Get the translation documents to be counted; The translation manuscript to be counted is divided into text, header and footer, picture, and graphic to obtain the sub-item results; Performing word count on the text in the sub-item results to obtain a first statistical result; Applying a deduplication algorithm based on the sum of MD5 Hash values to the headers and footers in the sub-item results, and counting the number of non-repeated header and footer characters to obtain a second statistical result; Using an image translation recognition model to identify whether the image in the sub-item results is translated, and using OCR recognition technology to perform text recognition on the translated image, and counting the number of words on the recognition result to obtain a third statistical result; The graphics in the sub-item results are counted by using a corresponding statistical strategy to obtain a fourth statistical result. When the graphic type is a general graphic including AutoShape and SmartArt, the Office API is used to directly count the words; when the graphic type is a Visio graphic, an EMF format preview of the Visio graphic is obtained and the preview is converted into a PNG format, and the number of words is counted by using OCR recognition; when the graphic category is a graphic group, each sub-graphic is recursively traversed, and the number of words of the sub-graphics is added; The first statistical result, the second statistical result, the third statistical result and the fourth statistical result are summed to obtain the total number of words in the translated manuscript; Outputting the total number of words in the translated manuscript; The step of dividing the translation manuscript to be counted into text, header and footer, picture, and graphic to obtain the result of the division includes: Determining the content of the text, header and footer of the translation manuscript to be counted; Determine whether the format of the translation document to be counted is XML format; If the format of the translation document to be counted is not in XML format, copying the translation document to be counted and converting it into XML format; The translation document to be counted is parsed using the API of the OpenXML SDK library to obtain the images in the document; If the format of the translation document to be counted is XML format, executing the API of the OpenXML SDK library to parse the translation document to be counted to obtain the pictures in the document; Determining the content of the graphic for the translation manuscript to be counted; The performing word count on the text in the sub-item results to obtain a first statistical result includes: Calculating the number of words in the string using a custom statistical rule for the text in the sub-item result to obtain the total number of words in the string; Using the Office word count function to count the words in the text of the sub-item results to obtain a word count result; Using a large language model in combination with prompt words to identify the text in the sub-item results to obtain references and translations, and counting the corresponding words according to the references and translations to obtain a word count result of the document; The total number of characters in the character string, the character count result, and the document character count result are summed to obtain a first statistical result; The image translation recognition model is used to identify whether the image in the sub-item result is translated, and the OCR recognition technology is used to perform text recognition on the translated image, and the word count of the recognition result is performed to obtain a third statistical result, including: Inputting the image value in the sub-item result into the deep learning model determines whether the image has been translated; If the image has been translated, the image is used as the translated image; Using OCR recognition technology to perform text recognition on the translated image, and counting the number of words on the recognition result to obtain a third statistical result; If the image is not translated, inputting the image into an image translation recognition model for translation to obtain a translated image; The image translation recognition model is obtained by training a binary classification model based on deep learning by using translated images and untranslated images as sample sets.
2. The method for counting the number of words in a translation manuscript according to claim 1, characterized in that: The applying a deduplication algorithm based on the sum of MD5 Hash values to the headers and footers in the sub-item results to count the number of non-repeated header and footer characters to obtain a second statistical result includes: Extract key elements of each header and footer in the sub-item results to obtain a first extraction result; Compare the number of first extraction results of each header to determine the headers with the same number of first extraction results and the headers with different numbers of first extraction results; Calculate the MD5 Hash value of each header with the same number of extraction results, and determine the corresponding total Hash value; When the corresponding total Hash values are the same, the headers with the same number of the first extraction results are determined, only one of the headers is retained, and the retained header and the headers with different numbers from the first extraction results are combined to form a non-repeated header; Extracting key elements of each footer from the header and footer of the sub-item results to obtain a second proposed result; Compare the number of the second extraction results of each footer to determine the footers with the same number of second extraction results and the footers with different numbers of second extraction results; Calculate the MD5 Hash value of each of the footers with the same number of the second extraction results, and determine the corresponding total Hash value; When the corresponding total hash values are the same, the footers with the same number of second extraction results are determined, only one of the headers is retained, and the retained footer is combined with the footers with different numbers of second extraction results to form a non-repeated footer; The word count of the text in the non-repeated header and the non-repeated footer is counted, and the statistical results are accumulated to obtain a second statistical result.
3. The method for counting the number of words in a translation manuscript according to claim 1, characterized in that: The text recognition of the translated image is performed using OCR recognition technology, and the word count of the recognition result is performed to obtain a third statistical result, including: Performing OCR recognition on the translated image to obtain a text area list; Counting the number of words in each text area in the text area list respectively, and summing up the results of the respective counting to obtain the number of words in the picture; The word counts of all pictures are added up to obtain the third statistical result.
4. The method for counting the number of words in a translation manuscript according to claim 1, characterized in that: When the graphic type is a Visio graphic, obtain the preview image of the Visio graphic in EMF format and convert the preview image into PNG format, and use OCR to recognize and count the words, including: When the type of the graphic is a Visio graphic, a preview image of the Visio graphic in EMF format is obtained and the preview image is converted into a PNG format; The preview image after format conversion is recognized by using OCR text recognition technology and the text in the image is counted to obtain a fourth statistical result.
5. A translation manuscript word count device, characterized in that: include: A document acquisition unit, used to acquire the translation document to be counted; An itemization unit is used to itemize the translation manuscript to be counted into text, header and footer, picture, and graphic to obtain itemization results; A text word count unit, used for counting the word count of the text in the sub-item result to obtain a first statistical result; A header and footer word count counting unit, used for applying a deduplication algorithm based on the sum of MD5 Hash values to the headers and footers in the sub-item results, counting the number of unique header and footer words to obtain a second statistical result; A picture word count unit, configured to use a picture translation recognition model to identify whether the picture in the sub-item result is translated, and use an OCR recognition technology to perform text recognition on the translated picture, and count the words of the recognition result to obtain a third statistical result; A graphic word count unit is used to count the words of the graphics in the sub-item results using a corresponding statistical strategy to obtain a fourth statistical result. When the graphic type is a general graphic including AutoShape and SmartArt, the Office API is used to directly count the words; when the graphic type is a Visio graphic, an EMF format preview of the Visio graphic is obtained and the preview is converted into a PNG format, and the OCR recognition is used to count the words; when the graphic category is a graphic group, each sub-graphic is recursively traversed and the word counts of the sub-graphics are added; A summing unit, used for summing the first statistical result, the second statistical result, the third statistical result and the fourth statistical result to obtain the total number of words in the translated manuscript; An output unit, used for outputting the total number of words in the translated manuscript; The sub-units include: The first determination subunit is used to determine the content of the text, header and footer of the translation manuscript to be counted; the format judgment subunit is used to determine whether the format of the translation manuscript to be counted is XML format; if the format of the translation manuscript to be counted is XML format, the API of the OpenXML SDK library is used to parse the translation manuscript to be counted to obtain the image in the document; the copy subunit is used to copy the translation manuscript to be counted and convert it into XML format if the format of the translation manuscript to be counted is not XML format; the parsing subunit is used to parse the translation manuscript to be counted using the API of the OpenXML SDK library to obtain the image in the document; the content determination subunit is used to determine the content of the graphic of the translation manuscript to be counted; The text word count unit comprises: A character string total word count subunit is used to calculate the word count in the character string using a custom statistical rule for the text in the sub-item result to obtain the total word count of the character string; a word count subunit is used to count the word count of the text in the sub-item result using the Office word count function to obtain a word count result; a document word count subunit is used to identify the text in the sub-item result using a large language model combined with a prompt word method to obtain reference documents and translation conditions, and count the corresponding word counts according to the reference documents and translation conditions to obtain a document word count result; a summation subunit is used to sum the total word count of the character string, the word count result and the document word count result to obtain a first statistical result; The picture word count unit comprises: The translation judgment subunit is used to input the image in the sub-item result into the deep learning model to determine whether the image has been translated; the determination subunit is used to use the image as the translated image if the image has been translated; the translated image statistics subunit is used to use the OCR recognition technology to perform text recognition on the translated image, and count the number of words on the recognition result to obtain a third statistical result; the translation subunit is used to input the image into the image translation recognition model for translation if the image has not been translated to obtain the translated image; wherein the image translation recognition model is obtained by training a binary classification model based on deep learning by using the translated images and the untranslated images as sample sets.
6. A computer device, characterized in that: The computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 4 when executing the computer program.
7. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Online visual splitting method and system for document, and automatic combination method and system for document
CN108491492A
Intelligent detection system and method for student paper formats of colleges and universities
CN116306487A
Method for integrating and extracting multi-mode contents of multi-type documents
CN116627912A
Common Crawl data-based Chinese corpus acquisition method and system
CN118535792A