Non-invasive Word phonetic notation method based on Nodejs

Through the non-intrusive Word phonetic notation method based on Nodejs, automated and batched Pinyin notation is realized, supporting multiple Pinyin systems and customized dictionaries and text styles, solving the limitations of batch processing and Pinyin system diversity in the existing technology, and improving It improves processing efficiency and personalized customization capabilities, and maintains consistency in document format and style.

CN118586366APending Publication Date: 2024-09-03NEW TREND INT LOGIS TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410758820.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-13
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

The existing Microsoft Word document processing software has limitations when adding pinyin. It cannot batch process, does not support multiple pinyin systems and customized dictionaries and text styles, and cannot meet the personalized needs of users.

Method used

Adopt a non-invasive Word phonetic notation method based on Nodejs, through dictionary acquisition and storage, document transcoding and decompression, general text style setting, pinyin matching and processing, style merging and rewriting, dynamic dictionary update, compatibility optimization, error handling and logging Recording, performance optimization, user interface design and security assurance and other steps realize automated and batch-based pinyin notation functions, supporting multiple pinyin systems and customized dictionaries and text styles.

Benefits of technology

It has realized an automated and batch-based phonetic notation solution without relying on the Office suite, improved processing efficiency and personalized customization capabilities, maintained the format and style consistency of the original document, and solved the limitations of batch processing and pinyin system diversity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118586366A
    Figure CN118586366A
Patent Text Reader

Abstract

The invention discloses a Nodejs-based non-invasive Word phonetic notation method, which comprises the following steps: S1, dictionary acquisition and storage: firstly, acquiring a Pinyin dictionary, and storing the Pinyin dictionary in a memory for quick access; and S2, transcoding and decompressing the document: according to the doc format or docx format of the Word document, performing corresponding transcoding and decompressing operation by using Nodejs. According to the method, the flexibility of a Nodejs platform is utilized, an automatic and batch phonetic notation solution without depending on an Office suite is realized, the scheme supports a multi-pinyin system through user-defined pinyin dictionaries and text styles, the processing efficiency is improved, the personalized customization capability is greatly enhanced, and the user experience is improved. Through an efficient text matching algorithm and an intelligent style merging technology, the format and style of an original document are kept unchanged, meanwhile, accurate embedding of phonetic notation is achieved, and the limitation of a traditional method in the aspects of batch processing, pinyin system diversity and style keeping is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of Word document phonetic notation, and in particular to a non-intrusive Word phonetic notation method based on Nodejs. Background Art

[0002] In conventional Microsoft Word document technology, adding pinyin usually relies on document processing software such as Microsoft Office or WPS Office. These software have limitations when processing pinyin annotations, such as: 1. Pinyin can only be added to a small amount of text, which is not suitable for batch processing. The existing technology usually requires users to manually select the text to which pinyin needs to be added, so it is not suitable for batch processing of large amounts of text; 2. Only the internationally used pinyin system is supported, and other pinyin systems are not supported. The existing technology usually only supports the internationally used pinyin system, and other pinyin systems, such as Chinese Pinyin, Zhuyin Fuhao, etc. are not supported; 3. Pinyin dictionaries and text styles cannot be customized, and flexibility is insufficient. The existing technology usually cannot customize pinyin dictionaries and text styles, so it cannot meet the personalized needs of users. Summary of the invention

[0003] The object of the present invention is to provide a non-intrusive Word phonetic notation method based on Nodejs to solve the problems raised in the above-mentioned background technology.

