Method and device for determining validity of document, electronic device and storage medium

By parsing code files and documentation information, the system automatically analyzes the matching between code and documentation, solving the problem of code-document mismatch, improving R&D efficiency and reducing costs.

CN115509543BActive Publication Date: 2025-11-04BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211352730.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-31
Publication Date
2025-11-04
Estimated Expiration
2042-10-31

AI Technical Summary

Technical Problem

In collaborative work among multiple R&D personnel, mismatches between code and documentation can lead to low R&D efficiency and increased costs. Existing technologies lack effective methods to determine the validity of documentation.

Method used

By parsing the target code file and target documentation, relevant information is identified and compared. The system automatically analyzes whether the component's code matches the documentation, checks the validity of the documentation, and ensures that the documentation is updated in a timely manner.

Benefits of technology

It improved product development efficiency, reduced development costs, ensured users received accurate documentation, and enhanced the efficiency of team collaboration processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115509543B_ABST
    Figure CN115509543B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method and device for determining the validity of a document, electronic equipment and storage medium, relating to the technical field of computer, and particularly to the field of APP products. The specific implementation scheme is: determining first information related to a target code file according to the target code file; determining second information related to a target document according to the target document corresponding to the target code file; and comparing the first information and the second information to obtain the validity of the target document.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, in particular to the field of APP product, and more particularly, the present disclosure provides a method and device for determining validity of a document, an electronic device, a storage medium and a computer program product. BACKGROUND

[0002] With the development of Internet technology, smart devices such as mobile phones have been popularized among users. Software products such as application programs (APP) can be installed in smart devices to provide services to users. During the development of software products, developers need to write codes and documents. The documents are used to explain the usage of the codes, for example, the documents can explain the interfaces and dependency relationships in the codes.

[0003] Some products provide services to users for a long time. With the accumulation of time, the size of the codes increases continuously, but the documents corresponding to the codes are missing or not updated in time, resulting in a mismatch between the codes and the documents. Therefore, during the collaborative work of multiple developers, the developers cannot use the codes correctly based on the documents, which affects the development efficiency and increases the development cost. SUMMARY

[0004] The present disclosure provides a method and device for determining validity of a document, an electronic device and a storage medium.

[0005] According to an aspect of the present disclosure, a method for determining validity of a document is provided, including: determining first information related to a target code file according to the target code file; determining second information related to a target document corresponding to the target code file according to the target document; and comparing the first information and the second information to obtain the validity of the target document.

[0006] According to another aspect of the present disclosure, a device for determining validity of a document is provided, including: a first determining module, a second determining module and a comparing module. The first determining module is configured to determine first information related to a target code file according to the target code file. The second determining module is configured to determine second information related to a target document corresponding to the target code file according to the target document. The comparing module is configured to compare the first information and the second information to obtain the validity of the target document.

[0007] According to another aspect of the present disclosure, an electronic device is provided, including: at least one processor; and a memory connected to the at least one processor in communication. The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method provided by the present disclosure.

[0008] According to another aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to make a computer execute the method provided by the present disclosure.

[0009] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method provided by the present disclosure.

[0010] It should be understood that the contents described in this part are not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0011] The accompanying drawings are used to better understand the present scheme, and do not constitute a limitation on the present disclosure. Among them:

[0012] Figure 1 is an application scenario diagram of the method and device for determining the validity of a document according to an embodiment of the present disclosure;

[0013] Figure 2 is a schematic flow chart of the method for determining the validity of a document according to an embodiment of the present disclosure;

[0014] Figure 3A is a schematic principle diagram of the method for determining the validity of a document according to an embodiment of the present disclosure;

[0015] Figure 3B is a schematic principle diagram of determining the validity of a document;

[0016] Figure 3C is a schematic principle diagram of determining the invalidity of a document;

[0017] Figure 4 is a schematic structural block diagram of the device for determining the validity of a document according to an embodiment of the present disclosure; and

[0018] Figure 5 is a structural block diagram of an electronic device for implementing the method for determining the validity of a document according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0019] Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, which include various details of the embodiments of the present disclosure to help understanding, and should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Also, in order to be clear and concise, the description below omits the description of well-known functions and structures.

