A web-based automated reference format conversion system

By using a web-based automated reference format conversion system, the difficulties in submitting manuscripts caused by differences in the formats of different journals have been resolved. This system achieves efficient and accurate document format conversion, improving researchers' submission efficiency and format consistency.

CN121809406BActive Publication Date: 2026-05-19JIEHELIX (SHANGHAI) MEDICAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIEHELIX (SHANGHAI) MEDICAL TECH CO LTD
Filing Date
2026-03-09
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

In the process of submitting academic papers, the differences in reference formats among different journals make manual typesetting tedious, time-consuming, and prone to errors. Existing tools do not accurately parse author information when processing NBIB format data, and there is a lack of a cloud-based one-click processing method that is compatible with cross-devices.

Method used

Design a web-based automated reference format conversion system. The system adopts a B/S architecture, allowing users to upload Word documents and NBIB format data through a front-end interactive interface. The system uses the CSL style library to select journal formats, and a format conversion engine performs parsing and replacement. The system combines JSON-VDOM and the CSL rendering engine to achieve format conversion, and uses UUID to isolate and store intermediate data.

Benefits of technology

It achieves efficient and accurate cross-device reference format conversion, improves submission efficiency, reduces human error rate, adapts to multiple journal formats without the need to reorganize the reference database, and is easy to operate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121809406B_ABST
    Figure CN121809406B_ABST
Patent Text Reader

Abstract

The application discloses a kind of Web-based automated reference format conversion system, belong to computer software field.System uses B / S architecture, receives the Word manuscript uploaded by user and NBIB file exported by PubMed, provides dynamically loaded CSL style library for selecting target journal format.Through regular segmentation NBIB entry, with "FAU priority" strategy, author information is parsed to generate standardized BibTeX data;Word manuscript is converted into JSON-VDOM tree with reserved style, reference placeholder is positioned and three-dimensional mapping index is established, and through CSL rendering, placeholder is replaced, reference list is appended, and finally document is reversely generated.Using UUID to isolate temporary data and automatically clean up, security is guaranteed.The application solves the problems of local dependence, inaccurate parsing and complicated operation in the prior art, is efficient, accurate, flexible and easy to use, and greatly improves the efficiency of thesis reference layout.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer software technology, specifically relating to a Web-based automated reference format conversion system. Background Technology

[0002] In the academic paper submission process, different journals have significantly different requirements for reference formatting, including citation style, author name arrangement, DOI display, and other aspects. Researchers usually need to manually adjust the reference formatting or rely on local plugins such as EndNote and Zotero for management, but these existing technologies have obvious limitations:

[0003] The plugin is dependent on local environment configuration, and conflicts between the plugin and the Word version are likely to occur, affecting the stability of use.

[0004] When processing NBIB format literature data exported from PubMed, it cannot intelligently distinguish between full author names (FAU) and abbreviations (AU), resulting in inconsistent author list formats, and even missing fields or parsing errors.

[0005] The lack of lightweight, plugin-free cloud solutions makes it difficult to achieve one-click conversion from "documents + literature data" to "final draft documents," resulting in insufficient convenience when collaborating across devices.

[0006] The aforementioned problems make the reference formatting process cumbersome, time-consuming, and error-prone, seriously affecting researchers' submission efficiency. Therefore, there is an urgent need for an automated solution that can adapt to multiple journal formats, provide accurate parsing, and is easy to operate, in order to overcome the shortcomings of existing technologies. Summary of the Invention

[0007] To address the challenges of tedious, time-consuming, and error-prone manual formatting of academic papers due to variations in journal reference formats, existing tools for processing NBIB data suffer from inaccurate author information parsing (failing to distinguish between FAU and AU) and missing field mappings. Furthermore, these tools rely on local installation, posing a risk of version conflicts, and lack a cross-device compatible, cloud-based one-click processing method. This application proposes a web-based automated reference format conversion system designed to quickly convert manuscripts and reference metadata into the format required by specific journals during the academic paper submission process.

[0008] A web-based automated reference format conversion system, using a B / S architecture, includes a front-end interactive interface, a back-end processing service, and a format conversion engine;

[0009] The conversion method of the conversion system includes:

[0010] Step S1: Receive user-uploaded .docx format Word documents and PubMed exported NBIB format literature data through the front-end interactive interface;

[0011] Step S2: Provide a dynamically loaded CSL style library for users to select the target journal format;

[0012] Step S3: Parse the NBIB format data through the format conversion engine and generate a standardized BibTeX database file to perform structured processing on the Word document and locate the reference placeholders;

[0013] Step S4: Based on the CSL style library and BibTeX data, replace the citation placeholders with text that conforms to the target journal's format, and generate a final Word document containing a list of references.

[0014] Step S5: Isolate and automatically clean up intermediate data during the conversion process to ensure user data security.

[0015] Preferably, the method for loading the CSL style library includes:

[0016] When the backend processing service starts, it automatically scans all .csl files in a specified directory on the server.

[0017] Parse its metadata and establish a mapping between filenames and display names, then load this mapping into the memory cache;

[0018] The frontend uses Ajax to asynchronously request the / search_csl interface to implement paginated retrieval and on-demand loading of the style library. The frontend sends an Ajax request containing the parameters q (query term) and page (page number) to the / search_csl interface through the Select2 component. The backend performs fuzzy matching and pagination slicing on the CSL metadata in the memory cache and returns JSON data containing the results and pagination fields.

[0019] Preferably, the NBIB format data parsing uses the regular expression r'^(PMID-\s*\d+)' (multiline mode) to identify delimiters, divides the NBIB text stream into independent document entry blocks, and then extracts the metadata of each entry through prefix matching and establishes a field mapping dictionary. In the field mapping dictionary, the TI field is mapped to the title of BibTeX, and the year extracted from the DP field is mapped to the year of BibTeX.

[0020] Preferably, the author information processing strategy adopted in the NBIB format data parsing process is as follows: when traversing the document entry rows, a full name list (fau_authors) and an abbreviation list (au_authors) are maintained respectively. After parsing, non-empty fau_authors are used first. If fau_authors is empty, au_authors are used as a fallback. Then, the author list is formatted by the "and" concatenation operator to generate a standard BibTeX author string.

[0021] Preferably, the Word document structuring process includes: decompressing the .docx file and parsing the core component of word / document.xml in OpenXML format, traversing its... <w:p>Elements and <w:r>The element is mapped to a nested JSON tree structure (JSON-VDOM) containing Paragraph, Run, Text, and Style node attributes. This structure uses Root as the root node and recursively organizes paragraphs and text run objects through the children array. It aims to shield the underlying complexity of OpenXML and facilitate node traversal and replacement. The JSON-VDOM retains the key style attributes of bold and font size of the original text.

[0022] Preferably, the citation placeholder positioning uses the regular expression r'\[(\d+)\]' to traverse the Text nodes in the JSON-VDOM, marks the citation placeholder nodes to be processed, and establishes a three-dimensional mapping index of "document number → JSON node path → PubmedID", which includes the correspondence between the citation mark number in the document, the memory address or hierarchical index path of the target node in the JSON-VDOM tree, and the PMID of the NBIB source data. The logical mapping ensures the accurate anchoring of the document placeholders and the document entry data.

[0023] Preferably, the reference placeholder replacement process involves calling a custom CSL rendering engine, the core steps of which include:

[0024] An XML parser is used to read the CSL style file structure to obtain the layout rules for citation and bibliography definitions;

[0025] Convert the BibTeX data in the 3D mapping index into an internally compatible JSON intermediate format;

[0026] According to CSL <sort>Tagging rules perform in-memory sorting of the reference list;

[0027] When generating the cited text, the style attributes of the original placeholders (such as superscript and font size) are preserved, a new JSON node containing the rendered text is constructed, the original placeholder nodes in the JSON-VDOM are replaced, and a list of references nodes are appended to the end of the document.

[0028] Preferably, the method for isolating and automatically cleaning up the intermediate data is as follows: a unique UUID is generated for each conversion request, an independent temporary working directory is created on the server based on the UUID, and after the conversion is completed and the final document is generated, the intermediate JSON data, temporary Markdown and BibTeX files are deleted by using the shutil.rmtree function.

[0029] Preferably, the backend processing service is developed based on the Python Flask framework, and the format conversion engine includes the parse_nbib_to_bibtex function, the docx_to_json_serializer module, the json_vdom_processor engine, and the json_to_docx_builder module, wherein:

[0030] The parse_nbib_to_bibtex function is a state machine parser based on regular expressions, which implements high-fault-tolerant parsing from NBIB to BibTeX. This includes extracting the year (\d{4}) from the DP field using regular expressions, and a priority strategy that automatically backs down to use the AU field (abbreviation) when the FAU field (full name) does not exist.

[0031] The docx_to_json_serializer module is based on the underlying _Element interface of the python-docx library and parses Word documents into JSON-VDOM in a streaming manner;

[0032] The json_vdom_processor engine uses a recursive traversal algorithm to scan JSON-VDOM nodes layer by layer to identify reference placeholders and uses the formatted data generated by rendering to update the text and style attributes of the target nodes in real time.

[0033] The json_to_docx_builder module reverse-parses the processed JSON-VDOM into standard OpenXML format and repackages it to generate a .docx file.

[0034] Preferably, the front-end interactive interface is developed using HTML5 + jQuery + Select2 components, supporting asynchronous upload of Word documents and NBIB data, and supporting asynchronous upload of Word documents and NBIB data based on the FormData object. Specifically, it instantiates a FormData object to encapsulate the file stream by listening to the form submission event, uses jQuery's Ajax interface to send a POST request with both processData and contentType false, and binds the xhr.upload.onprogress event to realize real-time monitoring of upload progress, as well as the retrieval and selection operation of the CSL style library.

[0035] The advantages and effects of this application are as follows:

[0036] This application presents a web-based automated reference format conversion system. Employing a B / S architecture, it eliminates the need for bulky local document management software, allowing users to upload files, select formats, and download final drafts solely through a browser. This lowers the barrier to entry and adapts to cross-device collaboration scenarios. Through JSON-VDOM streaming parsing, CSL engine batch rendering, and automated workflow design, it can convert the reference format of a long document within one minute, improving efficiency by over 90% compared to manual typesetting. Furthermore, this application completely eliminates punctuation errors, author spelling mistakes, and inconsistent formatting caused by manual input through programmatic parsing of NBIB data, a "FAU-first" author handling strategy, and precise citation mapping indexes. Simultaneously, since this application supports tens of thousands of CSL styles, users can easily adapt to the format requirements of different journals by simply switching options through the front-end interface, without needing to reorganize the literature database.

[0037] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the preferred embodiments of this application are described in detail below with reference to the accompanying drawings.

[0038] The above and other objects, advantages and features of this application will become more apparent to those skilled in the art from the following detailed description of specific embodiments in conjunction with the accompanying drawings. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. In all drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.

[0040] Figure 1 A system flowchart of a Web-based automated reference format conversion system designed for this application;

[0041] Figure 2 The NBIB parsing logic diagram of a Web-based automated reference format conversion system designed for this application is shown. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. In the following description, specific details such as specific configurations and components are provided merely to help fully understand the embodiments of this application. Therefore, those skilled in the art should understand that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. In addition, for clarity and brevity, descriptions of known functions and structures are omitted in the embodiments.

[0043] It should be understood that the phrase "an embodiment" or "this embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "an embodiment" or "this embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.

[0044] Furthermore, reference numerals and / or letters may be repeated in different examples within this application. Such repetition is for the purpose of simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or settings discussed.

[0045] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist simultaneously. In this article, the term " / and" describes another type of relationship between related objects, indicating that two relationships can exist. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, in this article, the character " / " generally indicates that the related objects before and after it are in an "or" relationship.

[0046] In this article, the term "at least one" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, "at least one of A and B" can mean: A exists alone, A and B exist simultaneously, or B exists alone.

[0047] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion.

[0048] Example 1: Please refer to Figures 1-2 This embodiment mainly introduces a web-based automated reference format conversion system, which adopts a B / S (browser / server) architecture and mainly includes a front-end interactive interface, a back-end processing service, and a format conversion engine. The system achieves automated reference format conversion through the following steps:

[0049] (a) Data input and preprocessing

[0050] Users can upload Word documents (.docx format) and NBIB format literature data exported from PubMed through the front-end interactive interface;

[0051] When the backend processing service starts, it automatically scans all CSL (Citation Style Language) files in the specified directory of the server, parses their metadata (such as titles), establishes a mapping relationship between filenames and display names, and loads them into the memory cache. The frontend asynchronously requests the / search_csl interface via Ajax to implement paginated retrieval and on-demand loading of the CSL style library. The frontend sends an Ajax request containing the parameters q (query term) and page (page number) to the / search_csl interface through the Select2 component. The backend performs fuzzy matching and pagination slicing on the CSL metadata in the memory cache and returns JSON data containing the results and pagination fields for users to select the target journal format.

[0052] (II) NBIB Intelligent Parsing and BibTeX Generation

[0053] The format conversion engine uses the regular expression r'^(PMID-\s*\d+)' (multiline mode) to identify lines in NBIB files that start with "PMID-" as delimiters, splitting the continuous text stream into independent bibliographic entry blocks.

[0054] The `parse_nbib_to_bibtex` function scans each entry line by line, extracts metadata using prefix matching (such as TI-, DP-), and builds a field mapping dictionary (TI fields are mapped to BibTeX's title, DP fields are extracted and the year is mapped to BibTeX's year, etc.).

[0055] The author information processing strategy adopts "FAU priority": when traversing the entry row, the full name list (fau_authors) and the abbreviation list (au_authors) are maintained respectively. After parsing, non-empty fau_authors are used first. If fau_authors is empty, au_authors are used back. The author list is then formatted by the "and" concatenation operator to generate the standard BibTeX author string.

[0056] Following the BibTeX standard syntax specification, a standardized BibTeX (.bib) database file is generated, containing the @article type definition, reference key (CiteKey), and escaped field key-value pairs.

[0057] (III) Document structuring and intermediate layer mapping

[0058] The system unzips the Word document (OpenXML format), parses the core component of word / document.xml, and iterates through its contents. <w:p>(Paragraph) and <w:r>(Text execution) element;

[0059] A custom lightweight virtual document object model (JSON-VDOM) is constructed, which maps the traversed XML elements into a nested JSON tree structure containing node attributes such as Paragraph, Run, Text, and Style. This structure takes Root as the root node and recursively organizes paragraphs and text run objects through the children array. It aims to shield the underlying complexity of OpenXML and facilitate node traversal and replacement. The JSON-VDOM retains the key style attributes of bold and font size in the original text, and shields the complexity of the underlying XML.

[0060] Using the regular expression r'\[(\d+)\]', the Text nodes in the JSON-VDOM are traversed to locate the reference placeholder nodes in the form of [1] and [2], and a three-dimensional mapping index of "document number → JSON node path → PubmedID" is established. This index includes the correspondence between the reference mark number in the document, the memory address or hierarchical index path of the target node in the JSON-VDOM tree, and the PMID of the NBIB source data. The logical mapping ensures the accurate anchoring of the document placeholders and the document entry data.

[0061] (iv) JSON tree traversal and final reconstruction

[0062] The core steps of calling a custom CSL rendering engine based on CiteProc logic include: ① using an XML parser to read the CSL style file structure to obtain the layout rules defined by citation and bibliography; ② converting the BibTeX data in the 3D mapping index into an internally compatible JSON intermediate format; ③ according to the CSL... <sort>The tag rules sort the reference list in memory; ④ When generating the cited text, the style attributes of the original placeholders (such as superscript and font size) are preserved, a new JSON node containing the rendered text is constructed, the original placeholder node in JSON-VDOM is replaced, and the reference list node is appended to the end of the document.

[0063] Specifically, it is a CSL rendering engine based on CiteProc logic that generates formatted text (such as superscript "[1]" or "Author,2023" format) that meets the requirements of the target journal based on the metadata in the 3D mapping index.

[0064] Construct a new JSON node containing the formatted text and original style attributes (font, font size, superscript, etc.), and replace the original placeholder node in JSON-VDOM;

[0065] Append an array of Paragraph nodes containing a complete list of references to the end of the JSON-VDOM;

[0066] The modified JSON-VDOM is reverse-parsed into standard OpenXML format, and then repackaged to generate the final .docx document, ensuring that the document formatting such as headers, footers, and heading styles is preserved without loss.

[0067] (v) Resource Management and Clearance

[0068] A unique UUID (Universally Unique Identifier) ​​is generated for each conversion request, and an independent temporary working directory is created on the server based on the UUID. After the conversion is completed and the final document is generated, the intermediate JSON data, temporary Markdown and BibTeX files are automatically deleted using the shutil.rmtree function to ensure user data security.

[0069] Furthermore, the backend processing service is developed based on the Python Flask framework, and the format conversion engine comprises four core modules:

[0070] The `parse_nbib_to_bibtex` function is a state machine parser based on regular expressions that implements highly fault-tolerant parsing from NBIB to BibTeX. It includes extracting the year (\d{4}) from the DP field using regular expressions, and a priority strategy that automatically backs down to using the AU field (abbreviation) when the FAU field (full name) does not exist.

[0071] The docx_to_json_serializer module: Based on the underlying _Element interface of the python-docx library, it parses Word documents into JSON-VDOM in a streaming manner;

[0072] The json_vdom_processor engine uses a recursive traversal algorithm to scan JSON-VDOM nodes layer by layer to identify reference placeholders and uses the formatted data generated by rendering to update the text and style attributes of the target nodes in real time.

[0073] The json_to_docx_builder module reverse-parses the processed JSON-VDOM into standard OpenXML format and repackages it to generate a .docx file.

[0074] Furthermore, the front-end interactive interface is developed using HTML5, jQuery, and Select2 components. It supports asynchronous uploads of Word documents and NBIB data, and supports asynchronous uploads of Word documents and NBIB data based on the FormData object. Specifically, it instantiates a FormData object to encapsulate the file stream by listening to the form submission event, uses jQuery's Ajax interface to send a POST request with both processData and contentType false, and binds the xhr.upload.onprogress event to realize real-time monitoring of the upload progress, as well as the retrieval and selection operations of the CSL style library.

[0075] Example 2, based on Example 1, describes in detail a Web-based automated reference format conversion system, the specific implementation process of which is as follows:

[0076] (I) System Deployment and Initialization

[0077] Backend Deployment: The backend service is built based on the Python Flask framework, storing tens of thousands of CSL style files (.csl) in a specified directory on the server. When the backend service starts, it automatically scans all .csl files in the directory, parses the metadata of each file (such as the Title field), establishes a "filename-display name" mapping relationship and loads it into the memory cache. It also provides the / ajax / search_csl interface to support paginated search by filename or display name.

[0078] Front-end deployment: The front-end interactive interface is developed using HTML5, jQuery, and Select2 components, implementing two core functions: first, an asynchronous file upload control that supports simultaneous upload of Word documents (.docx) and NBIB format files (.nbib); second, a CSL style selection control that loads a style list by calling the backend / search_csl interface, supporting fuzzy search and quick selection.

[0079] (II) Data Input and Preprocessing

[0080] Users complete the following operations through the front-end interface: ① Upload the Word document to be processed and the NBIB file exported from PubMed; ② Select the format of the target journal (such as the format corresponding to "Nature" and "Science") from the CSL style list; ③ Click the "Format Conversion" button to submit the request. The front-end asynchronously sends the file data and style selection parameters to the back-end service via Ajax.

[0081] (III) NBIB Parsing and BibTeX Generation

[0082] After receiving the request, the backend service generates a unique UUID (such as "123e4567-e89b-12d3-a456-426614174000"), creates a temporary working directory based on the UUID, and executes the following parsing process:

[0083] The parse_nbib_to_bibtex function is called to read the contents of the NBIB file. The delimiter is identified by the regular expression r'^(PMID-\s*\d+)' (multiline mode), and the text stream is divided into independent blocks of bibliographic entries.

[0084] Each entry block is scanned line by line, and metadata such as PMID, TI (title), DP (publication date), FAU (full author name), and AU (author abbreviation) are extracted by prefix matching. A field mapping dictionary is established: TI→title, DP extracts year→year, AB→abstract, etc.

[0085] Author information processing: Initialize two empty lists, fau_authors and au_authors. Iterate through the entries in the block that start with "FAU-", extract the full author name and store it in fau_authors. If fau_authors is empty, iterate through the entries that start with "AU-", extract the author abbreviation and store it in au_authors. Concatenate the author list into a normalized string (e.g., "Zhang San and LiSi") using the "and" concatenation operator.

[0086] Following the BibTeX standard syntax, generate a .bib file containing the @article type definition, reference key (CiteKey, such as "Zhang2023"), and key-value pairs after escaping each field, and save it to a temporary working directory.

[0087] (iv) Word document structuring

[0088] The `docx_to_json_serializer` module is called to decompress the user-uploaded `.docx` file, read the core component `word / document.xml`, and iterate through its contents. <w:p>(Paragraph) and <w:r>(Text execution) element;

[0089] For each <w:p>Extract the alignment, outline level, and other attributes from the element, and generate a JSON node with the "type:paragraph" attribute; for each <w:r>Elements, extract text content and <w:b>(Bold) <w:i>(Italic) <w:sz>Style attributes such as font size are used to generate JSON child nodes with the name "type:run"; finally, a nested JSON-VDOM tree structure is constructed, which fully preserves the original text style.

[0090] The reference positioning algorithm is called to traverse all Text nodes in JSON-VDOM using the regular expression r'\[(\d+)\]', mark the reference placeholder nodes in the form of [1] and [2], and record their node paths in the JSON tree;

[0091] Based on the placeholder number, find the corresponding NBIB document entry PMID, create a three-dimensional mapping index table of "manuscript number → JSON node path → PMID", and save it to the temporary working directory.

[0092] (v) Reference replacement and document restructuring

[0093] The json_vdom_processor engine is invoked to load the JSON-VDOM tree and BibTeX file, and a depth-first traversal algorithm is used to traverse all Text nodes and match reference placeholders.

[0094] For the matched placeholder nodes, the corresponding BibTeX metadata is obtained through the three-dimensional mapping index table, and the CSL rendering engine (based on CiteProc logic) is called to generate formatted text that conforms to the target journal format (such as superscript "[1]" or "Zhang,2023").

[0095] Construct a new JSON node group containing formatted text and style attributes of the original node (such as bold and font size), and replace the original placeholder node with a splice operation;

[0096] Append a "References" header node and an array of Paragraph nodes containing all cited entries to the end of the JSON-VDOM tree. Each entry is arranged in the format required by the target journal (such as the order and punctuation of information such as author, title, journal, year, DOI, etc.).

[0097] The `json_to_docx_builder` module is called to reverse parse the modified JSON-VDOM tree into standard OpenXML format: for each paragraph node, `doc.add_paragraph()` is called to create a paragraph and restore its style; for each run node, `p.add_run()` is called to insert text and set font attributes; the file is saved as the final `.docx` draft using the `doc.save()` method and stored in a temporary working directory.

[0098] (vi) Data cleaning and result return

[0099] The backend service returns the final .docx file to the user through the frontend interface, which can be downloaded.

[0100] Call the shutil.rmtree function to delete the temporary working directory created based on the UUID and its intermediate files (JSON-VDOM data, temporary BibTeX files, Markdown files, etc.) to ensure that user data is not left behind.

[0101] The above description is merely a preferred embodiment of the present invention and does not limit the scope of protection of the present invention. For those skilled in the art, the present invention can have various modifications and variations. Any changes, modifications, substitutions, integrations, and parameter alterations to these embodiments within the spirit and principles of the present invention, achieved through conventional substitutions or by achieving the same function without departing from the principles and spirit of the present invention, fall within the scope of protection of the present invention.< / w:sz> < / w:i> < / w:b> < / w:r> < / w:p> < / w:r> < / w:p> < / sort> < / w:r> < / w:p> < / sort> < / w:r> < / w:p>

Claims

1. A Web-based automated reference format conversion system, characterized in that, It adopts a B / S architecture, including a front-end interactive interface, a back-end processing service, and a format conversion engine; The conversion method of the conversion system includes: Step S1: Receive user-uploaded .docx format Word documents and PubMed exported NBIB format literature data through the front-end interactive interface; Step S2: Provide a dynamically loaded CSL style library for users to select the target journal format; Step S3: Parse the NBIB format data through the format conversion engine and generate a standardized BibTeX database file to perform structured processing on the Word document and locate the reference placeholders; The NBIB format data parsing uses the regular expression r'^(PMID-\s*\d+)' to identify delimiters, dividing the NBIB text stream into independent document entry blocks. Then, it extracts the metadata of each entry through prefix matching and establishes a field mapping dictionary. In the field mapping dictionary, the TI field is mapped to the title of BibTeX, and the year extracted from the DP field is mapped to the year of BibTeX. The author information processing strategy adopted in the NBIB format data parsing process is as follows: when traversing the document entry rows, a full name list (fau_authors) and an abbreviation list (au_authors) are maintained respectively. After parsing, non-empty fau_authors are used first. If fau_authors is empty, au_authors are used as a fallback. The author list is then formatted using the "and" concatenation operator to generate a standard BibTeX author string. The Word document structuring process includes: decompressing the .docx file and parsing the core component of the OpenXML format word / document.xml file, traversing its contents. <w:p>Elements and <w:r> The element is mapped to a nested JSON tree structure JSON-VDOM containing Paragraph, Run, Text, and Style node attributes, which preserves the original text's key style attributes such as bold and font size;< / w:r> < / w:p> The citation placeholder location uses the regular expression r'\[(\d+)\]' to traverse the Text nodes in the JSON-VDOM, marking the citation placeholder nodes to be processed, and establishing a three-dimensional mapping index of "document number → JSON node path → Pubmed ID", which includes the correspondence between the citation mark number in the document, the memory address or hierarchical index path of the target node in the JSON-VDOM tree, and the PMID of the NBIB source data. The logical mapping ensures the accurate anchoring of the document placeholders and the document entry data. Step S4: Based on the CSL style library and BibTeX data, replace the citation placeholders with text that conforms to the target journal's format, and generate a final Word document containing a list of references. The reference placeholder replacement process is as follows: based on the CiteProc logic, a custom CSL rendering engine is called, and its core steps include: An XML parser is used to read the CSL style file structure to obtain the layout rules for citation and bibliography definitions; Convert the BibTeX data in the 3D mapping index into an internally compatible JSON intermediate format; According to CSL <sort> Tagging rules perform in-memory sorting of the reference list;< / sort> When generating cited text, the style properties of the original placeholders are preserved, a new JSON node containing the rendered text is constructed, the original placeholder node in JSON-VDOM is replaced, and a list of references node is appended to the end of the document. Step S5: Isolate and automatically clean up intermediate data during the conversion process to ensure user data security; The method for isolating and automatically cleaning up intermediate data is as follows: a unique UUID is generated for each conversion request, an independent temporary working directory is created on the server based on the UUID, and after the conversion is completed and the final document is generated, the intermediate JSON data, temporary Markdown and BibTeX files are deleted by using the shutil.rmtree function.

2. The Web-based automated reference format conversion system according to claim 1, characterized in that, The methods for loading the CSL style library include: When the backend processing service starts, it automatically scans all .csl files in a specified directory on the server. Parse its metadata and establish a mapping between filenames and display names, then load this mapping into the memory cache; The front-end uses Ajax to asynchronously request the / search_csl interface to implement paginated retrieval and on-demand loading of the style library.

3. The Web-based automated reference format conversion system according to claim 1, characterized in that, The backend processing service is developed based on the Python Flask framework. The format conversion engine includes the `parse_nbib_to_bibtex` function, the `docx_to_json_serializer` module, the `json_vdom_processor` engine, and the `json_todocx_builder` module, wherein: The `parse_nbib_to_bibtex` function is a state machine parser based on regular expressions, which implements highly fault-tolerant parsing from NBIB to BibTeX. The docx_to_json_serializer module is based on the underlying _Element interface of the python-docx library and parses Word documents into JSON-VDOM in a streaming manner; The json_vdom_processor engine uses a recursive traversal algorithm to scan JSON-VDOM nodes layer by layer to identify reference placeholders and uses the formatted data generated by rendering to update the text and style attributes of the target nodes in real time. The json_to_docx_builder module reverse-parses the processed JSON-VDOM into standard OpenXML format and repackages it to generate a .docx file.

4. The Web-based automated reference format conversion system according to claim 1, characterized in that, The front-end interactive interface is developed using HTML5, jQuery, and Select2 components, and supports asynchronous uploading of Word documents and NBIB data, as well as retrieval and selection operations of the CSL style library.