Software defect-based text automatic statistical method and system
Through the automatic statistics method and system based on software defect text, the problem of time-consuming and inaccurate manual statistics is solved, and efficient and accurate defect detection and management is achieved.
Patent Information
- Application Number
- CN202510601640.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-12
- Publication Date
- 2025-08-05
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional software defect statistics methods rely on manual reading and manual statistics, which are time-consuming and labor-intensive and easily lead to inaccurate results, making it difficult to meet the actual needs of large-scale software.
Automatic processing and output are achieved through python-docx, pandas and openpyxl libraries.
It improves the efficiency and accuracy of software defect detection and management, reduces manual participation, and achieves efficient and accurate statistics of software defect information.
Smart Images

Figure CN120429220A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of computer software, and in particular relates to a method and system for automatically counting software defect texts. Background Art
[0002] With the rapid development of the software industry, the importance of software quality has become increasingly prominent. Software defects are one of the main factors affecting software quality. They can not only lead to system failures but also cause serious economic and social consequences. Therefore, how to effectively predict and prevent software defects has become a research hotspot in software engineering.
[0003] During the software development process, defect detection is one of the important means to ensure software quality. Traditional defect statistics methods mainly rely on manual reading of defect reports and manual statistics of relevant information. This method is not only time-consuming and labor-intensive, but also prone to inaccurate statistical results due to human factors. With the continuous expansion of software scale and the increase in complexity, manual statistics methods have become difficult to meet actual needs. Based on the above situation, this application provides a method and system that can efficiently and accurately count relevant information about software defects and improve the efficiency of defect detection and management. Specifically, it provides an automatic statistics method and system based on software defect text. Summary of the Invention
[0004] The purpose of the present invention is to provide a method and system for automatic statistics based on software defect text, which can efficiently and accurately count the relevant information of software defects, reduce manual participation in column-by-column statistics, improve the efficiency of defect detection and management, and the accuracy and efficiency of statistical results.
[0005] The technical solutions adopted by the present invention are as follows:
[0006] A method and system for automatically counting software defect texts, comprising the following steps:
[0007] Step 1: Import text into the system for preprocessing, and automatically save the processed data into a .txt file
[0008] Step 2: Extract keyword features from the .txt text in step 1;
[0009] Step 3: Classify, aggregate and statistically analyze the extracted keyword features;
[0010] Step 4: Output the extracted classification and statistical results to the specified Excel file.
[0011] In a preferred embodiment, the preprocessing in step 1 further comprises: parsing the .docx file content using the python-docx library and saving it in .txt format;
[0012] Read all paragraphs in a .docx file and reprocess the text, including removing special symbols, blank lines, characters, and redundant text. Write the reprocessed text into a new .txt file in paragraph order and set the file encoding to GBK format.
[0013] The generated .txt file is stored in the system specified path and serves as the input data source for subsequent modules.
[0014] In a preferred embodiment, extracting keyword features in step 2 further comprises: reading the pre-processed text file content using a read_txt_file function, which parses the file line by line using a specified encoding and reads all lines;
[0015] After the read_txt_file function reads the file content line by line, it extracts key information based on the specific line beginning identifier, matches the key fields, stores them in the dictionary, and sets two states: decoding failure and decoding success.
[0016] If decoding fails, an error message will be displayed and the system will wait for user action.
[0017] If the decoding is successful, the parse_issues function is used to execute and parse the text file content, read the file content line by line, extract the relevant text information of the software defect report, and store the extracted key information in the dictionary data structure according to the field name to form a structured defect record.
[0018] In a preferred embodiment, the classification and statistical results in step 3 further include: using the value_counts() method of pandas to classify, aggregate and statistically analyze the extracted keyword features, and the above operation counts and statistics at least one of the following categories:
[0019] Statistical number and proportion of defect categories;
[0020] Count the number and distribution of defects by defect level;
[0021] Statistics of processing status according to processing opinions;
[0022] The above statistics return a dictionary containing the count results of each statistical category for output data mapping.
[0023] In a preferred solution, the outputting of the results in step 4 further comprises: using the save_to_excel function to save the extracted data dictionary and the statistical data dictionary as an Excel file;
[0024] Convert the generated data dictionary to a pandas.DataFrame object, generate column headers for the Excel table by field name, and associate them with the original data
[0025] Use the openpyxl engine to save it as an .xlsx file, assign it to different worksheets or data areas according to preset rules, and display the defect type distribution or level ratio.
[0026] An automatic statistics system based on software defect text, comprising:
[0027] The preprocessing module is used to import information containing software defect text data into the system, preprocess the software defect text data, remove useless symbols and redundant text in the text, and then save the preprocessed data into a .txt file in a specified format;
[0028] An extraction module is used to extract keyword features from the preprocessed .txt text, wherein the keyword features include at least one of defect identification, defect type, defect level, repair suggestion, defect category, defect description, handling opinion, cause analysis, and rectification plan;
[0029] A statistical analysis module, configured to perform statistical analysis on the extracted keyword features, wherein the statistical analysis includes at least one of defect quantity statistics, defect type distribution statistics, defect level statistics, and processing opinion statistics;
[0030] The output module is used to output the extracted keyword features and related data of statistical analysis to a specified Excel file.
[0031] In a preferred solution, in the extraction module, the beginning-of-row identifier can be configured by the user to dynamically expand a new keyword field.
[0032] In a preferred solution, the statistical analysis results support screening and filtering by time range, defect level or processing status to generate dynamic statistical reports.
[0033] The technical effects achieved by the present invention are:
[0034] The present invention can efficiently and accurately count the relevant information of software defects, improve the efficiency of defect detection and management, and realize the automatic acquisition of software defect text through the steps of preprocessing, feature extraction, statistical analysis and result output, thereby reducing manual participation in column-by-column statistics and improving the accuracy and efficiency of statistical results. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a schematic diagram of the process structure of automatic statistics of software defect text in the present invention. DETAILED DESCRIPTION
[0036] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0037] In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0038] Secondly, the term "one embodiment" or "embodiment" herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The phrase "in a preferred embodiment" appearing in various places throughout this specification does not necessarily refer to the same embodiment, nor does it constitute a separate or selective embodiment that is mutually exclusive of other embodiments.
[0039] Furthermore, the present invention is described in detail with reference to schematic diagrams. For ease of illustration, when describing the embodiments of the present invention, cross-sectional views illustrating device structures may be partially enlarged and not to scale. Furthermore, the schematic diagrams are merely illustrative and should not limit the scope of protection of the present invention. Furthermore, in actual production, the three-dimensional dimensions of length, width, and depth should be included.
[0040] Preface: Software defect text data refers to the textual information that records and describes software defects during the software development, testing, or maintenance process. This data usually exists in the form of documents, reports, or logs, and is used to describe the characteristics, causes, impacts, and repair suggestions of the defects. Software defect text data is an important basis for software quality management and defect tracking.
[0041] The present invention is an automatic statistical method based on software defect text and an automatic statistical system for processing the method. First, a batch of software defect text data is preset, and the software defect text data includes software versions;
[0042] Defect identification (BugID, etc.);
[0043] Keyword extraction: Extract key information from the text, such as defect type, level, and description;
[0044] Defect status: the current status of the defect, such as new, confirmed, under repair, fixed, verified, closed, etc.
[0045] Defect location: such as module, file, code line number, etc.;
[0046] Defect identification: a unique number for each defect (key feature) for tracking and management;
[0047] Number of defects: the total number of defects and their distribution rows;
[0048] Defect category: classification of defects, such as functional defects, performance defects, interface defects, security defects, etc.
[0049] Defect level: The severity of the defect is usually classified into fatal, serious, general, and minor levels. The priority of fixing the defect is determined based on the defect level. The urgency of fixing the defect is usually classified into high, medium, and low levels.
[0050] Defect description: A detailed description of the defect, including its manifestation and triggering conditions;
[0051] Reporter: Information of the person who submitted the defect;
[0052] Report Date: The time when the defect report was submitted;
[0053] Handling opinions: How to handle the defect, such as repair, postponement, or neglect;
[0054] Cause analysis: Analysis of the causes of defects, which may involve code, design, requirements, etc.
[0055] Corrective action plan: specific remediation steps or measures;
[0056] Impact domain: the scope of the defect's impact on software functions or systems;
[0057] Corrector: Information about the person responsible for fixing the defect;
[0058] Verification of Correction: Information about the person responsible for verifying the defect repair;
[0059] Verification results: Verification results after defect repair, such as pass, fail, etc.; of course, other relevant verification information designed during the development of the invention should fall within the scope of protection of this application, for example:
[0060] Based on defect trend prediction: predict the types and quantities of defects that may occur in the future;
[0061] Improve development processes: By analyzing the causes of defects, optimize development, testing, and maintenance processes to reduce the occurrence of similar defects;
[0062] Priority management: Arrange the repair order reasonably according to the severity and priority of the defects;
[0063] Data storage and management: Store the processed data in a database or file for subsequent query and use, etc.
[0064] Based on the data structured above, precise statistical analysis and report generation can be further achieved. The system automatically parses collected software defect text and classifies, counts, and analyzes defects based on preset rules and algorithms. Charts and reports provide intuitive displays of defect distribution, trends, and remediation progress. This not only improves defect management efficiency but also provides decision makers with intuitive insights, helping them better understand software quality and develop targeted improvement measures.
[0065] Please see the attached Figure 1 As shown, the present invention provides a method and system for automatically counting software defect texts, comprising the following steps:
[0066] Step 1: Import the text to be preprocessed into the system. The system preprocesses the text, including removing special symbols, blank lines, characters and redundant text, and saves the preprocessed data into a .txt file.
[0067] Step 2: Extract keyword features from the .txt text in step 1;
[0068] Step 3: Classify, aggregate and statistically analyze the extracted keyword features;
[0069] Step 4: Output the extracted classification and statistical results to the specified Excel file.
[0070] The preprocessing based on step 1 also includes:
[0071] Use the python-docx library to parse the .docx file content and save it in .txt format;
[0072] Read all paragraphs in a .docx file and reprocess the text, including removing special symbols, blank lines, characters, and redundant text. Write the reprocessed text into a new .txt file in paragraph order and set the file encoding to GBK format.
[0073] The generated .txt file is stored in the system specified path and serves as the input data source for subsequent modules.
[0074] The keyword features extracted based on step 2 also include:
[0075] Use the read_txt_file function to read the preprocessed text file content. This function parses the file line by line in the specified encoding and reads all lines;
[0076] After the read_txt_file function reads the file content line by line, based on a specific line start identifier, where the line start identifier can be set to any of other dynamic information such as defect type, defect level, defect quantity, defect location, etc., the existing decoding information can become the line start identifier of this application, extract key information, match the key field, store it in the dictionary, and set two states: decoding failure and decoding success;
[0077] If decoding fails, an error message will be displayed and the system will wait for user action.
[0078] If the decoding is successful, the parse_issues function is used to execute and parse the text file content, read the file content line by line, extract the relevant text information of the software defect report, and store the extracted key information in the dictionary data structure according to the field name to form a structured defect record.
[0079] Based on the classification and statistical results in step 3, the following are also included:
[0080] Use the value_counts() method of pandas to classify, aggregate, and perform statistical analysis on the extracted keyword features. The above operation counts at least one of the following categories:
[0081] Distribution statistics and percentage of defects by category, such as functional defects, performance defects, interface defects, and other information;
[0082] Count and distribute defects by level, such as fatal, serious, general, minor, or other more detailed levels;
[0083] Statistics of processing status according to processing opinions, such as repaired, pending verification, deferred processing, and other statuses;
[0084] The above statistics return a dictionary containing the count results of each statistical category for output data mapping.
[0085] The output results based on step 4 also include:
[0086] Use the save_to_excel function to save the extracted data dictionary and statistical data dictionary as an Excel file;
[0087] Convert the generated data dictionary to a pandas.DataFrame object, generate column headers for the Excel table by field name, and associate them with the original data
[0088] Use the openpyxl engine to save it as an .xlsx file, assign it to different worksheets or data areas according to preset rules, and display the defect type distribution or level ratio.
[0089] During the saving process, the openpyxl engine ensures file format compatibility, allowing the generated .xlsx file to be opened and edited smoothly in Microsoft Excel and other compatible software. Pre-set rules are designed to optimize data readability and usability. For example, data is allocated to different worksheets based on different defect categories (functional defects, performance defects, interface defects, etc.) or defect levels (fatal, severe, general, minor, etc.). Each worksheet will clearly display statistical information on its corresponding defect type or level, including quantity distribution and percentage, ensuring that the required information can be intuitively obtained, facilitating subsequent data analysis and decision-making.
[0090] Please see the attached Figure 1 As shown, a software defect text automatic statistics system is used to automatically count software defect texts using the above four steps, including:
[0091] The preprocessing module is used to import information containing software defect text data into the system, preprocess the software defect text data, remove useless symbols and redundant text in the text, and then save the preprocessed data into a .txt file in a specified format;
[0092] The extraction module is used to extract keyword features from the preprocessed .txt text. The keyword features include at least one of the following information: defect identification, defect type, defect level, repair suggestion, defect category, defect description, handling opinion, cause analysis, and rectification plan. In the extraction module, the line start identifier can be customized by the user, and new keyword fields can be dynamically expanded.
[0093] A statistical analysis module is used to perform statistical analysis on the extracted keyword features. The statistical analysis includes at least one of the following information: defect quantity statistics, defect type distribution statistics, defect level statistics, and treatment opinion statistics. The statistical analysis results can be filtered by time range, defect level, or treatment status to generate dynamic statistical reports.
[0094] The output module is used to output the extracted keyword features and related data of statistical analysis to a specified Excel file.
[0095] The working principle of the present invention is:
[0096] First, the software to be tested is cleaned and formatted through the preprocessing module for the original defect text data. The system reads the defect text file in .docx format through a file parsing tool (such as the python-docx library), extracts all paragraph contents and cleans the text, removes special symbols, blank lines, redundant text and invalid characters, and ensures the standardization and readability of the text content. The cleaned text is written into a new .txt file in paragraph order, and the encoding is set to GBK format and stored in the specified path as the input data source for subsequent modules. Keyword features are extracted from the preprocessed .txt file. The system calls the read_txt_file function to read the text content line by line and matches the key fields through the preset line identifiers (such as "defect identifier", "defect type", "defect level", etc.). The parse_issues function is used to parse the text line by line and extract the value or description of the corresponding field according to the line identifier. The system extracts information and stores the extracted key information in a dictionary data structure according to the field name to form a structured defect record. Then, it performs multi-dimensional statistical analysis on the extracted keyword features. The system uses the value_counts() method of the pandas library to classify and aggregate fields such as defect type, defect level, and handling opinions, and generates results including defect quantity statistics, defect type distribution statistics, defect level statistics, and handling opinion statistics. The statistical results are stored in the form of a dictionary to facilitate data mapping and visual display of the subsequent output module. Finally, the statistical results are output to the specified Excel file through the output module. The system converts the dictionary data generated by the feature extraction module into a pandas.DataFrame object, generates the column header of the Excel table according to the field name, and uses the openpyxl engine to write the DataFrame object to the Excel file, and distributes it to different worksheets or data areas according to preset rules.
[0097] Through the collaborative work of the above modules, the present invention realizes the automated processing and analysis of software defect text data, significantly improves the efficiency and accuracy of defect statistics, and provides strong support for software quality management and defect repair.
[0098] The foregoing is merely a preferred embodiment of the present invention. It should be noted that those skilled in the art may make various improvements and modifications without departing from the principles of the present invention, and such improvements and modifications are also within the scope of protection of the present invention. Structures, devices, and operating methods not specifically described or explained herein shall, unless otherwise specified or limited, be implemented in accordance with conventional means in the art.
Claims
1. An automatic statistical method based on software defect text, characterized in that: The following steps are involved: Step 1: Import text into the system for preprocessing, and automatically save the processed data into a .txt file Step 2: Extract keyword features from the .txt text in step 1; Step 3: Classify, aggregate and statistically analyze the extracted keyword features; Step 4: Output the extracted classification and statistical results to the specified Excel file.
2. The automatic statistics method based on software defect text according to claim 1, characterized in that: The pre-processing in step 1 further includes: Use the python-docx library to parse the .docx file content and save it in .txt format; Read all paragraphs in a .docx file and reprocess the text, including removing special symbols, blank lines, characters, and redundant text. Write the reprocessed text into a new .txt file in paragraph order and set the file encoding to GBK format. The generated .txt file is stored in the system specified path and serves as the input data source for subsequent modules.
3. The automatic statistics method based on software defect text according to claim 1, characterized in that: Extracting keyword features in step 2 further includes: Use the read_txt_file function to read the preprocessed text file content. This function parses the file line by line in the specified encoding and reads all lines; After the read_txt_file function reads the file content line by line, it extracts key information based on the specific line beginning identifier, matches the key fields, stores them in the dictionary, and sets two states: decoding failure and decoding success. If decoding fails, an error message will be displayed and the system will wait for user action. If the decoding is successful, the parse_issues function is used to execute and parse the text file content, read the file content line by line, extract the relevant text information of the software defect report, and store the extracted key information in the dictionary data structure according to the field name to form a structured defect record.
4. The automatic statistics method based on software defect text according to claim 1 is characterized by: The classification and statistical results in step 3 also include: Use the value_counts() method of pandas to classify, aggregate, and perform statistical analysis on the extracted keyword features. The above operation counts at least one of the following categories: Statistical number and proportion of defect categories; Count the number and distribution of defects by level; Statistics of processing status according to processing opinions; The above statistics return a dictionary containing the count results of each statistical category for output data mapping.
5. The method for automatically counting software defect texts according to claim 1, characterized in that: The output results in step 4 also include: Use the save_to_excel function to save the extracted data dictionary and statistical data dictionary as an Excel file; Convert the generated data dictionary to a pandas.DataFrame object, generate column headers for the Excel table by field name, and associate them with the original data Use the openpyxl engine to save it as an .xlsx file, assign it to different worksheets or data areas according to preset rules, and display the defect type distribution or level ratio.
6. A software defect text-based automatic statistics system, used in the software defect text-based automatic statistics method according to any one of claims 1 to 5, characterized in that: include: The preprocessing module is used to import information containing software defect text data into the system, preprocess the software defect text data, remove useless symbols and redundant text in the text, and then save the preprocessed data into a .txt file in a specified format; An extraction module is used to extract keyword features from the preprocessed .txt text, wherein the keyword features include at least one of defect identification, defect type, defect level, repair suggestion, defect category, defect description, handling opinion, cause analysis, and rectification plan; A statistical analysis module, configured to perform statistical analysis on the extracted keyword features, wherein the statistical analysis includes at least one of defect quantity statistics, defect type distribution statistics, defect level statistics, and processing opinion statistics; The output module is used to output the extracted keyword features and related data of statistical analysis to a specified Excel file.
7. The method and system for automatically counting software defect texts according to claim 6, characterized in that: In the extraction module, the row start identifier can be configured by the user and a new keyword field can be dynamically expanded.
8. The method and system for automatically counting software defect texts according to claim 6, characterized in that: The statistical analysis results can be filtered by time range, defect level or processing status to generate dynamic statistical reports.
Citation Information
Cited By
A method for test report automation generation and distribution
CN122364104A
A method for test report automation generation and distribution
CN122364104B