[0020] It can be understood that as the product scale increases, the product can be developed in a componentized manner, for example, developers can each develop a component that they are responsible for, and different components can depend on and call each other. In the process of developing the components, the developers need to write code and documents. The documents can represent a manual for using the code, and the documents are used to explain the manner of using the code, for example, the documents can explain interfaces, descriptions, calls, parameters, return values, and the like related to the code.

[0021] However, in actual application, developers pay attention to the writing of code and ignore the writing of documents, and there is a lack of a work link of checking whether the documents are accurate, and a problem of mismatch between the documents and the code occurs. For example, a developer only writes code and does not write documents, resulting in missing documents. Or after a developer updates a code version, the developer fails to update the documents corresponding to the code in a timely manner, resulting in inaccurate document content. When the documents and the code are mismatched, a user (for example, another developer) cannot accurately know the manner of using the code based on the documents, resulting in low collaboration efficiency, and thus delaying the development cycle of the product and increasing the development cost.

[0022] Embodiments of the present disclosure aim to provide a method for determining document effectiveness, which can automatically analyze whether the code of a component matches the documents, check the effectiveness of the documents, determine whether the documents corresponding to the code are updated in a timely manner when the code of the component is released, and discover problems of inaccurate manner of use, dependency relationship, and the like in the documents in a timely manner, so as to ensure that a user obtains correct documents, thereby improving the development efficiency of the product and reducing the development cost.

[0023] The technical solutions provided by the present disclosure will be described in detail below with reference to the accompanying drawings and specific embodiments.

[0024] Figure 1 is an application scenario diagram of the method and device for determining document effectiveness according to the embodiments of the present disclosure.

[0025] It should be noted that Figure 1 The system architecture shown is only an example of a system architecture to which the embodiments of the present disclosure can be applied, to help those skilled in the art understand the technical content of the present disclosure, but does not mean that the embodiments of the present disclosure cannot be used for other devices, systems, environments or scenarios.

[0026] As Figure 1 shown, the system architecture 100 according to the embodiment can include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide a communication link between the terminal devices 101, 102, 103 and the server 105. The network 104 can include various connection types, such as wired and / or wireless communication links, and the like.

[0027] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. The terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, etc.

[0028] The server 105 can be a server providing various services, for example, a background management server supporting a website browsed by the user using the terminal devices 101, 102, 103 (only as an example). The background management server can analyze and process the received user request data, etc., and feed back the processing results (for example, the validity of the target document generated according to the corresponding target code file and target document, etc.) to the terminal device.

[0029] It should be noted that the method for determining the validity of the document provided by the embodiments of the present disclosure can generally be executed by the server 105. Accordingly, the apparatus for determining the validity of the document provided by the embodiments of the present disclosure can generally be arranged in the server 105. The method for determining the validity of the document provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105. Accordingly, the apparatus for determining the validity of the document provided by the embodiments of the present disclosure can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and / or the server 105.

[0030] It should be understood that the number of terminal devices, networks and servers in Figure 1 is only illustrative. According to the needs of implementation, there can be any number of terminal devices, networks and servers.

[0031] Figure 2 is a schematic flowchart of the method for determining the validity of the document according to the embodiments of the present disclosure.

[0032] As shown in Figure 2 , the method 200 for determining the validity of the document can include operations S210-S230.

[0033] At operation S210, according to the target code file, first information related to the target code file is determined.

[0034] For example, the code repository can include a plurality of code files, which can include header files, interface files, etc. Some of the code files in the code repository can be publicly disclosed and called by the user, and the other code files can not be publicly disclosed.

[0035] The code files in the code repository can be determined as target code files according to actual needs. For example, all code files in the code repository can be determined as target code files, or only part of the code files in the code repository can be determined as target code files, such as code files that are disclosed.

[0036] The first information can represent information related to the target code file. For example, the first information can include at least one of the following: module information described by the target code file, dependency relationship between modules, hierarchical relationship of modules, version number, class, interface information (such as disclosed interface), variable (such as disclosed variable), global function, global variable, macro definition, constant. The first information can be obtained by parsing the target code, for example.

