Text test case generation method based on component assembly
The text test case generation method based on component assembly solves the problems of inaccurate evaluation of natural language processing applications and difficulty in constructing test predictions in the existing technology, and achieves efficient testing and error detection of various NLP tasks.
Patent Information
- Application Number
- CN202410786654.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-10-01
AI Technical Summary
Existing technologies cannot effectively evaluate the real performance of natural language processing applications, and test methods lack diversity and versatility, making it difficult to adapt to the complexity of deep neural network models, resulting in difficulty in constructing test predictions and inaccurate evaluation results.
The text test case generation method based on component assembly is used to generate diversified test cases through sentence disassembly and derivation steps, and build transformation relationships to detect wrong behaviors of NLP applications. It is suitable for a variety of NLP tasks.
It improves the testing efficiency and accuracy of NLP applications, enables a more comprehensive evaluation of the performance of natural language processing applications, and detects erroneous behaviors. It is suitable for a variety of NLP tasks, including machine reading comprehension, sentiment analysis, and semantic similarity measurement.
Smart Images

Figure CN118733447A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a text test case generation method based on component assembly, belonging to the technical field of software testing and program analysis. Background Art
[0002] Currently, the standard paradigm for evaluating the performance of Natural Language Processing (NLP) applications is to use validation and test sets divided from well-annotated benchmarks, feed them to the object to be tested, and calculate indicators such as accuracy, precision, recall, and F1-score based on the output results. Researchers have established various benchmarks for various NLP applications, such as SQuAD, GLUE, and NIST MT. We can get the latest developments of some NLP tasks from the rankings displayed on the official websites of some benchmarks. However, the validation or test sets in the benchmarks are not comprehensive and have the same data distribution and bias as the training sets. The data they contain may not trigger erroneous behaviors to discover potential problems in NLP applications. Therefore, the evaluation results of the standard evaluation paradigm cannot fully reflect the actual performance of NLP applications when facing unpredictable inputs in real application scenarios. In addition, checking the consistency between the output and the reference text is a very single way to evaluate the capabilities of NLP applications. Consistency and statistical indicators representing performance only reflect the overall performance of the object under test, and cannot identify the specific characteristics of defects and propose targeted improvement measures. Sometimes, researchers use some tricks to improve the performance of NLP applications, and checking consistency cannot tell whether the correct output is related to these tricks. For example, a machine reading comprehension model can easily "guess" the correct answer through pattern memory or keywords, and consistency checking cannot tell whether the model truly understands the text and infers the answer. Therefore, we propose a test case generation method that can alleviate the limitations of benchmarks and test capabilities and is applicable to a variety of NLP tasks. It can provide effective test cases with diverse sentence patterns and meanings to simulate and cover real-world inputs and evaluate the capabilities of various NLP applications, such as semantic understanding, word recognition, etc.
[0003] In order to better promote the development of NLP applications, researchers have begun to focus on testing methods that can be used for various NLP applications. However, the core module in NLP applications, deep neural network models, makes testing very challenging. The design of traditional testing methods is based on the internal logic manually built by software developers. Therefore, traditional testing methods are not well adapted to deep neural networks whose internal logic is built with millions of parameters and whose programming paradigm is data-driven. In addition, it is very difficult to build rigorous test oracles for NLP applications, that is, the expected output for a given input. For Natural Language Generation (NLG) tasks such as machine translation, the huge output space makes it extremely complex and difficult to manually build and check rigorous oracle information. At present, the evaluation methods of NLG tasks use some indicators (BLEU, ROUGE, etc.) to calculate the difference between the output and the reference text (a subset of the correct output space) to estimate the quality of the output. However, studies have shown that there is no obvious correlation between these indicators and human evaluation.
[0004] So far, researchers have proposed some testing methods for NLP applications that do not rely on benchmark sets. He et al. proposed a structural invariance testing method for machine translation software. This method captures translation errors by checking whether the output of the software satisfies structural invariance. Chen et al. proposed a metamorphic testing method for machine reading comprehension models, including seven metamorphic relations designed specifically for machine reading comprehension tasks (e.g., conversion based on antonym adjectives, conversion based on tense changes, etc.). However, these testing methods can only be used for a single NLP task, and only the input and output characteristics of a single NLP task are considered when designing the metamorphic relations, so they are not universal. CheckList is a behavioral testing tool for multiple types of NLP applications. It includes commonly used test case generation methods and can verify whether NLP applications have some general capabilities. However, unlike automated testing tools, CheckList requires users to participate in the test case generation process to ensure the availability of test cases. Summary of the invention
[0005] The purpose of the present invention is to overcome the technical defects of the prior art and propose a text test case generation method based on component assembly, which effectively solves the current problems of lack of test data in natural language processing applications and difficulty in constructing test predictions, helps testers to efficiently build test case sets, and further helps testers capture the erroneous behavior of the object under test and improves test efficiency.
[0006] The present invention specifically adopts the following technical solution: a text test case generation method based on component assembly, comprising the following steps:
[0007] Step SS1: a sentence decomposition step, comprising: obtaining a compression result by determining the modifiers in the original sentence and deleting them from the original sentence, and then obtaining a slot where the modifiers can be inserted by comparing the compression result with the original sentence to create a sentence derivation template;
[0008] Step SS2: sentence derivation step, including: deriving a new sentence according to the sentence derivation template and the modifier set, and applying a mutation operator to generate a new modifier that conforms to the context;
[0009] Step SS3: constructing a metamorphosis relationship step, including: generating a new test set according to the input format of the NLP task under test and the pre-designed metamorphosis relationship, and then inputting the new test set into the object under test to detect erroneous behavior.
[0010] As a preferred embodiment, the sentence decomposition step specifically includes: defining the sentence derivation template obtained by sentence decomposition as a base plate, defining the removed modifiers as bricks, and given a seed sentence s, the process of decomposing the above sentence is described as follows:
[0011]
[0012] Among them, D(s) represents the sentence decomposition operation, p 0 The sentence derivation template representing the seed sentence s contains basic grammatical elements and slots for inserting modifiers. represents the set of modifiers to be removed, b i Denotes the i-th modifier removed from left to right by D.
[0013] As a preferred embodiment, the sentence derivation step specifically includes: according to the sentence derivation template p 0 and a set of modifiers of size n To derive a new sentence, if the i-th modifier b i Insert templates p in order 0 The i-th slot d i and save, we can generate n+1 sentences; apply the mutation operator σ(b) to generate new modifiers that match the context, and combine the mutated modifiers with the template to generate more new sentences. Given the compression result s 0 and the derived template p 0 , get the initial set S 0 ={s 0} and the derivation chain
[0014] As a preferred embodiment, the sentence derivation step specifically further includes: using a derivation tree to display the dispatch relationship between the newly generated sentences, wherein the root node is the compression result s of the seed sentence0 , which is the starting point of derivation. Each sentence in the i-th layer has one more b inserted than its parent node in the i-1th layer. i The leaf nodes are sentences with all slots filled, and the new sentence set obtained is the union of the outputs of each assembly step; intuitively, from the root node s 0 To the leaf node The path tp j Each node on represents a newly generated sentence and has a derivation relationship. Given a sentence derivation template p0 and a subsidiary set B, the above process is described as follows:
[0015]
[0016] Among them, Sent Lego represents the set of newly generated sentences, and τ represents the use of the derived template p 0 and modifier sets The derivation method of S i represents the output of the i-th assembly step.
[0017] As a preferred embodiment, the step of constructing the transformation relationship specifically includes: according to the input format of the tested NLP task and the pre-designed transformation relationship, the transformation relationship can be based on Sent Lego Generate a new test set Test Lego , then Test Lego The NLP tasks include machine reading comprehension application, sentiment analysis application and semantic similarity measurement application.
[0018] As a preferred embodiment, the step of constructing the metamorphosis relationship specifically further includes: for the machine reading comprehension application, detecting whether it has erroneous behavior by verifying the semantic invariance relationship output by the machine reading comprehension application; given a paragraph p and a question q related to the paragraph p, the semantic invariance relationship is expressed as follows:
[0019]
[0020] Among them, p′ represents a new paragraph with the same semantics as p, M mrc represents the machine reading comprehension application under test, whose output is the answer to the question q it predicts, Represents a semantic invariance relationship; semantic invariance means that when reading a paragraph with the same semantics to answer the same question, the semantics of the predicted answer should not change.
[0021] As a preferred embodiment, the step of constructing the metamorphosis relationship specifically further includes: for the sentiment analysis application, setting a directional expectation to solve the problem of lack of test prediction for new test cases. The directional expectation means that the change of expected emotions meets certain expectations. If a positive / negative text component is added, the emotion of the sentence should become more positive / negative. When testing, the probability change of the sentiment analysis application is regarded as the change of emotion. Given a sentence s and a text component c, the directional expectation relationship is expressed as:
[0022]
[0023] Among them, M sa represents a sentiment analysis application, whose output is the sentiment label of the input c or s+c. Indicates the sentiment label when the input is s+c The corresponding probability, ↑ indicates an increase in probability.
[0024] As a preferred embodiment, the step of constructing the metamorphosis relationship specifically further includes: for the text semantic similarity measurement, the erroneous behavior of the application is captured by verifying whether the similarity labels of a pair of sentences with semantic differences are different; two sentences with a derivation relationship have semantic differences. Given two sentences s and s′ with a derivation relationship, the semantic difference relationship is expressed as follows:
[0025] Sem s ≠Sem s′ →M ssm (s,s′)=0
[0026] Among them, Sem s Represents the semantics of sentence s, Sem s′ Represents the semantics of sentence s′, M ssm Represents the application of text similarity measurement, and its output is 0 or 1; 0 means that the semantics of sentence s and sentence s′ are different, and 1 means that the semantics of sentence s and sentence s′ are the same.
[0027] Beneficial effects achieved by the present invention: The present invention proposes a component-assembly-based test case generation method suitable for a variety of NLP tasks, which can effectively alleviate the limitations of benchmark sets and the capabilities of NLP applications being evaluated. Based on a single seed test case, the method generates new test cases covering a variety of sentence patterns and sentence meanings to simulate and cover real-world inputs to a greater extent, and evaluate various capabilities of NLP applications, such as semantic understanding, word recognition, etc. The present invention conducted experiments on four commonly used NLP tasks, and selected four advanced NLP models and three commercial software as test objects to conduct a comprehensive performance evaluation of the method. The results show that the method can effectively generate test cases for multiple NLP tasks and detect erroneous behaviors of NLP applications, helping testers to evaluate the performance of natural language processing applications in real application scenarios and improve the testing efficiency of software testing and software iterative development. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is a derived case illustration of a component-assembly-based text test case generation method of the present invention.
[0029] Figure 2 The present invention is a flowchart of a method for generating text test cases based on component assembly. DETAILED DESCRIPTION
[0030] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0031] like Figure 1 and Figure 2 As shown, a text test case generation method based on component assembly fully explores the variation potential of seed test cases based on semantic analysis to generate more test cases and improve test efficiency, which specifically includes the following steps.
[0032] S1 generates derived templates: This method uses sentence decomposition operation D to decompose the seed sentence into a simpler sentence s 0 and modifier sets Then, by comparing the seed sentence with s 0 , the method determines that the removed modifier can be inserted into s 0 The positions of the slots in the 0 Together they form the derived template p 0 The input of the sentence disassembly operation D is a seed sentence, and the output is the derived template p 0 and modifier sets The present invention uses spaCy to obtain the dependency structure of the seed sentence, and uses the component parser of Stanford CoreNLP to obtain the component structure. The dependency relationship reflects the part-to-part relationship between paired words in a sentence, while the component relationship reflects the part-to-whole relationship between a sentence and one of its components (words, phrases, sentences, etc.). Through practice, the present invention finds that the dependency relationship is more suitable for extracting adjectives, adverbs, prepositional phrases and verb phrases, while the component relationship is more suitable for extracting clauses. These components are usually regarded as modifiers in complex sentences. Therefore, the present invention first extracts the above-mentioned types of words, phrases and clauses according to the dependency relationship and component relationship of the seed sentence. Then, the present invention selects a sentence compression model SLAHAN with excellent performance to calculate their attention weights, which indicates the importance of the component to the seed sentence. The output of SLAHAN is a label sequence consisting of 0 and 1, and its length is the same as the number of tokens in the input sentence. If the label corresponding to the token is 1, the token should be retained; otherwise, it should be deleted. The present invention regards the number of "1" labels in the label sequence corresponding to these components as their attention weights. If the attention weight of a component is greater than half of the number of tokens it contains, the component is considered to contain important content and should be retained; otherwise, the component is considered to be a modifier and can be deleted. Afterwards, the present invention can obtain the compression result s 0 The n slots corresponding to the modifiers together constitute the derived template p 0 .
[0033] S2 generates new sentences: This method adopts a method based on the derived template p 0 and modifier sets The derivation method τ is used to generate new modifiers that fit the context. This method combines the template and the new modifier σ(b 1 )…σ(b n ) are assembled in sequence. The sentence set Sent generated in this step Lego The sentences in have derivational relationships and different degrees of variation. When generating sentences at the i-th level of the derivation tree, the method inserts the i-th modifier into the sentence at the i-1-th level. The insertion position is the template p 0The i-th slot in . In order to improve the efficiency of test case generation, this method adopts the idea of fuzzy testing to mutate the original modifiers to derive more modifiers that meet the context. In each mutation process, the method replaces one word in the modifier. The parts of speech of the words that can be replaced (candidate words) are nouns, verbs, adjectives and adverbs, excluding stop words (common words) provided by NLTK to avoid grammatical errors. This method uses two methods to determine candidate words. The first method is synonym replacement. This method searches for synonyms of each replaced word in the online word library WordNet corpus. After that, the search results are further corrected according to the singular and plural of the replaced noun, the tense of the replaced verb, and the level of the replaced adjective. This mutation method ensures that the semantics of the modifier does not change as much as possible. The second method is to use a masked language model (MLM) to predict which words are suitable for the context of the replaced word. First, the method uses "[MASK]" to replace the words that meet the replacement conditions in the i-th modifier to obtain multiple modifiers with one "[MASK]". We then insert these modifiers with a "[MASK]" into the sentences at the i-1th layer to form sentences with a "[MASK]". These sentences are like intermediate products of sentence derivation and are the input of the masked language model. The masked language model outputs which words are likely to appear in the masked position, and this method replaces "[MASK]" with these words to obtain new modifiers. The semantics of the modifiers mutated in this way may change, allowing the generated sentences to cover more meanings.
[0034] S3 Test NLP Application: According to NLP tasks and Sent Lego Based on the characteristics of the sentences in Sentences, this method constructs different metamorphosis relations for various NLP tasks. Lego Generate a new test set Test Lego . Then the method will Test Lego Input into the object under test to detect erroneous behavior. Metamorphic testing has been widely used to detect various software defects. It can solve the test prediction problem by defining the necessary properties that the results of multiple executions of the target program need to meet, that is, defining metamorphic relations (MR) to automate the testing process. Violation of metamorphic relations means that there are potential errors in the target program. This method constructs metamorphic relations for three common NLP tasks (machine reading comprehension, sentiment analysis, and semantic similarity measurement).
[0035] For machine reading comprehension applications, this method detects whether it has incorrect behavior by verifying the semantic invariance relationship of the machine reading comprehension application output. Given a paragraph p and a question q related to the paragraph p, the semantic invariance relationship can be expressed as follows:
[0036]
[0037] Among them, p′ represents a new paragraph with the same semantics as p, M mrc represents the machine reading comprehension application under test, whose output is the answer to the question q it predicts, Represents a semantic invariance relationship. Semantic invariance means that when reading a paragraph with the same semantics to answer the same question, the semantics of the predicted answer should not change. From the previous article, we can know that this method can provide new sentences with different degrees of change based on the same seed sentence, and modifier variation also supports synonym replacement to achieve the effect of not changing the semantics. Therefore, this method can generate test cases that meet semantic invariance.
[0038] As shown in the text box, a complete machine reading comprehension test case consists of a paragraph, a question, and the corresponding answer. This method randomly selects four sentences from the paragraph (if the total number of sentences is less than four, all are selected) to transform them. The key point of the transformation is to keep its semantics as unchanged as possible. Therefore, this method chooses the synonym replacement method to change the modifiers, and regards the leaves of each derivation tree as the transformation result of each sentence. In addition, this method does not mutate the modifiers related to the answer and question. For efficiency, this method uses beam search to prune the derivation tree. Beam search is a heuristic search algorithm commonly used in the field of NLP. It selects the best output based on the set target variable. This method sets the target variable as the maximum similarity between word vectors, and the beam size is 4. Therefore, this method can generate up to 256 new test cases based on one seed test case.
[0039] For sentiment analysis applications, the method sets a directional expectation to address the problem of lack of test prediction for new test cases. Directed expectation is to expect the change in sentiment to meet certain expectations. If a positive / negative text component is added, the sentiment of the sentence should become more positive / negative. When testing, the method treats the probabilistic change of sentiment analysis applications as a change in sentiment. Given a sentence s and a text component c, the directional expectation relationship can be expressed as:
[0040]
[0041] Among them, M sa represents a sentiment analysis application, whose output is the sentiment label of the input c or s+c. Indicates the sentiment label when the input is s+c The corresponding probability, ↑ indicates an increase in probability. When a positive or negative component is added, the probability of the opposite label increases and exceeds the threshold, an incorrect behavior will be detected. During the test, this method sets the threshold to 0.1.
[0042] For text semantic similarity measurement, this method can capture the application's misbehavior by verifying whether the similarity labels of a pair of semantically different sentences are different. Sentence decomposition can be understood as turning a concrete sentence into a more abstract sentence. Although concrete sentences and abstract sentences look similar, concrete sentences contain more detailed information than abstract sentences, so their semantics are relatively different. Details are usually added in the form of modifiers, and the conversion relationship between abstract and concrete coincides with the derivation relationship in the output of this method. It can be seen that there is a semantic difference between two sentences with a derivation relationship. Given two sentences s and s′ with a derivation relationship, the semantic difference relationship can be expressed as follows:
[0043] Sem s ≠Sem s′ →M ssm (s,s′)=0
[0044] Among them, Sem s Represents the semantics of sentence s, Sem s′ Represents the semantics of sentence s′, M ssm It represents the application of text similarity measurement, and its output is 0 or 1. 0 means that the semantics of sentence s and sentence s' are different, and 1 means that the semantics of sentence s and sentence s' are the same. This method is based on the path in the derived tree generated by the seed sentence, that is, from the root node to the leaf node, which is the process of gradually changing from an abstract sentence to a concrete sentence. Therefore, this method can also be well adapted to the text similarity measurement test.
[0045] Table 1 is a performance comparison table of the present invention and the existing CheckList on three tasks
[0046]
[0047]
[0048] In order to objectively evaluate whether the test cases generated by this method can efficiently and effectively capture defects, this method is compared with the existing method CheckList in the experimental stage, as shown in Table 1. The above table shows the performance comparison between this method and CheckList on three tasks, where #Bugs represents the number of erroneous behaviors found, P bugThe accuracy of the representation method. It can be seen that the component assembly-based test case generation method in the present invention has higher test performance. Under the size limit of the same seed data set, this method can discover more defects in natural language processing applications with higher accuracy.
[0049] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0050] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0051] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A text test case generation method based on component assembly, characterized in that: The steps include: Step SS1: a sentence decomposition step, comprising: obtaining a compression result by determining the modifiers in the original sentence and deleting them from the original sentence, and then obtaining a slot where the modifiers can be inserted by comparing the compression result with the original sentence to create a sentence derivation template; Step SS2: sentence derivation step, including: deriving a new sentence according to the sentence derivation template and the modifier set, and applying a mutation operator to generate a new modifier that conforms to the context; Step SS3: constructing a metamorphosis relationship step, including: generating a new test set according to the input format of the NLP task under test and the pre-designed metamorphosis relationship, and then inputting the new test set into the object under test to detect erroneous behavior.
2. A method for generating text test cases based on component assembly according to claim 1, characterized in that: The sentence decomposition step specifically includes: defining the sentence derivation template obtained by sentence decomposition as a base plate, defining the removed modifiers as bricks, and given a seed sentence s, the process of decomposing the above sentence is described as follows: Where D(s) represents the sentence disassembly operation, p0 represents the sentence derivation template of the seed sentence s, which contains basic grammatical elements and slots for inserting modifiers. represents the set of modifiers to be removed, b i Denotes the i-th modifier removed from left to right by D.
3. A text test case generation method based on component assembly according to claim 2, characterized in that: The sentence derivation step specifically includes: according to the sentence derivation template p0 and the modifier set of size n To derive a new sentence, if the i-th modifier b i Insert into the i-th slot d of template p0 in sequence i And save, you can generate n+1 sentences; apply the mutation operator σ(b) to generate new modifiers that match the context, and combine the mutated modifiers with the template to generate more new sentences. Given the compression result s0 and the derived template p0, we get the initial set S0 = {s0} and the derived chain 4. A method for generating text test cases based on component assembly according to claim 3, characterized in that: The sentence derivation step specifically includes: using a derivation tree to show the dispatch relationship between the newly generated sentences, where the root node is the compression result s0 of the seed sentence, which is the starting point of derivation, and each sentence in the i-th layer has one more b inserted than its parent node in the i-1th layer. i The leaf nodes are sentences with all slots filled, and the new sentence set is the union of the outputs of each assembly step; intuitively, from the root node s0 to the leaf node The path tp j Each node on represents a newly generated sentence and has a derivation relationship. Given a sentence derivation template p0 and a subsidiary set B, the above process is described as follows: Among them, Sent Lego represents the set of newly generated sentences, τ represents the use of the derived template p0 and the set of modifiers The derivation method of S i represents the output of the i-th assembly step.
5. A method for generating text test cases based on component assembly according to claim 4, characterized in that: The step of constructing the metamorphosis relationship specifically includes: according to the input format of the tested NLP task and the pre-designed metamorphosis relationship, the Sent Lego Generate a new test set Test Lego , then Test Lego The NLP tasks include machine reading comprehension application, sentiment analysis application and semantic similarity measurement application.
6. A method for generating text test cases based on component assembly according to claim 5, characterized in that: The step of constructing the metamorphosis relationship specifically includes: for the machine reading comprehension application, detecting whether it has erroneous behavior by verifying the semantic invariance relationship output by the machine reading comprehension application; given a paragraph p and a question q related to the paragraph p, the semantic invariance relationship is expressed as follows: Among them, p′ represents a new paragraph with the same semantics as p, M mrc represents the machine reading comprehension application under test, whose output is the answer to the question q it predicts, Represents a semantic invariance relationship; semantic invariance means that when reading a paragraph with the same semantics to answer the same question, the semantics of the predicted answer should not change.
7. A method for generating text test cases based on component assembly according to claim 5, characterized in that: The step of constructing the transformation relationship specifically includes: for the sentiment analysis application, setting a directional expectation to solve the problem of lack of test prediction for new test cases. The directional expectation means that the change of expected emotions meets certain expectations. If a positive / negative text component is added, the emotion of the sentence should become more positive / negative. When testing, the probability change of the sentiment analysis application is regarded as the change of emotion. Given a sentence s and a text component c, the directional expectation relationship is expressed as: Among them, M sa represents a sentiment analysis application, whose output is the sentiment label of the input c or s+c. Indicates the sentiment label when the input is s+c The corresponding probability, ↑ indicates an increase in probability.
8. The method for generating text test cases based on component assembly according to claim 5, characterized in that: The step of constructing the metamorphosis relationship specifically includes: for the text semantic similarity measurement, the erroneous behavior of the application is captured by verifying whether the similarity labels of a pair of sentences with semantic differences are different; two sentences with a derivation relationship have semantic differences. Given two sentences s and s′ with a derivation relationship, the semantic difference relationship is expressed as follows: Without s ≠Without s′ →M ssm (s,s′)=0 Among them, Sem s Represents the semantics of sentence s, Sem s′ Represents the semantics of sentence s′, M ssm Represents the application of text similarity measurement, and its output is 0 or 1; 0 means that the semantics of sentence s and sentence s′ are different, and 1 means that the semantics of sentence s and sentence s′ are the same.
Citation Information
Cited By
Automatic speech translation test method based on semantic analysis
CN119808799A
Intelligent text dialogue model fuzzy testing method based on uncertainty
CN119847913A
