Dictionary construction method, dictionary-based file evaluation method and device, and equipment

By building preset instructions and score dictionary for mirrors, the problem of lack of quantitative standards for Dockerfile's pros and cons is solved, and the flexibility of resource utilization and dictionary construction is improved.

CN115421873BActive Publication Date: 2025-07-22CCB FINTECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211219204.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2025-07-22
Estimated Expiration
2042-09-30

AI Technical Summary

Technical Problem

The lack of quantitative standards for the advantages and disadvantages of Dockerfiles in the prior art, resulting in excessive space occupied by exceptional images and wasted resources.

Method used

By obtaining preset instructions for building images, obtaining text files and mirror information within the preset period, determining the scores of each preset instruction, and building a preset dictionary to represent the advantages and disadvantages of the image, quantitative evaluation of Dockerfile is achieved.

Benefits of technology

It improves the flexibility of dictionary construction, avoids resource waste, realizes quantitative evaluation of Dockerfile, and improves resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115421873B_ABST
    Figure CN115421873B_ABST
Patent Text Reader

Abstract

The present disclosure provides a dictionary construction method, a dictionary-based file evaluation method and apparatus, and a device, which can be applied to the fields of computer technology and fintech. The dictionary construction method includes: obtaining at least one preset instruction for constructing an image; obtaining a text file and corresponding image information within a preset time period according to the at least one preset instruction, where the text file includes at least one preset instruction, and the image information is used to represent information of the image constructed based on the text file; determining respective scores corresponding to the at least one preset instruction according to the image information; and constructing a preset dictionary according to the at least one preset instruction and the respective scores corresponding to the at least one preset instruction, where the preset dictionary is represented by key-value pairs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology and fintech, and more particularly, to a dictionary construction method, a dictionary-based file evaluation method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product. Background Art

[0002] With the development of computer technology, the application container engine (Docker) technology has emerged. Docker is a tool that can create and maintain a container environment on a physical machine. A container is a lightweight virtualized environment with an independent running space. A Dockerfile is a description file of a Docker image. An image can be built based on a base image, a Dockerfile, and source code.

[0003] In the process of implementing the concept of the present disclosure, the inventors found that there are at least the following problems in the related art: Since there is no quantitative standard for the quality of Dockerfiles, it is easy to cause excessive space occupation by abnormal images, resulting in resource waste. Summary of the Invention

[0004] In view of this, the present disclosure provides a dictionary construction method, a dictionary-based file evaluation method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product.

[0005] According to one aspect of the present disclosure, there is provided a dictionary construction method, including:

[0006] Obtaining at least one preset instruction for building an image;

[0007] According to the at least one preset instruction, obtaining a text file within a preset time period and mirror information corresponding to the text file, wherein the text file includes the at least one preset instruction, and the mirror information is used to characterize information of the mirror built based on the text file;

[0008] Determining respective scores corresponding to the at least one preset instruction according to the mirror information; and

[0009] Constructing a preset dictionary according to the at least one preset instruction and the respective scores corresponding to the at least one preset instruction, wherein the preset dictionary is represented by key-value pairs.

[0010] According to an embodiment of the present disclosure, the obtaining a text file within a preset time period and mirror information corresponding to the text file according to the at least one preset instruction includes:

[0011] Determining a target preset instruction among the at least one preset instruction;

[0012] According to the above-mentioned target preset instruction, obtain the target text file within a preset time period and the target mirror image information corresponding to the above-mentioned target text file, wherein the above-mentioned target text file includes the above-mentioned target preset instruction, and the above-mentioned target mirror image information is used to represent the information of the target mirror image constructed based on the above-mentioned target text file.

[0013] According to an embodiment of the present disclosure, the determining the scores corresponding to the at least one preset instruction according to the above-mentioned mirror image information includes:

[0014] According to the above-mentioned target mirror image information, determine the target score corresponding to the above-mentioned target preset instruction.

[0015] According to another aspect of the present disclosure, a dictionary-based file evaluation method is provided, including:

[0016] In response to receiving a file evaluation request, according to the above-mentioned file evaluation request, obtain the text file to be evaluated for constructing a target mirror image, wherein the above-mentioned text file to be evaluated includes at least one text block to be evaluated;

[0017] According to a preset dictionary, evaluate each of the at least one text block to be evaluated respectively to obtain the evaluation value corresponding to each of the at least one text block to be evaluated;

[0018] According to the above-mentioned evaluation values corresponding to each of the at least one text block to be evaluated, determine the evaluation value of the above-mentioned text file to be evaluated; and

[0019] According to the evaluation value of the above-mentioned text file to be evaluated, determine the text file evaluation result;

[0020] Wherein, the above-mentioned preset dictionary is constructed by using the dictionary construction method as described above.

[0021] According to an embodiment of the present disclosure, each of the at least one text block to be evaluated includes text block association information and at least one instruction to be evaluated, and each of the at least one instruction to be evaluated includes instruction association information.

[0022] According to an embodiment of the present disclosure, the evaluating each of the at least one text block to be evaluated respectively according to the preset dictionary to obtain the evaluation value corresponding to each of the at least one text block to be evaluated includes:

[0023] According to the above-mentioned text block association information, sequentially determine the at least one text block to be evaluated as the target text block to be evaluated;

[0024] Based on the above target text block to be evaluated and the above instruction association information corresponding to the above target text block to be evaluated, determine the above at least one instruction to be evaluated corresponding to the above target text block to be evaluated as the target instruction to be evaluated in sequence;

[0025] Based on the above target instruction to be evaluated, determine the target preset instruction among the above at least one preset instructions in the above preset dictionary;

[0026] Determine the score corresponding to the above target preset instruction as the score of the above target instruction to be evaluated; and

[0027] Based on the above target text block to be evaluated, the above instruction association information corresponding to the above target text block to be evaluated, and the score of the above target instruction to be evaluated, determine the evaluation value corresponding to each of the above at least one text blocks to be evaluated.

[0028] According to an embodiment of the present disclosure, the above method further includes:

[0029] In response to detecting that the above instruction to be evaluated includes a preset character, set the score corresponding to the above instruction to be evaluated to a first preset threshold.

[0030] According to an embodiment of the present disclosure, the above determining the text file evaluation result based on the evaluation value of the above text file to be evaluated includes:

[0031] Determine the difference between the evaluation value of the above text file to be evaluated and a second preset threshold;

[0032] In the case where the above difference is greater than a third preset threshold, determine that the above text file to be evaluated passes the evaluation; and

[0033] In the case where the above difference is less than or equal to the third preset threshold, determine that the above text file to be evaluated fails the evaluation.

[0034] According to an embodiment of the present disclosure, the above method further includes:

[0035] In the case where it is determined that the text file evaluation result indicates that the evaluation passes, construct the above target image based on the above text file to be evaluated.

