CN115421873A - Dictionary construction method, and file evaluation method, device and equipment based on dictionary - Google Patents

Dictionary construction method, and file evaluation method, device and equipment based on dictionary Download PDF

Info

Publication number
CN115421873A
CN115421873A CN202211219204.5A CN202211219204A CN115421873A CN 115421873 A CN115421873 A CN 115421873A CN 202211219204 A CN202211219204 A CN 202211219204A CN 115421873 A CN115421873 A CN 115421873A
Authority
CN
China
Prior art keywords
evaluated
target
instruction
preset
text file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211219204.5A
Other languages
Chinese (zh)
Inventor
黄维一
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202211219204.5A priority Critical patent/CN115421873A/en
Publication of CN115421873A publication Critical patent/CN115421873A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45508Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45591Monitoring or debugging support

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Machine Translation (AREA)

Abstract

The disclosure provides a dictionary construction method, a dictionary-based file evaluation device and a dictionary-based file evaluation device, which can be applied to the technical field of computers and the technical field of finance. The dictionary construction method comprises the following steps: acquiring at least one preset instruction for constructing a mirror image; acquiring a text file and mirror image information corresponding to the text file in a preset time period according to at least one preset instruction, wherein the text file comprises the at least one preset instruction, and the mirror image information is used for representing information of a mirror image constructed based on the text file; determining a score corresponding to each of at least one preset instruction according to the mirror image information; and constructing a preset dictionary according to the at least one preset instruction and the score corresponding to the at least one preset instruction, wherein the preset dictionary is represented by key-value pairs.

Description