[0004] To achieve the above object, the present invention provides the following technical solution: a non-intrusive Word phonetic notation method based on Nodejs, comprising the following steps: S1. Dictionary acquisition and storage: First, obtain the pinyin dictionary and store it in memory for fast access; S2. Document transcoding and decompression: Use Nodejs to perform corresponding transcoding and decompression operations according to the doc format or docx format of the Word document; S3, source file identification: determine whether the Word document contains non-text resources, such as pictures. If not, directly process the decompressed source file. If it does, find the file with the same name as the document in the decompressed folder as the processing object; S4. General text style setting: set a general text style for Zhuyin, such as font, color, and spacing, for standardized Zhuyin display; S5. Text matching: Use efficient algorithms to perform text matching and pinyin processing, and match text that needs to be processed in batches according to business needs, and the matching priority of words is higher than that of single characters; S6, Pinyin matching and processing: matching the matched text with the phonetic dictionary to obtain the corresponding Pinyin, then processing the text and wrapping the text and Pinyin with the phonetic tag; S7, style merging and rewriting: Get the style:name of the original text, calculate the corresponding style rules, merge and convert it with the phonetic style defined above to make the style compliant, rewrite the text style, then merge it with the pre-defined phonetic style to ensure style consistency, and rewrite the text style; S8. Document recoding and compression: According to the format of the Word document, use Nodejs to recode and compress the modified document; S9. Dynamic dictionary update: Design and implement the dynamic update function of the Pinyin dictionary, allowing users to update the Pinyin dictionary content in real time without restarting the system; S10. Compatibility optimization: Conduct in-depth compatibility testing and optimization for different versions of Microsoft Word, including but not limited to Word 2007 to Word 2019 and Office 365, to ensure that the generated documents with phonetic symbols can be displayed correctly in all versions of Word, including the consistency of phonetic symbol style, layout and document structure; S11. Error handling and logging: Build a comprehensive error handling mechanism, design reasonable error handling logic for abnormal situations that may occur in key links such as document parsing, pinyin matching, and style application, such as providing a rollback mechanism and error prompts. At the same time, implement a detailed logging function to record key information, error details, and system status during the operation, which is convenient for later debugging and problem tracking; S12. Performance optimization: Optimize algorithms for large-scale document processing scenarios, such as using more efficient string search algorithms, such as KMP, Boyer-Moore algorithm, parallel processing strategies, such as Nodejs's Cluster module or multi-threaded processing and memory management strategies, to reduce I / O operations and improve overall processing speed and resource utilization; S13. User interface and interaction design: Develop an intuitive and easy-to-use user interface that allows users to upload Word documents, select or upload custom pinyin dictionaries, preview processing effects, and export processed documents through a graphical interface. The interface also includes a progress bar and status prompt functions to improve user experience. S14. Security: When processing documents and dictionaries uploaded by users, strict security measures are implemented, such as data encryption transmission, input verification, and prevention of SQL injection and cross-site scripting attacks, to protect user data security and system stability; S15. Documentation and Examples: Write detailed user manuals and developer documentation, covering installation and deployment, usage tutorials, API interface descriptions, and FAQs. Also provide sample Word documents and pinyin dictionary templates to help users quickly get started and understand system functions.

[0005] Preferably, in step S1, an interface is provided to support users to customize pinyin dictionaries and text styles to increase flexibility and practicality, and the specific method is: 1. Let the user download the phonetic table template first, and the present invention currently supports Excel; 2. The user fills in the corresponding text, words and phonetic symbols in the phonetic table according to the template specifications; 3. After the user completes the phonetic table work, upload the template to the system.

[0006] Preferably, in step S2, doc and docx are the default file formats in Microsoft Word, which are compressed files containing many XML files and media files, and the method of decompressing the .docx file is as follows: 1. First define the DTD document or Schema document type of XML, that is, the document rule of XML. At present, there are some standard document types, such as DITA and S1000D. If the standard document type can meet the requirements, try to select the standard document type. Generally, it is recommended to select DITA as the document type. If there are still requirements that cannot be met, it is implemented by using specialization based on DITA. The specialization mechanism of DITA is a mechanism for expansion when the document type defined by DITA cannot meet the requirements; 2. After the document type is obtained, a mapping relationship between the source file and the target XML is established. This mapping relationship is used in the conversion program to realize content conversion, and the mapping relationship is: Heading 1->topicref / @navtitle; Heading 2->topicref / @navtitle; Heading 3->topic / title;para->p; 3. Parsing Word documents directly into XML in Nodejs is not as direct as operating text files, because Word documents (especially .docx format) are actually ZIP compressed packages, which contain multiple XML files to describe the content and style information of the document. To achieve this goal, copy the docx file to your computer, then rename it to a .zip file, right-click the renamed .zip file, and select "Extract Here"; 4. The system will create a new folder with the same name as the .zip file in the same folder. When you open the folder, you will see multiple files and folders; 5. Use docx-parser or other suitable libraries to parse the decompressed XML content. Note that you may need to write code to further process the XML data according to actual needs, because automatic conversion into fully structured XML may require complex logic to handle elements such as styles, tables, and pictures, and find the document content you want to edit, which is usually saved in the "document.xml" file in the "word" folder.