[0036] According to an embodiment of the present disclosure, the above constructing the above target image based on the above text file to be evaluated in the case where it is determined that the text file evaluation result indicates that the evaluation passes includes:

[0037] According to the above text file to be evaluated, determine the base image for constructing the above target image; and

[0038] Based on the above base image, execute the above text file to be evaluated to obtain the above target image.

[0039] According to an embodiment of the present disclosure, the above method further includes:

[0040] When it is determined that the evaluation result of the above text file indicates that the evaluation fails, changing the above at least one text block to be evaluated to obtain at least one changed text block to be evaluated;

[0041] Determining an evaluation result of the changed text file according to the above evaluation values respectively corresponding to the above at least one changed text block to be evaluated; and

[0042] When it is determined that the evaluation result of the above changed text file indicates that the evaluation passes, constructing the above target image based on the changed text file to be evaluated.

[0043] According to another aspect of the present disclosure, there is provided a dictionary construction device, including:

[0044] A first acquisition module, configured to acquire at least one preset instruction for constructing an image;

[0045] A second acquisition module, configured to acquire a text file within a preset period and image information corresponding to the text file according to the above at least one preset instruction, wherein the text file includes the above at least one preset instruction, and the image information is used to represent information of an image constructed based on the text file;

[0046] A first determination module, configured to determine scores respectively corresponding to the above at least one preset instruction according to the above image information; and

[0047] A first construction module, configured to construct a preset dictionary according to the above at least one preset instruction and the scores respectively corresponding to the above at least one preset instruction, wherein the preset dictionary is represented by key-value pairs.

[0048] According to another aspect of the present disclosure, there is provided a dictionary-based file evaluation device, including:

[0049] A third acquisition module, configured to, in response to receiving a file evaluation request, acquire a text file to be evaluated for constructing a target image according to the file evaluation request, wherein the text file to be evaluated includes at least one text block to be evaluated;

[0050] An evaluation module, configured to evaluate each of the above at least one text block to be evaluated according to a preset dictionary to obtain evaluation values respectively corresponding to the above at least one text block to be evaluated;

[0051] A second determination module, configured to determine an evaluation value of the text file to be evaluated according to the above evaluation values respectively corresponding to the above at least one text block to be evaluated; and

[0052] A third determination module, configured to determine an evaluation result of a text file according to the evaluation values respectively corresponding to the at least one text block to be evaluated;

[0053] Wherein, the preset dictionary is constructed by using the dictionary construction device as described above.

[0054] According to another aspect of the present disclosure, there is provided an electronic device, including:

[0055] One or more processors;

[0056] A memory for storing one or more instructions,

[0057] Wherein, when the one or more instructions are executed by the one or more processors, the one or more processors are caused to implement the method as described above.

[0058] According to another aspect of the present disclosure, there is provided a computer-readable storage medium, on which executable instructions are stored, and when the executable instructions are executed by a processor, the processor is caused to implement the method as described above.

[0059] According to another aspect of the present disclosure, there is provided a computer program product, the computer program product includes computer-executable instructions, and the computer-executable instructions are used to implement the method as described above when executed.

[0060] According to the embodiments of the present disclosure, by obtaining at least one preset instruction for constructing an image, according to the at least one preset instruction, obtaining a text file within a preset time period and image information corresponding to the text file, and then according to the image information, determining scores respectively corresponding to the at least one preset instruction. Since the preset dictionary is constructed according to the at least one preset instruction and the scores respectively corresponding to the at least one preset instruction, thus, the flexibility of dictionary construction is improved. In addition, since the corresponding score can be determined based on the preset instruction to implement file evaluation based on the dictionary, the technical problem in the related art of lacking a quantitative standard for the pros and cons of a Dockerfile is avoided, and thus the resource utilization rate is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] Through the following description of the embodiments of the present disclosure with reference to the drawings, the above and other objects, features and advantages of the present disclosure will become clearer. In the drawings:

[0062] Figure 1 Schematically shows a system architecture to which the dictionary construction method and the file evaluation method based on the dictionary according to the embodiments of the present disclosure can be applied;

[0063] Figure 2 Schematically shows a flowchart of the dictionary construction method according to the embodiments of the present disclosure;

[0064] Figure 3 Schematically shows an example schematic diagram of a dictionary construction process according to an embodiment of the present disclosure;

[0065] Figure 4 Schematically shows a flowchart of a dictionary-based file evaluation method according to an embodiment of the present disclosure;

[0066] Figure 5 Schematically shows an example schematic diagram of a dictionary-based file evaluation process according to an embodiment of the present disclosure;

[0067] Figure 6 Schematically shows a block diagram of a dictionary construction device according to an embodiment of the present disclosure;

[0068] Figure 7 Schematically shows a block diagram of a dictionary-based file evaluation device according to an embodiment of the present disclosure; and

[0069] Figure 8 Schematically shows a block diagram of an electronic device suitable for implementing a dictionary construction method and a dictionary-based file evaluation method according to an embodiment of the present disclosure. Detailed implementation manners

[0070] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the following detailed description, for the sake of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, obviously, one or more embodiments can also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily obscuring the concepts of the present disclosure.

[0071] In the technical solution of the present disclosure, the processing of the data involved (such as including but not limited to user personal information) in terms of collection, storage, use, processing, transmission, provision, disclosure, and application, etc., all comply with the provisions of relevant laws and regulations, necessary confidentiality measures are taken, and it does not violate public order and good customs.

[0072] The terms used herein are merely for describing specific embodiments and are not intended to limit the present disclosure. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0073] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0074] In the case of using expressions such as "at least one of A, B, and C, etc.", generally, it should be interpreted according to the meaning that those skilled in the art usually understand this expression (for example, "a system having at least one of A, B, and C" should include, but not be limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.). In the case of using expressions such as "at least one of A, B, or C, etc.", generally, it should be interpreted according to the meaning that those skilled in the art usually understand this expression (for example, "a system having at least one of A, B, or C" should include, but not be limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).

[0075] A Dockerfile is a text file used to build an image. The content of a Docker container can be defined by the declarations in the Dockerfile, and the declarations in the Dockerfile can specify Docker commands and the corresponding execution order. Multiple instructions and descriptions required for building an image can be included in the Dockerfile to facilitate customizing the image using the Dockerfile.

[0076] However, since the quality of the Dockerfile is related to the occupied space of the image, and there is a lack of a quantitative standard for the quality of the Dockerfile in the related art, it is easy to cause excessive occupied space of abnormal images, resulting in waste of resources.

[0077] To at least partially solve the technical problems existing in the related art, the present disclosure provides a dictionary construction method, a file evaluation method and device, and a device based on the dictionary, which can be applied to the fields of computer technology and fintech. The dictionary construction method includes: obtaining at least one preset instruction for building an image; according to the at least one preset instruction, obtaining a text file within a preset time period and image information corresponding to the text file, where the text file includes at least one preset instruction, and the image information is used to characterize the information of the image built based on the text file; determining respective scores corresponding to the at least one preset instruction according to the image information; and constructing a preset dictionary according to the at least one preset instruction and the respective scores corresponding to the at least one preset instruction, where the preset dictionary is represented by key-value pairs