Dictionary construction method, and file evaluation method, device and equipment based on dictionary
Technical Field
The present disclosure relates to the field of computer technology and the field of financial technology, 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
With the development of computer technology, application container engine (Docker) technology has come into force. Docker is a tool that can create and maintain a container environment on a physical machine. A container is a lightweight virtualized environment with independent operating spaces. Dockerfile is a description file of a Docker image. The image may be constructed from a base image, dockerfile, and source code.
In implementing the disclosed concept, the inventors found that there are at least the following problems in the related art: due to the fact that the quality of Dockerfile lacks of a quantification standard, the occupation space of abnormal mirror images is too much, and resource waste is caused.
Disclosure of Invention
In view of the above, 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.
According to an aspect of the present disclosure, there is provided a dictionary construction method including:
acquiring at least one preset instruction for constructing a mirror image;
acquiring a text file and mirror image information corresponding to the text file in a preset time period according to the at least one preset instruction, wherein the text file comprises the at least one preset instruction, and the mirror image information is used for representing information of a mirror image constructed based on the text file;
determining a score corresponding to each of the at least one preset instruction according to the mirror image information; and
and constructing a preset dictionary according to the at least one preset instruction and the score corresponding to the at least one preset instruction, wherein the preset dictionary is represented by key value pairs.
According to an embodiment of the present disclosure, the obtaining, according to the at least one preset instruction, a text file and mirror image information corresponding to the text file in a preset time period includes:
determining a target preset instruction in the at least one preset instruction;
and acquiring a target text file and target mirror image information corresponding to the target text file in a preset time period according to the target preset instruction, wherein the target text file comprises the target preset instruction, and the target mirror image information is used for representing information of a target mirror image constructed based on the target text file.
According to an embodiment of the present disclosure, the determining, according to the mirror image information, a score corresponding to each of the at least one preset instruction includes:
and determining a target score corresponding to the target preset instruction according to the target mirror image information.
According to another aspect of the present disclosure, there is provided a dictionary-based file evaluation method, including:
in response to receiving a file evaluation request, acquiring a text file to be evaluated for constructing a target mirror image according to the file evaluation request, wherein the text file to be evaluated comprises at least one text block to be evaluated;
according to a preset dictionary, each text block to be evaluated in the at least one text block to be evaluated is evaluated respectively to obtain an evaluation value corresponding to each text block to be evaluated;
determining an evaluation value of the text file to be evaluated according to the evaluation value 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;
the preset dictionary is constructed by the dictionary construction method.
According to the embodiment of the disclosure, each text block to be evaluated in the at least one text block to be evaluated comprises 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 comprises instruction association information.
According to an embodiment of the present disclosure, the evaluating each text block to be evaluated in the at least one text block to be evaluated according to a preset dictionary, and obtaining an evaluation value corresponding to each text block to be evaluated includes:
determining the at least one text block to be evaluated as a target text block to be evaluated in sequence according to the text block association information;
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 in sequence 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 in the at least one preset instruction of the preset dictionary according to the target instruction to be evaluated;
determining the score corresponding to the target preset instruction as the score of the target instruction to be evaluated; and
and determining evaluation values corresponding to 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.
According to an embodiment of the present disclosure, the method further includes:
and in response to the fact that the instruction to be evaluated comprises preset characters, setting a score value corresponding to the instruction to be evaluated as a first preset threshold value.
According to an embodiment of the present disclosure, the determining the text file evaluation result according to the evaluation value of the text file to be evaluated includes:
determining a difference value between the evaluation value of the text file to be evaluated and a second preset threshold value;
determining that the text file to be evaluated passes the evaluation under the condition that the difference value is larger than a third preset threshold value; and
and under the condition that the difference value is smaller than or equal to a third preset threshold value, determining that the text file to be evaluated does not pass the evaluation.
According to an embodiment of the present disclosure, the method further includes:
and under the condition that the text file evaluation result representation evaluation is determined to pass, constructing the target mirror image based on the text file to be evaluated.
According to an embodiment of the present disclosure, in the case that it is determined that the text file evaluation result representation evaluation passes, constructing the target image based on the text file to be evaluated includes:
determining a basic mirror image for constructing the target mirror image according to the text file to be evaluated; and
and executing the text file to be evaluated based on the basic mirror image to obtain the target mirror image.
According to an embodiment of the present disclosure, the method further includes:
under the condition that the representation evaluation of the text file evaluation result is not passed, changing the at least one text block to be evaluated to obtain at least one changed text block to be evaluated;
determining an evaluation result of the changed text file according to the evaluation value corresponding to the at least one changed text block to be evaluated; and
and under the condition that the changed text file evaluation result representation evaluation is passed, constructing the target mirror image based on the changed text file to be evaluated.
According to another aspect of the present disclosure, there is provided a dictionary construction apparatus including:
the first acquisition module is used for acquiring at least one preset instruction for constructing a mirror image;
the second obtaining module is used for obtaining a text file and mirror image information corresponding to the text file in a preset time period according to the at least one preset instruction, wherein the text file comprises the at least one preset instruction, and the mirror image information is used for representing mirror image information constructed based on the text file;
the first determining module is used for determining scores corresponding to the at least one preset instruction according to the mirror image information; and
the first construction module is used for constructing a preset dictionary according to the at least one preset instruction and the score corresponding to the at least one preset instruction, wherein the preset dictionary is represented by key value pairs.
According to another aspect of the present disclosure, there is provided a dictionary-based document evaluation apparatus including:
the third acquisition module is used for responding to a received file evaluation request and acquiring a text file to be evaluated for constructing a target mirror image according to the file evaluation request, wherein the text file to be evaluated comprises at least one text block to be evaluated;
the evaluation module is used for 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 an evaluation value corresponding to each text block to be evaluated;
a second determining module, configured to determine, according to the evaluation value corresponding to each of the at least one text block to be evaluated, an evaluation value of the text file to be evaluated; and
a third determining module, configured to determine a text file evaluation result according to the evaluation value corresponding to each of the at least one text block to be evaluated;
wherein, the preset dictionary is constructed by the dictionary construction device.
According to another aspect of the present disclosure, there is provided an electronic device including:
one or more processors;
a memory to store one or more instructions that,
wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method as described above.
According to another aspect of the present disclosure, there is provided a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to implement the method as described above.
According to another aspect of the present disclosure, there is provided a computer program product comprising computer executable instructions for implementing the method as described above when executed.
According to the embodiment of the disclosure, the method comprises the steps of obtaining at least one preset instruction for constructing the mirror image, obtaining the text file in the preset time period and the mirror image information corresponding to the text file according to the at least one preset instruction, and determining the score corresponding to the at least one preset instruction according to the mirror image information. In addition, the corresponding score can be determined based on the preset instruction so as to realize the dictionary-based file evaluation, so that the technical problem that the Dockerfile quality in the related technology lacks of quantitative standards is solved, and the resource utilization rate is improved.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent from the following description of embodiments of the present disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates a system architecture to which a dictionary construction method and a dictionary-based file evaluation method may be applied, according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow diagram of a dictionary construction method in accordance with an embodiment of the present disclosure;
FIG. 3 schematically illustrates an example diagram of a dictionary construction process in accordance with an embodiment of this disclosure;
FIG. 4 schematically illustrates a flow chart of a dictionary-based document evaluation method in accordance with an embodiment of the present disclosure;
FIG. 5 schematically illustrates an example schematic diagram of a dictionary-based document evaluation process in accordance with an embodiment of this disclosure;
FIG. 6 schematically shows a block diagram of a dictionary construction apparatus according to an embodiment of the present disclosure;
FIG. 7 schematically illustrates a block diagram of a dictionary-based document evaluation apparatus in accordance with an embodiment of the present disclosure; and
FIG. 8 schematically illustrates a block diagram of an electronic device suitable for implementing a dictionary construction method and a dictionary-based file evaluation method in accordance with an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
In the technical scheme of the present disclosure, the collection, storage, use, processing, transmission, provision, disclosure, application and other processing of the related data (such as but not limited to personal information of the user) are all in accordance with the regulations of the relevant laws and regulations, and necessary security measures are taken without violating the customs of the public order.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B, and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B, and C" would include but not be limited to systems that have A alone, B alone, C alone, A and B together, A and C together, B and C together, and/or A, B, and C together, etc.). In those instances where a convention analogous to "at least one of A, B, or C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B, or C" would include but not be limited to systems that have A alone, B alone, C alone, A and B together, A and C together, B and C together, and/or A, B, and C together, etc.).
The Docker file is a text file used to construct an image, the content of the Docker container may be defined by a declaration in the Docker file, which may specify the Docker commands and corresponding execution order. Multiple instructions and descriptions may be included in the Dockerfile that are needed to build the image in order to customize the image with the Dockerfile.
However, the quality of the Dockerfile is related to the occupied space of the mirror image, and the quality of the Dockerfile in the related art lacks a quantization standard, so that the occupation space of the abnormal mirror image is excessive, and resource waste is caused.
In order to at least partially solve the technical problems in the related art, the disclosure provides a dictionary construction method, a dictionary-based file evaluation device and equipment, which can be applied to the technical field of computers and the technical field of financial science and technology. The dictionary construction method comprises the following steps: acquiring at least one preset instruction for constructing a mirror image; acquiring a text file and mirror image information corresponding to the text file in a preset time period according to at least one preset instruction, wherein the text file comprises the at least one preset instruction, and the mirror image information is used for representing information of a mirror image constructed based on the text file; determining a score corresponding to each of at least one preset instruction according to the mirror image information; and constructing a preset dictionary according to the at least one preset instruction and the score corresponding to the at least one preset instruction, wherein the preset dictionary is represented by key-value pairs
It should be noted that the dictionary construction method and the dictionary-based file evaluation method and apparatus provided by the embodiments of the present disclosure may be applied to the fields of computer technology and financial technology, for example, to the field of container technology. The dictionary construction method and the dictionary-based file evaluation method and device provided by the embodiment of the disclosure can also be used in any fields except the computer technical field and the financial technology field, such as the information processing technical field. The application fields of the dictionary construction method, the dictionary-based file evaluation method and the dictionary-based file evaluation device provided by the embodiment of the disclosure are not limited.
FIG. 1 schematically illustrates a system architecture to which a dictionary construction method and a dictionary-based file evaluation method may be applied, according to an embodiment of the present disclosure. It should be noted that fig. 1 is only an example of a system architecture to which the embodiments of the present disclosure may be applied to help those skilled in the art understand the technical content of the present disclosure, and does not mean that the embodiments of the present disclosure may not be applied to other devices, systems, environments or scenarios.
As shown in fig. 1, 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 to provide a medium of communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using at least one of the first terminal device 101, the second terminal device 102, the third terminal device 103, to receive or send messages or the like. Various communication client applications, such as a shopping application, a web browser application, a search application, an instant messaging tool, a mailbox client, social platform software, etc. (for example only), may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103.
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, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the dictionary construction method and the dictionary-based file evaluation method provided in the embodiments of the present disclosure may be generally executed by the server 105. Accordingly, the dictionary construction apparatus and the dictionary-based file evaluation apparatus provided by the embodiments of the present disclosure may be generally disposed in the server 105. The dictionary construction method and the dictionary-based file evaluation method provided by the embodiments of the present disclosure may also be executed by a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105. Accordingly, the dictionary construction apparatus and the dictionary-based file evaluation apparatus provided in the embodiments of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103 and/or the server 105.
Alternatively, the dictionary construction method and the dictionary-based file evaluation method provided by the embodiment of the present disclosure may also be executed by the first terminal device 101, the second terminal device 102, and the third terminal device 103, or may 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. Accordingly, the dictionary construction apparatus and the dictionary-based file evaluation apparatus provided in the embodiments of the present disclosure may also be provided in the first terminal device 101, the second terminal device 102, and the third terminal device 103, or in other terminal devices different from the first terminal device 101, the second terminal device 102, and the third terminal device 103.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
It should be noted that the sequence numbers of the respective operations in the following methods are merely used as representations of the operations for description, and should not be construed as representing the execution order of the respective operations. The method need not be performed in the exact order shown, unless explicitly stated.
FIG. 2 schematically shows a flow diagram of a dictionary construction method according to an embodiment of the present disclosure.
As shown in FIG. 2, the dictionary construction method 200 may include operations S210-S240.
In operation S210, at least one preset instruction for constructing an image is acquired.
In operation S220, a text file and mirror image information corresponding to the text file within a preset time period are acquired according to at least one preset instruction. The text file comprises at least one preset instruction, and the mirror image information is used for representing information of a mirror image constructed based on the text file.
In operation S230, scores corresponding to the at least one preset instruction are determined according to the mirror image information.
In operation S240, a preset dictionary is constructed according to at least one preset instruction and a score value corresponding to each of the at least one preset instruction. The preset dictionary is represented by key-value pairs.
According to the embodiment of the disclosure, the container (i.e., container) is a unified platform for building, distributing and running the application program, and can be used for realizing automatic installation, deployment and upgrade of the application program. The image (i.e., image) is a file system obtained by standardizing and packaging the code machine operating environment of the application program, and can be applied to an operating system in which a container is installed. Since the mirror image provides various resources required by the container operation, and is the basis for the container to be operated, the mirror image of the application program needs to be constructed before the application program is automatically deployed based on the container technology.
According to an embodiment of the present disclosure, a base image, a Dockerfile, and source code need to be used when building an image of an application. Dockerfile is a description file used to construct 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, ONBUILD, and the like.
According to the embodiment of the disclosure, after at least one preset instruction for constructing the mirror image is acquired, corresponding scores can be respectively set for each preset instruction according to the historical mirror image construction condition of the preset instruction. One skilled in the art may set scores for different preset instructions according to actual needs, and the embodiment of the present disclosure does not limit a specific score setting manner.
According to the embodiment of the disclosure, the image information can be used for representing the quality condition of the image. The specific value of the preset time period may be set by a person skilled in the art according to actual needs, and the embodiment of the present disclosure does not limit the specific value of the preset time period.
According to the embodiment of the disclosure, a corresponding score can be set for each preset instruction used by the Dockerfile in the preset dictionary. Each preset instruction field in the preset dictionary can be expanded according to actual requirements. Each score field in the preset dictionary can be adjusted according to actual requirements. According to an embodiment of the present disclosure, after determining the score corresponding to each preset instruction, the key-value pair (i.e., "key = value") may be determined according to at least one preset instruction and the score corresponding to each preset instruction. At least one preset instruction may be set to key1, key2, right, key, 8230, keyN, a score value corresponding to preset instruction key1 is set to value1, a score value corresponding to preset instruction key2 is set to value 2. In this case, the key value may be set according to the key value pair key1: value, key2: value 2., keyn: value, \8230, keyN: valueN to construct a preset dictionary.
According to the embodiment of the disclosure, at least one preset instruction for constructing a mirror image is obtained, the text file in a preset time period and the mirror image information corresponding to the text file are obtained according to the at least one preset instruction, and the score corresponding to the at least one preset instruction is determined according to the mirror image information. In addition, the corresponding score can be determined based on the preset instruction so as to realize the dictionary-based file evaluation, so that the technical problem that the Dockerfile quality in the related technology lacks of quantitative standards is solved, and the resource utilization rate is improved.
Referring now to FIG. 3, a dictionary construction method 200 in accordance with an embodiment of the present invention is further described.
According to an embodiment of the present disclosure, operation S220 may include the following operations.
And determining a target preset instruction in at least one preset instruction. And acquiring a target text file and target mirror image information corresponding to the target text file in a preset time period according to the target preset instruction. The target text file comprises a target preset instruction, and the target image information is used for representing the information of the target image constructed based on the target text file.
According to an embodiment of the present disclosure, operation S230 may include the following operations.
And determining a target score corresponding to the target preset instruction according to the target mirror image information.
According to embodiments of the present disclosure, the FROM instruction may be used to designate an image as the base image system for building a custom image. The maintarget instruction may be used to specify MAINTAINER information. The LABEL instruction may be used to add a metadata tag to the image. The CMD instruction can be used to specify the command to be run for the container that is launched. An EXPOSE instruction may be used to tell the Docker service that the container needs the exposed port number. The ENV instruction may be used to set or define an environment variable. The ARG instructions may be used to set image build parameters. The ADD instruction may be used to copy files from a context directory or a directory to a specified path in a container. The COPY instruction may be used to COPY files from a context directory or a directory to a specified path in a container. The ENTRYPOINT instruction is used to specify a container start. The VOLUME instruction may be used to define mount anonymous VOLUME directories. The WORKDIR directive may be used to specify a working directory. The ONBUILD instruction may be used to configure the operational instructions that are executed when the created image is the base image for other newly created images.
According to the embodiment of the disclosure, the target preset instruction can be sequentially determined in the obtained at least one preset instruction. The target image information of the target image constructed according to the target text file and the target text file can be obtained according to the target preset instruction within a preset time period.
According to the embodiment of the disclosure, after the corresponding target mirror image information is acquired, a target score corresponding to a target preset instruction can be determined. For example, the mirror volume obtained by construction is increased when the COPY instruction is used too much, and the use of the COPY instruction is reduced as much as possible when the Dockerfile file is written by increasing the score corresponding to the COPY instruction.
According to the embodiment of the disclosure, the target text file and the corresponding target mirror image information in the preset time period are obtained, and the target score corresponding to the target preset instruction is determined according to the target mirror image information, so that the change of program logic is avoided, the scores corresponding to different preset instructions can be flexibly adjusted, and the flexibility of dictionary construction is improved.
FIG. 3 schematically shows an example schematic of a dictionary construction process in accordance with an embodiment of the present disclosure.
As shown in fig. 3, at least one preset instruction 301 for building an image may be obtained. In at least one preset instruction 301, a target preset instruction 302 is determined.
After the target preset instruction 302 is acquired, the target text file 303 within a preset period may be acquired. The corresponding mirrored information 304 may be constructed based on the target text file 303. After determining the mirrored information 304, a target score 305 corresponding to the target preset instruction 302 may be determined.
After determining the target score 305, a preset dictionary 306 may be constructed from at least one preset instruction 301 and the target score 305 corresponding to each of the at least one preset instruction 301.
The above is only an exemplary embodiment, but is not limited thereto, and other dictionary construction methods known in the art may be included as long as they can construct a dictionary.
FIG. 4 schematically illustrates a flow chart of a dictionary-based document evaluation method in accordance with an embodiment of the present disclosure.
As shown in FIG. 4, the dictionary-based file evaluation method 400 may include operations S410-S440.
In operation S410, in response to receiving the file evaluation request, a text file to be evaluated for constructing the target image is acquired according to the file evaluation request. The text file to be evaluated comprises at least one text block to be evaluated.
In operation S420, each text block to be evaluated in the at least one text block to be evaluated is evaluated according to the preset dictionary, so as to obtain an evaluation value corresponding to each text block to be evaluated.
In operation S430, evaluation values of the text file to be evaluated are determined according to the evaluation values respectively corresponding to the at least one text block to be evaluated.
In operation S440, a text file evaluation result is determined according to evaluation values respectively corresponding to at least one text block to be evaluated.
According to the embodiment of the disclosure, under the condition that file evaluation is required, a user can run a script capable of generating a file evaluation request through terminal equipment, and can send the generated file evaluation request message to a server, so that the server can determine a text file evaluation result according to the file evaluation request message.
According to the embodiment of the disclosure, after a file evaluation request is received, a text file to be evaluated for constructing a target image can be acquired according to the file evaluation request. The text file to be evaluated may include a Dockerfile. Dockerfile is a configuration file in text format that can 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 of the at least one text block to be evaluated may comprise at least one line of command sentences. Each text block to be evaluated can comprise basic mirror image information, maintainer information, mirror image operation instructions, container execution instructions at the time of starting and the like.
According to the embodiment of the disclosure, the preset dictionary can be constructed by using the dictionary construction method as described above. For example, a preset dictionary represented by key-value pairs may be constructed by acquiring at least one preset instruction for constructing a mirror image, setting a corresponding score for each preset instruction, and constructing the preset dictionary according to the at least one preset instruction and the score corresponding to the at least one preset instruction.
According to the embodiment of the disclosure, corresponding scores can be respectively determined for each text block to be evaluated in at least one text block to be evaluated according to a preset dictionary, so as to obtain evaluation values corresponding to the at least one text block to be evaluated respectively. The evaluation value may be used to characterize a score corresponding to the text block to be evaluated.
According to the embodiment of the disclosure, the text file evaluation result can be determined according to the evaluation values respectively corresponding to at least one text block to be evaluated. The text file evaluation result can be used for representing whether the text file to be evaluated passes the evaluation.
According to the embodiment of the disclosure, the text file to be evaluated is obtained according to the 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 according to the preset dictionary, the evaluation value of the text file to be evaluated is determined according to the evaluation value corresponding to each text block to be evaluated, and then the text file evaluation result is determined according to the evaluation value of the text file to be evaluated, so that the integral quantization of the text file to be evaluated is realized, the problem that the Dockerfile lacks a quantization standard in the related technology, the abnormal mirror image occupies too much space and causes resource waste is avoided, and the resource utilization rate is improved.
A dictionary-based document evaluation method 400 in accordance with an embodiment of the present invention is further described with reference to FIG. 5.
According to an embodiment of the present disclosure, operation S420 may include the following operations.
And sequentially determining at least one text block to be evaluated as a target text block to be evaluated according to the text block association information. And determining at least one instruction to be evaluated corresponding to the target text block to be evaluated as the target instruction to be evaluated in sequence according to the target text block to be evaluated and the instruction association information corresponding to the target text block to be evaluated. And determining a target preset instruction in at least one preset instruction of a preset dictionary according to the target instruction to be evaluated. And determining the score corresponding to the target preset instruction as the score of the target instruction to be evaluated. And determining evaluation values respectively corresponding to 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.
According to the embodiment of the disclosure, each text block to be evaluated in at least one text block to be evaluated comprises 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 comprises instruction association information. The text block association information can be used for representing the association relation between each text block to be evaluated. The instruction association information can be used for representing the association relationship between each instruction to be evaluated in the same text block to be evaluated.
The dictionary-based document evaluation method 400 may further include the following operations in accordance with an embodiment of the present disclosure.
And in response to the fact that the instruction to be evaluated comprises the preset characters, setting a score corresponding to the instruction to be evaluated as a first preset threshold value.
According to the embodiment of the present disclosure, the preset characters may be set by those skilled in the art according to actual requirements, which is not limited in the embodiment of the present disclosure. For example, the preset character may be "#", in which case the instruction to be evaluated is an annotation.
According to the embodiment of the disclosure, in the case that it is detected that "#" is included in the instruction to be evaluated, a score corresponding to the instruction to be evaluated may be set as a first preset threshold. The first preset threshold may be set by a person skilled in the art according to actual needs, and the embodiment of the present disclosure does not limit this. For example, the first preset threshold may be zero.
According to the embodiment of the disclosure, since the target text block to be evaluated is determined sequentially according to the at least one text block to be evaluated, the target instruction to be evaluated is determined sequentially according to the at least one instruction to be evaluated corresponding to the target text block to be evaluated, and the evaluation values corresponding to the at least one text block to be evaluated are determined respectively according to the target text block to be evaluated, the instruction association information corresponding to the target text block to be evaluated and the scores of the target instruction to be evaluated, so that a quantization standard is provided for the quality of Dockerfile.
Operation S440 may include the following operations according to an embodiment of the present disclosure.
And determining the difference value between the evaluation value of the text file to be evaluated and a second preset threshold value. And determining that the text file to be evaluated passes the evaluation under the condition that the difference value is larger than a third preset threshold value. And under the condition that the difference value is smaller than or equal to a third preset threshold value, determining that the text file to be evaluated fails to be evaluated.
According to the embodiment of the present disclosure, after determining the evaluation value of the text file to be evaluated, a difference value between the evaluation value of the text file to be evaluated and a second preset threshold value may be determined. The second preset threshold may be set by a person skilled in the art according to actual needs, and the embodiment of the present disclosure does not limit this. For example, the second preset threshold may be 100.
According to an embodiment of the present disclosure, the difference value may be determined by the following formula (1).
t=f-d (1)
Wherein t is used for representing the difference value, f is used for representing a second preset threshold value, and d is used for representing the evaluation value of the text file to be evaluated.
According to the embodiment of the disclosure, after the difference value is determined, whether the text file to be evaluated passes the evaluation may be determined according to the relationship between the difference value and the third preset threshold. The third preset threshold may be set by a person skilled in the art according to actual needs, and the embodiment of the present disclosure does not limit this. For example, the third preset threshold may be 60.
According to the embodiment of the disclosure, the larger the difference value is, the higher the quality of the text file to be evaluated can be represented. And under the condition that the difference value is smaller than or equal to the third preset threshold value, combining at least one text block to be evaluated in the text file to be evaluated so as to improve the quality of the text file to be evaluated. Alternatively, the quality of the text file to be evaluated may be improved by reducing the use of instructions with larger scores.
The dictionary-based document evaluation method 400 may further include the following operations in accordance with an embodiment of the present disclosure.
And under the condition that the characterization evaluation of the text file evaluation result is passed, constructing a target mirror image based on the text file to be evaluated.
According to the embodiment of the disclosure, the text file evaluation result can be used for representing whether the text file to be evaluated passes the evaluation. And under the condition that the text file evaluation result representation evaluation is determined to pass, constructing a target mirror image based on the text file to be evaluated.
According to the embodiment of the disclosure, in the case that the evaluation result characterization evaluation of the text file is determined to pass, building the target image based on the text file to be evaluated may include the following operations.
And determining a basic mirror image for constructing the target mirror image according to the text file to be evaluated. And executing the text file to be evaluated based on the basic mirror image to obtain a target mirror image.
According to the embodiment of the disclosure, the text file to be evaluated may include basic image information, maintainer information, image operation instruction, execution instruction when the container is started, and the like. The basic mirror image on which the target mirror image construction depends can be determined according to the basic mirror image information in the text file to be evaluated. The base image may include base system files on which the image runs depend. After determining to construct a base image of the target image, the text file to be evaluated may be executed based on the base image to obtain the target image.
The dictionary-based document evaluation method 400 may further include the following operations in accordance with an embodiment of the present disclosure.
And under the condition that the representation evaluation of the text file evaluation result is not passed, at least one text block to be evaluated is changed to obtain at least one changed text block to be evaluated. And determining the modified text file evaluation result according to the evaluation value corresponding to each of the at least one modified text block to be evaluated. And under the condition that the evaluation result representation evaluation of the changed text file passes, constructing a target mirror image based on the changed text file to be evaluated.
According to the embodiment of the disclosure, the text file evaluation result can be used for representing whether the text file to be evaluated passes the evaluation. And under the condition that the text file evaluation result representation evaluation is determined not to pass, at least one text block to be evaluated can be changed, so that a target mirror image is constructed on the basis of the changed text file to be evaluated.
According to an embodiment of the present disclosure, changing at least one text block to be evaluated may include a deletion operation and a modification operation. For example, the change operation to at least one text block to be evaluated may be implemented by deleting an instruction with a larger score. Alternatively, the change operation on the at least one text block to be evaluated can be realized by combining the at least one text block to be evaluated.
According to the embodiment of the disclosure, after at least one text block to be evaluated is changed to obtain at least one changed text block to be evaluated, the changed text file evaluation value can be determined. A modified difference between the modified text file evaluation value and a second preset threshold may be determined, and whether the modified text file to be evaluated passes the evaluation may be determined according to a relationship between the modified difference and a third preset threshold.
According to the embodiment of the present disclosure, since the evaluation value of the text file to be evaluated is determined based on the evaluation value corresponding to each of the at least one text block to be evaluated, the difference value is determined based on the evaluation value of the text file to be evaluated and the second preset threshold value, and the text file evaluation result is determined based on the relationship between the difference value and the third preset threshold value, thereby realizing the integral quantization of the text file to be evaluated. In addition, the target mirror image is constructed on the basis of the text file to be evaluated under the condition that the evaluation result characterization evaluation of the text file is determined to pass, at least one text block to be evaluated is changed under the condition that the evaluation result characterization evaluation of the text file is determined not to pass, and the target mirror image is constructed on the basis of the changed text file to be evaluated, so that the quality of the text file for constructing the mirror image is improved.
FIG. 5 schematically shows an example schematic of a dictionary-based document evaluation process in accordance with an embodiment of the present disclosure.
As shown in fig. 5, in response to receiving a file evaluation request 501, a text file to be evaluated 502 for constructing a target image may be obtained according to the file evaluation request 501. The text file to be evaluated 502 may include at least one text block to be evaluated 503. Each text block 503 to be evaluated in the at least one text block 503 to be evaluated may include text block association information 503 u 1 and at least one instruction 503 u 2 to be evaluated.
At least one text block to be evaluated can be sequentially determined as a target text block to be evaluated 504 according to the text block association information 503_1. Instruction association information 505 corresponding to the target text block to be evaluated 504 may 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 504 to be evaluated can be sequentially determined as a target instruction to be evaluated 506 according to the target text block 504 to be evaluated and the corresponding instruction association information 505.
The preset dictionary 507 may include at least one preset instruction 507_1 and a score 507_2 corresponding to each of the at least one preset instruction 507_1. The target pre-set instruction 508 may be determined in at least one pre-set instruction 507_1 of the pre-set dictionary 507 according to the target to-be-evaluated instruction 506.
The score 507_2 corresponding to the target preset instruction 508 may be determined as the score 509 of the target instruction to be evaluated. The evaluation value 510 corresponding to each of at least one text block to be evaluated may be determined based on 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.
The evaluation value 511 of the text file to be evaluated may be determined based on the evaluation value 510 corresponding to each of the at least one text block to be evaluated. A difference 513 between the evaluation value 511 of the text file to be evaluated and the second preset threshold 512 may be determined. The text file evaluation result 515 may be determined from the relationship of the difference value 513 to the third preset threshold value 514.
The above is merely an exemplary embodiment, but is not limited thereto, and other dictionary-based file evaluation methods known in the art may be included as long as file evaluation can be performed.
Fig. 6 schematically shows a block diagram of a dictionary construction apparatus according to an embodiment of the present disclosure.
As shown in fig. 6, the dictionary construction apparatus 600 may include a first obtaining module 601, a second obtaining module 602, a first determining module 603, and a first constructing module 604.
The first obtaining module 601 is configured to obtain at least one preset instruction for constructing a mirror image.
The second obtaining module 602 is configured to obtain, according to at least one preset instruction, a text file and image information corresponding to the text file in a preset time period, where 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.
The first determining module 603 is configured to determine, according to the mirror image information, a score corresponding to each of the at least one preset instruction. The first constructing module 604 is configured to construct a preset dictionary according to at least one preset instruction and a score corresponding to each of the at least one preset instruction. The preset dictionary is represented by key-value pairs.
According to an embodiment of the present disclosure, the second obtaining module 602 may include a first determining unit and a first obtaining unit.
The first determining unit is used for determining a target preset instruction in at least one preset instruction.
The first obtaining unit is used for obtaining a target text file and target mirror image information corresponding to the target text file within a preset time period according to a target preset instruction. The target text file comprises a target preset instruction, and the target mirror image information is used for representing the information of the target mirror image constructed based on the target text file.
According to an embodiment of the present disclosure, the first determining module 603 may include a second determining unit.
And the second determining unit is used for determining a target score corresponding to the target preset instruction according to the target mirror image information.
FIG. 7 schematically shows a block diagram of a dictionary-based document evaluation apparatus according to an embodiment of the present disclosure.
As shown in fig. 7, the dictionary-based file evaluation apparatus 700 may include a third obtaining module 701, an evaluation module 702, a second determination module 703, and a third determination module 704.
The third obtaining module 701 is configured to, in response to receiving the file evaluation request, obtain, according to the file evaluation request, a text file to be evaluated for constructing the target image. The text file to be evaluated comprises at least one text block to be evaluated.
The evaluation module 702 is configured to evaluate each text block to be evaluated in the at least one text block to be evaluated according to a preset dictionary, so as to obtain an evaluation value corresponding to each text block to be evaluated.
A second determining module 703, configured to determine an evaluation value of the text file to be evaluated according to the evaluation value corresponding to each of the at least one text block to be evaluated.
A third determining module 704, configured to determine a text file evaluation result according to the evaluation value corresponding to each of the at least one text block to be evaluated.
According to the embodiment of the disclosure, the preset dictionary is obtained by constructing according to the dictionary constructing device.
According to the embodiment of the disclosure, each text block to be evaluated in at least one text block to be evaluated comprises 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 comprises instruction association information.
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.
And the third determining unit is used for sequentially determining at least one text block to be evaluated as a target text block to be evaluated according to the text block association information.
And the fourth determining unit is used for sequentially determining at least one instruction to be evaluated corresponding to the target text block to be evaluated as the 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.
And the fifth determining unit is used for determining a target preset instruction in at least one preset instruction of the preset dictionary according to the target instruction to be evaluated.
And the sixth determining unit is used for determining the score corresponding to the target preset instruction as the score of the target instruction to be evaluated.
And the seventh determining unit is used for determining the evaluation value corresponding to 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.
According to an embodiment of the present disclosure, the dictionary-based document evaluation apparatus 700 may further include a setup module.
And the setting module is used for setting the score corresponding to the instruction to be evaluated as a first preset threshold value in response to the fact that the instruction to be evaluated comprises preset characters.
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.
And the eighth determining unit is used for determining the difference value between the evaluation value of the text file to be evaluated and the second preset threshold value.
And the ninth determining unit is used for determining that the text file to be evaluated passes the evaluation under the condition that the difference value is larger than a third preset threshold value.
And the tenth determining unit is used for determining that the text file to be evaluated fails to be evaluated under the condition that the difference value is smaller than or equal to a third preset threshold value.
According to an embodiment of the present disclosure, the dictionary-based file evaluation apparatus 700 may further include a second building module.
And the second construction module is used for constructing a target mirror image based on the text file to be evaluated under the condition that the representation evaluation of the text file evaluation result is determined to pass.
According to an embodiment of the present disclosure, the second building block may include an eleventh determining unit and an executing unit.
And the eleventh determining unit is used for determining a basic mirror image for constructing the target mirror image according to the text file to be evaluated.
And the execution unit is used for executing the text file to be evaluated based on the basic mirror image to obtain a target mirror image.
According to an embodiment of the present disclosure, the dictionary-based document evaluation apparatus 700 may further include a change module, a second determination module, and a third construction module.
And the changing module is used for changing at least one text block to be evaluated under the condition that the representation evaluation of the text file evaluation result is determined not to pass, so as to obtain at least one changed text block to be evaluated.
And the second determining module is used for determining the modified text file evaluation result according to the evaluation value corresponding to each of the at least one modified text block to be evaluated.
And the third construction module is used for constructing a target mirror image based on the changed text file to be evaluated under the condition that the changed text file evaluation result representation evaluation is determined to pass.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part 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 may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be implemented at least partly as a computer program module, which when executed, may perform a corresponding function.
For example, any number of the first obtaining module 601, the second obtaining module 602, the first determining module 603, and the first constructing module 604 may be combined and implemented in one module/unit/sub-unit, or any one of the modules/units/sub-units may be split into a plurality of modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality 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 first obtaining module 601, the second obtaining module 602, the first determining module 603, and the first constructing module 604 may 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 may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three implementations of software, hardware, and firmware, or implemented by a suitable combination of any of them. Alternatively, at least one of the second obtaining module 602, the first determining module 603 and the first constructing module 604 may be at least partly implemented as a computer program module, which when executed may perform a corresponding function.
For example, any number of the second obtaining module 701, the evaluating module 702, the second determining module 703 and the third determining module 704 may be combined into one module/unit/sub-unit to be implemented, or any one of the modules/units/sub-units may be split into multiple modules/units/sub-units. Alternatively, at least part of the functionality of one or more of these modules/units/sub-units may be combined with at least part of the functionality 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 obtaining module 701, the evaluating module 702, the second determining module 703 and the third determining module 704 may be implemented at least partially 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 may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three implementations of software, hardware and firmware, or implemented by a suitable combination of any several of them. Alternatively, at least one of the second obtaining module 701, the evaluating module 702, the second determining module 703 and the third determining module 704 may be at least partly implemented as a computer program module, which when executed may perform a corresponding function.
It should be noted that the dictionary construction device part in the embodiment of the present disclosure corresponds to the dictionary construction method part in the embodiment of the present disclosure, and the description of the dictionary construction device part specifically refers to the dictionary construction method part, which is not described herein again. The dictionary-based file evaluation device part in the embodiment of the present disclosure corresponds to the dictionary-based file evaluation method part in the embodiment of the present disclosure, and the description of the dictionary-based file evaluation device part specifically refers to the dictionary-based file evaluation method part, and is not repeated here.
FIG. 8 schematically illustrates a block diagram of an electronic device suitable for implementing a dictionary construction method and a dictionary-based file evaluation method in accordance with an embodiment of the present disclosure. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 8, a 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 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flows according to embodiments of the present disclosure.
In the RAM 803, various programs and data necessary for the operation of the electronic apparatus 800 are stored. The processor 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. The processor 801 performs various operations of the method flow according to the embodiments of the present disclosure by executing programs in the ROM 802 and/or the RAM 803. Note that the programs may also be stored in one or more memories other than the ROM 802 and RAM 803. The processor 801 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 800 may also include input/output (I/O) interface 805, input/output (I/O) interface 805 also connected to bus 804, according to an embodiment of the present disclosure. The electronic device 800 may also include one or more of the following components connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. 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, or the like is mounted on the drive 810 as necessary, so that the computer program read out therefrom is mounted on the storage section 808 as necessary.
According to embodiments of the present disclosure, method flows according to embodiments of the present disclosure may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer-readable storage medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program, when executed by the processor 801, performs the above-described functions defined in the system of the embodiments of the present disclosure. The systems, devices, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist separately and not be assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to an embodiment of the present disclosure, the computer readable storage medium may be a non-volatile computer readable storage medium. Examples may include, but are not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 802 and/or RAM 803 described above and/or one or more memories other than the ROM 802 and RAM 803.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method provided by the embodiments of the present disclosure, when the computer program product is run on an electronic device, the program code being adapted to cause the electronic device to carry out the dictionary construction method and the dictionary-based file evaluation method provided by the embodiments of the present disclosure.
The computer program, when executed by the processor 801, performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, and the like. In another embodiment, the computer program may also be transmitted in the form of a signal, distributed over a network medium, downloaded and installed via communications portion 809, and/or installed from removable media 811. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures 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 diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions. Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the present disclosure, and such alternatives and modifications are intended to be within the scope of the present disclosure.