[0007] Preferably, in step S3, if word does not introduce resources, such as pictures, then the required source file is obtained after decompression. Otherwise, a folder is obtained after decompression, and the file in the folder with the same name as the document is the required source file. The specific method is as follows: the docx document is essentially a compressed package. The document suffix .docx can be directly modified to .zip, and then the zip package is decompressed to obtain the following docx document detailed structure (including utf-8 or utf-16 encoded XML files and other media files such as pictures and videos. The structure is based on Open Packaging Conventions), and the main structure is: 1. [Content_Types].xml, each docx compressed package contains this file, located in the root directory of the compressed package, which introduces the content types of all components used in the compressed package, such as the content type of the main document component; 2. *.rels file, there are many .rels files in the document structure, which maintain the mapping relationship between the current level and the external resources of the compressed package, the purpose is to separate the resource relationship from the content and maintain it uniformly; 3. word / document.xml, the main document file, the content and structure seen by opening the docx file through word / wps are stored in this file, which can be compared to HTML, When the content or structure changes, the content and structure you see will change accordingly; 4. word / styles.xml, as the name suggests, is a file that controls the document style, similar to CSS, in which the complex style required for the document is defined in the form of id selectors; 5. word / numbering.xml, various ordered lists and unordered lists are more commonly used in the document, and the list style and structure are defined and maintained separately in this file. A mapping relationship is established between the w:numId of w:num and the w:val of w:numId in document.xml, so that the list style is applied to the document content. The document contains content such as ordered list auto-increment rules and unordered list icon styles.

[0008] Preferably, in step S4, the nodes of the pinyin guide are: <w:ruby>, which has several child nodes: <w:rubypr>This is the style of the phonetic guide. <w:rt>It is the phonetic text of the phonetic guide. <w:rubybase>It is the benchmark text for the phonetic guide.

[0009] Preferably, in step S5, first a vocabulary words is defined, and then two functions are defined: matchWords() is used to match words in the vocabulary, matchCharacters() is used to match single characters, and convertLines() function combines the results of these two functions to return the text that needs to be wrapped. In the matchWords() function, a regular expression is created using the RegExp() constructor to match words in the vocabulary, and then the match() method is used to match whether there are matching words in the text. If so, the matching results are added to the result array and the matched words are deleted from the text. In the matchCharacters() function, a for() loop is used to traverse each character in the text, and each time the loop is repeated, the current character is added to the result array. In the convertLines() function, the matchWords() function is first used to match the words in the vocabulary, and then the matchCharacters() function is used to match the remaining characters. Finally, the results of the two functions are combined to return the text that needs to be wrapped.

[0010] Preferably, in step S6, a py attribute is added to the matchWords() function to store the pinyin of the matched words, and then, in the convertLines() function, the map() method is used to traverse the matched text, and an if statement is used to determine whether the pinyin exists. If so, use ... The label wraps the pinyin and text.

[0011] Preferably, in step S7, the style of the text paragraph needs to take into account the size and spacing of the pinyin guide style and use this as a condition, the formula is: new line spacing = old line spacing + pinyin guide font size + pinyin guide font spacing; the pseudo code is: newLineHeight = oldLineHeight + rubyFontSize + rubyFontPaddingTop + rubyFontPaddingBottom.

[0012] Preferably, in step S9, by monitoring file changes in a specific path or providing an API interface, new dictionary data is received and the pinyin mapping in the memory is updated in real time, thereby enhancing the real-time performance and flexibility of the system.