[0078] It should be noted that the dictionary construction method, the dictionary-based file evaluation method, and the device provided by the embodiments of the present disclosure can be used in the fields of computer technology and fintech, such as in the field of container technology. The dictionary construction method, the dictionary-based file evaluation method, and the device provided by the embodiments of the present disclosure can also be used in any field other than the fields of computer technology and fintech, such as in the field of information processing technology. The application fields of the dictionary construction method, the dictionary-based file evaluation method, and the device provided by the embodiments of the present disclosure are not limited.

[0079] Figure 1 Schematically shows a system architecture to which the dictionary construction method and the dictionary-based file evaluation method according to the embodiments of the present disclosure can be applied. It should be noted that, Figure 1 The illustration 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 it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.

[0080] As Figure 1 shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used as a medium to provide a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0081] Users can use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0082] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, and desktop computers, etc.

[0083] Server 105 may be a server that provides various services. For example, it can be a background management server (only for illustration) that supports the websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server can analyze and process data such as user requests received, and feedback the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.

[0084] It should be noted that the dictionary construction method and the dictionary-based file evaluation method provided by the embodiments of the present disclosure can generally be executed by server 105. Correspondingly, the dictionary construction device and the dictionary-based file evaluation device provided by the embodiments of the present disclosure can generally be set in server 105. The dictionary construction method and the dictionary-based file evaluation method provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the dictionary construction device and the dictionary-based file evaluation device provided by the embodiments of the present disclosure can also be set in a server or a server cluster different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105.

[0085] Alternatively, the dictionary construction method and the dictionary-based file evaluation method provided by the embodiments of the present disclosure can also be executed by the first terminal device 101, the second terminal device 102, and the third terminal device 103, or can also be executed by other terminal devices different from the first terminal device 101, the second terminal device 102, and the third terminal device 103. Correspondingly, the dictionary construction device and the dictionary-based file evaluation device provided by the embodiments of the present disclosure can also be set in the first terminal device 101, the second terminal device 102, and the third terminal device 103, or can be set in other terminal devices different from the first terminal device 101, the second terminal device 102, and the third terminal device 103.

[0086] It should be understood that Figure 1 the numbers of terminal devices, networks, and servers in

[0087] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers.

[0088] Figure 2 The flowchart of the dictionary construction method according to the embodiments of the present disclosure is schematically shown.

[0089] As Figure 2 shown, the dictionary building method 200 may include operations S210 to S240.

[0090] In operation S210, obtain at least one preset instruction for building an image.

[0091] In operation S220, according to the at least one preset instruction, obtain text files within a preset time period and mirror information corresponding to the text files. The text files include at least one preset instruction, and the mirror information is used to characterize the information of the mirror built based on the text files.

[0092] In operation S230, according to the mirror information, determine scores corresponding to each of the at least one preset instruction.

[0093] In operation S240, build a preset dictionary according to the at least one preset instruction and the scores corresponding to each of the at least one preset instruction. The preset dictionary is represented by key-value pairs.

[0094] According to an embodiment of the present disclosure, a container (i.e., container) is a unified platform for building, distributing, and running application programs, and can be used to implement the automatic installation, deployment, and upgrade of application programs. An image (i.e., image) is a file system obtained by standardizing and encapsulating the code machine running environment of an application program, and can be applied to an operating system installed with a container. Since the image provides various resources required for the container to run and is the basis for the container to run, it is necessary to first build the image of the application program before automatically deploying the application program based on container technology.

[0095] According to an embodiment of the present disclosure, a base image, a Dockerfile, and source code are required when building the image of an application program. A Dockerfile is a description file for building a Docker image. The Dockerfile may include at least one preset instruction for building an image. The preset instructions may include FROM, MAINTAINER, LABEL, RUN, CMD, EXPOSE, ENV, ARG, ADD, COPY, ENTRYPOINT, VOLUME, WORKDIR, and ONBUILD, etc.

[0096] According to an embodiment of the present disclosure, after obtaining at least one preset instruction for building an image, corresponding scores may be set for each preset instruction according to the historical image building situation of the preset instruction. Those skilled in the art may set scores for different preset instructions according to actual needs, and the embodiments of the present disclosure do not limit the specific score setting method.

[0097] According to an embodiment of the present disclosure, the mirror image information can be used to characterize the quality of the mirror image. The specific value of the preset time period can be set by those skilled in the art according to actual needs, and the embodiments of the present disclosure do not limit the specific value of the preset time period.

[0098] According to an embodiment of the present disclosure, corresponding scores can be set for each preset instruction used in the Dockerfile in a preset dictionary. Each preset instruction field in the preset dictionary can be expanded according to actual needs. Each score field in the preset dictionary can be adjusted according to actual needs. According to an embodiment of the present disclosure, after determining the scores corresponding to each preset instruction respectively, key-value pairs (i.e., "key=value") can be determined according to at least one preset instruction and the scores corresponding to each of the at least one preset instruction. At least one preset instruction can be set as key1, key2, ..., keyn, …, keyN, the score corresponding to the preset instruction key1 is set as value1, the score corresponding to the preset instruction key2 is set as value2, ..., the score corresponding to the preset instruction keyn is set as valuen, ..., the score corresponding to the preset instruction keyN is set as valueN, where N can be an integer greater than or equal to 1, and n ∈ {1, 2, …, (N - 1), N}. In this case, the preset dictionary can be constructed according to the key-value pairs key1: valuel, key2: value2, ..., keyn: valuen, …, keyN: valueN.

[0099] According to an embodiment of the present disclosure, by obtaining at least one preset instruction for constructing a mirror image, and according to the at least one preset instruction, obtaining a text file within a preset time period and the mirror image information corresponding to the text file, and then according to the mirror image information, determining the scores corresponding to each of the at least one preset instruction, since the preset dictionary is constructed according to the at least one preset instruction and the scores corresponding to each of the at least one preset instruction, thus, the flexibility of dictionary construction is improved. In addition, since the corresponding score can be determined based on the preset instruction to achieve file evaluation based on the dictionary, the technical problem of lacking a quantitative standard for the quality of the Dockerfile in the related art is avoided, and thus the resource utilization rate is improved.

[0100] The following refers to Figure 3 , and further illustrates the dictionary construction method 200 according to an embodiment of the present invention.

[0101] According to an embodiment of the present disclosure, operation S220 may include the following operations.

[0102] Among at least one preset instruction, determine a target preset instruction. According to the target preset instruction, obtain a target text file within a preset time period and target mirror information corresponding to the target text file. The target text file includes the target preset instruction, and the target mirror information is used to represent information of a target mirror constructed based on the target text file.

