Text paragraph recognition method and device, computer equipment, readable storage medium and program product
By combining semantic analysis model and phrase analysis model, the semantic correlation and phrase correlation of text lines are analyzed, and the problem of low accuracy of traditional paragraph recognition methods is solved, and more efficient text paragraph recognition is achieved.
Patent Information
- Application Number
- CN202411522551.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-01-07
AI Technical Summary
Traditional paragraph identification methods are not accurate, mainly because paragraph annotation is not uniform and relies on manual labor, which makes it easy to cause misalignment and missed labeling.
The semantic analysis model based on long and short-term memory networks and the phrase analysis model of convolutional neural networks are used to determine whether the text line belongs to the same paragraph through semantic correlation and phrase correlation analysis, and analyze the correlation of adjacent text lines in combination with semantic level and phrase level. .
It improves the accuracy of text paragraph recognition, captures long-term dependencies and local features in text information, and overcomes the problem of insufficient accuracy of traditional methods.
Smart Images

Figure CN119272769A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a text paragraph recognition method, apparatus, computer equipment, readable storage medium and program product. Background Art
[0002] With the rapid development of big data technology, a large amount of text information has appeared in all walks of life. When processing a large amount of text information, it is usually necessary to perform paragraph recognition on the text information and then classify it. Paragraph recognition refers to the process of identifying each paragraph in the text information.
[0003] Traditional paragraph recognition is usually implemented by paragraph annotation, that is, paragraph annotations are added to the text in advance to distinguish each text paragraph. However, paragraph annotation has the problem of inconsistent annotation forms, and paragraph annotation is generally done manually, which is prone to wrong annotations and missed annotations. These phenomena will lead to low accuracy of current text paragraph recognition. Summary of the invention
[0004] Based on this, it is necessary to provide a text paragraph recognition method, apparatus, computer device, computer-readable storage medium and computer program product that can improve the accuracy of text paragraph recognition in order to address the above technical problems.
[0005] In a first aspect, the present application provides a text paragraph recognition method, comprising: in response to a paragraph recognition instruction for a target text, obtaining first text information of a target text line in the target text, and second text information of a previous text line of the target text line; performing a semantic association analysis between the first text information and the second text information through a semantic analysis model to obtain semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; performing a phrase association analysis between the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; when the semantic association reaches a correlation threshold and the phrase association analysis result indicates that the first text information contains a keyword phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0006] In one embodiment, a semantic association analysis is performed on a first text information and a second text information through a semantic analysis model to obtain the semantic association between the first text information and the second text information, including: extracting semantic features of the first text information and the second text information respectively through the semantic analysis model to obtain a first semantic feature of the first text information and a second semantic feature of the second text information; performing a similarity analysis on the first semantic feature and the second semantic feature to obtain a feature similarity between the first semantic feature and the second semantic feature; and determining the semantic association between the first text information and the second text information based on the feature similarity.
[0007] In one embodiment, the method also includes: obtaining an initial sample text containing multiple paragraph tags, removing paragraph tags from the initial sample text to obtain a first sample text; replacing paragraph tags from the initial sample text to obtain a second sample text; adjusting the order of paragraphs in the initial sample text to obtain a third sample text; using the first sample text, the second sample text, and the third sample text as training samples, and training a pre-trained semantic analysis model based on the training samples until the number of training times of the pre-trained semantic analysis model reaches a number threshold, thereby obtaining a semantic analysis model; and training a pre-trained phrase analysis model based on the training samples until the number of training times of the pre-trained phrase analysis model reaches a number threshold, thereby obtaining a phrase analysis model.
[0008] In one of the embodiments, in response to a paragraph recognition instruction for a target text, first text information of a target text line in the target text and second text information of a previous text line of the target text are obtained, including: in response to a paragraph recognition instruction for the target text, performing a security check on the target text to obtain a security check result of the target text; when the security check result indicates that the target text is a safe text, obtaining text content of the target text; performing an integrity check on the text content to obtain an integrity check result of the text content; when the integrity check result indicates that the text content is complete, obtaining first text information of a target text line in the target text and second text information of a previous text line of the target text line.
[0009] In one of the embodiments, the method also includes: performing word segmentation processing on the first text information and the second text information respectively to obtain each first text segmentation of the first text information and each second text segmentation of the second text information; performing word embedding on each first text segmentation and each second text segmentation respectively to obtain a first word vector of each first text segmentation and a second word vector of each second text segmentation; the first word vector and the second word vector are both used as inputs of a semantic analysis model and a phrase analysis model.
[0010] In one of the embodiments, the process of obtaining the keyword group of the first text information includes: performing word frequency statistics on each first text segmentation to obtain the occurrence frequency of each first text segmentation; among each first text segmentation, screening out the target text segmentation whose occurrence frequency exceeds the frequency threshold; and taking the target text segmentation and the text phrase at the specified text position in the first text information as the keyword group.
[0011] In the second aspect, the present application also provides a text paragraph recognition device, including: a text information acquisition module, which is used to respond to a paragraph recognition instruction for a target text, and obtain the first text information of a target text line in the target text, and the second text information of the previous text line of the target text line; a semantic analysis module, which is used to perform a semantic association analysis between the first text information and the second text information through a semantic analysis model, and obtain the semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; a phrase analysis module, which is used to perform a phrase association analysis between the first text information and the second text information through a phrase analysis model, and obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; a paragraph recognition module, which is used to classify the target text line and the previous text line as the same paragraph when the semantic association reaches a correlation threshold and the phrase association analysis result indicates that the first text information contains a keyword phrase of the second text information.
[0012] In one embodiment, the semantic analysis module is also used to: extract semantic features of the first text information and the second text information respectively through a semantic analysis model to obtain a first semantic feature of the first text information and a second semantic feature of the second text information; perform similarity analysis on the first semantic feature and the second semantic feature to obtain feature similarity between the first semantic feature and the second semantic feature; and determine the semantic correlation between the first text information and the second text information based on the feature similarity.
[0013] In one of the embodiments, the device is also used to: obtain an initial sample text containing multiple paragraph tags, remove paragraph tags from the initial sample text to obtain a first sample text; replace paragraph tags on the initial sample text to obtain a second sample text; adjust the paragraph order of the initial sample text to obtain a third sample text; use the first sample text, the second sample text and the third sample text as training samples, and perform model training on a pre-trained semantic analysis model based on the training samples until the number of training times of the pre-trained semantic analysis model reaches a number threshold, thereby obtaining a semantic analysis model; and perform model training on a pre-trained phrase analysis model based on the training samples until the number of training times of the pre-trained phrase analysis model reaches a number threshold, thereby obtaining a phrase analysis model.
[0014] In one of the embodiments, the text information acquisition module is also used to: in response to a paragraph recognition instruction for a target text, perform a security check on the target text to obtain a security check result of the target text; when the security check result indicates that the target text is a safe text, obtain the text content of the target text; perform an integrity check on the text content to obtain an integrity check result of the text content; when the integrity check result indicates that the text content is complete, obtain the first text information of a target text line in the target text and the second text information of the previous text line of the target text line.
[0015] In one of the embodiments, the device is also used to: perform word segmentation processing on the first text information and the second text information respectively to obtain each first text segmentation of the first text information and each second text segmentation of the second text information; perform word embedding on each first text segmentation and each second text segmentation respectively to obtain a first word vector for each first text segmentation and a second word vector for each second text segmentation; the first word vector and the second word vector are both used as inputs of a semantic analysis model and a phrase analysis model.
[0016] In one of the embodiments, the device is also used to: perform word frequency statistics on each first text segmentation to obtain the occurrence frequency of each first text segmentation; among each first text segmentation, screen out the target text segmentation whose occurrence frequency exceeds the frequency threshold; and use the target text segmentation and the text phrase at the specified text position in the first text information as a keyword phrase.
[0017] In a third aspect, the present application also provides a computer device, comprising a memory and a processor, the memory storing a computer program, and the processor implementing the following steps when executing the computer program: in response to a paragraph recognition instruction for a target text, obtaining first text information of a target text line in the target text and second text information of a previous text line of the target text line; performing a semantic association analysis on the first text information and the second text information through a semantic analysis model to obtain the semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; performing a phrase association analysis on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; when the semantic association reaches a correlation threshold and the phrase association analysis result indicates that the first text information contains a keyword phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0018] In a fourth aspect, the present application also provides a computer-readable storage medium having a computer program stored thereon, which implements the following steps when executed by a processor: in response to a paragraph recognition instruction for a target text, obtaining first text information of a target text line in the target text and second text information of a previous text line of the target text line; performing a semantic association analysis on the first text information and the second text information through a semantic analysis model to obtain semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; performing a phrase association analysis on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; when the semantic association reaches a correlation threshold and the phrase association analysis result indicates that the first text information contains a keyword phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0019] In a fifth aspect, the present application also provides a computer program product, comprising a computer program, which implements the following steps when executed by a processor: in response to a paragraph recognition instruction for a target text, obtain the first text information of a target text line in the target text, and the second text information of a previous text line of the target text line; perform a semantic association analysis on the first text information and the second text information through a semantic analysis model to obtain the semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; perform a phrase association analysis on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; when the semantic association reaches a correlation threshold and the phrase association analysis result indicates that the first text information contains a keyword phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0020] The above-mentioned text paragraph recognition method, device, computer equipment, computer-readable storage medium and computer program product, in response to the paragraph recognition instruction for the target text, first obtain the first text information of the target text line in the target text, and the second text information of the previous text line of the target text line. And through the semantic analysis model, the semantic association analysis is performed between the first text information and the second text information, so as to obtain the semantic association between the first text information and the second text information. And through the phrase analysis model, the phrase association analysis is performed between the first text information and the second text information to obtain the phrase association analysis result between the first text information and the second text information. When the semantic association reaches the association threshold and the phrase association analysis result indicates that the first text information contains the keyword phrase of the second text information, it is considered that the target text line and the previous text line belong to the same paragraph. Therefore, the present application analyzes the association between adjacent text lines from the semantic level and the phrase level, so as to determine whether the two text lines belong to the same paragraph, thereby improving the accuracy of text paragraph recognition. In addition, the semantic analysis model in the present application is a model obtained in advance based on the long short-term memory network training, which can capture the long-term dependency in the text information and improve the accuracy of the text semantic association analysis. The phrase analysis model is a model pre-trained based on a convolutional neural network. The convolutional neural network can capture local features in text information through the convolution layer. This local perception ability enables the convolutional neural network to efficiently process text data, especially when detecting whether the current text line contains the keyword phrase of the previous text line, it can accurately and efficiently identify the existence of the phrase. Therefore, this application can overcome the technical defect of low accuracy of text paragraph recognition and effectively improve the accuracy of text paragraph recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0022] Figure 1 A diagram showing an application environment of a text paragraph recognition method in an embodiment;
[0023] Figure 2 A schematic diagram of a flow chart of a text paragraph recognition method in one embodiment;
[0024] Figure 3 A schematic diagram of a text paragraph recognition model in one embodiment;
[0025] Figure 4is a flowchart of semantic analysis in one embodiment;
[0026] Figure 5 A schematic diagram of a process of model training in one embodiment;
[0027] Figure 6 A flowchart of text detection in one embodiment;
[0028] Figure 7 is a flowchart of word embedding in one embodiment;
[0029] Figure 8 A schematic diagram of a process for determining a keyword group in one embodiment;
[0030] Fig. 9 is a structural block diagram of a text paragraph recognition device in one embodiment;
[0031] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, which should be considered as exemplary, and their purpose is only to illustrate the feasibility of the implementation of the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0033] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations. The acquisition, storage, use, and processing of data in the technical solution of this application are in compliance with relevant provisions of national laws and regulations.
[0034] The text paragraph recognition method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 responds to the paragraph recognition instruction for the target text initiated by the terminal 102, and first obtains the first text information of the target text line in the target text, and the second text information of the previous text line of the target text line. Then, through the semantic analysis model, the semantic association analysis is performed between the first text information and the second text information to obtain the semantic association between the first text information and the second text information. The semantic analysis model is a model pre-trained based on the long short-term memory network. At the same time, through the phrase analysis model, the phrase association analysis is performed between the first text information and the second text information to obtain the phrase association analysis result between the first text information and the second text information. The phrase analysis model is a model pre-trained based on the convolutional neural network. Finally, when the semantic association reaches the association threshold, and the phrase association analysis result indicates that the first text information contains the keyword group of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0035] The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and IoT devices. The server 104 may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0036] In an exemplary embodiment, Figure 2 As shown, a text paragraph recognition method is provided, which is applied to Figure 1 The server 104 in FIG. 1 is used as an example to illustrate the method, including steps S202 to S208, wherein:
[0037] Step S202 : in response to a paragraph recognition instruction for a target text, obtaining first text information of a target text line in the target text and second text information of a previous text line of the target text line.
[0038] Among them, the target text may refer to the text that needs to be paragraph recognized. In one example, the target text may be a clause text, and the clause text may refer to a text containing multiple required clauses, such as an audit document. The paragraph recognition instruction may refer to an instruction to perform paragraph recognition on the target text, and paragraph recognition may refer to the operation of identifying each text paragraph in the target text. The target text line may refer to any line in the target text, and the previous text line refers to the previous line of the target text line. The first text information refers to the text information recorded in the target text line, and the second text information refers to the text information recorded in the previous text line.
[0039] Exemplarily, when the server receives a paragraph recognition instruction for a target text initiated by the terminal, it may first select any line in the target text as the target text line, thereby obtaining text information of the target text line and text information of the previous line of the target text line.
[0040] In one example, the server may select the target text line in a top-down order. When the target text line is the first line of the target text, there may not be a previous text line for the target text line. In this case, the target text line may be used as the beginning of a paragraph, i.e., the first line of a paragraph. The next line of the target text line is selected as the new target text line. At this time, the target text line becomes the previous text line, so as to determine whether the next line belongs to the same paragraph as the target text line. It is understandable that if the next line does not belong to the same paragraph as the target text line, the next line is used as the beginning of the new paragraph, and so on, until all text lines in the target text line are detected.
[0041] Step S204: performing semantic association analysis on the first text information and the second text information through a semantic analysis model to obtain the semantic association between the first text information and the second text information.
[0042] Among them, the semantic analysis model is a model pre-trained based on the long short-term memory network. In this embodiment, the long short-term memory network can effectively capture and memorize long-term dependencies by introducing a gating mechanism (including a forget gate, an input gate, and an output gate) and a cell state, which enables the long short-term memory network to retain distant contextual information when processing long sequence text data, thereby more accurately understanding the semantic association between texts. Semantic association analysis may refer to the process of analyzing the semantic relationship between text information of two adjacent text lines. Semantic relevance may refer to the degree of semantic association between a first text information and a second text information. In one example, the semantic relevance may be reflected by the similarity of semantic features.
[0043] Exemplarily, after obtaining the first text information of the target text line and the second text information of the previous text line, the server can input the first text information and the second text information into a semantic analysis model pre-trained based on a long short-term memory network to analyze the degree of semantic association between the first text information and the second text information.
[0044] Step S206: Perform a phrase association analysis on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information.
[0045] Among them, the phrase analysis model is a model pre-trained based on a convolutional neural network. A convolutional neural network is a type of feedforward neural network that includes convolution calculations and has a deep structure. In this embodiment, the convolutional neural network can effectively extract local features in the text and capture the relevance between words through convolution and pooling operations. Phrase association analysis can be a process of analyzing the relevance between a phrase in a first text message and a phrase in a second text message. It should be noted that in this embodiment, the phrase relevance is mainly reflected by judging whether the first text message contains a keyword group of the second text message, that is, judging whether the target text line contains a keyword group of the previous text line. Therefore, the result of the phrase association analysis can be a keyword group used to characterize whether the first text message contains the second text message.
[0046] Exemplarily, after obtaining the first text information of the target text line and the second text information of the previous text line, the server can input the first text information and the second text information into a phrase analysis model pre-trained based on a convolutional neural network to analyze the phrase association relationship between the first text information and the second text information, that is, to determine whether the first text information contains the keyword phrase of the second text information.
[0047] Step S208: when the semantic relevance reaches the relevance threshold and the phrase relevance analysis result indicates that the first text information contains the keyword phrase of the second text information, the target text line and the previous text line are classified into the same paragraph.
[0048] The relevance threshold may be a reference value pre-set for semantic relevance. When the threshold is reached, it can be considered that there is a semantic relevance relationship between the first text information and the second text information. When the threshold is not reached, it can be considered that there is no semantic relevance relationship between the first text information and the second text information. The keyword group may be understood as a core phrase in the second text information. In one example, the keyword group may be a phrase with a high frequency of occurrence in the second text information, or a phrase at a specified position in the second text information.
[0049] Exemplarily, when the semantic relevance reaches the relevance threshold and the result of the phrase association analysis indicates that the first text information contains the keyword phrase of the second text information, it means that there is a semantic association relationship and a phrase association relationship between the first text information and the second text information, then it can be considered that the first text information and the second text information belong to the same paragraph, that is, the target text line and the previous text line belong to the same paragraph.
[0050] In one example, the server may integrate the semantic analysis model and the phrase analysis model into a text paragraph recognition model. Figure 3As shown, the text paragraph recognition model may include an input layer, a word embedding layer, a feature extraction layer, a feature splicing layer, a fully connected layer, and an output layer. Among them, the input layer receives the first text information and the second text information, and sends them to the word embedding layer, so that the word embedding layer can perform word embedding processing on the first text information and the second text information respectively. And the processed first text information and the second text information are sent to the feature extraction layer, which includes a semantic analysis model and a phrase analysis model. The semantic analysis model and the phrase analysis model perform semantic association analysis and phrase association analysis on the first text information and the second text information respectively, so as to obtain corresponding semantic association features and phrase association features. The semantic association features and phrase association features enter the feature splicing layer for splicing to obtain splicing features. The splicing features then enter the fully connected layer for feature fusion. Finally, the output layer outputs the final result, and the final result can be a binary classification output result, that is, whether the target text line belongs to the same paragraph as the previous text.
[0051] In this embodiment, in response to the paragraph recognition instruction for the target text, the server first obtains the first text information of the target text line in the target text, and the second text information of the previous text line of the target text line. And through the semantic analysis model, the semantic association analysis is performed between the first text information and the second text information, so as to obtain the semantic association between the first text information and the second text information. And through the phrase analysis model, the phrase association analysis is performed between the first text information and the second text information to obtain the phrase association analysis result between the first text information and the second text information. When the semantic association reaches the association threshold, and the phrase association analysis result indicates that the first text information contains the key words of the second text information, it is considered that the target text line and the previous text line belong to the same paragraph. Therefore, this embodiment analyzes the association between adjacent text lines from the semantic level and the phrase level, so as to determine whether the two text lines belong to the same paragraph, thereby improving the accuracy of text paragraph recognition. In addition, the semantic analysis model in this embodiment is a model obtained in advance based on the long short-term memory network training, which can capture the long-term dependency in the text information and improve the accuracy of the text semantic association analysis. The phrase analysis model is a model pre-trained based on a convolutional neural network. The convolutional neural network can capture local features in text information through the convolution layer. This local perception ability enables the convolutional neural network to efficiently process text data, especially when detecting whether the current text line contains the keyword phrase of the previous text line, it can accurately and efficiently identify the existence of the phrase. Therefore, this embodiment can overcome the technical defect of low accuracy of text paragraph recognition and effectively improve the accuracy of text paragraph recognition.
[0052] In an exemplary embodiment, Figure 4As shown, a semantic correlation analysis is performed on the first text information and the second text information through a semantic analysis model to obtain the semantic correlation between the first text information and the second text information, including steps S402 to S406, wherein:
[0053] Step S402: extracting semantic features from the first text information and the second text information respectively through a semantic analysis model to obtain a first semantic feature of the first text information and a second semantic feature of the second text information.
[0054] The semantic feature can be understood as the characteristics or attributes of a sentence or text at the semantic level. The first semantic feature refers to the semantic feature extracted from the first text information, and the second semantic feature refers to the semantic feature extracted from the second text information.
[0055] Exemplarily, the server inputs the first text information and the second text information into a semantic analysis model, and the semantic analysis model may first extract semantic features from the first text information and the second text information, respectively, to obtain semantic features of the first text information and semantic features of the second text information.
[0056] Step S404: performing similarity analysis on the first semantic feature and the second semantic feature to obtain feature similarity between the first semantic feature and the second semantic feature.
[0057] The similarity analysis can be understood as a process of analyzing the similarity between the first semantic feature and the second semantic feature. The feature similarity is used to characterize the similarity between the first semantic feature and the second semantic feature.
[0058] Exemplarily, after the semantic analysis model extracts the first semantic feature of the first text information and the second semantic feature of the second text information, it can further analyze the similarity between the two semantic features. The similarity between the two semantic features can be evaluated by vectorizing the two semantic features and then using methods such as cosine similarity and Euclidean distance. Among them, cosine similarity measures the similarity of two feature vectors in direction, while Euclidean distance measures the straight-line distance between two feature vectors in space.
[0059] Step S406: Determine the semantic relevance between the first text information and the second text information based on the feature similarity.
[0060] Exemplarily, the semantic analysis model outputs the similarity between the first semantic feature and the second semantic feature. The server may use the feature similarity as the semantic relevance between the first text information and the second text information, and further determine whether it reaches the relevance threshold. If it reaches, it is considered that there is a semantic relevance relationship between the first text information and the second text information. If it does not reach, it is considered that there is no semantic relevance relationship between the first text information and the second text information.
[0061] In this embodiment, semantic features are extracted through a semantic analysis model, and similarity analysis is performed on the extracted semantic features to determine the semantic relevance between the first text information and the second text information, thereby improving the accuracy of the semantic relevance and further improving the accuracy of text paragraph recognition.
[0062] In an exemplary embodiment, Figure 5 As shown, the model training process also includes:
[0063] Step S502: obtaining an initial sample text containing multiple paragraph marks, removing the paragraph marks from the initial sample text, and obtaining a first sample text.
[0064] The paragraph mark may refer to a mark used to distinguish paragraphs, such as 1. / 2. / 3. or A / B / C. The initial sample text may refer to a sample text containing paragraph marks, and the sample text refers to each text used for model training. The first sample text refers to the text obtained after removing the paragraph mark.
[0065] Exemplarily, when the server is training the model, it needs to construct training samples. First, the server can obtain initial sample texts containing multiple paragraph tags, and randomly select some sample texts from these initial sample texts to remove paragraph tags, that is, delete the paragraph tags in the text. The sample text with the paragraph tags removed, that is, the first sample text, can be used as one of the training samples.
[0066] Step S504: Replace the paragraph marks of the initial sample text to obtain a second sample text.
[0067] The second sample text refers to the text obtained after the paragraph mark is replaced.
[0068] Exemplarily, the server may also randomly select part of the sample text from the initial sample text and replace paragraph marks, such as replacing 1. / 2. / 3 with A / B / C, thereby obtaining a second sample text, which is also used as one of the training samples.
[0069] Step S506: Adjust the paragraph order of the initial sample text to obtain a third sample text.
[0070] The third sample text refers to the text obtained after the order of paragraphs is adjusted.
[0071] Exemplarily, in addition to removing and replacing paragraph markers, the server can also randomly select some sample texts from the initial sample texts to adjust the paragraph order, that is, change the order of the paragraphs in the text, and even randomly delete a paragraph to obtain a third sample text as one of the training samples.
[0072] Step S508, taking the first sample text, the second sample text and the third sample text as training samples, and performing model training on the pre-trained semantic analysis model based on the training samples until the number of training times of the pre-trained semantic analysis model reaches a threshold number of times, thereby obtaining a semantic analysis model.
[0073] Step S510: Based on the training samples, the pre-trained phrase analysis model is trained until the training times of the pre-trained phrase analysis model reaches a times threshold, thereby obtaining a phrase analysis model.
[0074] Among them, the pre-trained semantic analysis model may refer to an initial model established based on a long short-term memory network. The pre-trained phrase analysis model may refer to an initial model established based on a convolutional neural network. The number of training times may refer to the number of model training times or the number of iterations. The number threshold may be a value set in advance for the number of model training times. When the threshold is reached, the model training can be stopped. Of course, in actual applications, it is also possible to determine whether to stop model training based on the accuracy of the model output results, that is, when the accuracy of the model output results reaches a pre-set accuracy threshold, the model training can be stopped.
[0075] Exemplarily, after the server obtains the first sample text, the second sample text and the third sample text, the first sample text, the second sample text and the third sample text can be used as training samples. Thus, the pre-trained semantic analysis model and the pre-trained phrase analysis model are trained using the training samples respectively until the number of model trainings reaches a threshold number of times, thereby obtaining a semantic analysis model and a phrase analysis model.
[0076] In this embodiment, different sample texts are constructed as training samples for model training to simulate more text scenarios, thereby improving the accuracy and reliability of the training samples, thereby improving the accuracy and reliability of the semantic analysis model and the phrase analysis model, and further improving the accuracy and reliability of text paragraph recognition.
[0077] In an exemplary embodiment, Figure 6As shown, in response to a paragraph recognition instruction for a target text, obtaining first text information of a target text line in the target text and second text information of a previous text line of the target text line includes steps S602 to S608, wherein:
[0078] Step S602, in response to the paragraph recognition instruction for the target text, performing a security check on the target text to obtain a security check result of the target text.
[0079] The security detection may refer to an operation of detecting the security of a target text, and the security detection result may be used to indicate whether the target text is a safe text.
[0080] For example, when the server receives a paragraph recognition instruction for a target text, in order to ensure the security of the text paragraph recognition process, it can first perform a security check on the target text, that is, check whether the target text is a safe text. If the target text is not a safe text, the server can refuse to perform paragraph recognition on the target text.
[0081] In one example, whether the target text is a safe text can be judged from the perspective of the text code. For example, when there is no malicious code in the text code, the target text can be considered to be a safe text. Of course, it can also be judged from the text content. For example, when there is no malicious content in the text content, the target text can also be considered to be a safe text. The specific judgment basis can be set based on the actual situation, and this embodiment does not limit this.
[0082] Step S604, when the security detection result indicates that the target text is a safe text, the text content of the target text is obtained.
[0083] The text content refers to the content of the target text.
[0084] Exemplarily, when the security detection result indicates that the target text is a safe text, the server may further obtain the text content of the target text to perform further detection on the text content.
[0085] Step S606, performing integrity check on the text content to obtain the integrity check result of the text content.
[0086] The integrity check may refer to the operation process of checking whether the text content is complete. The integrity check result may be used to indicate whether the text content is complete.
[0087] For example, after determining that the target text is safe, the server can further detect the text content of the target text, that is, detect whether the text content is complete, in order to further ensure the accuracy of text paragraph recognition. When the text content is incomplete, the server can still refuse to perform paragraph recognition on the target text and feedback a prompt that the text content is incomplete.
[0088] In one example, whether the text content of the target text is complete can be determined from the format of the text content, such as whether the format of the text content is in accordance with the standard text format, or whether the text content contains necessary parts. Of course, the specific judgment basis can be set based on actual conditions, and this embodiment does not limit this.
[0089] Step S608, when the integrity check result indicates that the text content is complete, obtaining first text information of a target text line in the target text and second text information of a previous text line of the target text line.
[0090] Exemplarily, when the text content of the target text is complete, the server may perform paragraph recognition on the target file, that is, obtain the first text information of the target text line in the target text and the second text information of the previous text line of the target text line.
[0091] In this embodiment, on the one hand, the target text is tested for text security to ensure the security of text paragraph recognition, and on the other hand, the target text is tested for text content integrity to ensure the accuracy of the target text, thereby improving the accuracy of paragraph recognition.
[0092] In an exemplary embodiment, Figure 7 As shown, the text information processing process also includes steps S702 to S704, wherein:
[0093] Step S702 : performing word segmentation processing on the first text information and the second text information respectively to obtain each first text segmentation of the first text information and each second text segmentation of the second text information.
[0094] The word segmentation process may refer to segmenting the first text information and the second text information into a plurality of word group sequences. The first text word segmentation process may refer to the word segmentation process obtained after the first text information is segmented. The second text word segmentation process may refer to the word segmentation process obtained after the second text information is segmented.
[0095] Exemplarily, after acquiring the first text information and the second text information, the server may perform word segmentation processing on the first text information and the second text information respectively, so as to separate the phrase sequences of the two text information respectively, so as to facilitate the subsequent word embedding operation.
[0096] In one example, the server may match the first text information and the second text information with entries in a pre-compiled dictionary, and if an entry in the dictionary is found, the match is successful, thereby segmenting a phrase.
[0097] Step S704, word embedding is performed on each first text segmentation and each second text segmentation to obtain a first word vector of each first text segmentation and a second word vector of each second text segmentation.
[0098] Among them, word embedding refers to the operation of mapping a phrase into a continuous vector space. The first word vector refers to the vector obtained after the first text word is embedded. The second word vector refers to the vector obtained after the second text word is embedded. The first word vector and the second word vector are both used as inputs of the semantic analysis model and the phrase analysis model. In one example, the word embedding operation can be performed by the word embedding layer in the text paragraph recognition model.
[0099] Exemplarily, the server can input the obtained first text segmentations and second text segmentations into a text paragraph recognition model, and the word embedding layer in the text paragraph recognition model can perform word embedding operations on each first text segmentation and second text segmentation respectively, so as to obtain a first word vector for each first text segmentation and a second word vector for each second text segmentation.
[0100] In this embodiment, the text information is segmented to obtain text segmentation. The text segmentation is then embedded to obtain word vectors, which are used as inputs for the semantic analysis model and the phrase analysis model. This improves the model performance and detection accuracy, thereby improving the accuracy of paragraph recognition.
[0101] In an exemplary embodiment, Figure 8 As shown, the process of acquiring the keyword group of the first text information includes steps S802 to S806, wherein:
[0102] Step S802: Perform word frequency statistics on each first text segmentation to obtain the occurrence frequency of each first text segmentation.
[0103] The word frequency statistics may refer to counting the occurrence frequency of each first text segment word. The occurrence frequency refers to the number of times the first text segment word appears.
[0104] Exemplarily, when acquiring the keyword group of the first text information, the server may perform word frequency statistics on each obtained first text segmentation after segmenting the first text information, that is, count the number of occurrences of each first text segmentation.
[0105] Step S804: Filter out target text segmentations whose occurrence frequency exceeds a frequency threshold from among the first text segmentations.
[0106] The frequency threshold may be a value set in advance for the frequency of occurrence of a segmentation. When the threshold is exceeded, it can be indicated that the frequency of occurrence of the corresponding segmentation is high, and when the threshold is not exceeded, it can be indicated that the frequency of occurrence of the corresponding segmentation is low. The target text segmentation refers to the first text segmentation whose frequency of occurrence exceeds the frequency threshold.
[0107] Exemplarily, after obtaining the frequency of occurrence of each first text segmentation word through statistics, the server may filter out first text segmentations whose frequency of occurrence exceeds a preset frequency.
[0108] Step S806: The target text segmentation and the text phrase at the designated text position in the first text information are taken together as a keyword phrase.
[0109] The designated text position can be understood as a designated position in the first text information, such as the beginning position or the end position in the first text information. For example, in the clause text, the phrase at the beginning position mostly contains the core content of the text.
[0110] Exemplarily, after the server screens out the target text segmentation, the server can use the target text segmentation and the text phrase at the specified text position in the first text information as a keyword phrase.
[0111] In this embodiment, the text segmentation with a higher frequency and the text phrases at the specified text position are taken together as the keyword phrases, which improves the accuracy of the keyword phrases, thereby improving the accuracy of the phrase analysis, and further improving the accuracy of the text paragraph recognition.
[0112] In a specific embodiment, the target text is a clause text. For the clause text, each requirement clause will make requirements for a certain type of document or a certain type of audit scenario, making the content of the clause text complex and diverse, which makes paragraph recognition of the clause text more difficult. Therefore, the server can obtain an initial sample text containing multiple paragraph tags in advance, and remove the paragraph tags from the initial sample text to obtain a first sample text. The paragraph tags of the initial sample text are replaced to obtain a second sample text. The paragraph order of the initial sample text is adjusted to obtain a third sample text. The first sample text, the second sample text, and the third sample text are used as training samples together. Based on the training samples, the pre-trained semantic analysis model is trained until the number of training times of the pre-trained semantic analysis model reaches the number threshold, and a semantic analysis model is obtained. Based on the training samples, the pre-trained phrase analysis model is trained until the number of training times of the pre-trained phrase analysis model reaches the number threshold, and a phrase analysis model is obtained.
[0113] When the server receives the paragraph recognition instruction for the clause text, it can first perform a security check on the clause text. When it is determined that the clause text belongs to a safe text, the text content of the clause text is checked for integrity. When it is determined that the text content of the clause text is complete, the first text information of the target text line in the clause text and the second text information of the previous text line of the target text line are obtained. Then the first text information and the second text information are respectively processed by word segmentation to obtain each first text segmentation of the first text information and each second text segmentation of the second text information. At this time, the server can perform word frequency statistics on each first text segmentation to obtain the frequency of occurrence of each first text segmentation, and filter out the target text segmentation whose frequency of occurrence exceeds the frequency threshold. The target text segmentation and the text phrase at the specified text position in the first text information are used as a keyword group. Then, each first text segmentation and each second text segmentation are respectively embedded to obtain the first word vector of each first text segmentation and the second word vector of each second text segmentation. The first word vector and the second word vector are both used as inputs of the semantic analysis model and the phrase analysis model.
[0114] Through the semantic analysis model, semantic features of the first text information and the second text information are extracted respectively to obtain the first semantic feature of the first text information and the second semantic feature of the second text information. Similarity analysis is performed on the first semantic feature and the second semantic feature to obtain the feature similarity between the first semantic feature and the second semantic feature. Based on the feature similarity, the semantic relevance between the first text information and the second text information is determined. The semantic analysis model is a model pre-trained based on the long short-term memory network. Through the phrase analysis model, phrase association analysis is performed between the first text information and the second text information to obtain the phrase association analysis result between the first text information and the second text information. The phrase analysis model is a model pre-trained based on the convolutional neural network. When the semantic relevance reaches the relevance threshold and the phrase association analysis result indicates that the first text information contains the keyword phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0115] In this embodiment, the server responds to the paragraph recognition instruction for the clause text, and first obtains the first text information of the target text line in the clause text, and the second text information of the previous text line of the target text line. And through the semantic analysis model, the semantic association analysis is performed between the first text information and the second text information, so as to obtain the semantic association between the first text information and the second text information. And through the phrase analysis model, the phrase association analysis is performed between the first text information and the second text information to obtain the phrase association analysis result between the first text information and the second text information. When the semantic association reaches the association threshold, and the phrase association analysis result indicates that the first text information contains the keyword phrase of the second text information, it is considered that the target text line and the previous text line belong to the same paragraph. Therefore, this embodiment analyzes the association between adjacent text lines from the semantic level and the phrase level, so as to determine whether the two text lines belong to the same paragraph, thereby improving the accuracy of the clause text paragraph recognition. In addition, the semantic analysis model in this embodiment is a model pre-trained based on the long short-term memory network, which can capture the long-term dependency in the text information and improve the accuracy of the text semantic association analysis. The phrase analysis model is a model pre-trained based on a convolutional neural network. The convolutional neural network can capture local features in text information through the convolution layer. This local perception ability enables the convolutional neural network to efficiently process text data, especially when detecting whether the current text line contains the keyword phrase of the previous text line, it can accurately and efficiently identify the existence of the phrase. Therefore, this embodiment can overcome the technical defect of the current low accuracy of clause text paragraph recognition and effectively improve the accuracy of clause text paragraph recognition.
[0116] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0117] Based on the same inventive concept, the embodiment of the present application also provides a text paragraph recognition device for implementing the text paragraph recognition method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more text paragraph recognition device embodiments provided below can refer to the limitations of the text paragraph recognition method above, and will not be repeated here.
[0118] In an exemplary embodiment, Fig. 9 As shown, a text paragraph recognition device is provided, including: a text information acquisition module 902, which is used to respond to a paragraph recognition instruction for a target text, and obtain the first text information of a target text line in the target text, and the second text information of the previous text line of the target text line; a semantic analysis module 904, which is used to perform a semantic association analysis between the first text information and the second text information through a semantic analysis model to obtain the semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; a phrase analysis module 906, which is used to perform a phrase association analysis between the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; a paragraph recognition module 908, which is used to classify the target text line and the previous text line as the same paragraph when the semantic association reaches the association threshold and the phrase association analysis result indicates that the first text information contains a keyword phrase of the second text information.
[0119] In one embodiment, the semantic analysis module 904 is also used to: extract semantic features of the first text information and the second text information respectively through a semantic analysis model to obtain a first semantic feature of the first text information and a second semantic feature of the second text information; perform similarity analysis on the first semantic feature and the second semantic feature to obtain feature similarity between the first semantic feature and the second semantic feature; and determine the semantic correlation between the first text information and the second text information based on the feature similarity.
[0120] In one of the embodiments, the device is also used to: obtain an initial sample text containing multiple paragraph tags, remove paragraph tags from the initial sample text to obtain a first sample text; replace paragraph tags on the initial sample text to obtain a second sample text; adjust the paragraph order of the initial sample text to obtain a third sample text; use the first sample text, the second sample text and the third sample text as training samples, and perform model training on a pre-trained semantic analysis model based on the training samples until the number of training times of the pre-trained semantic analysis model reaches a number threshold, thereby obtaining a semantic analysis model; and perform model training on a pre-trained phrase analysis model based on the training samples until the number of training times of the pre-trained phrase analysis model reaches a number threshold, thereby obtaining a phrase analysis model.
[0121] In one of the embodiments, the text information acquisition module 902 is also used to: respond to a paragraph recognition instruction for a target text, perform a security check on the target text to obtain a security check result of the target text; when the security check result indicates that the target text is a safe text, obtain the text content of the target text; perform an integrity check on the text content to obtain an integrity check result of the text content; when the integrity check result indicates that the text content is complete, obtain the first text information of a target text line in the target text, and the second text information of the previous text line of the target text line.
[0122] In one of the embodiments, the device is also used to: perform word segmentation processing on the first text information and the second text information respectively to obtain each first text segmentation of the first text information and each second text segmentation of the second text information; perform word embedding on each first text segmentation and each second text segmentation respectively to obtain a first word vector for each first text segmentation and a second word vector for each second text segmentation; the first word vector and the second word vector are both used as inputs of a semantic analysis model and a phrase analysis model.
[0123] In one of the embodiments, the device is also used to: perform word frequency statistics on each first text segmentation to obtain the occurrence frequency of each first text segmentation; among each first text segmentation, screen out the target text segmentation whose occurrence frequency exceeds the frequency threshold; and use the target text segmentation and the text phrase at the specified text position in the first text information as a keyword phrase.
[0124] Each module in the above-mentioned text paragraph recognition device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0125] In an exemplary embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as shown in FIG. Fig.10 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store text paragraph recognition data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a text paragraph recognition method is implemented.
[0126] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0127] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the following steps when executing the computer program: in response to a paragraph recognition instruction for a target text, obtaining first text information of a target text line in the target text and second text information of a previous text line of the target text line; performing semantic association analysis on the first text information and the second text information through a semantic analysis model to obtain semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; performing phrase association analysis on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; when the semantic association reaches an association threshold and the phrase association analysis result indicates that the first text information contains a key word phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0128] In one embodiment, the processor further implements the following steps when executing the computer program: in response to a paragraph recognition instruction for a target text, obtain first text information of a target text line in the target text, and second text information of a previous text line of the target text line; perform semantic association analysis on the first text information and the second text information through a semantic analysis model to obtain semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; perform phrase association analysis on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; when the semantic association reaches a correlation threshold and the phrase association analysis result indicates that the first text information contains a key word phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0129] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining an initial sample text containing multiple paragraph tags, removing the paragraph tags from the initial sample text to obtain a first sample text; replacing the paragraph tags from the initial sample text to obtain a second sample text; adjusting the paragraph order of the initial sample text to obtain a third sample text; using the first sample text, the second sample text, and the third sample text as training samples, and performing model training on a pre-trained semantic analysis model based on the training samples until the number of training times of the pre-trained semantic analysis model reaches a number threshold, thereby obtaining a semantic analysis model; and performing model training on a pre-trained phrase analysis model based on the training samples until the number of training times of the pre-trained phrase analysis model reaches a number threshold, thereby obtaining a phrase analysis model.
[0130] In one embodiment, when the processor executes the computer program, the following steps are also implemented: in response to a paragraph recognition instruction for a target text, a security check is performed on the target text to obtain a security check result of the target text; when the security check result indicates that the target text is a safe text, the text content of the target text is obtained; an integrity check is performed on the text content to obtain an integrity check result of the text content; when the integrity check result indicates that the text content is complete, the first text information of a target text line in the target text and the second text information of the previous text line of the target text line are obtained.
[0131] In one embodiment, when the processor executes the computer program, the following steps are also implemented: in response to a paragraph recognition instruction for a target text, a security check is performed on the target text to obtain a security check result of the target text; when the security check result indicates that the target text is a safe text, the text content of the target text is obtained; an integrity check is performed on the text content to obtain an integrity check result of the text content; when the integrity check result indicates that the text content is complete, the first text information of a target text line in the target text and the second text information of the previous text line of the target text line are obtained.
[0132] In one embodiment, when the processor executes the computer program, the following steps are also implemented: performing word frequency statistics on each first text segmentation to obtain the occurrence frequency of each first text segmentation; among each first text segmentation, screening out the target text segmentation whose occurrence frequency exceeds the frequency threshold; and taking the target text segmentation and the text phrase at the specified text position in the first text information as a keyword phrase.
[0133] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented: in response to a paragraph recognition instruction for a target text, first text information of a target text line in the target text and second text information of a previous text line of the target text line are obtained; a semantic association analysis is performed on the first text information and the second text information through a semantic analysis model to obtain semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; a phrase association analysis is performed on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; when the semantic association reaches an association threshold and the phrase association analysis result indicates that the first text information contains a key word phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0134] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: using a semantic analysis model, semantic features are extracted from the first text information and the second text information respectively to obtain a first semantic feature of the first text information and a second semantic feature of the second text information; similarity analysis is performed on the first semantic feature and the second semantic feature to obtain feature similarity between the first semantic feature and the second semantic feature; based on the feature similarity, the semantic correlation between the first text information and the second text information is determined.
[0135] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining an initial sample text containing multiple paragraph tags, removing the paragraph tags from the initial sample text to obtain a first sample text; replacing the paragraph tags from the initial sample text to obtain a second sample text; adjusting the paragraph order of the initial sample text to obtain a third sample text; using the first sample text, the second sample text, and the third sample text as training samples, and performing model training on a pre-trained semantic analysis model based on the training samples until the number of training times of the pre-trained semantic analysis model reaches a number threshold, thereby obtaining a semantic analysis model; and performing model training on a pre-trained phrase analysis model based on the training samples until the number of training times of the pre-trained phrase analysis model reaches a number threshold, thereby obtaining a phrase analysis model.
[0136] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to a paragraph recognition instruction for a target text, a security check is performed on the target text to obtain a security check result of the target text; when the security check result indicates that the target text is a safe text, the text content of the target text is obtained; an integrity check is performed on the text content to obtain an integrity check result of the text content; when the integrity check result indicates that the text content is complete, the first text information of a target text line in the target text and the second text information of the previous text line of the target text line are obtained.
[0137] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the first text information and the second text information are respectively segmented to obtain each first text segmentation of the first text information and each second text segmentation of the second text information; each first text segmentation and each second text segmentation are respectively embedded to obtain a first word vector for each first text segmentation and a second word vector for each second text segmentation; the first word vector and the second word vector are both used as inputs of the semantic analysis model and the phrase analysis model.
[0138] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: performing word frequency statistics on each first text segmentation to obtain the occurrence frequency of each first text segmentation; among each first text segmentation, screening out the target text segmentation whose occurrence frequency exceeds the frequency threshold; and taking the target text segmentation and the text phrase at the specified text position in the first text information as a keyword phrase.
[0139] In one embodiment, a computer program product is provided, including a computer program, which implements the following steps when executed by a processor: in response to a paragraph recognition instruction for a target text, obtaining first text information of a target text line in the target text and second text information of a previous text line of the target text line; performing semantic association analysis on the first text information and the second text information through a semantic analysis model to obtain semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; performing phrase association analysis on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; when the semantic association reaches an association threshold and the phrase association analysis result indicates that the first text information contains a keyword phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
[0140] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: using a semantic analysis model, semantic features are extracted from the first text information and the second text information respectively to obtain a first semantic feature of the first text information and a second semantic feature of the second text information; similarity analysis is performed on the first semantic feature and the second semantic feature to obtain feature similarity between the first semantic feature and the second semantic feature; based on the feature similarity, the semantic correlation between the first text information and the second text information is determined.
[0141] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining an initial sample text containing multiple paragraph tags, removing the paragraph tags from the initial sample text to obtain a first sample text; replacing the paragraph tags from the initial sample text to obtain a second sample text; adjusting the paragraph order of the initial sample text to obtain a third sample text; using the first sample text, the second sample text, and the third sample text as training samples, and performing model training on a pre-trained semantic analysis model based on the training samples until the number of training times of the pre-trained semantic analysis model reaches a number threshold, thereby obtaining a semantic analysis model; and performing model training on a pre-trained phrase analysis model based on the training samples until the number of training times of the pre-trained phrase analysis model reaches a number threshold, thereby obtaining a phrase analysis model.
[0142] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: in response to a paragraph recognition instruction for a target text, a security check is performed on the target text to obtain a security check result of the target text; when the security check result indicates that the target text is a safe text, the text content of the target text is obtained; an integrity check is performed on the text content to obtain an integrity check result of the text content; when the integrity check result indicates that the text content is complete, the first text information of a target text line in the target text and the second text information of the previous text line of the target text line are obtained.
[0143] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: the first text information and the second text information are respectively segmented to obtain each first text segmentation of the first text information and each second text segmentation of the second text information; each first text segmentation and each second text segmentation are respectively embedded to obtain a first word vector for each first text segmentation and a second word vector for each second text segmentation; the first word vector and the second word vector are both used as inputs of the semantic analysis model and the phrase analysis model.
[0144] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: performing word frequency statistics on each first text segmentation to obtain the occurrence frequency of each first text segmentation; among each first text segmentation, screening out the target text segmentation whose occurrence frequency exceeds the frequency threshold; and taking the target text segmentation and the text phrase at the specified text position in the first text information as a keyword phrase.
[0145] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0146] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0147] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A text paragraph recognition method, characterized in that: The method comprises: In response to a paragraph recognition instruction for a target text, acquiring first text information of a target text line in the target text and second text information of a previous text line of the target text line; Performing semantic association analysis on the first text information and the second text information through a semantic analysis model to obtain semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; Performing a phrase association analysis on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; When the semantic relevance reaches a relevance threshold and the phrase relevance analysis result indicates that the first text information contains a keyword phrase of the second text information, the target text line and the previous text line are classified as the same paragraph.
2. The method according to claim 1, characterized in that The performing semantic association analysis on the first text information and the second text information by using a semantic analysis model to obtain the semantic association between the first text information and the second text information includes: Using a semantic analysis model, respectively extracting semantic features from the first text information and the second text information to obtain a first semantic feature of the first text information and a second semantic feature of the second text information; Performing a similarity analysis on the first semantic feature and the second semantic feature to obtain a feature similarity between the first semantic feature and the second semantic feature; Based on the feature similarity, a semantic relevance between the first text information and the second text information is determined.
3. The method according to claim 1, characterized in that The method further comprises: Acquire an initial sample text containing multiple paragraph marks, remove the paragraph marks from the initial sample text, and obtain a first sample text; Replacing the paragraph marks of the initial sample text to obtain a second sample text; Adjusting the order of paragraphs of the initial sample text to obtain a third sample text; The first sample text, the second sample text and the third sample text are collectively used as training samples, and based on the training samples, a pre-trained semantic analysis model is trained until the number of training times of the pre-trained semantic analysis model reaches a number threshold, thereby obtaining a semantic analysis model; Based on the training samples, the pre-trained phrase analysis model is trained until the training times of the pre-trained phrase analysis model reaches the times threshold, thereby obtaining a phrase analysis model.
4. The method according to claim 1, characterized in that: The step of obtaining, in response to a paragraph recognition instruction for a target text, first text information of a target text line in the target text and second text information of a previous text line of the target text line comprises: In response to a paragraph recognition instruction for a target text, performing a security check on the target text to obtain a security check result of the target text; When the security detection result indicates that the target text is a safe text, obtaining the text content of the target text; Performing integrity detection on the text content to obtain an integrity detection result of the text content; When the integrity check result indicates that the text content is complete, first text information of a target text line in the target text and second text information of a previous text line of the target text line are obtained.
5. The method according to claim 1, characterized in that The method further comprises: Performing word segmentation processing on the first text information and the second text information respectively to obtain each first text segmentation of the first text information and each second text segmentation of the second text information; Each of the first text segmentation and each of the second text segmentation is word embedded to obtain a first word vector of each of the first text segmentation and a second word vector of each of the second text segmentation; the first word vector and the second word vector are both used as inputs of the semantic analysis model and the phrase analysis model.
6. The method according to claim 5, characterized in that The process of acquiring the keyword group of the first text information includes: Performing word frequency statistics on each of the first text segmentations to obtain the occurrence frequency of each of the first text segmentations; In each of the first text segmentations, the target text segmentations whose occurrence frequency exceeds a frequency threshold are selected; The target text segmentation and the text phrase at the designated text position in the first text information are taken together as a keyword group.
7. A text paragraph recognition device, characterized in that: The device comprises: A text information acquisition module, configured to acquire, in response to a paragraph recognition instruction for a target text, first text information of a target text line in the target text and second text information of a previous text line of the target text line; A semantic analysis module, configured to perform semantic association analysis on the first text information and the second text information through a semantic analysis model to obtain semantic association between the first text information and the second text information; the semantic analysis model is a model pre-trained based on a long short-term memory network; A phrase analysis module, configured to perform a phrase association analysis on the first text information and the second text information through a phrase analysis model to obtain a phrase association analysis result between the first text information and the second text information; the phrase analysis model is a model pre-trained based on a convolutional neural network; The paragraph identification module is used to classify the target text line and the previous text line into the same paragraph when the semantic relevance reaches a relevance threshold and the phrase association analysis result indicates that the first text information contains a keyword group of the second text information.
8. The device according to claim 7, characterized in that The semantic analysis module is further used to: extract semantic features from the first text information and the second text information respectively through a semantic analysis model to obtain a first semantic feature of the first text information and a second semantic feature of the second text information; Performing a similarity analysis on the first semantic feature and the second semantic feature to obtain a feature similarity between the first semantic feature and the second semantic feature; and determining a semantic relevance between the first text information and the second text information based on the feature similarity.
9. The device according to claim 7, characterized in that The device is also used to: obtain an initial sample text containing multiple paragraph tags, remove paragraph tags from the initial sample text to obtain a first sample text; replace paragraph tags from the initial sample text to obtain a second sample text; adjust the paragraph order of the initial sample text to obtain a third sample text; use the first sample text, the second sample text and the third sample text as training samples, and perform model training on a pre-trained semantic analysis model based on the training samples until the number of training times of the pre-trained semantic analysis model reaches a number threshold, thereby obtaining a semantic analysis model; and perform model training on a pre-trained phrase analysis model based on the training samples until the number of training times of the pre-trained phrase analysis model reaches the number threshold, thereby obtaining a phrase analysis model.
10. The device according to claim 7, characterized in that The text information acquisition module is also used to: in response to a paragraph recognition instruction for a target text, perform a security check on the target text to obtain a security check result of the target text; when the security check result indicates that the target text is a safe text, obtain the text content of the target text; perform an integrity check on the text content to obtain an integrity check result of the text content; when the integrity check result indicates that the text content is complete, obtain the first text information of a target text line in the target text and the second text information of the previous text line of the target text line.
11. The device according to claim 7, characterized in that The device is also used to: perform word segmentation processing on the first text information and the second text information respectively to obtain each first text segmentation of the first text information and each second text segmentation of the second text information; perform word embedding on each first text segmentation and each second text segmentation to obtain a first word vector of each first text segmentation and a second word vector of each second text segmentation; and the first word vector and the second word vector are both used as inputs of the semantic analysis model and the phrase analysis model.
12. The device according to claim 11, characterized in that The device is also used to: perform word frequency statistics on each of the first text segmentations to obtain the occurrence frequency of each of the first text segmentations; screen out the target text segmentations whose occurrence frequency exceeds a frequency threshold in each of the first text segmentations; and use the target text segmentation and the text phrase at the specified text position in the first text information as a keyword group.
13. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Text segmentation method, computer equipment, readable storage medium and program product
CN120354843A