[0037] In operation S220, second information related to the target document is determined according to the target document corresponding to the target code file.

[0038] For example, the target document can represent a user manual of the target code file, used to describe the usage of the target code file. For example, the target document records the modules in the target code file, the dependency relationship between the modules, the hierarchical relationship of the modules, the version number, the class, the interface information, etc. The target document can record information related to the target code file through at least one of text and pictures, such as at least one of text and interface call relationship diagram to record interface information. It can be understood that one target document can correspond to multiple target code files, such as using one target document to describe the usage of multiple target code files.

[0039] The second information can represent information recorded in the target document. For example, the second information can include at least one of the following: module information recorded in the target document, dependency relationship between modules, hierarchical relationship of modules, version number, class, interface information (such as disclosed interface), variable (such as disclosed variable), global function, global variable, macro definition, constant. The second information can be obtained by parsing the text and / or pictures in the target document, for example.

[0040] In operation S230, the first information and the second information are compared to obtain the validity of the target document.

[0041] It should be noted that the first information can represent the full information M_F1 related to the target code file, or the information M_C1 changed with respect to the previous version file of the target code file. Similarly, the second information can represent the full information M_F2 related to the target document, or the information M_C2 changed with respect to the previous version document of the target document.

[0042] In the process of comparison, the full quantity information M_F1 can be compared with the full quantity information M_F2, the change information M_C1 can be compared with the change information M_C2, or the change information M_C1 can be compared with the full quantity information M_F2.

[0043] After comparison, it can be determined that the target document is valid when the first information and the second information are consistent. It can be determined that the target document is invalid when the first information and the second information are inconsistent.

[0044] According to the technical scheme provided by the embodiment of the present disclosure, the first information and the second information are determined from the target code file and the target document, and then the first information and the second information are compared. Whether the first information and the second information are consistent is determined to determine whether the target document is valid. In actual application, the R&D personnel can be prompted to modify the invalid target document in time, so as to ensure that the correct target document is obtained by using the method, improve the collaboration efficiency of the team collaboration process, reduce unnecessary communication cost, and improve the R&D efficiency of the software product.

[0045] According to another embodiment of the present disclosure, the target code file can be determined from the code repository before the first information is determined. The embodiment of the present disclosure does not limit the way of determining the target code file from the code repository.

[0046] For example, the predetermined configuration information can be preconfigured, and the predetermined configuration information can indicate the identifier of the code file disclosed to the outside. Then, the target code file can be determined from the code repository according to the predetermined configuration information.

[0047] For another example, at least one predetermined storage path can be preconfigured, and the code file disclosed to the outside can be stored in the predetermined storage path. Then, the code file in the predetermined storage path can be determined as the target code file.

[0048] According to the technical scheme provided by the embodiment of the present disclosure, the predetermined configuration information can be preconfigured, or the code file to be parsed can be stored in the predetermined storage path. Therefore, the target code file can be flexibly determined according to actual needs.

[0049] According to another embodiment of the present disclosure, the operation of determining the first information related to the target code file according to the target code file can include the following operations: parsing the target code file to obtain first raw data. The previous version file of the target code file can be parsed to obtain second raw data. Then, the first information is determined according to the first raw data and the second raw data.

[0050] For example, the information that the second original data is changed relative to the first original data is determined as the first information. It can be seen that the first information reflects what changes have occurred in the newly released target code file, and the form of the changes can include addition, deletion, and modification. It can be understood that in actual application, a smaller modification can be made to the software product of the previous version, and therefore the amount of information that is changed is smaller.

[0051] The embodiments of the present disclosure respectively parse the target code file of the current version and the code file of the previous version, and then determine the first information by the changes between the first original information and the second original information. Therefore, when the comparison operation is performed subsequently, the full amount of information related to the target code file does not need to be compared, thereby reducing the data processing amount and providing processing efficiency.