[0103] According to an embodiment of the present disclosure, operation S230 may include the following operations.

[0104] According to the target mirror information, determine a target score corresponding to the target preset instruction.

[0105] According to an embodiment of the present disclosure, the FROM instruction can be used to specify a mirror as the base mirror for building a custom mirror. The MAINTAINER instruction can be used to specify maintainer information. The LABEL instruction can be used to add metadata tags to the mirror. The CMD instruction can be used to specify the command to be run for the started container. The EXPOSE instruction can be used to tell the Docker service the port numbers that the container needs to expose. The ENV instruction can be used to set or define environment variables. The ARG instruction can be used to set mirror build parameters. The ADD instruction can be used to copy files or directories from the context directory to a specified path in the container. The COPY instruction can be used to copy files or directories from the context directory to a specified path in the container. The ENTRYPOINT instruction is used to specify the container startup. The VOLUME instruction can be used to define a mounted anonymous data volume directory. The WORKDIR instruction can be used to specify the working directory. The ONBUILD instruction can be used to configure the operation instructions to be executed when the created mirror is used as the base mirror for other newly created mirrors.

[0106] According to an embodiment of the present disclosure, among the obtained at least one preset instruction, the target preset instruction can be determined in sequence. According to the target preset instruction, a target text file including the target preset instruction within a preset time period and target mirror information of a target mirror constructed based on the target text file can be obtained.

[0107] According to an embodiment of the present disclosure, after obtaining the corresponding target mirror information, a target score corresponding to the target preset instruction can be determined. For example, excessive use of the COPY instruction will increase the volume of the constructed mirror, and the score corresponding to the COPY instruction can be increased to remind minimizing the use of the COPY instruction when writing the Dockerfile.

[0108] According to an embodiment of the present disclosure, by obtaining a target text file and corresponding target mirror information within a preset time period, and determining a target score corresponding to a target preset instruction according to the target mirror information, changes to the program logic are avoided, the scores corresponding to different preset instructions can be flexibly adjusted, and the flexibility of dictionary construction is improved.

[0109] Figure 3 FIG. schematically shows an example diagram of a dictionary construction process according to an embodiment of the present disclosure.

[0110] As Figure 3 shown, at least one preset instruction 301 for constructing a mirror can be obtained. Among the at least one preset instruction 301, a target preset instruction 302 is determined.

[0111] After obtaining the target preset instruction 302, a target text file 303 within a preset time period can be obtained. Based on the target text file 303, corresponding mirror information 304 can be constructed. After determining the mirror information 304, a target score 305 corresponding to the target preset instruction 302 can be determined.

[0112] After determining the target score 305, a preset dictionary 306 can be constructed according to the at least one preset instruction 301 and the target scores 305 respectively corresponding to the at least one preset instruction 301.

[0113] The above are only exemplary embodiments, but are not limited thereto. Other dictionary construction methods known in the art may also be included, as long as a dictionary can be constructed.

[0114] Figure 4 FIG. schematically shows a flowchart of a dictionary-based file evaluation method according to an embodiment of the present disclosure.

[0115] As Figure 4 shown, the dictionary-based file evaluation method 400 may include operations S410 to S440.

[0116] In operation S410, in response to receiving a file evaluation request, according to the file evaluation request, a text file to be evaluated for constructing a target mirror is obtained. The text file to be evaluated includes at least one text block to be evaluated.

[0117] In operation S420, according to the preset dictionary, each text block to be evaluated among the at least one text block to be evaluated is evaluated separately to obtain an evaluation value corresponding to each text block to be evaluated.

[0118] In operation S430, according to the evaluation values corresponding to the at least one text block to be evaluated, the evaluation value of the text file to be evaluated is determined.

[0119] In operation S440, determine the text file evaluation result according to the evaluation values respectively corresponding to at least one text block to be evaluated.

[0120] According to an embodiment of the present disclosure, in the case where file evaluation is required, a user may run a script capable of generating a file evaluation request through a terminal device, and may send the generated file evaluation request message to a server, so that the server determines the text file evaluation result according to the file evaluation request message.

[0121] According to an embodiment of the present disclosure, after receiving a file evaluation request, a text file to be evaluated for constructing a target image may be obtained according to the file evaluation request. The text file to be evaluated may include a Dockerfile. The Dockerfile is a configuration file in text format, and a Dockerfile may be used to construct an image. The text file to be evaluated may include at least one text block to be evaluated. Each text block to be evaluated in the at least one text block to be evaluated may include at least one line of command statements. Each text block to be evaluated may include base image information, maintainer information, image operation instructions, instructions executed when a container starts, and the like.

[0122] According to an embodiment of the present disclosure, a preset dictionary may be constructed by using the dictionary construction method described above. For example, at least one preset instruction for constructing an image may be obtained, and a corresponding score may be set for each preset instruction, and then a preset dictionary represented by key-value pairs may be constructed according to the at least one preset instruction and the scores respectively corresponding to the at least one preset instruction.

[0123] According to an embodiment of the present disclosure, corresponding scores may be respectively determined for each text block to be evaluated in the at least one text block to be evaluated according to the preset dictionary, so as to obtain evaluation values respectively corresponding to the at least one text block to be evaluated. The evaluation value may be used to represent the score corresponding to the text block to be evaluated.

[0124] According to an embodiment of the present disclosure, the text file evaluation result may be determined according to the evaluation values respectively corresponding to the at least one text block to be evaluated. The text file evaluation result may be used to represent whether the text file to be evaluated passes the evaluation.

[0125] According to an embodiment of the present disclosure, since the text file to be evaluated is obtained according to a file evaluation request, the evaluation value is obtained by evaluating each text block to be evaluated in at least one text block to be evaluated respectively according to a preset dictionary. By determining the evaluation value of the text file to be evaluated according to the evaluation values corresponding to the at least one text block to be evaluated respectively, and then determining the text file evaluation result according to the evaluation value of the text file to be evaluated, the overall quantification of the text file to be evaluated is realized, avoiding the technical problem in the related art that there is a lack of a quantification standard for the advantages and disadvantages of the Dockerfile, which easily leads to excessive space occupied by abnormal images and causes waste of resources, and improving the resource utilization rate.

[0126] Next, refer to Figure 5 to further describe the dictionary-based file evaluation method 400 according to an embodiment of the present invention.

[0127] According to an embodiment of the present disclosure, operation S420 may include the following operations.

[0128] According to the text block association information, at least one text block to be evaluated is sequentially determined as the target text block to be evaluated. According to the target text block to be evaluated and the instruction association information corresponding to the target text block to be evaluated, at least one instruction to be evaluated corresponding to the target text block to be evaluated is sequentially determined as the target instruction to be evaluated. According to the target instruction to be evaluated, a target preset instruction is determined among at least one preset instruction in the preset dictionary. The score corresponding to the target preset instruction is determined as the score of the target instruction to be evaluated. According to the target text block to be evaluated, the instruction association information corresponding to the target text block to be evaluated, and the score of the target instruction to be evaluated, the evaluation values corresponding to the at least one text block to be evaluated respectively are determined.