Claims (14)

1. A dictionary construction method, comprising:
acquiring at least one preset instruction for constructing a mirror image;
acquiring a text file and mirror image information corresponding to the text file in a preset time period according to the at least one preset instruction, wherein the text file comprises the at least one preset instruction, and the mirror image information is used for representing information of a mirror image constructed based on the text file;
determining a score corresponding to each of the at least one preset instruction according to the mirror image information; and
and constructing a preset dictionary according to the at least one preset instruction and the score corresponding to the at least one preset instruction, wherein the preset dictionary is represented by key value pairs.
2. The method of claim 1, wherein,
the obtaining the text file and the mirror image information corresponding to the text file within a preset time period according to the at least one preset instruction comprises:
determining a target preset instruction in the at least one preset instruction;
according to the target preset instruction, acquiring a target text file and target mirror image information corresponding to the target text file in a preset time period, wherein the target text file comprises the target preset instruction, and the target mirror image information is used for representing information of a target mirror image constructed based on the target text file;
the determining, according to the mirror image information, a score corresponding to each of the at least one preset instruction includes:
and determining a target score corresponding to the target preset instruction according to the target mirror image information.
3. A dictionary-based file evaluation method, comprising:
in response to receiving a file evaluation request, acquiring a text file to be evaluated for constructing a target mirror image according to the file evaluation request, wherein the text file to be evaluated comprises at least one text block to be evaluated;
according to a preset dictionary, each text block to be evaluated in the at least one text block to be evaluated is evaluated respectively to obtain an evaluation value corresponding to each text block to be evaluated;
determining an evaluation value of the text file to be evaluated according to the evaluation value 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 predetermined dictionary is constructed by the method according to claim 1 or 2.
4. The method according to claim 3, wherein each text block to be evaluated in the at least one text block to be evaluated comprises 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 comprises instruction association information;
the evaluating each text block to be evaluated in the at least one text block to be evaluated according to the preset dictionary to obtain an evaluation value corresponding to each text block to be evaluated comprises:
according to the text block association information, sequentially determining the at least one text block to be evaluated as a target text block to be evaluated;
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 in sequence 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 in the at least one preset instruction of the preset dictionary according to the target instruction to be evaluated;
determining the score corresponding to the target preset instruction as the score of the target instruction to be evaluated; and
and determining evaluation values corresponding to 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.
5. The method of any of claims 3 or 4, further comprising:
and in response to the fact that the instruction to be evaluated comprises preset characters, setting a score value corresponding to the instruction to be evaluated as a first preset threshold value.
6. The method as claimed in claim 5, wherein said determining a text file evaluation result according to the evaluation value of the text file to be evaluated comprises:
determining a difference value between the evaluation value of the text file to be evaluated and a second preset threshold value;
determining that the text file to be evaluated passes the evaluation under the condition that the difference value is larger than a third preset threshold value; and
and under the condition that the difference value is smaller than or equal to a third preset threshold value, determining that the text file to be evaluated does not pass the evaluation.
7. The method of claim 6, further comprising:
and under the condition that the evaluation result representation evaluation of the text file passes, constructing the target mirror image based on the text file to be evaluated.
8. The method of claim 7, wherein the constructing the target image based on the text file to be evaluated in the case that the evaluation result representation of the text file passes the evaluation comprises:
determining a basic mirror image for constructing the target mirror image according to the text file to be evaluated; and
and executing the text file to be evaluated based on the basic mirror image to obtain the target mirror image.
9. The method of claim 6, further comprising:
under the condition that the representation evaluation of the text file evaluation result is not passed, changing the at least one text block to be evaluated to obtain at least one changed text block to be evaluated;
determining an evaluation result of the changed text file according to the evaluation value corresponding to the at least one changed text block to be evaluated; and
and under the condition that the changed text file evaluation result representation evaluation is passed, constructing the target mirror image based on the changed text file to be evaluated.
10. A dictionary construction apparatus comprising:
the first acquisition module is used for acquiring at least one preset instruction for constructing a mirror image;
the second obtaining module is used for obtaining a text file and mirror image information corresponding to the text file in a preset time period according to the at least one preset instruction, wherein the text file comprises the at least one preset instruction, and the mirror image information is used for representing information of a mirror image constructed based on the text file;
the first determining module is used for determining a score corresponding to each preset instruction according to the mirror image information; and
the first construction module is used for constructing a preset dictionary according to the at least one preset instruction and the score corresponding to the at least one preset instruction, wherein the preset dictionary is represented by key value pairs.
11. A dictionary-based document evaluation apparatus comprising:
the third acquisition module is used for responding to a received file evaluation request and acquiring a text file to be evaluated for constructing a target mirror image according to the file evaluation request, wherein the text file to be evaluated comprises at least one text block to be evaluated;
the evaluation module is used for 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 an evaluation value corresponding to the at least one text block to be evaluated;
the second determination module is used for determining the evaluation value of the text file to be evaluated according to the evaluation value corresponding to the at least one text block to be evaluated; and
the third determining module is used for determining a text file evaluation result according to the evaluation value of the text file to be evaluated;
wherein the predetermined dictionary is constructed using the apparatus of claim 10.
12. An electronic device, comprising:
one or more processors;
a memory to store one or more instructions that,
wherein the one or more instructions, when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-2 or any one of claims 3-9.
13. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 2 or any one of claims 3 to 9.
14. A computer program product comprising computer executable instructions for implementing the method of any one of claims 1 to 2 or any one of claims 3 to 9 when executed.
CN202211219204.5A 2022-09-30 2022-09-30 Dictionary construction method, and file evaluation method, device and equipment based on dictionary Pending CN115421873A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211219204.5A CN115421873A (en) 2022-09-30 2022-09-30 Dictionary construction method, and file evaluation method, device and equipment based on dictionary

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211219204.5A CN115421873A (en) 2022-09-30 2022-09-30 Dictionary construction method, and file evaluation method, device and equipment based on dictionary

