AI-based unstructured test case conversion method and device
Through the unstructured test case conversion method based on AI, the problems of manual conversion efficiency and low quality of unstructured test cases are solved, and automated conversion is realized, which improves test efficiency and quality.
Patent Information
- Application Number
- CN202411469398.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-03-18
AI Technical Summary
The testing efficiency and quality of unstructured test cases in the prior art are not high, mainly because manual conversion requires a lot of manpower, which is prone to repeated labor and human errors, and lack of consistency, resulting in cumbersome and complex testing process.
Using an AI-based unstructured test case conversion method, a text vector is generated by preprocessing the conversion test cases, a target category is determined based on the preset classification template, and a structured test case is converted based on the target category and the preset output document to obtain a structured test case.
Save a lot of manpower required for manual conversion, improve the accuracy and efficiency of conversion, and improve the testing efficiency and test quality.
Smart Images

Figure CN119645826A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software testing technology, and in particular to an AI-based unstructured test case conversion method and device. Background Art
[0002] In the process of software testing related to smart grid, test engineering teams usually use TESTLINK platform to handle test cases. TESTLINK is a web-based test management tool that can simplify the creation, management and execution of test cases. However, although TESTLINK provides enough flexibility to support various testing requirements, it does not work well for unstructured test cases. This is because unstructured test cases usually lack clear definitions and have inconsistent formats, which may lead to consistency and repeatability problems in the test execution process, thereby affecting test efficiency and test quality. In order to improve test efficiency and quality, it is very necessary to convert unstructured test cases into structured formats. The existing technical solutions to solve the problem of low test efficiency and quality of unstructured test cases are mainly manual conversion by humans, for example, reading the description of each unstructured test case, and then the tester manually converts it into a structured form based on personal experience, including test title, prerequisites, test steps, expected results, etc.; defining a standard template, all test cases are rewritten according to this template, and the template can include necessary fields such as identifiers, priorities, associated requirements, etc.
[0003] However, due to the characteristics of unstructured test cases, manual conversion of unstructured test cases usually requires a lot of manpower, which is not only prone to duplication of work and human errors, but also lacks consistency, making the entire testing process cumbersome and complicated, resulting in reduced testing efficiency and quality. Summary of the invention
[0004] In order to solve the above-mentioned problem of reduced test efficiency and test quality caused by manual conversion, the embodiment of the present application provides an AI-based unstructured test case conversion method and device, and its technical solution is as follows: In a first aspect, an embodiment of the present application provides an AI-based unstructured test case conversion method, comprising: Preprocess the test cases to be converted and generate text vectors based on the preprocessing results; Determine the target category based on a preset classification template and a text vector; wherein the preset classification template includes at least two categories; Based on the target category and the preset output document, the test cases to be converted are converted to obtain structured test cases.
[0005] In an optional solution of the first aspect, preprocessing the test case to be converted and generating a text vector according to the preprocessing result includes: Split the test case to be converted into at least two words; Mark each word and get the part of speech corresponding to each word; Determine the weight value of each word based on all words and the part of speech corresponding to each word; According to the weight value of each word, a text vector corresponding to the test case to be converted is generated.
[0006] In another optional solution of the first aspect, determining the weight value of each word according to all words and the part of speech corresponding to each word includes: Determine a first weight value according to the frequency of occurrence of all words; Determine a second weight value based on a preset database and a part of speech corresponding to each word; wherein the preset database includes at least two parts of speech and a second weight value corresponding to each part of speech; A third weight value is calculated based on the first weight value and the second weight value, and the third weight value is used as the weight value of each word.
[0007] In another optional solution of the first aspect, determining the target category based on a preset classification template and a text vector includes: Determine the category to which each sample vector belongs based on a preset classification template; Calculate the distance between the text vector and all sample vectors to represent the proximity between the text vector and all sample vectors; The target category is determined based on all distance values.
[0008] In yet another optional solution of the first aspect, determining the target category according to all distance values includes: Sort all distance values from small to large, and select the sample vectors corresponding to the first three distance values as reference vectors; Count the categories to which each reference vector belongs; When it is detected that at least two reference vectors belong to the same category, the same category is taken as the target category.
[0009] In yet another optional solution of the first aspect, after counting the category to which each reference vector belongs, the method further includes: When it is detected that all reference vectors belong to different categories, the sample vectors corresponding to the first five distance values are selected as reference vectors; According to the category to which each reference vector belongs, the target category is determined.
[0010] In yet another optional solution of the first aspect, based on the target category and the preset output document, the test case to be converted is converted to obtain a structured test case, including: Determining an output format corresponding to the target category in a preset output document; wherein the preset output document includes at least two target categories and an output format corresponding to each target category; The test cases to be converted and the output formats are input into a preset conversion model to obtain structured test cases; wherein the preset conversion model is trained by sample test cases to be converted, the output formats corresponding to each sample test case to be converted, and the corresponding structured sample test cases.
[0011] In a second aspect, an embodiment of the present application provides an AI-based unstructured test case conversion device, comprising: The first processing module is used to preprocess the test case to be converted and generate a text vector according to the preprocessing result; A second processing module, used to determine a target category based on a preset classification template and a text vector; wherein the preset classification template includes at least two categories; The third processing module is used to convert the test case to be converted based on the target category and the preset output document to obtain a structured test case.
[0012] In a third aspect, an embodiment of the present application further provides an AI-based unstructured test case conversion device, including a processor and a memory; The processor is connected to the memory; A memory for storing executable program codes; The processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the AI-based unstructured test case conversion method provided by the first aspect of the embodiment of the present application or any one of the implementation methods of the first aspect.
[0013] In a fourth aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the AI-based unstructured test case conversion method provided by the first aspect of the embodiment of the present application or any implementation method of the first aspect can be implemented.
[0014] The beneficial effects brought by the technical solutions provided by some embodiments of this specification include at least: In the AI-based unstructured test case conversion process, the test cases to be converted are preprocessed and then classified according to the preset classification template to determine the target category of the test case. Then, they are converted according to the target category and the preset output document to obtain structured test cases, which saves a lot of manpower required for manual conversion and improves the accuracy and efficiency of conversion, thereby improving test efficiency and quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0016] Figure 1 An overall flow chart of an AI-based unstructured test case conversion method provided in an embodiment of the present application; Figure 2 A schematic diagram of the structure of an unstructured test case conversion device based on AI provided in an embodiment of the present application; Figure 3 A schematic diagram of the structure of another AI-based unstructured test case conversion device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0018] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application, and different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments recorded. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, although the embodiment may not be clearly recorded in the following text.
[0019] The following description provides examples and does not limit the scope, applicability, or examples set forth in the claims. Changes may be made to the function and arrangement of the elements described without departing from the scope of the present application. Various processes or components may be appropriately omitted, substituted, or added to each example. For example, the methods described may be performed in a different order than described, and various steps may be added, omitted, or combined. In addition, features described for some examples may be combined into other examples.
[0020] Please refer to Figure 1 , Figure 1 which shows the overall flowchart of an AI-based unstructured test case conversion method provided by an embodiment of the present application.
[0021] As Figure 1 shown, the AI-based unstructured test case conversion method may at least include the following steps: Step 101, preprocess the test case to be converted and generate a text vector according to the result of the preprocessing.
[0022] In an embodiment of the present application, the AI-based unstructured test case conversion method may be but is not limited to being applied to cloud servers, high-performance computers, laptops, etc. During the conversion process of the AI-based unstructured test case, by preprocessing the test case to be converted, and then classifying it according to a preset classification template to determine the target category of the test case, and then converting it according to the target category and a preset output document to obtain a structured test case, which saves a large amount of manpower required for manual conversion, improves the conversion accuracy and efficiency, and thus improves the test efficiency and test quality.
[0023] Specifically, during the conversion process of the AI-based unstructured test case, each test case to be converted can be preprocessed, which may be but is not limited to including parsing the test case from a test platform (such as the TestLink platform) and processing the parsed data using NLP (Natural Language Processing) technology. For example, word segmentation (dividing the text into words or phrases); removing stop words (removing words that do not carry semantic information, such as "of", "is", "in", etc.); stemming (reducing words to their basic form); lemmatization (converting words to their dictionary form), etc.
[0024] It should be noted that the test cases to be converted are all unstructured test cases, that is, test case descriptions that do not have a fixed format or structure. Such test cases often appear in documents, notes, or verbal descriptions, lacking clear field identifiers or format specifications. In the application of smart grids, unstructured power data is very common as test cases, for example, voltage data with different decimal places, current data with different significant digits, temperature data with different units, etc.
[0025] Furthermore, the preprocessed data can be input into a deep learning model for processing natural language (such as the Wav2Vec model, the Word2Vec model, and the BERT model), and the text vector output by the model can be obtained.
[0026] As an option of the embodiment of the present application, preprocessing the test case to be converted and generating a text vector according to the preprocessing result includes: Split the test case to be converted into at least two words; Mark each word and get the part of speech corresponding to each word; Determine the weight value of each word based on all words and the part of speech corresponding to each word; According to the weight value of each word, a text vector corresponding to the test case to be converted is generated.
[0027] Specifically, in the process of preprocessing the test case to be converted and generating a text vector according to the preprocessing result, the test case to be converted can be segmented first, and the words in the test case to be converted can be separated from the original description, thereby obtaining at least two words.
[0028] Next, each word can be marked to determine the part of speech of each word. It is worth noting that the part of speech here can be a common part of speech (such as noun, verb, etc.) or a custom part of speech. Each word is marked according to a custom rule, for example, the first part of speech used to represent voltage, the second part of speech used to represent current, and the third part of speech used to represent angle, etc.
[0029] After that, each word can be assigned a corresponding weight value according to each word and its part of speech. The rule for assigning weight values can be, but is not limited to: a noun weight value of 2, a verb weight value of 1, if the noun belongs to category A, the weight value is increased by 1, and so on.
[0030] After obtaining the weight value of each word, a text vector corresponding to the test case to be converted can be generated according to the weight value. For example, when the test case to be converted is segmented to obtain words A, B, and C, and the weight values of A, B, and C are assigned to 5, 3, and 8 respectively according to the custom rules, the corresponding text vector [5, 3, 8] can be generated.
[0031] As another option of the embodiment of the present application, the weight value of each word is determined according to all words and the part of speech corresponding to each word, including: Determine a first weight value according to the frequency of occurrence of all words; Determine a second weight value based on a preset database and a part of speech corresponding to each word; wherein the preset database includes at least two parts of speech and a second weight value corresponding to each part of speech; A third weight value is calculated based on the first weight value and the second weight value, and the third weight value is used as the weight value of each word.
[0032] Specifically, in the process of determining the weight value of each word based on all words and their corresponding parts of speech, the frequency of each word appearing in the test case to be converted can be calculated first, and used as the first weight value, and then the second weight value corresponding to the part of speech of the word can be found in a preset database, wherein the preset database includes at least two parts of speech and a second weight value corresponding to each part of speech.
[0033] Next, a third weight value can be calculated based on the first weight value and the second weight value, and the calculated third weight value can be used as the weight value of each word, wherein the calculation method can be but is not limited to taking the average value, weighted average value, maximum value, or minimum value of the two.
[0034] Step 102: determining a target category based on a preset classification template and a text vector; Specifically, after obtaining the text vector, the closest sign vector to the text vector can be found in the preset sign library, and then the category to which the sign vector belongs can be determined, wherein the preset sign library includes at least two sign vectors and the category to which each sign vector belongs. Then, the determined category can be used as the target category to which the text vector belongs. It is worth noting that the preset classification template includes at least two categories, and the categories included in the preset sign library are all set according to the preset classification template.
[0035] It should be noted that the method of finding the landmark vector closest to the text vector may include but is not limited to calculating the mean square error, standard deviation, absolute deviation, etc. of all values in the two vectors.
[0036] As another option of the embodiment of the present application, determining the target category based on a preset classification template and a text vector includes: Determine the category to which each sample vector belongs based on a preset classification template; Calculate the distance between the text vector and all sample vectors to represent the proximity between the text vector and all sample vectors; The target category is determined based on all distance values.
[0037] Specifically, in the process of determining the target category according to the preset classification template and the text vector, the category to which each sample vector belongs can be determined according to the preset classification template, and the category to which it belongs can be determined by, but not limited to, the word with the largest weight value in the sample vector, wherein the sample vector can be, but not limited to, set by the tester according to the actual measurement data. For example, when the sample vector is [3,5,8], corresponding to words A, B, and C respectively, it can be known that the weight value of word C is the largest, and the sample vector can be classified according to the category to which word C belongs.
[0038] Next, the distance value between the obtained text vector and all sample vectors may be calculated, and the distance value may be, but is not limited to, Euclidean distance, Manhattan distance, cosine similarity, etc., thereby obtaining a plurality of distance values of different sizes.
[0039] Thereafter, a target vector (such as a sample vector with the smallest distance value) may be determined from all sample vectors according to the numerical relationship between the multiple distance values, and the category to which the target vector belongs may be used as the target category.
[0040] It can be understood that the distance value is used to characterize the proximity between the text vector and all sample vectors. The higher the proximity, the more accurate the classification result, and the more efficient the process of converting the test cases to be converted into structured test cases.
[0041] As another option of the embodiment of the present application, determining the target category according to all distance values includes: Sort all distance values from small to large, and select the sample vectors corresponding to the first three distance values as reference vectors; Count the categories to which each reference vector belongs; When it is detected that at least two reference vectors belong to the same category, the same category is taken as the target category.
[0042] Specifically, in the process of determining the target category based on all distance values, all distance values can be sorted from small to large, and then the first three sample vectors with the smallest distance values can be selected as reference vectors, and the category to which each reference vector belongs can be counted.
[0043] It can be understood that the smaller the distance value is, the closer the sample vector is to the text vector, and the higher the similarity is. Therefore, when selecting a reference vector, sample vectors with smaller distance values are preferably selected.
[0044] Next, when it is detected that at least two reference vectors belong to the same category, the same category is used as the target category (i.e., majority voting method). For example, when the categories of the three reference vectors are X, X, Y or X, X, X, category X is used as the target category.
[0045] As another option of the embodiment of the present application, after counting the category to which each reference vector belongs, the following step is further included: When it is detected that all reference vectors belong to different categories, the sample vectors corresponding to the first five distance values are selected as reference vectors; According to the category to which each reference vector belongs, the target category is determined.
[0046] Specifically, after counting the categories to which each reference vector belongs, when it is detected that the categories to which all reference vectors belong are different, it means that the number of reference vectors selected at this time is small and insufficient to provide reference value. Therefore, it is necessary to select sample vectors corresponding to the first five distance values (that is, the 5 sample vectors closest to the text vector) as reference vectors.
[0047] It is worth noting that the number of reference vectors added here can be but not limited to 5, and can also be 6, 7 or more numbers. However, in order to avoid a tie in the majority voting method, an odd number of reference vectors is preferred.
[0048] Next, a target vector may be determined according to the category to which each reference vector belongs, by, but not limited to, majority voting, and the category to which the target vector belongs is used as the target category.
[0049] Step 103: Based on the target category and the preset output document, the test case to be converted is converted to obtain a structured test case.
[0050] Specifically, after determining the target category, a unique output format can be determined in a preset output document according to the target category, and then the test case to be converted can be converted into the format for output according to the output format, thereby obtaining a structured test case, and achieving structural unification of test cases of the same type. For example, the voltage value is unified to retain two decimal places, the angle value is unified to retain one decimal place, etc.
[0051] It should be noted that the preset output document includes at least two target categories and an output format corresponding to each target category.
[0052] As another option of the embodiment of the present application, based on the target category and the preset output document, the test case to be converted is converted to obtain a structured test case, including: Determining an output format corresponding to the target category in a preset output document; wherein the preset output document includes at least two target categories and an output format corresponding to each target category; The test cases to be converted and the output formats are input into a preset conversion model to obtain structured test cases; wherein the preset conversion model is trained by sample test cases to be converted, the output formats corresponding to each sample test case to be converted, and the corresponding structured sample test cases.
[0053] Specifically, after determining the target category, since the preset output document includes at least two target categories and the output format corresponding to each target category, the output format corresponding to the target category can be determined in the preset output document, and then the test case to be converted and the output format can be input into the preset conversion model to obtain a structured test case output by the model, and the format of the structured test case is the output format corresponding to the target category.
[0054] It should be noted that the preset conversion model is trained by the sample test cases to be converted, the output format corresponding to each sample test case to be converted, and the corresponding structured sample test cases. In addition, the conversion model is an LLM (Large Language Model), which refers to deep learning models with a large number of parameters. Such models are usually pre-trained on large-scale text data to learn rich language representations. These models can be used for a variety of natural language processing (NLP) tasks, such as text generation, text classification, question-answering systems, etc.
[0055] It can be understood that if there is a test case to be converted including data VoltageA=240V, VoltageB=240V, VoltageC=240V, CurrentA=0A, CurrentB=0A, CurrentC=0A, AngleV-IA=0°, AngleV-IB=0°, AngleV-IC=0°, then the converted structured test case includes data VoltageL1=240.00V, VoltageL2=240.00V, VoltageL3=240.00V, CurrentL1=000.00A, CurrentL2=000.00A, CurrentL3=000.00A, AngleU-IL1=000.0°, AngleU-IL2=000.0°, AngleU-IL3=000.0°.
[0056] See also Figure 2 , Figure 2A structural schematic diagram of an AI-based unstructured test case conversion device provided in an embodiment of the present application is shown.
[0057] like Figure 2 As shown, the AI-based unstructured test case conversion device may include at least a first processing module 201, a second processing module 202, and a third processing module 203, wherein: The first processing module 201 is used to pre-process the test case to be converted and generate a text vector according to the pre-processing result; The second processing module 202 is used to determine the target category based on a preset classification template and a text vector; wherein the preset classification template includes at least two categories; The third processing module 203 is used to convert the test case to be converted based on the target category and the preset output document to obtain a structured test case.
[0058] In some possible embodiments, preprocessing the test case to be converted and generating a text vector according to the preprocessing result includes: The first processing module 201 is specifically used for: Split the test case to be converted into at least two words; Mark each word and get the part of speech corresponding to each word; Determine the weight value of each word based on all words and the part of speech corresponding to each word; According to the weight value of each word, a text vector corresponding to the test case to be converted is generated.
[0059] In some possible embodiments, the weight value of each word is determined according to all words and the part of speech corresponding to each word, including: The first processing module 201 is specifically used for: Determine a first weight value according to the frequency of occurrence of all words; Determine a second weight value based on a preset database and a part of speech corresponding to each word; wherein the preset database includes at least two parts of speech and a second weight value corresponding to each part of speech; A third weight value is calculated based on the first weight value and the second weight value, and the third weight value is used as the weight value of each word.
[0060] In some possible embodiments, determining the target category based on a preset classification template and a text vector includes: The second processing module 202 is specifically used for: Determine the category to which each sample vector belongs based on a preset classification template; Calculate the distance between the text vector and all sample vectors to represent the proximity between the text vector and all sample vectors; The target category is determined based on all distance values.
[0061] In some possible embodiments, determining the target category according to all distance values includes: The second processing module 202 is specifically used for: Sort all distance values from small to large, and select the sample vectors corresponding to the first three distance values as reference vectors; Count the categories to which each reference vector belongs; When it is detected that at least two reference vectors belong to the same category, the same category is taken as the target category.
[0062] In some possible embodiments, after counting the category to which each reference vector belongs, the method further includes: The second processing module 202 is specifically used for: When it is detected that all reference vectors belong to different categories, the sample vectors corresponding to the first five distance values are selected as reference vectors; According to the category to which each reference vector belongs, the target category is determined.
[0063] In some possible embodiments, based on the target category and the preset output document, the test case to be converted is converted to obtain a structured test case, including: The third processing module 203 is specifically used for: Determining an output format corresponding to the target category in a preset output document; wherein the preset output document includes at least two target categories and an output format corresponding to each target category; The test cases to be converted and the output formats are input into a preset conversion model to obtain structured test cases; wherein the preset conversion model is trained by sample test cases to be converted, the output formats corresponding to each sample test case to be converted, and the corresponding structured sample test cases.
[0064] See also Figure 3 , Figure 3 A structural schematic diagram of another AI-based unstructured test case conversion device provided in an embodiment of the present application is shown.
[0065] like Figure 3 As shown, the AI-based unstructured test case conversion device 300 may include at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .
[0066] The communication bus 302 may be used to realize the connection and communication among the above-mentioned components.
[0067] The user interface 303 may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.
[0068] The network interface 304 may include, but is not limited to, a Bluetooth module, an NFC module, a Wi-Fi module, etc.
[0069] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect the various parts of the entire AI-based unstructured test case conversion device 300, and executes various functions and processes data of the AI-based unstructured test case conversion device 300 by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of DSP, FPGA, and PLA. The processor 301 can integrate one or a combination of CPU, GPU, modem, etc. Among them, the CPU mainly processes the operating system, user interface, and application program; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented by a single chip.
[0070] The memory 305 may include a RAM or a ROM. Optionally, the memory 305 includes a non-transitory computer-readable medium. The memory 305 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may optionally be at least one storage device located away from the aforementioned processor 301. As Figure 3 As shown, the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an AI-based unstructured test case conversion device application.
[0071] Specifically, the processor 301 may be used to call the AI-based unstructured test case conversion device application stored in the memory 305, and specifically perform the following operations: Preprocess the test cases to be converted and generate text vectors based on the preprocessing results; Determine the target category based on a preset classification template and a text vector; wherein the preset classification template includes at least two categories; Based on the target category and the preset output document, the test cases to be converted are converted to obtain structured test cases.
[0072] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of the above method are implemented. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0073] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0074] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0075] In the several embodiments provided in the present application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0076] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0077] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0078] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM), random access memory (RAM), mobile hard disk, disk or optical disk and other media that can store program codes.
[0079] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by entering a program to instruct related hardware. The program may be stored in a computer-readable memory, and the memory may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0080] The above are only exemplary embodiments of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure here, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the technical field that are not recorded in the present disclosure. The description and examples are only regarded as exemplary, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. An AI-based unstructured test case conversion method, characterized in that: include: Preprocessing the test case to be converted, and generating a text vector according to the result of the preprocessing; Determine the target category based on a preset classification template and the text vector; wherein the preset classification template includes at least two categories; Based on the target category and the preset output document, the test case to be converted is converted to obtain a structured test case.
2. The method according to claim 1, characterized in that: The preprocessing of the test case to be converted and generating a text vector according to the result of the preprocessing includes: Split the test case to be converted into at least two words; Marking each of the words to obtain a part of speech corresponding to each of the words; Determine a weight value of each of the words according to all of the words and the part of speech corresponding to each of the words; According to the weight value of each of the words, a text vector corresponding to the test case to be converted is generated.
3. The method according to claim 2, characterized in that Determining the weight value of each word according to all the words and the part of speech corresponding to each word includes: Determining a first weight value according to the frequencies of occurrence of all the words; Determine a second weight value based on a preset database and a part of speech corresponding to each of the words; wherein the preset database includes at least two parts of speech and a second weight value corresponding to each part of speech; A third weight value is calculated based on the first weight value and the second weight value, and the third weight value is used as the weight value of each of the words.
4. The method according to claim 1, characterized in that: The determining of the target category based on the preset classification template and the text vector includes: Determine the category to which each sample vector belongs based on a preset classification template; Calculating the distance value between the text vector and all the sample vectors to represent the proximity between the text vector and all the sample vectors; The target category is determined based on all the distance values.
5. The method according to claim 4, characterized in that Determining the target category according to all the distance values includes: All the distance values are sorted in ascending order, and sample vectors corresponding to the first three distance values are selected as reference vectors; Counting the category to which each reference vector belongs; When it is detected that at least two reference vectors belong to the same category, the same category is taken as the target category.
6. The method according to claim 5, characterized in that After counting the categories to which each reference vector belongs, the method further includes: When it is detected that the categories to which all the reference vectors belong are different, the sample vectors corresponding to the first five distance values are selected as reference vectors; According to the category to which each of the reference vectors belongs, a target category is determined.
7. The method according to claim 1, characterized in that The converting the test case to be converted based on the target category and the preset output document to obtain a structured test case includes: Determining an output format corresponding to the target category in a preset output document; wherein the preset output document includes at least two of the target categories and an output format corresponding to each of the target categories; The test cases to be converted and the output formats are input into a preset conversion model to obtain structured test cases; wherein the preset conversion model is trained by sample test cases to be converted, the output formats corresponding to each of the sample test cases to be converted, and the corresponding structured sample test cases.
8. An AI-based unstructured test case conversion device, characterized in that: include: A first processing module, used for preprocessing the test case to be converted and generating a text vector according to the result of the preprocessing; A second processing module, used to determine a target category based on a preset classification template and the text vector; wherein the preset classification template includes at least two categories; The third processing module is used to convert the test case to be converted based on the target category and a preset output document to obtain a structured test case.
9. An AI-based unstructured test case conversion device, characterized in that: including a processor and a memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the steps of the method according to any one of claims 1 to 7.
Citation Information
Cited By
Information extraction method and device for unstructured detection text
CN120670589A
An information extraction method and device for unstructured detection text
CN120670589B