[0129] According to an embodiment of the present disclosure, each text block to be evaluated in at least one text block to be evaluated includes text block association information and at least one instruction to be evaluated, and each instruction to be evaluated in at least one instruction to be evaluated includes instruction association information. The text block association information can be used to represent the association relationship between each text block to be evaluated. The instruction association information can be used to represent the association relationship between each instruction to be evaluated in the same text block to be evaluated.

[0130] According to an embodiment of the present disclosure, the dictionary-based file evaluation method 400 may further include the following operations.

[0131] In response to detecting that the instruction to be evaluated includes a preset character, the score corresponding to the instruction to be evaluated is set to a first preset threshold.

[0132] According to an embodiment of the present disclosure, the preset character can be set by those skilled in the art according to actual needs, and the embodiments of the present disclosure do not limit this. For example, the preset character can be "#", and in this case, the instruction to be evaluated is a comment.

[0133] According to an embodiment of the present disclosure, when it is detected that the instruction to be evaluated includes "#", the score corresponding to the instruction to be evaluated can be set to a first preset threshold. The first preset threshold can be set by those skilled in the art according to actual needs, and the embodiments of the present disclosure do not limit this. For example, the first preset threshold can be zero.

[0134] According to an embodiment of the present disclosure, since the target text block to be evaluated is determined sequentially according to at least one text block to be evaluated, and the target instruction to be evaluated is determined sequentially according to at least one instruction to be evaluated corresponding to the target text block to be evaluated, by determining the evaluation value corresponding to each of the at least one text block to be evaluated based on the target text block to be evaluated, the instruction association information corresponding to the target text block to be evaluated, and the score of the target instruction to be evaluated, a quantitative standard for the quality of the Dockerfile is thus achieved.

[0135] According to an embodiment of the present disclosure, operation S440 may include the following operations.

[0136] Determine the difference between the evaluation value of the text file to be evaluated and the second preset threshold. When the difference is greater than the third preset threshold, it is determined that the text file to be evaluated passes the evaluation. When the difference is less than or equal to the third preset threshold, it is determined that the text file to be evaluated fails the evaluation.

[0137] According to an embodiment of the present disclosure, after determining the evaluation value of the text file to be evaluated, the difference between the evaluation value of the text file to be evaluated and the second preset threshold can be determined. The second preset threshold can be set by those skilled in the art according to actual needs, and the embodiments of the present disclosure do not limit this. For example, the second preset threshold can be 100.

[0138] According to an embodiment of the present disclosure, the difference can be determined by the following formula (1).

[0139] t = f - d (1)

[0140] Wherein, t is used to represent the difference, f is used to represent the second preset threshold, and d is used to represent the evaluation value of the text file to be evaluated.

[0141] According to an embodiment of the present disclosure, after determining the difference, it can be determined whether the text file to be evaluated passes the evaluation according to the relationship between the difference and the third preset threshold. The third preset threshold can be set by those skilled in the art according to actual needs, and the embodiments of the present disclosure do not limit this. For example, the third preset threshold can be 60.

[0142] According to an embodiment of the present disclosure, the larger the difference value is, the higher the quality of the text file to be evaluated can be characterized. When the difference value is less than or equal to a third preset threshold, the quality of the text file to be evaluated can be improved by merging at least one text block to be evaluated in the text file to be evaluated. Alternatively, the quality of the text file to be evaluated can be improved by reducing the use of instructions with larger scores.

[0143] According to an embodiment of the present disclosure, the dictionary-based file evaluation method 400 may further include the following operations.

[0144] When it is determined that the text file evaluation result indicates that the evaluation is passed, a target image is constructed based on the text file to be evaluated.

[0145] According to an embodiment of the present disclosure, the text file evaluation result can be used to indicate whether the text file to be evaluated passes the evaluation. When it is determined that the text file evaluation result indicates that the evaluation is passed, a target image can be constructed based on the text file to be evaluated.

[0146] According to an embodiment of the present disclosure, when it is determined that the text file evaluation result indicates that the evaluation is passed, constructing a target image based on the text file to be evaluated may include the following operations.

[0147] Based on the text file to be evaluated, determine the base image for constructing the target image. Based on the base image, execute the text file to be evaluated to obtain the target image.

[0148] According to an embodiment of the present disclosure, the text file to be evaluated may include information about the base image it depends on, maintainer information, image operation instructions, instructions executed when the container starts, etc. The base image for constructing the target image can be determined according to the base image information in the text file to be evaluated. The base image may include the basic system files on which the image depends when running. After determining the base image for constructing the target image, the text file to be evaluated can be executed based on the base image to obtain the target image.

[0149] According to an embodiment of the present disclosure, the dictionary-based file evaluation method 400 may further include the following operations.

[0150] When it is determined that the text file evaluation result indicates that the evaluation fails, at least one text block to be evaluated is changed to obtain at least one changed text block to be evaluated. According to the evaluation values corresponding to the at least one changed text block to be evaluated respectively, determine the evaluation result of the changed text file. When it is determined that the evaluation result of the changed text file indicates that the evaluation is passed, a target image is constructed based on the changed text file to be evaluated.

[0151] According to an embodiment of the present disclosure, the evaluation result of a text file can be used to characterize whether the text file to be evaluated passes the evaluation. In the case where it is determined that the evaluation result of the text file characterizes that the evaluation fails, at least one text block to be evaluated can be changed so as to construct a target image based on the changed text file to be evaluated.

[0152] According to an embodiment of the present disclosure, changing at least one text block to be evaluated can include a deletion operation and a modification operation. For example, the change operation of at least one text block to be evaluated can be implemented by deleting instructions with relatively high scores. Alternatively, the change operation of at least one text block to be evaluated can be implemented by merging at least one text block to be evaluated.

[0153] According to an embodiment of the present disclosure, after changing at least one text block to be evaluated to obtain at least one changed text block to be evaluated, the evaluation value of the changed text file can be determined. The changed difference between the evaluation value of the changed text file and a second preset threshold can be determined, and whether the changed text file to be evaluated passes the evaluation can be determined according to the relationship between the changed difference and a third preset threshold.

[0154] According to an embodiment of the present disclosure, since the evaluation value of the text file to be evaluated is determined according to the evaluation values corresponding to at least one text block to be evaluated respectively, the difference is determined according to the evaluation value of the text file to be evaluated and the second preset threshold, and the text file evaluation result is determined according to the relationship between the difference and the third preset threshold, thereby realizing the overall quantification of the text file to be evaluated. In addition, by constructing a target image based on the text file to be evaluated in the case where it is determined that the text file evaluation result characterizes that the evaluation passes, and changing at least one text block to be evaluated in the case where it is determined that the text file evaluation result characterizes that the evaluation fails, and constructing a target image based on the changed text file to be evaluated, the quality of the text file used for constructing the image is improved.

[0155] Figure 5 Schematically shows an example schematic diagram of a dictionary-based file evaluation process according to an embodiment of the present disclosure.

[0156] As Figure 5 shown, in response to receiving a file evaluation request 501, a text file 502 to be evaluated for constructing a target image can be obtained according to the file evaluation request 501. The text file 502 to be evaluated can include at least one text block 503 to be evaluated. Each text block 503 among the at least one text block 503 to be evaluated can include text block association information 503_1 and at least one instruction 503_2 to be evaluated.

[0157] At least one text block to be evaluated can be sequentially determined as the target text block to be evaluated 504 according to the text block association information 503_1. The instruction association information 505 corresponding to the target text block to be evaluated 504 can be determined according to the target text block to be evaluated 504. At least one instruction to be evaluated 503_2 corresponding to the target text block to be evaluated 504 can be sequentially determined as the target instruction to be evaluated 506 according to the target text block to be evaluated 504 and the corresponding instruction association information 505.

[0158] The preset dictionary 507 can include at least one preset instruction 507_1 and the score 507_2 corresponding to each of the at least one preset instruction 507_1. The target preset instruction 508 can be determined in the at least one preset instruction 507_1 of the preset dictionary 507 according to the target instruction to be evaluated 506.

[0159] The score 507_2 corresponding to the target preset instruction 508 can be determined as the score 509 of the target instruction to be evaluated. The evaluation value 510 corresponding to each of the at least one text block to be evaluated can be determined according to the target text block to be evaluated 504, the instruction association information 505 corresponding to the target text block to be evaluated 504, and the score 509 of the target instruction to be evaluated.

[0160] The evaluation value 511 of the text file to be evaluated can be determined according to the evaluation value 510 corresponding to each of the at least one text block to be evaluated. The difference 513 between the evaluation value 511 of the text file to be evaluated and the second preset threshold 512 can be determined. The text file evaluation result 515 can be determined according to the relationship between the difference 513 and the third preset threshold 514.

[0161] The above are only exemplary embodiments, but are not limited thereto. Other dictionary-based file evaluation methods known in the art can also be included, as long as file evaluation can be performed.

[0162] Figure 6 A block diagram of a dictionary construction device according to an embodiment of the present disclosure is schematically shown.

[0163] As Figure 6 shown, the dictionary construction device 600 can include a first acquisition module 601, a second acquisition module 602, a first determination module 603, and a first construction module 604.

[0164] The first acquisition module 601 is configured to acquire at least one preset instruction for constructing an image.

[0165] The second acquisition module 602 is configured to acquire a text file and mirror information corresponding to the text file within a preset period according to the at least one preset instruction, where the text file includes at least one preset instruction, and the mirror information is used to characterize the information of the mirror constructed based on the text file.

[0166] The first determination module 603 is configured to determine scores corresponding to at least one preset instruction according to the mirror information. The first construction module 604 is configured to construct a preset dictionary according to at least one preset instruction and the scores corresponding to at least one preset instruction respectively. The preset dictionary is represented by key-value pairs.

[0167] According to an embodiment of the present disclosure, the second acquisition module 602 may include a first determination unit and a first acquisition unit.

[0168] The first determination unit is configured to determine a target preset instruction among at least one preset instruction.

[0169] The first acquisition unit is configured to acquire a target text file within a preset period and target mirror information corresponding to the target text file according to the target preset instruction. The target text file includes the target preset instruction, and the target mirror information is used to characterize the information of the target mirror constructed based on the target text file.

[0170] According to an embodiment of the present disclosure, the first determination module 603 may include a second determination unit.

[0171] The second determination unit is configured to determine a target score corresponding to the target preset instruction according to the target mirror information.

[0172] Figure 7 A block diagram of a dictionary-based file evaluation device according to an embodiment of the present disclosure is schematically shown.

[0173] As Figure 7 shown, the dictionary-based file evaluation device 700 may include a third acquisition module 701, an evaluation module 702, a second determination module 703, and a third determination module 704.

[0174] The third acquisition module 701 is configured to, in response to receiving a file evaluation request, acquire a text file to be evaluated for constructing a target mirror according to the file evaluation request. The text file to be evaluated includes at least one text block to be evaluated.

[0175] The evaluation module 702 is configured to evaluate each text block to be evaluated among at least one text block to be evaluated respectively according to the preset dictionary, and obtain an evaluation value corresponding to each text block to be evaluated.

[0176] The second determination module 703 is configured to determine an evaluation value of the text file to be evaluated according to the evaluation values corresponding to at least one text block to be evaluated respectively.

[0177] The third determination module 704 is configured to determine a text file evaluation result according to the evaluation values corresponding to at least one text block to be evaluated respectively.

[0178] According to an embodiment of the present disclosure, the preset dictionary is constructed by using a dictionary construction device.

[0179] According to an embodiment of the present disclosure, each of the at least one text block to be evaluated includes text block association information and at least one instruction to be evaluated, and each of the at least one instruction to be evaluated includes instruction association information.

[0180] According to an embodiment of the present disclosure, the evaluation module 702 may include a third determination unit, a fourth determination unit, a fifth determination unit, a sixth determination unit, and a seventh determination unit.

[0181] The third determination unit is configured to sequentially determine at least one text block to be evaluated as a target text block to be evaluated according to the text block association information.

[0182] The fourth determination unit is configured to sequentially determine at least one instruction to be evaluated corresponding to the target text block to be evaluated as a target instruction to be evaluated according to the target text block to be evaluated and the instruction association information corresponding to the target text block to be evaluated.

[0183] The fifth determination unit is configured to determine a target preset instruction among at least one preset instruction in the preset dictionary according to the target instruction to be evaluated.

[0184] The sixth determination unit is configured to determine the score corresponding to the target preset instruction as the score of the target instruction to be evaluated.

[0185] The seventh determination unit is configured to determine an evaluation value corresponding to each of the at least one text block to be evaluated according to the target text block to be evaluated, the instruction association information corresponding to the target text block to be evaluated, and the score of the target instruction to be evaluated.

[0186] According to an embodiment of the present disclosure, the dictionary-based file evaluation device 700 may further include a setting module.

[0187] The setting module is configured to set the score corresponding to the instruction to be evaluated as a first preset threshold in response to detecting that the instruction to be evaluated includes a preset character.

[0188] According to an embodiment of the present disclosure, the third determination module 704 may include an eighth determination unit, a ninth determination unit, and a tenth determination unit.

[0189] The eighth determination unit is configured to determine the difference between the evaluation value of the text file to be evaluated and a second preset threshold.

[0190] The ninth determination unit is configured to determine that the text file to be evaluated passes the evaluation when the difference is greater than a third preset threshold.

[0191] A tenth determination unit, configured to determine that the text file to be evaluated fails the evaluation when the difference is less than or equal to a third preset threshold.

[0192] According to an embodiment of the present disclosure, the dictionary-based file evaluation device 700 may further include a second construction module.

[0193] The second construction module is configured to construct a target image based on the text file to be evaluated when it is determined that the evaluation result of the text file indicates that the evaluation passes.

[0194] According to an embodiment of the present disclosure, the second construction module may include an eleventh determination unit and an execution unit.

[0195] The eleventh determination unit is configured to determine a base image for constructing the target image according to the text file to be evaluated.

[0196] The execution unit is configured to execute the text file to be evaluated based on the base image to obtain a target image.

[0197] According to an embodiment of the present disclosure, the dictionary-based file evaluation device 700 may further include a change module, a second determination module, and a third construction module.

[0198] The change module is configured to change at least one text block to be evaluated to obtain at least one changed text block to be evaluated when it is determined that the evaluation result of the text file indicates that the evaluation fails.

[0199] The second determination module is configured to determine the evaluation result of the changed text file according to the evaluation values respectively corresponding to at least one changed text block to be evaluated.

[0200] The third construction module is configured to construct a target image based on the changed text file to be evaluated when it is determined that the evaluation result of the changed text file indicates that the evaluation passes.

[0201] Any of a plurality of modules, sub-modules, units, and sub-units according to embodiments of the present disclosure, or at least part of the functions of any of them, can be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to embodiments of the present disclosure can be split into multiple modules for implementation. Any one or more of the modules, sub-modules, units, and sub-units according to embodiments of the present disclosure can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by any other reasonable way of integrating or packaging circuits, or implemented in any one of software, hardware, and firmware, or in a suitable combination of any of them. Alternatively, one or more of the modules, sub-modules, units, and sub-units according to embodiments of the present disclosure can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding functions can be executed.

[0202] For example, any of the first acquisition module 601, the second acquisition module 602, the first determination module 603, and the first construction module 604 can be combined and implemented in one module / unit / sub-unit, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to embodiments of the present disclosure, at least one of the first acquisition module 601, the second acquisition module 602, the first determination module 603, and the first construction module 604 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by any other reasonable way of integrating or packaging circuits, or implemented in any one of software, hardware, and firmware, or in a suitable combination of any of them. Alternatively, at least one of the second acquisition module 602, the first determination module 603, and the first construction module 604 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding functions can be executed.

[0203] For example, any combination of the second acquisition module 701, the evaluation module 702, the second determination module 703, and the third determination module 704 can be implemented in one module / unit / sub-unit, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the second acquisition module 701, the evaluation module 702, the second determination module 703, and the third determination module 704 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on a substrate, a system in a package, an application specific integrated circuit (ASIC), or any other reasonable way of integrating or packaging circuits, etc., implemented by hardware or firmware, or implemented in any one of the three implementation manners of software, hardware, and firmware, or in an appropriate combination of any several of them. Alternatively, at least one of the second acquisition module 701, the evaluation module 702, the second determination module 703, and the third determination module 704 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding functions can be executed.

[0204] It should be noted that the dictionary building apparatus part in the embodiments of the present disclosure corresponds to the dictionary building method part in the embodiments of the present disclosure. For the description of the dictionary building apparatus part, please refer to the dictionary building method part specifically, and details are not repeated here. The dictionary-based file evaluation apparatus part in the embodiments of the present disclosure corresponds to the dictionary-based file evaluation method part in the embodiments of the present disclosure. For the description of the dictionary-based file evaluation apparatus part, please refer to the dictionary-based file evaluation method part specifically, and details are not repeated here.

[0205] Figure 8 A block diagram of an electronic device suitable for implementing the dictionary building method and the dictionary-based file evaluation method according to an embodiment of the present disclosure is schematically shown. Figure 8 The shown electronic device is only an example and should not impose any limitation on the functions and usage scope of the embodiments of the present disclosure.

[0206] Such as Figure 8As shown, the computer electronic device 800 according to an embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage section 809 into a random access memory (RAM) 803. The processor 801 can include, for example, a general microprocessor (such as a CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (such as an application-specific integrated circuit (ASIC)), and so on. The processor 801 can also include on-board memory for caching purposes. The processor 801 can include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.

[0207] In the RAM 803, various programs and data required for the operation of the electronic device 800 are stored. The processor 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. The processor 801 performs various operations of the method flow according to an embodiment of the present disclosure by executing the programs in the ROM 802 and / or the RAM 803. It should be noted that the programs can also be stored in one or more memories other than the ROM 802 and the RAM 803. The processor 801 can also perform various operations of the method flow according to an embodiment of the present disclosure by executing the programs stored in the one or more memories.

[0208] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, and the input / output (I / O) interface 805 is also connected to the bus 804. The electronic device 800 may further include one or more of the following components connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed so that a computer program read from it can be installed into the storage section 808 as needed.

[0209] According to an embodiment of the present disclosure, the method flow according to the embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes program codes for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 809, and / or installed from a removable medium 811. When the computer program is executed by a processor 801, the above functions defined in the system according to the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the above-described systems, devices, apparatuses, modules, units, etc. can be implemented by computer program modules.

[0210] The present disclosure also provides a computer-readable storage medium, which can be included in the device / apparatus / system described in the above embodiment; or can exist alone without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.

[0211] According to an embodiment of the present disclosure, the computer-readable storage medium can be a non-volatile computer-readable storage medium. For example, it can include but is not limited to: portable computer disks, hard disks, random access memories (RAMs), read-only memories (ROMs), erasable programmable read-only memories (EPROMs or flash memories), portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program, and the program can be used by or in combination with an instruction execution system, device, or device.

[0212] For example, according to an embodiment of the present disclosure, the computer-readable storage medium can include the above-described ROM 802 and / or RAM 803 and / or one or more memories other than ROM 802 and RAM 803.

[0213] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program includes program codes for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program codes are used to enable the electronic device to implement the dictionary building method and the file evaluation method based on the dictionary provided by the embodiment of the present disclosure.

[0214] When the computer program is executed by the processor 801, the above functions defined in the system / apparatus of the embodiments of the present disclosure are performed. According to the embodiments of the present disclosure, the systems, apparatuses, modules, units, etc. described above can be implemented by computer program modules.

[0215] In one embodiment, the computer program can rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program can also be transmitted and distributed in the form of signals on a network medium, and be downloaded and installed through the communication part 809, and / or be installed from the removable medium 811. The program code included in the computer program can be transmitted by any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0216] According to the embodiments of the present disclosure, the program code for executing the computer program provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level procedures and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include but are not limited to, such as Java, C++, python, the "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, by using an Internet service provider to connect through the Internet).

[0217] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks may occur in an order different from that noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and combinations of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features recited in the various embodiments and / or claims of the present disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly recited in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features recited in the various embodiments and / or claims of the present disclosure can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present disclosure.

[0218] The embodiments of the present disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments have been described separately above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. The scope of the present disclosure is defined by the appended claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art can make various substitutions and modifications, and all such substitutions and modifications should fall within the scope of the present disclosure.

Claims

1. A dictionary construction method, comprising: Obtaining at least one preset instruction for constructing an image; Obtaining a text file within a preset time period and corresponding image information based on the at least one preset instruction, wherein the text file includes the at least one preset instruction, and the image information is used to represent information of an image constructed based on the text file; Determining respective scores corresponding to the at least one preset instruction according to the image information; and Constructing a preset dictionary according to the at least one preset instruction and the respective scores corresponding to the at least one preset instruction, wherein the preset dictionary is represented by key-value pairs; The obtaining a text file within a preset time period and corresponding image information according to the at least one preset instruction includes: Determining a target preset instruction among the at least one preset instruction; Obtaining a target text file within a preset time period and corresponding target image information according to the target preset instruction, wherein the target text file includes the target preset instruction, and the target image information is used to represent information of a target image constructed based on the target text file; The determining respective scores corresponding to the at least one preset instruction according to the image information includes: Determining a target score corresponding to the target preset instruction according to the target image information.

2. A file evaluation method based on a dictionary, comprising: In response to receiving a file evaluation request, obtaining a text file to be evaluated for constructing a target image according to the file evaluation request, wherein the text file to be evaluated includes at least one text block to be evaluated; Evaluating each text block to be evaluated in the at least one text block to be evaluated respectively according to a preset dictionary to obtain respective evaluation values corresponding to the at least one text block to be evaluated; Determining an evaluation value of the text file to be evaluated according to the respective evaluation values corresponding to the at least one text block to be evaluated; and Determining a text file evaluation result according to the evaluation value of the text file to be evaluated; wherein the preset dictionary is constructed by using the method according to claim 1.

3. The method according to claim 2, wherein, Each text block to be evaluated in the at least one text block to be evaluated includes text block association information and at least one instruction to be evaluated, and each instruction to be evaluated in the at least one instruction to be evaluated includes instruction association information; The evaluating each text block to be evaluated in the at least one text block to be evaluated respectively according to a preset dictionary to obtain respective evaluation values corresponding to the at least one text block to be evaluated includes: Sequentially determining the at least one text block to be evaluated as a target text block to be evaluated according to the text block association information; Sequentially determining the at least one instruction to be evaluated corresponding to the target text block to be evaluated as a target instruction to be evaluated according to the target text block to be evaluated and the instruction association information corresponding to the target text block to be evaluated; Determining a target preset instruction among the at least one preset instruction in the preset dictionary according to the target instruction to be evaluated; Determine the score corresponding to the target preset instruction as the score of the target instruction to be evaluated; and Determine the evaluation value corresponding to each of the at least one text block to be evaluated according to the target text block to be evaluated, the instruction association information corresponding to the target text block to be evaluated, and the score of the target instruction to be evaluated.

4. The method according to claim 3, further comprising: In response to detecting that the instruction to be evaluated includes a preset character, set the score corresponding to the instruction to be evaluated to a first preset threshold.

5. The method according to claim 4, wherein, The determining the text file evaluation result according to the evaluation value of the text file to be evaluated includes: Determine the difference between the evaluation value of the text file to be evaluated and a second preset threshold; In the case where the difference is greater than a third preset threshold, determine that the text file to be evaluated passes the evaluation; and In the case where the difference is less than or equal to the third preset threshold, determine that the text file to be evaluated fails the evaluation.

6. The method according to claim 5, further comprising: In the case where it is determined that the text file evaluation result indicates passing the evaluation, construct the target image based on the text file to be evaluated.

7. The method according to claim 6, wherein, The constructing the target image based on the text file to be evaluated in the case where it is determined that the text file evaluation result indicates passing the evaluation includes: Determine a base image for constructing the target image according to the text file to be evaluated; and Based on the base image, execute the text file to be evaluated to obtain the target image.

8. The method according to claim 5, further comprising: In the case where it is determined that the text file evaluation result indicates failing the evaluation, make changes to the at least one text block to be evaluated to obtain at least one changed text block to be evaluated; Determine the evaluation result of the changed text file according to the evaluation value corresponding to each of the at least one changed text block to be evaluated; And In the case where it is determined that the evaluation result of the changed text file indicates passing the evaluation, construct the target image based on the changed text file to be evaluated.

9. A dictionary construction device, comprising: A first acquisition module, configured to acquire at least one preset instruction for constructing an image; A second acquisition module, configured to acquire a text file within a preset time period and mirror information corresponding to the text file according to the at least one preset instruction, wherein the text file includes the at least one preset instruction, and the mirror information is used to represent information of a mirror constructed based on the text file; A first determination module, configured to determine the score corresponding to each of the at least one preset instruction according to the mirror information; and A first construction module, configured to construct a preset dictionary according to the at least one preset instruction and the score corresponding to each of the at least one preset instruction, wherein the preset dictionary is represented by key-value pairs; The second acquisition module includes: A first determination unit, configured to determine a target preset instruction among the at least one preset instruction; A first acquisition unit, configured to obtain a target text file within a preset time period and target mirror image information corresponding to the target text file according to the target preset instruction, where the target text file includes the target preset instruction, and the target mirror image information is used to represent information of a target mirror image constructed based on the target text file; According to the mirror image information, the first determination module includes: A second determination unit, configured to determine a target score corresponding to the target preset instruction according to the target mirror image information.

10. A file evaluation device based on a dictionary, including: A third acquisition module, configured to, in response to receiving a file evaluation request, obtain a text file to be evaluated for constructing a target mirror image according to the file evaluation request, where the text file to be evaluated includes at least one text block to be evaluated; An evaluation module, configured to evaluate each text block to be evaluated in the at least one text block to be evaluated respectively according to a preset dictionary, and obtain an evaluation value corresponding to each text block to be evaluated; A second determination module, configured to determine an evaluation value of the text file to be evaluated according to the evaluation values corresponding to the at least one text block to be evaluated respectively; and A third determination module, configured to determine a text file evaluation result according to the evaluation value of the text file to be evaluated; where the preset dictionary is constructed by using the device according to claim 9.

11. An electronic device, including: One or more processors; A memory, configured to store one or more instructions, where when the one or more instructions are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 or 2 - 8.

12. A computer-readable storage medium, on which executable instructions are stored, and when the executable instructions are executed by a processor, the processor implements the method according to any one of claims 1 or 2 - 8.

13. A computer program product, where the computer program product includes computer-executable instructions, and the computer-executable instructions are used to implement the method according to any one of claims 1 or 2 - 8 when being executed.

Citation Information

Patent Citations

  • Data dictionary generation method and device, electronic equipment and storage medium

    CN110348004A

  • Application processing method and device, electronic equipment and storage medium

    CN113687907A