Publications (1)

Publication Number Publication Date
CN115421873A true CN115421873A (en) 2022-12-02

Family

ID=84206245

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211219204.5A Pending CN115421873A (en) 2022-09-30 2022-09-30 Dictionary construction method, and file evaluation method, device and equipment based on dictionary

Country Status (1)

Country Link
CN (1) CN115421873A (en)

Similar Documents

Publication Publication Date Title
CN111221521B (en) Method, device, computer system and readable storage medium for generating log code
US20180234329A1 (en) Test building for testing server operation
CN113505302A (en) Method, device and system for supporting dynamic acquisition of buried point data and electronic equipment
CN113900834A (en) Data processing method, device, equipment and storage medium based on Internet of things technology
CN113434241A (en) Page skipping method and device
CN115982491A (en) Page updating method and device, electronic equipment and computer readable storage medium
CN115357761A (en) Link tracking method and device, electronic equipment and storage medium
CN114237651A (en) Installation method and device of cloud native application, electronic equipment and medium
CN112965916A (en) Page testing method, page testing device, electronic equipment and readable storage medium
CN116521317A (en) Mirror image management method and device, electronic equipment and computer readable storage medium
CN116560661A (en) Code optimization method, device, equipment and storage medium
CN114490136A (en) Service calling and providing method, device, electronic equipment, medium and program product
CN115421873A (en) Dictionary construction method, and file evaluation method, device and equipment based on dictionary
CN113326079A (en) Service version switching method, switching device, electronic equipment and storage medium
CN110457632B (en) Webpage loading processing method and device
CN113656041A (en) Data processing method, device, equipment and storage medium
CN113448578A (en) Page data processing method, processing system, electronic device and readable storage medium
CN112068814A (en) Method, device, system and medium for generating executable file
CN114218330A (en) ES cluster selection method, ES cluster selection device, ES cluster selection apparatus, ES cluster selection medium, and program product
CN115016827A (en) Method, device, electronic equipment and medium for deploying JAVA application
CN116541029A (en) Method and device for generating application program installation package, electronic equipment and storage medium
CN116821158A (en) Structured query statement generation method and device, electronic equipment and storage medium
CN114817041A (en) Test module construction method and device, electronic equipment and storage medium
CN116894004A (en) Information display method and device, electronic equipment and computer readable storage medium
CN115098391A (en) Page detection method, device, equipment and medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination