A method and device for classifying demand documents based on machine learning
Through the machine learning-based requirement document classification method, preprocessing and classification models are used to automatically classify demand documents, which solves the problem of manual dependence on demand document classification in the existing technology, and improves the accuracy and efficiency of classification.
Patent Information
- Application Number
- CN202110739627.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-06-30
AI Technical Summary
In the prior art, the classification of demand documents still relies on manual labor, resulting in the large number of required documents in the software development process, which cannot be effectively classified and lacks an alternative to automation.
Using machine learning-based requirements document classification method, the requirements document to be classified, preprocessed to obtain word vectors and word feature information, input information into the preset classification model to output the type of word vectors, and according to Types and text content determine the type of the required document.
Solve the problem of manual classification of requirements documents, reduce the learning cost of architects and developers for flow chart composition, improve the concreteness of requirements and the accuracy of demand expression, increase the effective coding time of developers, and pass Continuously learn to improve the accuracy of classification.
Smart Images

Figure CN113342981B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet financial technology, and in particular to a method and device for classifying demand documents based on machine learning. Background Art
[0002] Requirements analysis is an essential part of software development. The requirements plan is mainly used to clarify business scenarios, processes, etc. The analysis and understanding of requirements documents are crucial for developers. Unclear requirements will lead to code modification or even rewriting. As the complexity of business logic increases, the need for graphical requirements document processes becomes more urgent.
[0003] However, the classification of requirement documents is still in the manual classification stage. Due to the large number of requirement documents in the software development process and the increasing complexity leading to a wide variety of types, which also involve semantic relationships, there is currently no other way to replace manual classification, so there are many shortcomings. Summary of the invention
[0004] The classification of requirement documents in the prior art is still in the manual classification stage. Due to the large number of requirement documents in the software development process, the increasing complexity leads to a wide variety of types, which also involves problems such as semantic relationships. There is currently no other way to replace manual classification. The present invention provides a method and device for classifying requirement documents based on machine learning. The requirement documents are classified through a machine learning model, which solves the problem that the current requirement documents need to be manually classified, meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart construction. The requirements are visualized, allowing the architecture to express the requirements more accurately, the development to understand the requirements more clearly, and the effective coding time of developers is increased. Through continuous learning, the accuracy of classification is improved.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] In a first aspect, the present application provides a method for classifying demand documents based on machine learning, comprising:
[0007] Get the requirements document to be classified;
[0008] Preprocessing the demand document to obtain word vectors and word feature information of the demand document;
[0009] Input each word vector and word feature information into a preset classification model, and the classification model outputs the type of each word vector in the requirement document;
[0010] The type of the requirement document is determined according to the type of each word vector and the text content of the requirement document; wherein the classification model is trained using historical word vector data.
[0011] In a preferred embodiment, the preprocessing of the demand document includes:
[0012] Performing syntactic analysis on the demand document to obtain word feature information of the demand document, wherein the word feature information includes: syntactic structure, topic type, and knowledge graph;
[0013] The word feature information is segmented to obtain the word vector and the word feature information; the word feature information includes: part-of-speech information, word importance, synonym relationship, demand word, and position relationship between words.
[0014] In a preferred embodiment, the historical word vector data includes a word vector and a category to which the word vector corresponds, and the method further includes:
[0015] Build a classification model;
[0016] The historical word vector data is input into the classification model to train the classification model.
[0017] In a preferred embodiment, the classification model is a FastText model, and the requirement document classification method further includes:
[0018] Set up a hierarchical classifier.
[0019] In a preferred embodiment, the hierarchical classifier is a hierarchical softmax model.
[0020] In a preferred embodiment, determining the type of the requirement document according to the type of each word vector and the text content of the requirement document includes:
[0021] Using the N-Gram model, a sliding operation is performed on the text content of the demand document with a sliding window of a set byte length to obtain a plurality of byte segments of the set byte length;
[0022] Perform frequency statistics on all byte segments to form a key gram list;
[0023] The type of the requirement document is determined by combining the type of each word vector output by the classification model and the frequency of occurrence of each byte segment in the key gram list.
[0024] In a preferred embodiment, it also includes:
[0025] Matching a process template according to the type of the demand document to generate a process flow chart for the demand document;
[0026] The requirement document is processed according to the requirement document processing flow chart.
[0027] In a second aspect, the present invention provides a demand document classification device based on machine learning, comprising:
[0028] Get module to get the requirement document to be classified;
[0029] A preprocessing module preprocesses the demand document to obtain word vectors and word feature information of the demand document;
[0030] The model input module inputs each word vector and word feature information into a preset classification model, and the classification model outputs the type of each word vector in the requirement document;
[0031] A determination module determines the type of the requirement document according to the type of each word vector and the text content of the requirement document; wherein the classification model is trained using historical word vector data.
[0032] In a preferred embodiment, the preprocessing module comprises:
[0033] A parsing unit performs syntactic parsing on the demand document to obtain word feature information of the demand document, wherein the word feature information includes: syntactic structure, topic type, and knowledge graph;
[0034] The segmentation unit segments the word feature information to obtain the word vector and the word feature information; the word feature information includes: part-of-speech information, word importance, synonym relationship, demand word and position relationship between words.
[0035] In a preferred embodiment, the historical word vector data includes a word vector and a category to which the word vector corresponds, and the device further includes:
[0036] Model building module, building classification model;
[0037] The training module inputs the historical word vector data into the classification model to train the classification model.
[0038] In a preferred embodiment, the classification model is a FastText model, and the demand document classification device further includes:
[0039] Classifier setting module, sets the hierarchical classifier.
[0040] In a preferred embodiment, the hierarchical classifier is a hierarchical softmax model.
[0041] In a preferred embodiment, the determining module includes:
[0042] A sliding unit, using an N-Gram model to perform a sliding operation on the text content of the demand document with a sliding window of a set byte length to obtain a plurality of byte segments of the set byte length;
[0043] The key gram list generation unit counts the frequencies of all byte segments to form a key gram list;
[0044] A determination unit determines the type of the requirement document in combination with the type of each word vector output by the classification model and the frequency of occurrence of each byte segment in the key gram list.
[0045] In a preferred embodiment, it also includes:
[0046] A matching module, matching a process template according to the type of the demand document, and generating a process flow chart for the demand document;
[0047] A processing module processes the requirement document according to the requirement document processing flow chart.
[0048] In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method for classifying demand documents based on machine learning when executing the program.
[0049] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for classifying demand documents based on machine learning.
[0050] It can be seen from the above technical solution that the present invention provides a method and device for classifying demand documents based on machine learning, which classifies demand documents through a machine learning model, solves the problem that current demand documents need to be manually classified, meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart design. The requirements are visualized, allowing the architecture to express the requirements more accurately, allowing developers to understand the requirements more clearly, increasing the effective coding time of developers, and improving the accuracy of classification through continuous learning, increasing the speed of processing transaction data, increasing data throughput, and reducing user waiting time. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0052] Figure 1 It is a structural framework diagram of text division in an embodiment of the present invention.
[0053] Figure 2 It is a schematic diagram of the architecture of the FastTest model in an embodiment of the present invention.
[0054] Figure 3 It is a schematic diagram of the structure of the hierarchical softmax in an embodiment of the present invention.
[0055] Figure 4 Schematic diagram of N-gram word bag parsing in an embodiment of the present invention.
[0056] Figure 5 It is a schematic diagram of keyword extraction and arrangement in an embodiment of the present invention.
[0057] Figure 6 It is a system flow operation diagram in an embodiment of the present invention.
[0058] Figure 7 It is one of the flowcharts of the method steps executed in the embodiment of the present invention.
[0059] Figure 8 This is the second schematic flow chart of the method steps executed in the embodiment of the present invention.
[0060] Fig. 9 This is the third schematic flow chart of the method steps executed in the embodiment of the present invention.
[0061] Fig.10 It is a structural diagram of a demand document classification device based on machine learning in an embodiment of the present invention.
[0062] Fig.11 It is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0064] It should be noted that the method and device for classifying demand documents based on machine learning disclosed in the present invention can be used in the financial field, and can also be used in any field other than the financial field. The application field of the method and device for classifying demand documents based on machine learning disclosed in the present invention is not limited.
[0065] However, the classification of requirement documents is still in the manual classification stage. Due to the large number of requirement documents in the software development process and the increasing complexity leading to a wide variety of types, which also involve semantic relationships, there is currently no other way to replace manual classification, so there are many shortcomings.
[0066] Based on the above content, in order to solve the above problems, the present invention imports the demand document into the system, pre-processes the text, and the system divides it according to the machine learning algorithm, matches the appropriate process model, and automatically generates a flowchart.
[0067] The present invention provides a method and device for classifying demand documents based on machine learning for implementing one or more embodiments of the present invention, specifically, including: obtaining demand documents to be classified; preprocessing the demand documents to obtain word vectors and word feature information of the demand documents; inputting each word vector and word feature information into a preset classification model, and the classification model outputs the type of each word vector in the demand document; determining the type of the demand document according to the type of each word vector and the text content of the demand document; wherein the classification model is trained using historical word vector data. The present invention classifies demand documents through a machine learning model, solves the problem that current demand documents need to be manually classified, meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart construction. The requirements are visualized, so that the architecture can express the requirements more accurately, the development can understand the requirements more clearly, and the effective coding time of developers is increased. Through continuous learning, the accuracy of classification is improved, the speed of processing transaction data is improved, the data throughput is increased, and the user waiting time is reduced.
[0068] It is understandable that the demand document classification device of the present invention may be a server or a mobile terminal, for example, a smart phone, a tablet electronic device, a portable computer, a desktop computer, a personal digital assistant (PDA), a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, smart watches, smart bracelets, etc.
[0069] The above-mentioned demand document classification device has a communication module, which can be connected to the development terminal for communication and realize data transmission with the development terminal.
[0070] The above-mentioned demand document classification device and the development terminal can communicate using any suitable network protocol, including network protocols that have not been developed on the date of submission of the present invention. The network protocol may include, for example, TCP / IP protocol, UDP / IP protocol, HTTP protocol, HTTPS protocol, etc. Of course, the network protocol may also include, for example, RPC protocol (Remote Procedure Call Protocol) and REST protocol (Representational State Transfer) used on top of the above-mentioned protocols.
[0071] The present invention provides a method and device for classifying demand documents based on machine learning, which classifies demand documents through a machine learning model, solves the problem that current demand documents need to be manually classified, meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart drawing. The requirements are visualized, allowing the architecture to express the requirements more accurately, allowing developers to understand the requirements more clearly, increasing the effective coding time of developers, and improving the accuracy of classification through continuous learning, increasing the speed of processing transaction data, increasing data throughput, and reducing user waiting time.
[0072] The details are described through the following multiple embodiments and application examples.
[0073] In order to solve the problem that the classification of requirement documents in the prior art is still in the manual classification stage, and there is no other way to replace manual classification due to the large number of requirement documents in the software development process and the increase in complexity, which also involves semantic relationships, etc., the present invention provides an embodiment of a requirement document classification method based on machine learning, see Figure 7 , specifically including the following contents:
[0074] Step S101: Obtain the demand document to be classified.
[0075] In the present invention, demand analysis is an essential part of software development. The demand plan is mainly used to clarify the business scenarios, processes, etc. The analysis and understanding of demand documents are crucial for developers. Unclear requirements will lead to code modification or even rewriting. With the increase in the complexity of business logic, the demand for graphical requirements document processes is more urgent.
[0076] Step S102: pre-process the demand document to obtain word vectors and word feature information of the demand document.
[0077] Step S103: input each word vector and word feature information into a preset classification model, and the classification model outputs the type of each word vector in the requirement document;
[0078] Step S104: Determine the type of the requirement document according to the type of each word vector and the text content of the requirement document; wherein the classification model is trained using historical word vector data.
[0079] It can be seen from the above technical solution that the present invention provides a method for classifying demand documents based on machine learning, which classifies demand documents through a machine learning model, solves the problem that current demand documents need to be manually classified, meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart drawing. By visualizing the requirements, the architecture can express the requirements more accurately, the developers can understand the requirements more clearly, the effective coding time of the developers can be increased, and the accuracy of classification can be improved through continuous learning.
[0080] In order to provide an operation flow of a preprocessing step, in one or more embodiments of the present invention, the requirement document is preprocessed, such as Figure 8 include:
[0081] S201: Performing syntactic analysis on the requirement document to obtain word feature information of the requirement document, wherein the word feature information includes: syntactic structure, topic type, and knowledge graph;
[0082] S202: Segment the word feature information to obtain the word vector and the word feature information; the word feature information includes: part-of-speech information, word importance, synonym relationship, demand word, and position relationship between words.
[0083] Specifically, Figure 1 It is a structural framework diagram for text segmentation. In the text preprocessing stage, the text is segmented into chapter level, syntactic level, and vocabulary level. The chapter level contains key information and text semantic understanding, the syntactic level contains syntactic structure, topic model, knowledge graph, word vector analysis, and the vocabulary level contains Chinese text, English text, analysis of Chinese sub-books, and analysis of English text. It distinguishes the text by part of speech recognition, proper nouns, word importance, synonyms, demand words, and positional relationships.
[0084] In the embodiment of the present application, the classification model can be pre-established or established during the implementation steps of the present invention. Similarly, the model training step is also the same. The present invention is not limited to this. In one or more embodiments, the historical word vector data of the present invention includes the word vector and the category to which the word vector corresponds, such as Fig. 9 As shown, the method also includes:
[0085] S5: Building a classification model;
[0086] S6: Inputting the historical word vector data into the classification model to train the classification model.
[0087] In order to adopt a targeted machine learning model, in one or more embodiments of the present invention, the classification model is a FastText model.
[0088] The FastText model has the best effect on the document format of the present invention. In the text classification stage, the present invention uses the FastText classification model to classify word vectors and text. FastText provides a simple and efficient method for text classification and representation learning, which is suitable for classifying and summarizing massive demand documents. Figure 2 FastText converts all words in a document into vectors through a lookup table, takes the average and directly uses a linear classifier to obtain the classification result. In the FastText model architecture: x1, x2, …, xN-1, xN represent n-gram vectors in a text, and each feature is the average value of the word vector.
[0089] In order to speed up the calculation process, the requirement document classification method further includes: setting a hierarchical classifier.
[0090] For datasets with a large number of categories, FastText uses a hierarchical classifier (rather than a flat architecture) to speed up the computation process. Different categories are integrated into a tree structure. In some text classification tasks, there are many categories, and the computational complexity of a linear classifier is high. Figure 3 To improve the running time, the FastText model uses the hierarchical Softmax technique. The hierarchical Softmax technique is based on Huffman coding, which encodes the labels and can greatly reduce the number of targets predicted by the model. FastText also takes advantage of the fact that the classes are imbalanced (some classes appear more frequently than others) by using the Huffman algorithm to build a tree structure for representing the classes. Therefore, the depth of the tree structure for frequently occurring classes is smaller than that for infrequently occurring classes, which makes further calculations more efficient and can reduce the complexity from N to logN.
[0091] In one or more embodiments of the present invention, the hierarchical classifier is a hierarchical softmax model.
[0092] In the hierarchical softmax model, the words of leaf nodes do not have direct output vectors, while non-leaf nodes have corresponding inputs. During the model training process, a huge Huffman tree is constructed through Huffman coding, and vectors are assigned to non-leaf nodes. What we want to calculate is the probability of the target word w. The specific meaning of this probability is the probability of walking randomly from the root node to the target word w. Therefore, when passing by non-leaf nodes (including the root) on the way, we need to know the probabilities of walking left and right respectively.
[0093] For example, when arriving at a non-leaf node n, the probabilities of going left and going right are:
[0094] p(n,left)=σ(θ n T h)
[0095] P(n,right)=1-σ(θ n T h)=σ(-θ n T h)
[0096] The probability that the target word is w can be expressed as:
[0097]
[0098] Where θn(w,j) is the vector representation of the non-leaf node n(w,j) (i.e., the output vector); h is the output value of the hidden layer, calculated from the vector of the input word; sign(x,j) is a special function definition
[0099]
[0100] In order to provide a specific implementation method of determining the type of the requirement document according to the type of each word vector and the text content of the requirement document, in one or more embodiments of the present invention, determining the type of the requirement document according to the type of each word vector and the text content of the requirement document includes:
[0101] Using the N-Gram model, a sliding operation is performed on the text content of the demand document with a sliding window of a set byte length to obtain a plurality of byte segments of the set byte length;
[0102] Perform frequency statistics on all byte segments to form a key gram list;
[0103] The type of the requirement document is determined by combining the type of each word vector output by the classification model and the frequency of occurrence of each byte segment in the key gram list.
[0104] Specifically, since the content of the requirements document is continuous, N-Gram is used to perform a sliding window operation of size N on the content of the text according to the bytes, forming a byte segment sequence of length N. Figure 4 and Figure 5 , each byte segment is called a gram. The frequency of occurrence of all the grams is counted and filtered according to the pre-set threshold to form a key gram list, which is the vector feature space of the text. Each gram in the list is a feature vector dimension. For example, the bag-of-words model features of the sentence "personal to public" are "person", "person", "transfer", "to", "public", which are the same as the features of "public to personal". If 3-Ngram is added, the features of the first sentence are "personal-person-transfer", "transfer-to-public", and the two sentences "personal to public" and "public to personal" can be distinguished. Of course, in order to improve efficiency, some low-frequency N-grams need to be filtered.
[0105] Furthermore, in order to process the classified demand documents, the present application has made further improvements, specifically, including:
[0106] Matching a process template according to the type of the demand document to generate a process flow chart for the demand document;
[0107] The requirement document is processed according to the requirement document processing flow chart.
[0108] Specifically, in this embodiment, after classifying the demand documents, specific texts are extracted, the texts are arranged in a prescribed format, a suitable flowchart model is selected, and a corresponding flowchart is automatically generated. Figure 5 , obtain the specific chapter text in the requirement document, extract the keywords in the text, parse the paragraphs and semantic words, arrange the corresponding keywords in the text according to the specified format, and then render a flow chart in the system according to the arrangement order.
[0109] The following is based on Figure 6 The system operation flow chart explains the entire process:
[0110] Step S1: The user first imports the requirement document into the system with one click.
[0111] Step S2: The system will perform text preprocessing on specific chapters (specified by the user) and split the text according to paragraphs and language meanings.
[0112] Step S3: Use the FastText classification model to classify the word vectors and text, identify the type of the requirement document, and store it in the central document library.
[0113] Step S4: Text formatting: arranging the text in a specific format and identifying the previous and next items.
[0114] Step S5: Generate a flow chart by adapting the model according to the formatted text.
[0115] Step S6: Export the flowchart with one click.
[0116] It can be seen from the above technical solution that the present invention provides a method for classifying demand documents based on machine learning, which classifies demand documents through a machine learning model, solves the problem that current demand documents need to be manually classified, meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart drawing. By visualizing the requirements, the architecture can express the requirements more accurately, the developers can understand the requirements more clearly, the effective coding time of the developers can be increased, and the accuracy of classification can be improved through continuous learning.
[0117] In order to solve the problem that the classification of requirement documents in the prior art is still in the manual classification stage, due to the large number of requirement documents in the software development process, the increase in complexity leads to a wide variety of types, and there is currently no other way to replace manual classification, which also involves semantic relationships, etc. In one or more embodiments of the present invention, the present invention provides a method and device for classifying requirement documents based on machine learning, such as Fig.10 As shown, including:
[0118] An acquisition module 11 acquires a requirement document to be classified;
[0119] A preprocessing module 12 preprocesses the demand document to obtain word vectors and word feature information of the demand document;
[0120] The model input module 13 inputs each word vector and word feature information into a preset classification model, and the classification model outputs the type of each word vector in the requirement document;
[0121] The determination module 14 determines the type of the requirement document according to the type of each word vector and the text content of the requirement document; wherein the classification model is trained using historical word vector data.
[0122] In the present invention, demand analysis is an essential part of software development. The demand plan is mainly used to clarify the business scenarios, processes, etc. The analysis and understanding of demand documents are crucial for developers. Unclear requirements will lead to code modification or even rewriting. With the increase in the complexity of business logic, the demand for graphical requirements document processes is more urgent.
[0123] It can be seen from the above technical solution that the present invention provides a method and device for classifying demand documents based on machine learning. The device classifies demand documents through a machine learning model, which solves the problem that current demand documents need to be manually classified, meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart drawing. The requirements are visualized, allowing the architecture to express the requirements more accurately, the development to understand the requirements more clearly, and the effective coding time of developers is increased. Through continuous learning, the accuracy of classification is improved.
[0124] Based on the same inventive concept, in a preferred embodiment, the preprocessing module includes:
[0125] A parsing unit performs syntactic parsing on the demand document to obtain word feature information of the demand document, wherein the word feature information includes: syntactic structure, topic type, and knowledge graph;
[0126] The segmentation unit segments the word feature information to obtain the word vector and the word feature information; the word feature information includes: part-of-speech information, word importance, synonym relationship, demand word and position relationship between words.
[0127] Based on the same inventive concept, in a preferred embodiment, the historical word vector data includes a word vector and a category corresponding to the word vector, and the device further includes:
[0128] Model building module, building classification model;
[0129] The training module inputs the historical word vector data into the classification model to train the classification model.
[0130] Based on the same inventive concept, in a preferred embodiment, the classification model is a FastText model, and the demand document classification device further includes:
[0131] Classifier setting module, sets the hierarchical classifier.
[0132] Based on the same inventive concept, in a preferred embodiment, the hierarchical classifier is a hierarchical softmax model.
[0133] Based on the same inventive concept, in a preferred embodiment, the determining module includes:
[0134] A sliding unit, using an N-Gram model to perform a sliding operation on the text content of the demand document with a sliding window of a set byte length to obtain a plurality of byte segments of the set byte length;
[0135] The key gram list generation unit counts the frequencies of all byte segments to form a key gram list;
[0136] A determination unit determines the type of the requirement document in combination with the type of each word vector output by the classification model and the frequency of occurrence of each byte segment in the key gram list.
[0137] Based on the same inventive concept, in a preferred embodiment, it also includes:
[0138] A matching module, matching a process template according to the type of the demand document, and generating a process flow chart for the demand document;
[0139] A processing module processes the requirement document according to the requirement document processing flow chart.
[0140] It can be known that demand analysis is an essential part of software development. The demand plan is mainly used to clarify the business scenarios, processes, etc. The analysis and understanding of the demand document is crucial for developers. Unclear requirements will lead to problems with code modification or even rewriting. With the increase in the complexity of business logic, the demand for graphical requirements document processes has become more urgent.
[0141] The present invention provides an automated means for completing the drawing of a demand document flow chart, giving developers a more intuitive impression and allowing them to conveniently immerse themselves in a specific scenario to experience and empathize, thereby freeing the hands of developers and allowing them to improve their creativity.
[0142] The present invention mainly solves the problem that the demand text is not intuitive and clear enough in the demand analysis stage. After classification through machine learning algorithm, the flow chart is automatically generated. This part of the work is converted from manual drawing to machine drawing, reducing the learning cost and time cost of developers.
[0143] At the same time, the present invention meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart design. By visualizing the requirements, the architecture can express the requirements more accurately, the developers can understand the requirements more clearly, and the developers can increase the effective coding time. The present invention provides a system for automatically building flowcharts in a process-based manner, which has the following advantages:
[0144] 1. Requirement documents of the same category can be divided and summarized according to the content, and matched with appropriate flowchart models. They can also be used as samples for continuous learning to improve the accuracy of classification.
[0145] 2. Change from manual flowchart drawing to automatic drawing. Through text preprocessing, parsing and keyword extraction of requirement documents, flowcharts can be generated with one click according to specific formats, and can be continuously corrected, with a certain degree of autonomous learning ability.
[0146] From the hardware level, in order to solve the problem that the classification of requirement documents in the prior art is still in the manual classification stage, due to the large number of requirement documents in the software development process, the increase in complexity leads to a wide variety of types, which also involves semantic relationships, and there is currently no other way to replace manual classification. The present invention provides an embodiment of an electronic device for implementing all or part of the content of the requirement document classification method based on machine learning, and the electronic device specifically includes the following content:
[0147] Fig.11 FIG. 9 is a schematic block diagram of the device structure of the electronic device 9600 according to an embodiment of the present invention. Fig.11 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Fig.11 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0148] In one embodiment, the function of the demand document classification method based on machine learning can be integrated into the central processing unit. The central processing unit can be configured to perform the following control:
[0149] Step S101: Obtain the demand document to be classified.
[0150] In the present invention, demand analysis is an essential part of software development. The demand plan is mainly used to clarify the business scenarios, processes, etc. The analysis and understanding of demand documents are crucial for developers. Unclear requirements will lead to code modification or even rewriting. With the increase in the complexity of business logic, the demand for graphical requirements document processes is more urgent.
[0151] Step S102: pre-process the demand document to obtain word vectors and word feature information of the demand document.
[0152] Step S103: input each word vector and word feature information into a preset classification model, and the classification model outputs the type of each word vector in the requirement document;
[0153] Step S104: Determine the type of the requirement document according to the type of each word vector and the text content of the requirement document; wherein the classification model is trained using historical word vector data.
[0154] It can be seen from the above technical solution that the electronic device provided by the present invention classifies the requirement documents through a machine learning model, which solves the problem that the current requirement documents need to be manually classified, meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart drawing. By visualizing the requirements, the architecture can express the requirements more accurately, the developers can understand the requirements more clearly, the effective coding time of the developers can be increased, and the classification accuracy can be improved through continuous learning.
[0155] In another embodiment, the server may be configured separately from the central processor 9100. For example, the server may be a chip connected to the central processor 9100, and the function of the demand document classification method based on machine learning may be implemented through the control of the central processor.
[0156] like Fig.11 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Fig.11 In addition, the electronic device 9600 may also include Fig.11 For components not shown, reference may be made to the prior art.
[0157] like Fig.11 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.
[0158] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.
[0159] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.
[0160] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.
[0161] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0162] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0163] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.
[0164] An embodiment of the present invention also provides a computer-readable storage medium capable of implementing all the steps in the method for classifying demand documents based on machine learning in the above embodiment. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, all the steps in the method for classifying demand documents based on machine learning in the above embodiment are implemented, and for example, when the processor executes the computer program, the following steps are implemented:
[0165] Step S101: Obtain the demand document to be classified.
[0166] In the present invention, demand analysis is an essential part of software development. The demand plan is mainly used to clarify the business scenarios, processes, etc. The analysis and understanding of demand documents are crucial for developers. Unclear requirements will lead to code modification or even rewriting. With the increase in the complexity of business logic, the demand for graphical requirements document processes is more urgent.
[0167] Step S102: pre-process the demand document to obtain word vectors and word feature information of the demand document.
[0168] Step S103: input each word vector and word feature information into a preset classification model, and the classification model outputs the type of each word vector in the requirement document;
[0169] Step S104: Determine the type of the requirement document according to the type of each word vector and the text content of the requirement document; wherein the classification model is trained using historical word vector data.
[0170] It can be seen from the above technical solution that the computer storage medium provided by the present invention classifies the requirement documents through a machine learning model, which solves the problem that the current requirement documents need to be manually classified, meets the needs of architects and developers, and reduces the learning cost of architects and developers for flowchart drawing. The requirements are visualized, allowing the architecture to express the requirements more accurately, the development to understand the requirements more clearly, and the effective coding time of developers is increased. Through continuous learning, the accuracy of classification is improved.
[0171] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0172] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks 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 A device that provides the functions specified in a block or multiple blocks.
[0173] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0174] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing 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.
[0175] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for classifying demand documents based on machine learning, characterized in that: include: Get the requirements document to be classified; Preprocessing the demand document to obtain word vectors and word feature information of the demand document; Input each word vector and word feature information into a preset classification model, and the classification model outputs the type of each word vector in the requirement document; Determining the type of the requirement document according to the type of each word vector and the text content of the requirement document; wherein the classification model is trained using historical word vector data; The preprocessing of the demand document includes: Performing syntactic analysis on the requirement document to obtain first word feature information of the requirement document, wherein the first word feature information includes: syntactic structure, topic type, and knowledge graph; The first word feature information is segmented to obtain the word vector and the second word feature information; the second word feature information includes: part of speech information, word importance, synonym relationship, demand word and position relationship between words; The determining the type of the requirement document according to the type of each word vector and the text content of the requirement document includes: Using the N-Gram model, a sliding operation is performed on the text content of the demand document with a sliding window of a set byte length to obtain a plurality of byte segments of the set byte length; Perform frequency statistics on all byte segments to form a key gram list; The type of the requirement document is determined by combining the type of each word vector output by the classification model and the frequency of occurrence of each byte segment in the key gram list.
2. The method for classifying demand documents based on machine learning according to claim 1, characterized in that: The historical word vector data includes a word vector and a category corresponding to the word vector, and the method further includes: Build a classification model; The historical word vector data is input into the classification model to train the classification model.
3. The method for classifying demand documents based on machine learning according to claim 2 is characterized in that: The classification model is a FastText model, and the requirement document classification method further includes: Set up a hierarchical classifier.
4. The method for classifying demand documents based on machine learning according to claim 3 is characterized in that: The hierarchical classifier is a hierarchical softmax model.
5. The method for classifying demand documents based on machine learning according to claim 1, characterized in that: Also includes: Matching a process template according to the type of the demand document to generate a process flow chart for the demand document; The requirement document is processed according to the requirement document processing flow chart.
6. A demand document classification device based on machine learning, characterized in that: include: Get module to get the requirement document to be classified; A preprocessing module preprocesses the demand document to obtain word vectors and word feature information of the demand document; The model input module inputs each word vector and word feature information into a preset classification model, and the classification model outputs the type of each word vector in the requirement document; A determination module, which determines the type of the requirement document according to the type of each word vector and the text content of the requirement document; wherein the classification model is trained using historical word vector data; The preprocessing module comprises: A parsing unit performs syntactic parsing on the demand document to obtain first word feature information of the demand document, wherein the first word feature information includes: syntactic structure, topic type, and knowledge graph; A segmentation unit segments the first word feature information to obtain the word vector and second word feature information; the second word feature information includes: part of speech information, word importance, synonym relationship, demand word, and position relationship between words; The determining module comprises: A sliding unit, using an N-Gram model to perform a sliding operation on the text content of the demand document with a sliding window of a set byte length to obtain a plurality of byte segments of the set byte length; The key gram list generation unit counts the frequencies of all byte segments to form a key gram list; A determination unit determines the type of the requirement document in combination with the type of each word vector output by the classification model and the frequency of occurrence of each byte segment in the key gram list.
7. The device for classifying demand documents based on machine learning according to claim 6, characterized in that: The historical word vector data includes a word vector and a category corresponding to the word vector, and the device further includes: Model building module, building classification model; The training module inputs the historical word vector data into the classification model to train the classification model.
8. The device for classifying demand documents based on machine learning according to claim 7, characterized in that: The classification model is a FastText model, and the demand document classification device further includes: Classifier setting module, sets the hierarchical classifier.
9. The device for classifying demand documents based on machine learning according to claim 8, characterized in that: The hierarchical classifier is a hierarchical softmax model.
10. The device for classifying demand documents based on machine learning according to claim 6, characterized in that: Also includes: A matching module, matching a process template according to the type of the demand document, and generating a process flow chart for the demand document; A processing module processes the requirement document according to the requirement document processing flow chart.
11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 5 is implemented.
12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Short text classification method and device based on a bookkeeping scene
CN109871443A