[0052] It should be noted that the embodiments of the present disclosure do not limit the manner of parsing the code file. The manner of parsing the code file is described below by taking the code file to be parsed as the first code file as an example, and the manner of taking the code file to be parsed as the previous version file of the target code file is not described again.

[0053] In one example, the operation of parsing the target code file to obtain the first original data can include the following operation: a programming language is pre-configured, and the target code file is parsed according to the syntax of the pre-configured programming language. For example, the pre-configured programming language of the target code file is C++, and the target code file is parsed according to the syntax of the C++ language.

[0054] In another example, the operation of parsing the target code file to obtain the first original data can include the following operation: the programming language of the target code file is determined according to at least one of the extension name of the target code file, the implementation file, and the code content, and then the target code file is parsed according to the syntax corresponding to the programming language to obtain the first original data.

[0055] For example, the programming language can be determined according to the extension name of the target code file. For example, when the extension name of the target code file is.h, the programming language is C language or C++ language or OC (Objective C) language. For example, when the extension name is.swift, the programming language is swift language, and when the extension name is.java, the programming language is java language.

[0056] For example, the programming language can be determined according to the implementation file. For example, when the extension of the object code file is.h, the programming language can be C or C++ or OC (Objective C), wherein the object code file written in C language can be implemented in a file with the extension.c, the object code file written in C++ language can be implemented in a file with the extension.cpp, and the object code file written in OC language can be implemented in a file with the extension.m or.mm.

[0057] For example, the programming language can be determined according to the content of the object code file, which can include syntax. For example, when the object code file is a header file, a class (class) usually does not exist in C language, a class written as class exists in C++ language, and a class written as @class or @interface exists in OC language.

[0058] According to the embodiment of the present disclosure, the programming language is determined according to at least one of the extension, the implementation file and the code content, and then the object code file is parsed according to the syntax corresponding to the programming language, so that the first original information can be obtained accurately and comprehensively.

[0059] In addition, since each programming language corresponds to a syntax, the accuracy of the parsing result can be further improved based on the syntax for parsing the object code file.

[0060] According to another embodiment of the present disclosure, the operation of determining the second information related to the target document according to the target document corresponding to the object code file can include the following operation: determining the second information according to the image information in the target document.

[0061] For example, the target document can include text information and image information, and the image information can include at least one of a dependency graph, an architecture diagram, a class diagram and an interface call flow diagram.

[0062] For example, the dependency image in the image information can be recognized to obtain the module information and the dependency relationship between the modules in the second information. For example, the dependency image can be recognized by OCR (Optical Character Recognition) to extract the text information in the image. The direction of the arrow can also be recognized by target detection to determine the dependency order. It can be understood that if the first module depends on the second module in the object code file, the text information extracted from the target document needs to include the first module and the second module, and if the first module and / or the second module cannot be extracted from the document, it means that the target document does not match the object code and the target document is invalid.

[0063] For example, the image of the architecture diagram in the image information can be recognized to obtain the module hierarchical relationship in the second information. For example, the login component includes a network module, an input module, a security protection module, and a prompt module. In the architecture diagram, the login component corresponds to a larger box, and the box has smaller boxes corresponding to each module respectively. For example, the module information is obtained by recognizing the text in the image through OCR. The box lines in the image can also be recognized, and the module hierarchical relationship can be obtained based on the nesting relationship of the box lines.

[0064] For example, the image of the class diagram in the image information can be recognized to obtain the class information and the relationship between classes in the second information. For example, the class information can include public methods, public member variables, private methods, private member variables, protected methods, and protected member variables. The user can use the class information of the public type, and can also use the class information of the protected type through inheritance. The class information can be obtained by performing OCR recognition on the class diagram, and the relationship between classes can be determined based on the arrows between the class information in the image.

[0065] For example, the image of the interface calling flowchart in the image information can be recognized to obtain the interface information and the calling relationship between interfaces in the second information. For example, by recognizing the interface calling flowchart, the use flow and other information of the interface can be recognized. The definition, use case, and other interface information of the interface can also be recognized from the document.

[0066] In actual applications, some information is recorded in both the text and the image in the document, and some information is recorded only in the image. According to the image in the document, the second information can be recognized in the embodiment of the disclosure. Compared with the way of obtaining the second information by only recognizing the text in the target document, the embodiment of the disclosure uses the image to expand the determined second information, so that more comprehensive and accurate second information can be obtained from the target document.

[0067] According to another embodiment of the present disclosure, the first information includes a plurality of first sub-information, for example, the first information includes the following first sub-information: interface information, dependency relationship and version number described by the target code file. The second information includes a plurality of second sub-information, for example, the second information includes the following second sub-information: interface information, dependency relationship and version number recorded by the target file. Accordingly, the operation of comparing the first information and the second information to obtain the validity of the target document can include the following operations: determining a plurality of sub-information pairs according to the plurality of first sub-information and the plurality of second sub-information, each sub-information pair including first sub-information and second sub-information corresponding to the same category. In the case of determining a plurality of sub-information pairs, the first sub-information and the second sub-information included in each sub-information pair are consistent, it is determined that the target document is valid. In the case of determining a plurality of sub-information pairs, the first sub-information and the second sub-information included in at least one sub-information pair are inconsistent, it is determined that the target document is invalid.

[0068] For example, the interface information described by the target code file and the interface information recorded by the target file are determined as a sub-information pair, and the version number described by the target code file and the version number recorded by the target file are determined as another sub-information pair. Then, the two sub-information included in each sub-information pair are compared.

[0069] The embodiment of the present disclosure can compare the first sub-information and the second sub-information of the same category, and determine the validity of the target document according to the comparison results of a plurality of sub-information pairs, so as to comprehensively compare the first information and the second information, and accurately determine whether the target document is valid.

[0070] Figure 3A is a schematic principle diagram of the method for determining the validity of the document according to the embodiment of the present disclosure, Figure 3B is a schematic principle diagram of determining the validity of the document, Figure 3C is a schematic principle diagram of determining the invalidity of the document.

[0071] As shown in Figures 3A-3C , the following will be described in detail in combination with specific examples.

[0072] For example, a certain software product includes modules A, B and C, and module A depends on modules B and C.

[0073] The code file corresponding to module A includes code file A1 and code file A2 which are publicly disclosed, wherein the code file A1 includes the disclosed interfaces A11, A12 and A13, the code file A2 includes the disclosed interfaces A21 and A22, and the version number of the code file corresponding to module A before product update is 1.8.0.

[0074] The document corresponding to module A is A.doc, in which the usage instructions of interfaces A11, A12, A13 in code file A1 and the usage instructions of interfaces A21, A22 in code file A2 are recorded, and the usage instructions of the interfaces can include the interface, description, call, parameter, return value, etc. The dependency instructions of module A to modules B and C are also recorded in document A.doc, and the current version information is also recorded.

[0075] During the development process, the developer updates the software product. For example, interface A11 is updated to interface A11', interface A12 is deleted, code file A2 is deleted, code file A3 is added, and interface A31 is included in code file A3. For the dependency relationship between modules, module B is deleted, module D is added, and the version number is changed to 1.9.0.

[0076] As shown in Figure 3A The method provided by the embodiment of the disclosure can first determine the updated code file corresponding to module A from the code repository 301 according to at least one of the predetermined configuration information and the predetermined storage path, and the updated code file is the target code file 302 in the foregoing. Then, the updated code file is parsed based on the extension name of the code file, the implementation file, the code content, the syntax 303, etc., to obtain the first original information 304 related to the updated code file. The code file of the previous version can also be parsed to obtain the second original information 305. Then, the first information 306 is determined according to the first original information 304 and the second original information 305, for example, the information changed relative to the previous version of the current version is determined as the first information, and the changed information can include interface information, dependency information, version number, etc.

[0077] For example, the changed interface information can include: A11 interface deletion, new interface A11' addition, interface A12 deletion, code file A2 deletion, interfaces A21, A22 deletion, code file A3 addition, and interface A31 addition.

[0078] For example, the changed dependency information can include: deletion of the dependency of module A to module B, and addition of the dependency of module A to module D.

[0079] Next, the target document 307 corresponding to the changed module A can be parsed, for example, at least one of the text and the image in the target document 307 is recognized, so as to obtain the second information 308 recorded in the target document 307.

[0080] Next, the first information 306 and the second information 308 can be compared to determine the validity 309 of the target document 307.

[0081] For example, the interface information in the first information 306 and the interface information in the second information 308 can be compared. For instance, if target document 307 is valid, deleting interface A11 from target code file 302 will result in no record related to interface A11 in target document 307. Adding interface A11' to target code file 302 will result in a record related to interface A11' in target document 307, which may include text descriptions, public parameters, return values, etc. Deleting code file A2 will result in no description related to code file A2 in target document 307. Adding code file A3 will result in a description corresponding to interface A31 in target document 307.

[0082] For example, the dependency information in the first information 306 and the dependency information in the second information 308 can be compared. For example, if the target document 307 is valid, and module A in the target code file 302 no longer depends on module B, then the target document 307 should not contain any description of the dependency on module B. If the target code file 302 adds a dependency of module A on module D, then the target document 307 should contain a description of module D.

[0083] For example, the version number in the first information 306 and the version number in the second information 308 can be compared. If the target document 307 is valid, since the version number in the target code file 302 has changed, the updated version number should exist in the target document 307.

[0084] like Figure 3B As shown, parsing the target code file 302 and the target document 307 respectively yields first information 306 and second information 308. A comparison reveals that first information 306 and second information 308 are inconsistent, indicating that target code file 302 has been updated, while target document 307 has not. Therefore, target document 307 is invalid.

[0085] like Figure 3C As shown, a comparison reveals that the first information 306 is consistent with the second information 308, indicating that the target code file 302 and the target document 307 have been updated synchronously, therefore the target document 307 is valid.

[0086] Next, based on whether the interface information, dependency information, and version number are consistent, the system can prompt the user whether they need to modify the documentation. If they are inconsistent, the system can forcibly disallow the submission of the updated target code file (302 error), thus binding the correspondence between code and documentation. If they are completely different, the system can allow code submission and mark outdated documentation, thus prompting the user to update the documentation in a timely manner.

[0087] The embodiment of the present disclosure determines the first information 306 based on the change of the module in the code level, analyzes the document content, determines the second information 308, and then compares the first information 306 and the second information 308 to determine whether the document is updated synchronously with the code file.

[0088] Figure 4 FIG. 4 is a schematic structural block diagram of a device for determining document validity according to an embodiment of the present disclosure.

[0089] As shown in FIG. 4, the device 400 for determining document validity can include a first determining module 410, a second determining module 420, and a comparing module 430. Figure 4

[0090] The first determining module 410 is configured to determine first information related to a target code file according to the target code file.

[0091] The second determining module 420 is configured to determine second information related to a target document according to the target document corresponding to the target code file.

[0092] The comparing module 430 is configured to compare the first information and the second information to obtain the validity of the target document.

[0093] According to another embodiment of the present disclosure, the first determining module includes a parsing sub-module and a first determining sub-module. The parsing sub-module is configured to parse the target code file to obtain first raw data; and the first determining sub-module is configured to determine the first information according to the first raw data and second raw data, wherein the second raw data is obtained by parsing a previous version file of the target code file.

[0094] According to another embodiment of the present disclosure, the parsing sub-module includes a determining unit and a parsing unit. The determining unit is configured to determine a programming language of the target code file according to at least one of an extension name, an implementation file, and code content of the target code file; and the parsing unit is configured to parse the target code file according to a syntax corresponding to the programming language to obtain the first raw data.

[0095] According to another embodiment of the present disclosure, the device further includes a third determining module configured to determine the target code file from a plurality of code files according to at least one of predetermined configuration information and a predetermined storage path, before determining the first information related to the target code file according to the target code file.

[0096] According to another embodiment of the present disclosure, the second determining module includes a second determining sub-module configured to determine the second information according to image information in the target document.