[0013] Compared with the prior art, the present invention has the following beneficial effects: The present invention utilizes the flexibility of the Nodejs platform to realize an automated, batch phonetic notation solution that does not rely on the Office suite. The solution supports multiple phonetic notation systems through user-defined phonetic notation dictionaries and text styles, which not only improves processing efficiency but also greatly enhances personalized customization capabilities. Through efficient text matching algorithms and intelligent style merging technology, the format and style of the original document are maintained unchanged, while accurate phonetic notation embedding is achieved, solving the limitations of traditional methods in batch processing, phonetic notation system diversity and style retention. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] Figure 1 It is a flow chart of the present invention. DETAILED DESCRIPTION

[0015] 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 only 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.

[0016] See also Figure 1 , a non-intrusive Word phonetic notation method based on Nodejs, comprising the following steps: S1. Dictionary acquisition and storage: First, obtain the pinyin dictionary and store it in memory for fast access; S2. Document transcoding and decompression: Use Nodejs to perform corresponding transcoding and decompression operations according to the doc format or docx format of the Word document; S3, source file identification: determine whether the Word document contains non-text resources, such as pictures. If not, directly process the decompressed source file. If it does, find the file with the same name as the document in the decompressed folder as the processing object; S4. General text style setting: set a general text style for Zhuyin, such as font, color, and spacing, for standardized Zhuyin display; S5. Text matching: Use efficient algorithms to perform text matching and pinyin processing, and match text that needs to be processed in batches according to business needs, and the matching priority of words is higher than that of single characters; S6, Pinyin matching and processing: matching the matched text with the phonetic dictionary to obtain the corresponding Pinyin, then processing the text and wrapping the text and Pinyin with the phonetic tag; S7, style merging and rewriting: Get the style:name of the original text, calculate the corresponding style rules, merge and convert it with the phonetic style defined above to make the style compliant, rewrite the text style, then merge it with the pre-defined phonetic style to ensure style consistency, and rewrite the text style; S8. Document recoding and compression: According to the format of the Word document, use Nodejs to recode and compress the modified document; S9. Dynamic dictionary update: Design and implement the dynamic update function of the Pinyin dictionary, allowing users to update the Pinyin dictionary content in real time without restarting the system; S10. Compatibility optimization: Conduct in-depth compatibility testing and optimization for different versions of Microsoft Word, including but not limited to Word 2007 to Word 2019 and Office 365, to ensure that the generated documents with phonetic symbols can be displayed correctly in all versions of Word, including the consistency of phonetic symbol style, layout and document structure; S11. Error handling and logging: Build a comprehensive error handling mechanism, design reasonable error handling logic for abnormal situations that may occur in key links such as document parsing, pinyin matching, and style application, such as providing a rollback mechanism and error prompts. At the same time, implement a detailed logging function to record key information, error details, and system status during the operation, which is convenient for later debugging and problem tracking; S12. Performance optimization: Optimize algorithms for large-scale document processing scenarios, such as using more efficient string search algorithms, such as KMP, Boyer-Moore algorithm, parallel processing strategies, such as Nodejs's Cluster module or multi-threaded processing and memory management strategies, to reduce I / O operations and improve overall processing speed and resource utilization; S13. User interface and interaction design: Develop an intuitive and easy-to-use user interface that allows users to upload Word documents, select or upload custom pinyin dictionaries, preview processing effects, and export processed documents through a graphical interface. The interface also includes a progress bar and status prompt functions to improve user experience. S14. Security: When processing documents and dictionaries uploaded by users, strict security measures are implemented, such as data encryption transmission, input verification, and prevention of SQL injection and cross-site scripting attacks, to protect user data security and system stability; S15. Documentation and Examples: Write detailed user manuals and developer documentation, covering installation and deployment, usage tutorials, API interface descriptions, and FAQs. Also provide sample Word documents and pinyin dictionary templates to help users quickly get started and understand system functions.

[0017] In step S1, an interface is provided to support users to customize pinyin dictionaries and text styles to increase flexibility and practicality. The specific method is: 1. Let the user download the phonetic table template first. The present invention currently supports Excel; 2. The user fills in the corresponding text, words and phonetic symbols in the phonetic table according to the template specifications; 3. After the user completes the phonetic table work, upload the template to the system.

