A building specification document multi-version difference intelligent detection method, device and medium
Patent Information
- Application Number
- CN202610972143.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-01
- Publication Date
- 2026-09-22
AI Technical Summary
人工比对方式效率极为低下,难以应对规范高频更新的实际需求,且长时间重复性工作极易导致人为疏忽,造成细微条款调整、新增隐性要求或公式参数变更的遗漏与误判
通过从结构层面、版面层面和内容层面三个维度对建筑规范文档进行全面的跨版本差异检测,克服了现有通用文本比较工具仅能实现字面级别差异标记、无法识别建筑规范特有结构化特征的缺陷;支持三个及以上版本的建筑规范文档连续比对,通过为每一规范条款分配跨版本唯一标识,并在此基础上构建条款变更轨迹,使每一条款在各版本中的变更历史得以完整记录与追溯;通过获取用户对差异可视化数据的反馈标注,并基于该反馈标注对差异检测模型进行参数微调和样本库更新,构建了人工反馈到模型微调再到样本库增量更新的闭环迭代优化机制。
Smart Images

Figure CN122797516A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of document detection technology, and in particular to an intelligent detection method, device and medium for multiple versions of building code documents with differences. Background Technology
[0002] With the continuous improvement of informatization in the construction industry and the ongoing updates to national engineering construction standards, the version iteration frequency of building code documents has accelerated significantly. It has become commonplace for the same code to undergo multiple revisions, partial adjustments, and additions / deletions of clauses within a short period. As the core basis for engineering design, construction, acceptance, and operation and maintenance, the differences between different versions of building codes directly affect the compliance, safety, and quality stability of engineering projects. Therefore, the detection of differences between cross-version code documents and the alignment and tracing of key clauses are crucial foundational tasks for construction companies in conducting compliance reviews, design change management, and completion audits. Currently, building code documents are generally characterized by their large length, complex clause hierarchy, dense use of professional terminology, and the coexistence of technical parameters and formulas. Furthermore, different versions often involve complex situations such as adjustments to chapter structure, rearrangement of clause numbering, and changes in cross-code reference relationships, further exacerbating the difficulty of version comparison and information tracing.
[0003] In current practice, the detection of differences between multiple versions of building codes mainly relies on manual comparison of each clause or the assistance of general text comparison tools. Manual comparison is extremely inefficient, unable to meet the actual needs of frequent code updates, and the repetitive nature of this work easily leads to human oversight, resulting in omissions and misjudgments of minor clause adjustments, new implicit requirements, or changes in formula parameters. While general text comparison tools can mark differences at the literal level, they cannot recognize the unique chapter hierarchy, clause logic, and layout information of building codes. They also struggle to effectively handle differences in non-pure text content such as tables, formulas, and diagrams, and lack the semantic understanding of professional terminology in the building industry. This results in a large number of structural differences and key semantic changes failing to be accurately captured. Furthermore, existing solutions are generally limited to pairwise comparisons between two versions, unable to support continuous difference tracing and change trajectory reconstruction across three or more versions. The fragmented difference information hinders the systematic assessment of the impact of code changes. Summary of the Invention
[0004] This application provides a method, device, and medium for intelligent detection of differences between multiple versions of building code documents, in order to solve the above-mentioned technical problems.
[0005] On the one hand, embodiments of this application provide an intelligent detection method for differences between multiple versions of building code documents, including: At least two versions of building code documents to be tested are obtained. The format of each version of the building code document is parsed and structured, generating a structured document object model with a unified format. The structured document object model is then subjected to noise cleaning and terminology normalization to obtain a standardized document. Structural and semantic features are extracted from the standardized document to construct a multi-dimensional feature vector library; the structural features include page layout features and chapter tree structure features, and the semantic features include key entities and their location information in the document. Based on the multi-dimensional feature vector library, differences are monitored for at least two versions of building code documents. Structural differences between versions are detected at the structural, layout and content levels, and a list of structural differences is generated. The structured difference list is visualized and rendered to generate difference visualization data and a standardized difference summary report. User feedback annotations on the difference visualization data are obtained. Based on the feedback annotations, the parameters of the difference detection model are fine-tuned and the sample library is updated.
[0006] On the other hand, this application also provides an intelligent detection device for multiple versions of building code documents, the device comprising: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor, which are then executed by the at least one processor to enable the at least one processor to perform the intelligent detection method for multiple versions of building code documents as described above.
[0007] On the other hand, this application also provides a non-volatile computer storage medium storing computer-executable instructions, which, when executed, implement the above-described intelligent detection method for multiple versions of building code documents with differences.
[0008] This application provides a method, device, and medium for intelligent detection of differences between multiple versions of building code documents, which has at least the following beneficial effects: By comprehensively detecting cross-version differences in building code documents from three dimensions—structural, layout, and content—this approach overcomes the limitations of existing general text comparison tools, which can only identify literal differences and cannot recognize the unique structural features of building codes. It supports continuous comparison of three or more versions of building code documents. By assigning a unique cross-version identifier to each code clause and constructing a clause change trajectory based on this identifier, the change history of each clause across versions can be fully recorded and traced. Furthermore, by acquiring user feedback annotations on the difference visualization data and using these annotations to fine-tune the parameters of the difference detection model and update the sample library, a closed-loop iterative optimization mechanism is constructed, from manual feedback to model fine-tuning and then to incremental updates of the sample library. Attached Figure Description
[0009] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating an intelligent detection method for multiple versions of building code documents provided in this application embodiment; Figure 2 This is a schematic diagram of the internal structure of an intelligent detection device for multiple versions of building code documents, provided as an embodiment of this application. Detailed Implementation
[0010] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0011] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0012] Figure 1 This is a flowchart illustrating an intelligent detection method for multiple versions of building code documents, provided in an embodiment of this application.
[0013] The analysis method involved in the embodiments of this application can be implemented by a terminal device or a server, and this application does not impose any special limitations on it. For ease of understanding and description, the following embodiments are all described in detail using a server as an example.
[0014] It should be noted that the server can be a single device or a system composed of multiple devices, i.e., a distributed server. This application does not make any specific limitations on this.
[0015] like Figure 1 As shown in the embodiment of this application, a method for intelligent detection of differences between multiple versions of building code documents includes: Step 101: Obtain at least two versions of building code documents to be tested, perform format parsing and structuring processing on each version of the building code document, generate a structured document object model with a unified format, and perform noise cleaning and terminology normalization processing on the structured document object model to obtain a standardized document.
[0016] In this embodiment, building code documents refer to normative documents issued by the Ministry of Housing and Urban-Rural Development, local housing and urban-rural development departments, and relevant standardization management agencies to guide the design, construction, acceptance, and operation and maintenance of building projects. Specific forms include, but are not limited to, engineering construction standards, specifications, standard atlases, and technical guidelines. Since different versions of building code documents may exist in different file formats, such as standard PDFs, scanned PDFs, Word documents, TXT text files, screenshots, or even scanned copies of paper documents containing handwritten annotations, it is first necessary to obtain at least two versions of the building code documents to be tested and perform format parsing and structure processing on each version.
[0017] Specifically, format parsing and structuring processing refer to invoking appropriate parsing strategies based on the original document format type to extract unstructured or semi-structured content from the original document into computer-readable structured data. For example, when the building code document to be processed is a standard format PDF document, an optical character recognition (OCR) engine is used to recognize the text on the document page, extracting the text strings and the page coordinates of each character, so that the position of each text character on the page can be accurately located subsequently. When the building code document to be processed is a standard format Word document, a document parsing tool is used to parse the underlying markup language structure of the document, extracting the text content and its format attributes. Format attributes include important parameters characterizing the text presentation style, such as font name, font size, whether it is bold, and whether italicized. It should be noted that the aforementioned OCR engine and document parsing tool are only exemplary means of implementing the format parsing function; in actual implementation, other tools or algorithms with the same functionality can be used instead.
[0018] When the building code document to be processed is a scanned PDF document, since this type of document is essentially an image collection encapsulated from multiple scanned images, the text information cannot be directly extracted. Therefore, image preprocessing is required first. For example, image preprocessing includes denoising, tilt correction, and image enhancement. Denoising removes noise and scratches generated during scanning; tilt correction corrects page tilt that may exist during scanning, ensuring the accuracy of subsequent text recognition; and image enhancement improves image contrast and clarity, making the strokes of the text more legible. After image preprocessing, an optical character recognition engine is used to perform text recognition on the preprocessed image, extracting the text content and corresponding page coordinates. When the building code document to be processed is a handwritten annotation document, i.e., the document page contains handwritten annotations, comments, or supplementary explanations, a handwriting recognition engine is used to specifically recognize the handwritten annotation areas and extract the text content of the handwritten annotations. Understandably, handwriting recognition engines can use deep learning-based handwriting recognition models to adapt to different writing styles and handwriting characteristics, effectively extracting handwritten text information.
[0019] After completing various format parsing operations, the extracted heterogeneous data, such as text content, page coordinates, format attributes, and handwritten annotations, are integrated and encapsulated according to a pre-defined unified data model to generate a structured document object model. This structured document object model fully preserves the text content, layout, and format attribute information of the original document in a structured manner, providing a standardized data foundation for subsequent feature extraction and difference detection.
[0020] In this embodiment, after generating the structured document object model, noise cleaning and terminology normalization are also performed. The purpose of noise cleaning is to remove redundant information from the document that is unrelated to the main text. Specifically, based on the page element information in the structured document object model, the header, footer, and watermark areas on the page are identified. Headers and footers are usually located at the top and bottom of the page, and their content is mostly repetitive information such as the specification name, chapter title, or page number; watermarks are usually superimposed on the page background as semi-transparent text or images. This information belongs to the decorative or identifying elements of the document and is not part of the main text; therefore, it should not be included in the calculation in subsequent comparisons. Thus, it is necessary to identify and delete the aforementioned header, footer, and watermark information to generate the denoised document content.
[0021] After noise removal, the text content undergoes further purification. Specifically, the text string in the denoised document content is obtained, and whitespace characters and special symbols are filtered out. Whitespace characters include invisible characters such as spaces, tabs, and newlines, while special symbols include garbled characters or non-text symbols that may be introduced during page parsing. Simultaneously, for typos and omissions that may occur during optical character recognition due to poor image quality or special fonts, automatic corrections are performed based on contextual semantics and commonly used vocabulary in the construction industry to improve the accuracy and purity of the text.
[0022] It is understandable that building code documents contain a large number of professional terms, and the same technical concept may be expressed differently in different versions of the code, or the same term may have different connotations in different professional areas of the code. To solve the problem of inconsistent terminology, this application embodiment pre-constructs a three-dimensional building professional terminology dictionary system. For example, the three-dimensional terminology dictionary includes a general dictionary, professional area sub-dictionaries, and regional sub-dictionaries. Among them, the general dictionary includes basic general terms in the building industry; the professional area sub-dictionaries include terms classified according to professional areas such as structural engineering, water supply and drainage engineering, HVAC engineering, green building, and prefabricated building; the regional sub-dictionaries include standard terms with local characteristics issued by local housing and construction departments.
[0023] In the terminology normalization process, terminology data is obtained from the clean text, and matched and mapped based on the aforementioned three-dimensional terminology dictionary. When a term has a match in the dictionary, it is directly converted into the corresponding standardized terminology expression in the dictionary. For suspected terms not yet included in the dictionary, i.e., terms that have not been successfully matched, the cosine similarity of the word vectors of the suspected terms with each term in the three-dimensional terminology dictionary is calculated, and the semantic closeness between the two is determined by the similarity. When the cosine similarity of the word vectors exceeds a preset threshold, it is determined that the fuzzy match is successful, and the suspected terms are also converted into the corresponding standardized terminology expressions. By combining the above-mentioned precise matching and fuzzy matching, the fault tolerance of the method can be improved while ensuring the accuracy of terminology normalization. In addition, after completing terminology normalization, the English letters in the document are unified to lowercase, and various unit symbols are unified to standardized notations, such as unifying m and M to m, KN and kN to kN, etc., finally obtaining a standardized document with unified format, standardized terminology, and clean content, providing high-quality data input for subsequent cross-version feature extraction and difference detection.
[0024] Step 102: Extract structural and semantic features from standardized documents to construct a multi-dimensional feature vector library.
[0025] It should be noted that the structural features in the embodiments of this application include page layout features and chapter tree structure features, and the semantic features include key entities and the location information of key entities in the document.
[0026] In this embodiment, after obtaining the standardized document, it is necessary to extract multi-dimensional features that can represent the core information of the building code document in order to construct a multi-dimensional feature vector library. The significant difference between building code documents and ordinary text files lies in their rigorous chapter hierarchy, standardized page layout, and numerous professional terms and technical parameters. Therefore, single-dimensional feature extraction cannot fully represent the core information of the document; it is necessary to extract features from both structural and semantic dimensions. Structural features include page layout features and chapter tree structure features, while semantic features include key entities and their location information within the document.
[0027] When extracting layout features, page images of each page in the standardized document are obtained and input into a pre-built layout analysis model. It should be noted that the layout analysis model is built based on deep learning object detection technology. The backbone network adopts a general object detection network structure, and its parameters have been specifically fine-tuned for the layout characteristics of building code documents, enabling it to accurately identify various common layout components in building code documents.
[0028] For example, layout components include heading components, paragraph components, table components, formula components, and diagram components. The layout analysis model performs inference calculations on each page image, outputting the component type, number of components, and pixel position of each component on each page. This output information is stored as layout features. Understandably, component pixel positions are typically represented using rectangular coordinates. For example, with the top-left corner of the page as the origin, the horizontal start coordinate, horizontal end coordinate, vertical start coordinate, and vertical end coordinate of each component on the page are recorded, thus accurately representing the spatial position and occupied area of each layout component on the page.
[0029] When extracting chapter tree structure features, the font size, bolding, and other formatting attributes of each text paragraph in the standardized document, as well as the heading numbering rules, are obtained. Building code documents typically have a clear chapter numbering system, with common numbering formats including Chapter X, XX, XXX, etc., representing hierarchical numbering. Based on font size, bolding attributes, and heading numbering rules, heading nodes at each level in the document can be identified. For example, first-level headings typically use a larger font size and are centered, numbered as Chapter X; second-level headings use a smaller font size and are left-aligned, numbered as XX; and so on.
[0030] After identifying the heading nodes at each level, a hierarchical relationship between them is established based on a parent-child node association algorithm. For each heading node, the preceding heading node with a lower hierarchical number is identified as the parent node, and the following heading node with a lower hierarchical number is identified as the child node, thus constructing a complete chapter tree from the first-level heading to the last-level heading. In the chapter tree, each chapter node stores core attributes such as node depth, parent-child node association, and the number of child nodes, thereby fully representing the logical organizational structure of the document. Simultaneously, for each specification clause in the document, a unique cross-version identifier is assigned, and an association mapping is established between the specification clause and the chapter node, recording which chapter node each clause belongs to. This ensures that during subsequent multi-version comparisons, even if the clause number changes due to chapter adjustments, accurate cross-version tracing of clauses can be achieved based on the unique cross-version identifier.
[0031] When extracting key entities and their location information, the text content of standardized documents is obtained, and word segmentation and part-of-speech tagging are performed on the text content. For example, a general Chinese word segmentation tool can be used, optimized based on the aforementioned three-dimensional terminology dictionary, thereby improving the accuracy and professional adaptability of word segmentation. Then, the word segmentation results are input into a pre-built entity recognition model. It should be noted that the entity recognition model is built based on deep learning sequence labeling technology. The basic structure can use a general pre-trained language model, and it has been fine-tuned using a large corpus of building code texts labeled with entity type tags, enabling it to accurately identify various professional key entities in building code documents. For example, key entities include semantic units carrying core information content such as professional terms, technical parameters, numerical indicators, material names, construction process names, and code reference clauses. The entity recognition model performs inference calculations on the word segmentation results, and the model outputs the identified key entities and the location information of each key entity in the document. Specifically, the location information includes the chapter number, paragraph number, and the starting character position within the paragraph, thereby achieving precise location of each key entity in the document.
[0032] After extracting the key entities and their location information, an entity database is constructed based on the aforementioned data. Specifically, in the entity database, a four-dimensional index relationship is established for each entity, encompassing entity type, entity content, document location, and cross-version identifier. This enables rapid retrieval and location of entities based on any of these dimensions. Simultaneously, a building code reference relationship graph is constructed based on the cross-standard reference clauses in the entity database. For example, when a standard clause in a certain version references other standards, such as requiring compliance with Article XX of GB / T XXXXX-XXXX, the reference relationship is recorded in the entity database as an association between the source clause and the referenced standard clause. By extracting and aggregating all cross-standard reference relationships in the full text, a directed graph structure with standard clauses as nodes and reference relationships as edges can be constructed—the building code reference relationship graph. The building code reference relationship graph provides a data foundation for subsequent association change detection. When a referenced standard clause changes, all source clauses referencing that clause can be quickly retrieved through the building code reference relationship graph.
[0033] Integrating the aforementioned page layout features, chapter tree structure features, entity database, and building code reference relationship graph constitutes a multi-dimensional feature vector library. It can be understood that this feature vector library comprehensively represents building code documents from both structural and semantic dimensions, providing accurate multi-dimensional feature support for subsequent cross-version difference detection.
[0034] Step 103: Based on the multi-dimensional feature vector library, perform difference monitoring on at least two versions of building code documents, detect the structural differences between versions at the structural, layout and content levels, and generate a list of structural differences.
[0035] In this embodiment, after constructing a multi-dimensional feature vector library for each version of building code documents, cross-version difference detection can be performed on at least two versions of building code documents based on this feature vector library. The difference detection is carried out from three dimensions: structural level, layout level, and content level. The detection of the three dimensions is independent of each other but complementary, and together constitutes a comprehensive detection of cross-version changes in building code documents.
[0036] Structural-level difference detection is based on chapter tree structure features. First-version first-level chapter tree structure features and second-version second-level chapter tree structure features are obtained from a multi-dimensional feature vector library. The chapter tree structure features fully represent the parent-child hierarchical relationship between headings at all levels in the document using a tree-like data structure. Each node corresponds to a chapter in the document, and each node stores attributes such as node depth, parent-child relationships, and the number of child nodes. The first and second chapter tree structure features are then converted into computer-processable first and second ordered tree structure features, respectively. In the ordered tree structure, the child nodes of each node are arranged according to their order of appearance in the document to ensure that the order relationship between sibling nodes is preserved in subsequent calculations.
[0037] Then, the minimum editing cost required to transform from the first ordered tree structure feature to the second ordered tree structure feature is calculated. Specifically, four basic editing operations are defined: node insertion, node deletion, node modification, and node movement. Node insertion refers to adding a node to the target tree that does not exist in the source tree, corresponding to adding a chapter in the new version of the document in a real-world scenario; node deletion refers to a node that exists in the source tree but not in the target tree, corresponding to deleting a chapter in the old version of the document in the new version in a real-world scenario; node modification refers to a node that exists in both the source and target trees and whose parent node relationship remains unchanged, but whose content has changed, corresponding to revising the text content of a chapter while its position remains the same in a real-world scenario; node movement refers to a node that exists in both the source and target trees but whose parent node has changed, corresponding to a chapter that has moved between different versions or belongs to different parent chapters in a real-world scenario.
[0038] It should be noted that the four editing operations mentioned above have different degrees of impact on the document structure, therefore different editing weights need to be assigned to different operations. For example, node insertion and deletion only involve the addition or removal of a single node, and their impact on the overall structure is relatively small; node modification only involves changes to the node's content without structural changes; node movement involves a node detaching from its original parent node and attaching to a new parent node, which may trigger the migration of the entire subtree, resulting in a significant impact on the document structure. Therefore, it is understandable that in practical implementation, the weights of the four editing operations can be dynamically configured according to the specific application scenario. A dynamic programming algorithm is used to calculate all possible editing schemes for transforming from the first ordered tree to the second ordered tree, and the scheme with the minimum total editing cost is selected as the optimal editing scheme. The sequence of editing operations corresponding to this minimum editing cost is the optimal editing operation sequence.
[0039] Based on the optimal editing operation sequence, all changed difference nodes can be located, and the difference type of each difference node can be identified according to the associated editing operation type. Difference types include new node type, deleted node type, modified node type, and moved node type. For each difference node, its node position in the chapter tree, difference type, and cross-version unique identifier of the specification clause associated with the node are marked, thereby generating structural level difference data, and incorporating the structural level difference into the structured difference list.
[0040] Page layout-level difference detection is based on page layout features. First-level page layout features of each page in the first version and second-level page layout features of each page in the second version are obtained from a multi-dimensional feature vector library. Page layout features include the component type, number of components, and pixel position of the components on each page. During detection, the page layout features of corresponding pages in the first and second versions are compared item by item.
[0041] First, compare the component types on the corresponding pages. When the set of component types appearing on a page is inconsistent between the two versions—for example, the old version of the page contains an icon component while the new version does not—it is directly marked as a component type difference. When the component types are the same, further compare the quantity of each component on the corresponding pages. For example, if the old version of the page contains two table components while the new version has three, it is marked as a component quantity difference.
[0042] When the component type and number are consistent, the pixel position deviation of the corresponding component is further calculated. Specifically, based on the pixel coordinates of the same component in both versions, the horizontal and vertical offsets of the component are calculated, and these two are combined into a pixel position deviation. When this pixel position deviation exceeds a preset deviation threshold, it is determined that the component has undergone a position adjustment between the two versions, and it is marked as a layout position adjustment difference. For example, the preset deviation threshold can be configured according to the actual detection accuracy requirements.
[0043] For layout components of type table, specific content validation is required. Specifically, the number of cells, row and column layout structure, and text content of each cell are extracted. This information is then compared item by item between the two versions to generate table difference data. For layout components of type formula, the identified formula content is converted into structured markup language format. The symbol sequences, numerical parameters, and operational logic structures in the structured markup language data of the two versions are then compared to generate formula difference data. For layout components of type illustration, the image hash value of the illustration is calculated. By comparing the image hash values of the first and second versions of the illustration, if the similarity between the two hash values is lower than a preset similarity threshold, it is determined that the illustration content has changed and is marked as an illustration content change difference. The differences in component type, number of components, layout position adjustment, table, formula, and illustration content change are integrated into layout-level differences and included in the structured difference list.
[0044] Content-level difference detection is based on text content and semantic features, including four sub-tasks: literal difference localization, key entity change detection, cross-specification reference association detection, and multi-version difference tracing.
[0045] When performing literal difference localization, the first text content of each chapter in the first version and the second text content of the corresponding chapters in the second version are obtained from a multi-dimensional feature vector library. Sentence boundaries are identified in the first and second text contents based on clause numbers, punctuation marks, and semantic pauses, generating a first sentence sequence and a second sentence sequence. For example, the sentence boundary identification rules include using clause numbers as the starting identifier of a new sentence; using punctuation marks such as periods, semicolons, and question marks as the ending identifier of a sentence; and segmenting sentences even if explicit punctuation marks are missing when there is a clear semantic shift and the subsequent content has a complete declarative structure. Then, the longest common subsequence algorithm is used to calculate the longest common subsequence of the first and second sentence sequences. The common subsequence represents sentences that remain unchanged between the two versions. Sentences that do not belong to the longest common subsequence are marked as candidate difference regions, meaning these sentences have changed between the two versions. For the text strings in the candidate difference regions, further character-level comparisons are performed to accurately locate the changed characters and distinguish the difference forms of the differing characters, including added characters, deleted characters, and modified characters. Mark the start and end positions of each differing character in the sentence to generate literal difference data.
[0046] When performing key entity change detection, the system retrieves the first entity database for the first version and the second entity database for the second version from a multi-dimensional feature vector library. A mapping relationship is established between entities in the first and second versions based on entity content, document location, and cross-version identifiers. This determines which entities refer to the same thing in both versions, thus achieving cross-version alignment of entities. For entities with established mapping relationships, the system compares whether their content has changed between the two versions to identify the change type of each entity. Change types include added entities, deleted entities, and modified entities. For example, when a technical parameter changes from 1.5 to 2.0, the entity is marked as a modified entity; when a technical parameter not present in the old version appears in the new version, the entity is marked as a added entity; when a term from the old version is removed in the new version, the entity is marked as a deleted entity. Based on the above change types of entities, an entity change matrix between versions is generated. This matrix, with the version as the dimension, records the existence status and content changes of each entity in each version.
[0047] When performing cross-standard citation correlation detection, a reference relationship graph of building codes is obtained from a multi-dimensional feature vector library. When a change is detected in a clause of a referenced source standard, based on the reference relationship graph, all other standard clauses that directly or indirectly reference that clause are retrieved in the reverse direction of the reference relationship. The scope of impact of the change in the referenced clause is marked, i.e., which other clauses need to be re-examined or modified due to the change in the referenced source clause, generating correlation change detection data. For example, when Clause 3.2 of Standard A references Clause 5.1 of Standard B, and a change in the technical parameters of Clause 5.1 of Standard B is detected, Clause 3.2 of Standard A is automatically marked as an affected clause, and the user is prompted to perform a compliance check.
[0048] For scenarios involving continuous comparisons of three or more versions, unique cross-version identifiers for clauses in each version are obtained from a multi-dimensional feature vector library. Based on these unique cross-version identifiers, the change history of each clause across versions is analyzed, detailing the changes to each clause in each version update from the earliest to the latest version, generating a complete change trajectory for that clause. Through this change trajectory, users can trace the entire lifecycle evolution of any clause. The aforementioned literal differences, entity change matrices, related change detection, and clause change trajectories are integrated into content-level difference data, which is then incorporated into a structured difference list.
[0049] Step 104: Visualize the structured difference list, generate difference visualization data and a standardized difference summary report, obtain user feedback annotations on the difference visualization data, fine-tune the parameters of the difference detection model based on the feedback annotations, and update the sample library.
[0050] In this embodiment, after generating the structured difference list, the test results need to be presented to the user in an intuitive and efficient manner, and the user should be able to review and provide feedback on the test results. At the same time, the system can be continuously optimized based on the feedback information.
[0051] First, the structural differences, layout differences, and content differences in the structured difference list are obtained. Then, the differences in the structured difference list are categorized and organized according to their types: structural differences, layout differences, and content differences. This allows for differentiated presentation strategies for different types of differences in the visualization interface. Simultaneously, the original page rendering data of multiple versions of the building code documents to be tested are obtained; that is, the page images or page view data rendered according to the original layout format of each version's original document. The page rendering data of the first and second versions are symmetrically arranged based on a left-right column layout, presenting the same source content of both versions on the same visual level. For multi-version comparison scenarios, column switching control is implemented based on version number data. Users can switch between the current benchmark and target versions by clicking different version number tags. Furthermore, a timeline traceability interface is generated based on the clause change trajectory, allowing users to view the complete change history of a specific clause across versions in a timeline view.
[0052] After completing the basic layout, a difference marker layer is overlaid on the corresponding page rendering data based on the difference location and type in the structured difference list. The difference marker layer is a semi-transparent annotation layer independent of the original page rendering data; it can be overlaid with the original page rendering data or displayed independently during user interaction. Specifically, for marked areas corresponding to newly added content, the first color data is used for highlighting, allowing users to intuitively identify the new content in the new version; for marked areas corresponding to deleted content, the second color data is used for highlighting, indicating that the content existed in the old version but has been deleted in the new version; for marked areas corresponding to modified content, the third color data is used for highlighting, indicating that the content exists in both versions but its description or parameter values have changed; for marked areas corresponding to layout-level differences, a bold border is used for highlighting, visually indicating changes in the position, quantity, or size of layout components.
[0053] Furthermore, to enable collaborative browsing of multiple document versions, synchronized scrolling control data is generated. When a user scrolls on either side of the document, synchronized scrolling displacement is calculated based on this data. This means calculating the target position that related content should reach in other documents based on the current document's scroll position. This synchronized scrolling displacement is then sent to the rendering components of the other documents, ensuring that the display areas of each document remain synchronized. This guarantees that when users browse different versions, content from the same chapters or clauses is always presented at the same visual height, facilitating comparison and viewing.
[0054] While completing the visualization rendering, the system formats and fills in the categorized structural, layout, and content differences according to a preset report template, generating a standardized difference summary table and an audit report. The standardized difference summary table lists all detected differences in tabular form, with each record including the chapter, type, description, and associated version information. The audit report, based on the difference summary table, adds comprehensive information such as a difference statistics overview, difference distribution analysis, and change impact assessment. Both the standardized difference summary table and the audit report support export in various document formats, such as portable document format, word processing software format, and spreadsheet format, to meet different user needs for document archiving and compliance reporting. The timeline traceability interface, difference marker layer, document synchronous scrolling control, and standardized difference summary table are integrated into complete difference visualization data, provided to users for auditing.
[0055] During the user's review of the visualized difference data, the system obtains user feedback annotations on the automatic detection results through an interactive interface. Feedback annotations refer to user records of confirmation, correction, and supplementation of the automatic detection results. For example, feedback annotation types include marking misjudged differences (where the system marks a difference but it is not actually a difference); supplementing missed differences (where the system failed to detect differences that actually exist); correcting the difference type determination (where the user corrects the system's classification of the difference type when it does not match the actual situation); improving the difference description information (where the user supplements and refines the difference description); and marking the scope of the difference's associated impact (where the user marks other specification clauses or engineering processes that a change may affect). Feedback annotation data reflects the deviation between the automatic detection results and actual engineering judgments and is an important data resource for optimizing system performance.
[0056] After obtaining user feedback annotations, the core models and algorithms involved in difference detection are fine-tuned based on these annotations. Specifically, the fine-tuning targets include: First, the layout analysis model, which is incrementally fine-tuned by including page image samples containing feedback annotations in the training set to improve its recognition accuracy of special components such as tables, formulas, and diagrams in building codes; Second, the entity recognition model, which is incrementally fine-tuned by including text samples containing feedback annotations in the training set to improve its recognition accuracy and recall rate of professional entities in the building industry; Third, the weight allocation parameters of the tree edit distance algorithm, which dynamically adjust the weight values of four editing operations—node insertion, deletion, modification, and movement—based on user feedback on structural difference detection results, making the structural difference detection results more consistent with the actual changes in building codes; Fourth, the sentence segmentation rule parameters in the longest common subsequence algorithm, which optimize the sentence boundary recognition rules based on user feedback on literal difference detection results, improving the accuracy of character-level difference localization. It should be noted that the fine-tuning period can be flexibly configured, for example, it can be triggered periodically according to a preset time period, or it can be triggered when the accumulated number of feedback annotation samples reaches a preset threshold.
[0057] In addition, incremental updates are performed on the sample library simultaneously. Specifically, user-approved feedback-annotated samples are added to the sample library, newly released building code texts are added as new training data, newly identified building terms are added to the 3D terminology dictionary, and newly discovered entity information is added to the entity database. The sample library is categorized and managed according to code specialization, version type, and difference type to improve the targeting and efficiency of subsequent model training and feature extraction. Through the closed-loop iterative optimization mechanism of manual feedback, model fine-tuning, and incremental updates to the sample library, the system can continuously adapt to the updates and changes in building codes, constantly improving the accuracy and robustness of difference detection.
[0058] The above are embodiments of the method proposed in this application. Based on the same inventive concept, embodiments of this application also provide an intelligent detection device for multiple versions of building code documents with the following structure. Figure 2 As shown.
[0059] Figure 2 This is a schematic diagram of the internal structure of an intelligent detection device for multiple versions of building code documents, provided as an embodiment of this application. Figure 2 As shown, the device includes: At least one processor; And, a memory that is communicatively connected to at least one processor; The memory stores instructions that can be executed by at least one processor, and the instructions, when executed by at least one processor, enable at least one processor to: Obtain at least two versions of building code documents to be tested, perform format parsing and structuring processing on each version of the building code document, generate a structured document object model with a unified format, and perform noise cleaning and terminology normalization processing on the structured document object model to obtain a standardized document. Structural and semantic features are extracted from standardized documents to construct a multi-dimensional feature vector library. Structural features include page layout features and chapter tree structure features, while semantic features include key entities and their location information in the document. Based on a multi-dimensional feature vector library, differences are monitored for at least two versions of building code documents. The structural differences between the versions are detected at the structural, layout and content levels, and a list of structural differences is generated. The structured discrepancy list is visualized and rendered to generate discrepancy visualization data and a standardized discrepancy summary report. User feedback annotations on the discrepancy visualization data are obtained. Based on the feedback annotations, the parameters of the discrepancy detection model are fine-tuned and the sample library is updated.
[0060] This application also provides a non-volatile computer storage medium storing computer-executable instructions, which, when executed, can: Obtain at least two versions of building code documents to be tested, perform format parsing and structuring processing on each version of the building code document, generate a structured document object model with a unified format, and perform noise cleaning and terminology normalization processing on the structured document object model to obtain a standardized document. Structural and semantic features are extracted from standardized documents to construct a multi-dimensional feature vector library. Structural features include page layout features and chapter tree structure features, while semantic features include key entities and their location information in the document. Based on a multi-dimensional feature vector library, differences are monitored for at least two versions of building code documents. The structural differences between the versions are detected at the structural, layout and content levels, and a list of structural differences is generated. The structured discrepancy list is visualized and rendered to generate discrepancy visualization data and a standardized discrepancy summary report. User feedback annotations on the discrepancy visualization data are obtained. Based on the feedback annotations, the parameters of the discrepancy detection model are fine-tuned and the sample library is updated.
[0061] The various embodiments in this application are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for IoT devices and media are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0062] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A method for intelligent detection of differences between multiple versions of building code documents, characterized in that, The method includes: At least two versions of building code documents to be tested are obtained. The format of each version of the building code document is parsed and structured, generating a structured document object model with a unified format. The structured document object model is then subjected to noise cleaning and terminology normalization to obtain a standardized document. Structural and semantic features are extracted from the standardized document to construct a multi-dimensional feature vector library; the structural features include page layout features and chapter tree structure features, and the semantic features include key entities and their location information in the document. Based on the multi-dimensional feature vector library, differences are monitored for at least two versions of building code documents. Structural differences between versions are detected at the structural, layout and content levels, and a list of structural differences is generated. The structured difference list is visualized and rendered to generate difference visualization data and a standardized difference summary report. User feedback annotations on the difference visualization data are obtained. Based on the feedback annotations, the parameters of the difference detection model are fine-tuned and the sample library is updated.
2. The intelligent detection method for multiple versions of building code documents according to claim 1, characterized in that, Each version of the building code document undergoes format parsing and structuring to generate a unified structured document object model, specifically including: When the building code document is a standard format PDF document, an optical character recognition engine is used to recognize the text on the document page and extract the text content and the corresponding page coordinates. When the building code document is a standard format Word document, the document parsing tool is used to parse the markup language structure of the document and extract the text content and format attributes; When the building code document is a scanned PDF document, the scanned image is preprocessed, and the text is recognized by an optical character recognition engine to extract the text content and the corresponding page coordinates. The image preprocessing includes noise reduction, tilt correction and image enhancement. When the building code document is a handwritten annotation document, the handwriting recognition engine is called to recognize the annotation area and extract the handwritten annotation text; The extracted text content, page coordinates, format attributes, and handwritten annotations are integrated into structured data and encapsulated according to a preset data model to generate a structured document object model with a unified format.
3. The intelligent detection method for multiple versions of building code documents according to claim 1, characterized in that, The structured document object model is subjected to noise cleaning and terminology normalization to obtain a standardized document, specifically including: Based on the page elements in the structured document object model, the header, footer and watermark in the structured document object model are identified and deleted to generate denoised document content; The text string in the denoised document content is obtained, whitespace characters and special symbols in the text string are filtered out, and typos and omissions generated during the text recognition process are corrected to obtain clean text; The terminology in the clean text is obtained, and the terminology is matched and mapped based on a preset three-dimensional terminology dictionary. The successfully matched terminology is converted into standardized terminology expressions. The three-dimensional terminology dictionary includes a general dictionary, a professional sub-dictionary, and a regional sub-dictionary. For suspected terms that failed to match, the cosine similarity between the suspected terms and each term in the three-dimensional term dictionary is calculated, and based on the cosine similarity between the word vectors, the suspected terms that successfully matched are converted into the corresponding standardized term expressions. Standardize the capitalization of English letters and unit symbols in the text after terminology normalization to obtain a standardized document.
4. The intelligent detection method for multiple versions of building code documents according to claim 1, characterized in that, Structural and semantic features are extracted from the standardized documents to construct a multi-dimensional feature vector library, specifically including: The page image of each page in the standardized document is obtained, and the page image is input into a pre-built layout analysis model. The layout analysis model identifies the component type, number of components and pixel position of each layout component in each page, and stores them as layout features. The layout components include title components, paragraph components, table components, formula components and figure components. Based on the font size, bolding attribute, and heading numbering rules in the standardized document, heading nodes at all levels are identified, and hierarchical relationships between heading nodes are established through a parent-child node association algorithm to generate chapter tree structure features; each chapter node stores node depth, parent node association relationship, and number of child nodes. Obtain the standard clauses in the standardized document, assign a unique cross-version identifier to each standard clause, and establish an association mapping between the standard clauses and chapter nodes; The text content in the standardized document is obtained, and the text content is processed by word segmentation and part-of-speech tagging. The word segmentation results are input into a pre-built entity recognition model, and the entity recognition model outputs key entities and their position information in the document. The position information includes chapter number, paragraph number, and starting character position. An entity database is constructed based on the key entities and the location information, a four-dimensional indexed entity database is established, and a building code reference relationship graph is constructed based on the cross-code reference clauses in the entity database; the four-dimensional index relationship includes entity type, entity content, document location, and cross-version identifier; The page layout features, the chapter tree structure features, the entity database, and the building code reference relationship graph are integrated into a multi-dimensional feature vector library.
5. The intelligent detection method for multiple versions of building code documents according to claim 1, characterized in that, Based on the aforementioned multi-dimensional feature vector library, difference monitoring is performed on at least two versions of building code documents. At the structural level, structural differences between versions are detected, and a list of structural differences is generated, specifically including: Obtain the first chapter tree structure features of the first version and the second chapter tree structure features of the second version from the multi-dimensional feature vector library, convert the first chapter tree structure features and the second chapter tree structure features into first ordered tree structure features and second ordered tree structure features, and retain the node depth, parent node association relationship and child node number of each node in the ordered tree structure features; Calculate the minimum editing cost required to transform the first ordered tree structure feature into the second ordered tree structure feature, and assign editing weights to node insertion, node deletion, node modification, and node movement operations respectively; The difference nodes are located by the editing operation sequence corresponding to the minimum editing cost, and the number of difference types of each difference node is identified; the difference type data includes the type of newly added node, the type of deleted node, the type of modified node, and the type of moved node. For each difference node, mark its location, difference type, and associated clause identifier to generate structural-level differences, and include the organizational-level differences in the structured difference list.
6. The intelligent detection method for multiple versions of building code documents according to claim 1, characterized in that, Based on the aforementioned multi-dimensional feature vector library, difference monitoring is performed on at least two versions of building code documents. At the layout level, structural differences between versions are detected, and a list of structural differences is generated, specifically including: The first layout features of each page in the first version and the second layout features of each page in the second version are obtained from the multi-dimensional feature vector library; the layout features include the component type, number of components and pixel position of the layout components in each page; The component types of the corresponding pages in the first layout feature and the second layout feature are compared. When the component types are inconsistent, they are marked as component type differences. When the component types are consistent, the number of components on the corresponding pages is compared. When the number of components is inconsistent, it is marked as component number differences. When the component type and the number of components are the same, the pixel position deviation of the corresponding component is calculated. When the pixel position deviation exceeds the preset deviation threshold, it is marked as a difference in the layout position adjustment. For layout components of type table, extract the number of cells, row and column layout, and cell content of the table, and compare them to generate table differences; For layout components of type formula, the identified formula is converted into structured markup language format data, and the symbols, values and operation logic in the structured markup language format data are compared to generate formula differences; For layout components of type illustration, calculate the image hash value of the illustration and compare the image hash value of the first version illustration with the image hash value of the second version illustration. When the similarity of the hash values is lower than the preset similarity threshold, it is marked as a difference in the illustration content. The differences in component type, component quantity, layout position, table, formula, and illustration content are integrated into layout-level differences, and these layout-level differences are included in a structured difference list.
7. The intelligent detection method for multiple versions of building code documents according to claim 1, characterized in that, Based on the aforementioned multi-dimensional feature vector library, difference monitoring is performed on at least two versions of building code documents. At the content level, structural differences between versions are detected, and a list of structural differences is generated, specifically including: The first text content of each chapter of the first version and the second text content of the corresponding chapter of the second version are obtained from the multi-dimensional feature vector library. Sentence boundaries of the first text content and the second text content are identified based on clause number, punctuation marks and semantic pauses to generate a first sentence sequence and a second sentence sequence. Calculate the longest common subsequence of the first sentence sequence and the second sentence sequence, and mark sentences that do not belong to the longest common subsequence as candidate difference regions; The text strings in the candidate difference region are compared at the character level to locate the difference characters and distinguish the difference forms of the difference characters. The start position data and end position data of each difference character in the sentence are marked to generate literal differences. The difference forms include added character type, deleted character type and modified character type. The first entity database of the first version and the second entity database of the second version are obtained from the multi-dimensional feature vector library. A mapping relationship between the entities of the first version and the entities of the second version is established based on entity content, document location and cross-version identifier. The entity content of the entities with established mapping relationship is compared, the change type of each entity is identified, and an entity change matrix between versions is generated based on the change type. The change type includes new entity type, deleted entity type and modified entity type. The building code reference relationship map is obtained from the multi-dimensional feature vector library. When a change is detected in a clause of the referenced source code, the referenced code clause is retrieved based on the building code reference relationship map, and the scope of the impact of the change in the referenced clause is marked to generate associated change detection. For continuous comparisons of three or more versions, based on the cross-version unique identifier of the clauses in each version, the change records of each clause in each version are obtained, and the clause change trajectory is generated. The literal differences, the entity change matrix, the associated change detection, and the clause change trajectory are integrated into content-level differences, and these content-level differences are included in a structured difference list.
8. The intelligent detection method for multiple versions of building code documents according to claim 1, characterized in that, The structured discrepancy list is visualized and rendered to generate discrepancy visualization data and a standardized discrepancy summary report. User feedback and annotations on the discrepancy visualization data are obtained, specifically including: Obtain the structural differences, layout differences, and content differences from the structured difference list, and classify and organize each difference item in the structured difference list according to the difference type; the difference type includes structural difference type, layout difference type, and content difference type. The system acquires the original page rendering data of multiple versions of building code documents to be tested, and arranges the page rendering data of the first version and the page rendering data of the second version symmetrically based on the left and right column layout. For multi-version comparison scenarios, the system controls the column switching based on the version number and generates a timeline traceability interface based on the clause change trajectory. Based on the location and type of differences in the structured difference list, a difference marker layer is overlaid on the corresponding page rendering data. The marker area corresponding to deleted content is highlighted using the second color data, the marker area corresponding to modified content is highlighted using the third color data, and the marker area corresponding to layout differences is highlighted with a thick border. The marker area corresponding to newly added content in the difference marker layer is highlighted using the first color. Generate document synchronous scrolling control, and when a user is detected to be scrolling on either side of the document, calculate synchronous scroll displacement based on the scrolling operation, and send the synchronous scroll displacement to the rendering component of the other side of the document so that the display areas of each side of the document remain synchronously corresponding. The structural, layout, and content differences are formatted and filled according to the preset report template to generate a standardized difference summary table and an audit report. The timeline traceability interface, the difference marker layer, the document synchronous scrolling control, and the standardized difference summary table are then integrated into difference visualization data.
9. A smart detection device for differences between multiple versions of building code documents, characterized in that, The device includes: At least one processor; And, a memory communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor, which are executed by the at least one processor to enable the at least one processor to perform the intelligent detection method for multiple versions of building code documents as described in any one of claims 1-8.
10. A non-volatile computer storage medium storing computer-executable instructions, characterized in that, When the computer-executable instructions are executed, they implement the intelligent detection method for multiple versions of building code documents as described in any one of claims 1-8.