[0097] ​According to another embodiment of the present disclosure, the second determining submodule includes at least one of a first identifying unit, a second identifying unit, a third identifying unit, and a fourth identifying unit. The first identifying unit is configured to identify the dependency image in the image information to obtain the module information and the dependency relationship between the modules in the second information; the second identifying unit is configured to identify the image of the architecture diagram in the image information to obtain the module hierarchical relationship in the second information; the third identifying unit is configured to identify the image of the class diagram in the image information to obtain the class information and the relationship between the classes in the second information; and the fourth identifying unit is configured to identify the image of the interface calling flowchart in the image information to obtain the interface information and the calling relationship between the interfaces in the second information.

[0098] According to another embodiment of the present disclosure, the first information includes a plurality of first sub-information, and the second information includes a plurality of second sub-information; and the comparison module includes a third determining submodule, a fourth determining submodule, and a fifth determining submodule. The third determining submodule is configured to determine a plurality of sub-information pairs according to the plurality of first sub-information and the plurality of second sub-information, each sub-information pair including the first sub-information and the second sub-information corresponding to the same category; the fourth determining submodule is configured to determine that the target document is valid in a case where the first sub-information and the second sub-information included in each sub-information pair in the plurality of sub-information pairs are consistent; and the fifth determining submodule is configured to determine that the target document is invalid in a case where the first sub-information and the second sub-information included in at least one sub-information pair in the plurality of sub-information pairs are inconsistent.

[0099] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision, and disclosure of user personal information comply with relevant laws and regulations and do not violate public order and good customs.

[0100] In the technical solution of the present disclosure, the authorization or consent of the user is obtained before the user personal information is acquired or collected.

[0101] According to an embodiment of the present disclosure, the present disclosure further provides an electronic device, including at least one processor, and a memory connected with the at least one processor in communication; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method for determining the validity of the document.

[0102] According to an embodiment of the present disclosure, the present disclosure further provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to perform the method for determining the validity of the document.

[0103] According to an embodiment of the present disclosure, the present disclosure further provides a computer program product including a computer program, the computer program being executed by a processor to implement the method for determining the validity of the document.

[0104] Figure 5 A schematic block diagram of an example electronic device 500 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present disclosure described and / or claimed in this document.

[0105] As Figure 5 shown, the device 500 includes a computing unit 501 that can perform various suitable actions and processes in accordance with computer programs stored in a read-only memory (ROM) 502 or loaded into a random access memory (RAM) 503 from a storage unit 508. Various programs and data needed in the operation of the device 500 can also be stored in the RAM 503. The computing unit 501, the ROM 502, and the RAM 503 are connected to each other by a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0106] Various components in the device 500 are connected to the I / O interface 505, including an input unit 506, such as a keyboard, a mouse, etc.; an output unit 507, such as various types of displays, speakers, etc.; the storage unit 508, such as a magnetic disk, an optical disk, etc.; and a communication unit 509, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 509 allows the device 500 to exchange information / data with other devices through computer networks, such as the Internet, and / or various telecommunication networks.

[0107] The computing unit 501 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 501 performs various methods and processes described above, such as the method of determining document validity. For example, in some embodiments, the method of determining document validity can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded onto the RAM 503 and executed by the computing unit 501, one or more steps of the method of determining document validity described above can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform the method of determining document validity by any other appropriate means, such as by means of firmware.

[0108] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a complex programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0109] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / acts specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.

[0110] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0111] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0112] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0113] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.

[0114] It should be understood that the various forms of flow shown above can be used to reorder, add, or remove steps. For example, the steps described in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technology disclosed in the present disclosure are achieved, which is not limited herein.

[0115] The specific implementation described above does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A method for determining validity of a document, comprising: determining first information related to a target code file according to the target code file; determining second information related to a target document corresponding to the target code file according to the target document, the target document comprising image information; and comparing the first information and the second information to obtain validity of the target document; wherein the determining the second information related to the target document according to the target document corresponding to the target code file comprises at least one of: identifying a dependency image in the image information to obtain module information and a dependency relationship between modules in the second information; identifying an image of an architecture diagram in the image information to obtain a module hierarchy relationship in the second information; identifying an image of a class diagram in the image information to obtain class information and a relationship between classes in the second information; and identifying an image of an interface call flowchart in the image information to obtain interface information and a call relationship between interfaces in the second information.

2. The method of claim 1, wherein, the determining the first information related to the target code file according to the target code file comprises: parsing the target code file to obtain first raw data; and determining the first information according to the first raw data and second raw data; wherein the second raw data is obtained by parsing a previous version file of the target code file.

3. The method of claim 2, wherein, the parsing the target code file to obtain first raw data comprises: determining a programming language of the target code file according to at least one of an extension name, an implementation file and code content of the target code file; and parsing the target code file according to a syntax corresponding to the programming language to obtain the first raw data.

4. The method of claim 1, further comprising: before the determining the first information related to the target code file according to the target code file, determining the target code file from a plurality of code files according to at least one of predetermined configuration information and a predetermined storage path.

5. The method of claim 1, wherein, the first information comprises a plurality of first sub-information, and the second information comprises a plurality of second sub-information; the comparing the first information and the second information to obtain the validity of the target document comprises: determining a plurality of sub-information pairs according to the plurality of first sub-information and the plurality of second sub-information, each sub-information pair comprising first sub-information and second sub-information corresponding to a same category; in a case where the first sub-information and the second sub-information included in each sub-information pair in the plurality of sub-information pairs are consistent, determining that the target document is valid; and in a case where the first sub-information and the second sub-information included in at least one sub-information pair in the plurality of sub-information pairs are inconsistent, determining that the target document is invalid. 6.An apparatus for determining validity of a document, comprising: a first determining module configured to determine first information related to a target code file according to the target code file; a second determining module, configured to determine second information related to a target document corresponding to the target code file according to the target document, the target document comprising image information; and a comparison module, configured to compare the first information and the second information to obtain validity of the target document; wherein the second determining module comprises at least one of: a first identifying unit, configured to identify a dependency relationship image in the image information to obtain module information and a dependency relationship between modules in the second information; a second identifying unit, configured to identify an image of an architecture diagram in the image information to obtain a module hierarchical relationship in the second information; a third identifying unit, configured to identify an image of a class diagram in the image information to obtain class information and a relationship between classes in the second information; and a fourth identifying unit, configured to identify an image of an interface calling flowchart in the image information to obtain interface information and a calling relationship between interfaces in the second information.

7. The apparatus of claim 6, wherein, the first determining module comprises: a parsing submodule, configured to parse the target code file to obtain first raw data; and a first determining submodule, configured to determine the first information according to the first raw data and second raw data; wherein the second raw data is obtained by parsing a previous version file of the target code file.

8. The apparatus of claim 7, wherein, the parsing submodule comprises: a determining unit, configured to determine a programming language of the target code file according to at least one of an extension name, an implementation file and code content of the target code file; and a parsing unit, configured to parse the target code file according to a syntax corresponding to the programming language to obtain the first raw data.

9. The apparatus of claim 6, further comprising: a third determining module, configured to determine the target code file from a plurality of code files according to at least one of predetermined configuration information and a predetermined storage path before determining the first information related to the target code file according to the target code file.

10. The apparatus of claim 6, wherein, the first information comprises a plurality of first sub-information, and the second information comprises a plurality of second sub-information; and the comparison module comprises: a third determining submodule, configured to determine a plurality of sub-information pairs according to the plurality of first sub-information and the plurality of second sub-information, each sub-information pair comprising first sub-information and second sub-information corresponding to a same category; a fourth determining submodule, configured to determine that the target document is valid in a case where the first sub-information and the second sub-information included in each sub-information pair in the plurality of sub-information pairs are consistent; and a fifth determining submodule, configured to determine that the target document is invalid in a case where the first sub-information and the second sub-information included in at least one sub-information pair in the plurality of sub-information pairs are inconsistent.

11. An electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein, The memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 5.

12. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are for causing the computer to perform the method of any one of claims 1 to 5.

13. A computer program product comprising computer program which, when executed by a processor, implements the method of any one of claims 1 to 5.

Citation Information

Patent Citations

  • Interface document updating method and device, electronic equipment and readable storage medium

    CN114443905A