[0018] In step S2, doc and docx are the default file formats in Microsoft Word, which are compressed files containing many XML files and media files. The way to decompress the .docx file is as follows: 1. First define the DTD document or Schema document type of XML, that is, the document rule of XML. At present, there are some standard document types, such as DITA and S1000D. If the standard document type can meet the requirements, try to choose the standard document type. Generally, it is recommended to choose DITA as the document type. If there are still requirements that cannot be met, it is implemented based on DITA using specialization. The specialization mechanism of DITA is a mechanism for expansion when the document type defined by DITA cannot meet the requirements; 2. After having the document type, establish a mapping relationship between the source file and the target XML. This mapping relationship is used in the conversion program to realize content conversion, and the mapping relationship is: Heading 1->topicref / @navtitle; Heading 2->topicref / @navtitle; Heading 3->topic / title;para->p; 3. Parsing Word documents directly into XML in Nodejs is not as direct as operating text files, because Word documents (especially .docx format) are actually ZIP compressed packages, which contain multiple XML files to describe the content and style information of the document. To achieve this goal, copy the docx file to your computer, then rename it to a .zip file, right-click the renamed .zip file, and select "Extract Here"; 4. The system will create a new folder with the same name as the .zip file in the same folder. When you open the folder, you will see multiple files and folders; 5. Use docx-parser or other suitable libraries to parse the decompressed XML content. Note that you may need to write code to further process the XML data according to actual needs, because automatic conversion into fully structured XML may require complex logic to handle elements such as styles, tables, and pictures, and find the document content you want to edit, which is usually saved in the "document.xml" file in the "word" folder.

[0019] In step S3, if word does not introduce resources, such as pictures, then the required source file is obtained after decompression. Otherwise, a folder is obtained after decompression. The file in the folder with the same name as the document is the required source file. The specific method is as follows: the docx document is essentially a compressed package. The document suffix .docx can be directly modified to .zip, and then the zip package is decompressed to obtain the following docx document detailed structure (including utf-8 or utf-16 encoded XML files and other media files such as pictures and videos. This structure is based on Open Packaging Conventions), and the main structure is: 1. [Content_Types].xml, each docx compressed package contains this file, located in the root directory of the compressed package, which introduces the content types of all components used in the compressed package, such as the content type of the main document component; 2. *.rels file, there are many .rels files in the document structure, which maintain the mapping relationship between the current level and the external resources of the compressed package, the purpose is to separate the resource relationship from the content and maintain it uniformly; 3. word / document.xml, the main document file, the content and structure seen by opening the docx file through word / wps are stored in this file, which can be compared to HTML, When the content or structure changes, the content and structure you see will change accordingly; 4. word / styles.xml, as the name suggests, is a file that controls the document style, similar to CSS, in which the complex style required for the document is defined in the form of id selectors; 5. word / numbering.xml, various ordered lists and unordered lists are more commonly used in the document, and the list style and structure are defined and maintained separately in this file. A mapping relationship is established between the w:numId of w:num and the w:val of w:numId in document.xml, so that the list style is applied to the document content. The document contains content such as ordered list auto-increment rules and unordered list icon styles.

[0020] In step S4, the nodes of the pinyin guide are: <w:ruby>, which has several child nodes: <w:rubypr>This is the style of the phonetic guide. <w:rt>It is the phonetic text of the phonetic guide. <w:rubybase>It is the benchmark text for the phonetic guide.

[0021] In step S5, first define a vocabulary words, and then define two functions: matchWords() is used to match words in the vocabulary, matchCharacters() is used to match single characters, and convertLines() function combines the results of these two functions to return the text that needs to be wrapped. In the matchWords() function, a regular expression is created using the RegExp() constructor to match words in the vocabulary, and then the match() method is used to match whether there is a matching word in the text. If so, the matching result is added to the result array and the matched word is deleted from the text. In the matchCharacters() function, a for() loop is used to iterate over each character in the text. Each time the loop is completed, the current character is added to the result array. In the convertLines() function, the matchWords() function is first used to match the words in the vocabulary, and then the matchCharacters() function is used to match the remaining characters. Finally, the results of the two functions are combined to return the text that needs to be wrapped.

[0022] In step S6, a py attribute is added to the matchWords() function to store the pinyin of the matched words. Then, in the convertLines() function, the map() method is used to traverse the matched text, and an if statement is used to determine whether the pinyin exists. If so, use ... The label wraps the pinyin and text.

[0023] In step S7, the style of the text paragraph needs to take into account the size and spacing of the pinyin guide style and use this as a condition. The formula is: new line spacing = old line spacing + pinyin guide font size + pinyin guide font spacing; the pseudo code is: newLineHeight = oldLineHeight + rubyFontSize + rubyFontPaddingTop + rubyFontPaddingBottom.

[0024] In step S9, by monitoring file changes in a specific path or providing an API interface, new dictionary data is received and the pinyin mapping in the memory is updated in real time, thereby enhancing the real-time performance and flexibility of the system.

[0025] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.< / w:rubybase> < / w:rt> < / w:rubypr> < / w:ruby> < / w:rubybase> < / w:rt> < / w:rubypr> < / w:ruby>

Claims

1. A non-intrusive Word phonetic notation method based on Nodejs, characterized in that: The following steps are involved: S1. Dictionary acquisition and storage: First, obtain the pinyin dictionary and store it in memory for fast access; S2. Document transcoding and decompression: Use Nodejs to perform corresponding transcoding and decompression operations according to the doc format or docx format of the Word document; S3, source file identification: determine whether the Word document contains non-text resources, such as pictures. If not, directly process the decompressed source file. If it does, find the file with the same name as the document in the decompressed folder as the processing object; S4. General text style setting: set a general text style for Zhuyin, such as font, color, and spacing, for standardized Zhuyin display; S5. Text matching: Use efficient algorithms to perform text matching and pinyin processing, and match text that needs to be processed in batches according to business needs, and the matching priority of words is higher than that of single characters; S6, Pinyin matching and processing: matching the matched text with the phonetic dictionary to obtain the corresponding Pinyin, then processing the text and wrapping the text and Pinyin with the phonetic tag; S7, style merging and rewriting: Get the style:name of the original text, calculate the corresponding style rules, merge and convert it with the phonetic style defined above to make the style compliant, rewrite the text style, then merge it with the pre-defined phonetic style to ensure style consistency, and rewrite the text style; S8. Document recoding and compression: According to the format of the Word document, use Nodejs to recode and compress the modified document; S9. Dynamic dictionary update: Design and implement the dynamic update function of the Pinyin dictionary, allowing users to update the Pinyin dictionary content in real time without restarting the system; S10. Compatibility optimization: Conduct in-depth compatibility testing and optimization for different versions of Microsoft Word, including but not limited to Word 2007 to Word 2019 and Office 365, to ensure that the generated documents with phonetic symbols can be displayed correctly in all versions of Word, including the consistency of phonetic symbol style, layout and document structure; S11. Error handling and logging: Build a comprehensive error handling mechanism, design reasonable error handling logic for abnormal situations that may occur in key links such as document parsing, pinyin matching, and style application, such as providing a rollback mechanism and error prompts. At the same time, implement a detailed logging function to record key information, error details, and system status during the operation; S12. Performance optimization: Optimize algorithms for large-scale document processing scenarios, such as using more efficient string search algorithms, such as KMP, Boyer-Moore algorithm, parallel processing strategies, such as Node.js's Cluster module or multi-threaded processing and memory management strategies; S13. User interface and interaction design: Develop an intuitive and easy-to-use user interface that allows users to upload Word documents, select or upload custom pinyin dictionaries, preview processing effects, and export processed documents through a graphical interface. The interface also includes a progress bar and status prompt functions. S14. Security: Implement strict security measures when processing documents and dictionaries uploaded by users, such as data encryption transmission, input validation, and prevention of SQL injection and cross-site scripting attacks; S15, Documentation and Examples: Write detailed user manuals and developer documentation, covering installation and deployment, usage tutorials, API interface descriptions, and FAQs. Also provide sample Word documents and pinyin dictionary templates.

2. A non-intrusive Word phonetic notation method based on Nodejs according to claim 1, characterized in that: In the step S1, an interface is provided to support users to customize pinyin dictionaries and text styles to increase flexibility and practicality. The specific method is:

1. Let the user download the phonetic table template first. The present invention currently supports Excel; 2. The user fills in the corresponding text, words and phonetic symbols in the phonetic table according to the template specifications; 3. After the user completes the phonetic table work, the template is uploaded to the system.

3. A non-intrusive Word phonetic notation method based on Nodejs according to claim 1, characterized in that: In step S2, doc and docx are the default file formats in Microsoft Word, which are compressed files containing many XML files and media files, and the way to decompress the .docx file is as follows:

1. First define the DTD document or Schema document type of XML, that is, the document rule of XML; 2. After having the document type, establish a mapping relationship between the source file and the target XML, and the mapping relationship is: Heading 1->topicref / @navtitle; Heading 2->topicref / @navtitle; Heading 3->topic / title; para->p; 3. Copy the docx file to the computer, then rename it to a .zip file, right-click the renamed .zip file, and select "Extract Here"; 4. The system will create a new folder with the same name as the .zip file in the same folder. When you open the folder, you will see multiple files and folders; 5. Use docx-parser or other suitable libraries to parse the decompressed XML content and find the document content you want to edit.

4. A non-intrusive Word phonetic notation method based on Nodejs according to claim 1, characterized in that: In the step S3, if word does not introduce resources, such as pictures, then the required source file is obtained after decompression. Otherwise, a folder is obtained after decompression, and the file in the folder with the same name as the document is the required source file. The specific method is: the docx document is essentially a compressed package. The document .docx suffix can be directly modified to a .zip suffix, and then the zip package is decompressed to obtain the following docx document detailed structure, and the main structure is:

1. [Content_Types].xml; 2. *.rels file; 3. word / document.xml; 4. word / styles.xml; 5. word / numbering.xml.

5. A non-intrusive Word phonetic notation method based on Nodejs according to claim 1, characterized in that: In step S4, the nodes of the pinyin guide are: <w:ruby>, which has several child nodes: <w:rubypr>This is the style of the phonetic guide. <w:rt>It is the phonetic text of the phonetic guide. <w:rubybase> It is the benchmark text for the phonetic guide.< / w:rubybase> < / w:rt> < / w:rubypr> < / w:ruby> 6. A non-intrusive Word phonetic notation method based on Nodejs according to claim 1, characterized in that: In the step S5, a word list words is first defined, and then two functions are defined: matchWords() is used to match words in the word list, matchCharacters() is used to match single characters, and convertLines() function combines the results of the two functions to return the text that needs to be wrapped. In the matchWords() function, a regular expression is created using the RegExp() constructor, and then the match() method is used to match whether there are matching words in the text. If so, the matching results are added to the result array, and the matched words are deleted from the text. In the matchCharacters() function, a for() loop is used to traverse each character in the text, and each loop adds the current character to the result array. In the convertLines() function, the matchWords() function is first used to match the words in the word list, and then the matchCharacters() function is used to match the remaining characters. Finally, the results of the two functions are combined to return the text that needs to be wrapped.

7. A non-intrusive Word phonetic notation method based on Nodejs according to claim 1, characterized in that: In step S6, a py attribute is added to the matchWords() function, and then, in the convertLines() function, the map() method is used to traverse the matched text, and an if statement is used to determine whether pinyin exists. If so, use<spanclass="pinyin"> ...tags wrap pinyin and text.

8. A non-intrusive Word phonetic notation method based on Nodejs according to claim 1, characterized in that: In step S7, the style of the text paragraph needs to take into account the size and spacing of the pinyin guide style and use this as a condition, the formula is: new line spacing = old line spacing + pinyin guide font size + pinyin guide font spacing; the pseudo code is: newLineHeight = oldLineHeight + rubyFontSize + rubyFontPaddingTop + rubyFontPaddingBottom.

9. A non-intrusive Word phonetic notation method based on Nodejs according to claim 1, characterized in that: In step S9, by monitoring file changes in a specific path or providing an API interface, new dictionary data is received and the pinyin mapping in the memory is updated in real time.