Analysis of Poetry Style Based on Text Classification Algorithm

In order to realize the effect of intelligent poetry style analysis, this paper applies the text classification algorithm to the poetry style analysis, combines the knowledge representation algorithm to perform text classification and recognition, improves the algorithm, and applies it to the poetry style analysis model. Moreover, this paper combines intelligent algorithms to construct a poetry style analysis system, constructs the system’s functional modules, preprocesses the poetry documents in the corpus, and maps them to the vector space that can be directly processed by the computer. In addition, after constructing the system model, this paper verifies the poetry style analysis system based on the text classification algorithm through simulation experiments. From the research results, the effect of the poetry style analysis method based on the text classification algorithm proposed in this paper is very good, which meets the actual needs of poetry style analysis.


Introduction
At present, a lot of progress has been made in natural language processing technology. As a branch of natural language processing, computer processing of literary language is now in front of academia. With the support of the National Natural Science Foundation of China, this paper is trying to make preliminary explorations in this field. e focus of this paper is how to use machines to realize the style of poetry. As one of the essences of Chinese traditional culture, the classical poems have meaningful meaning, simple and deep sentiment, and their style is intoxicating. However, for a long time, the judgment of the style of poetry works is mostly based on the reader's judgment and cognition of the style based on experience and feeling. Moreover, traditionally, there are no clear quantitative rules and no formal rules. For machines, it can only rely on the text content of the poem to determine the style. From the form, the poem is also a paragraph of text, and the judgment of its style can also be regarded as the classification of the text style. erefore, this problem is essentially transformed into a text classification problem in machine learning. at is, under a given style classification system, the machine automatically learns the rules according to the content of the text, and establishes a classification discriminator according to the rules, and the classification discriminator automatically determines the style of the text. Based on this, this paper proposes a model framework for computing the style of Chinese classical poetry based on machine learning. is research is of great significance for expanding the application field of machine learning, for the informatization and excavation of traditional poetry, and for the language understanding of poetry and the computer-aided research of various literary works.
As one of the treasures in the history of Chinese literature, poetry has been passed down through the ages because of its enduring charm. is literary form, favored by the general public and literati and poojas, has been growing, evolving, and disseminating and has reached the peak of its development in the Tang and Song dynasties. e research on Tang poetry has always been a research hotspot among scholars and literary lovers. Since ancient times, countless experts and scholars have carried on extensive and in-depth research on Tang poetry and poetry from a literary perspective. However, with the continuous development of information science and technology, people have begun to try to use information science and technology to deal with some of the language problems encountered in work and life. Natural linguistics has developed rapidly in recent years. Faced with the victories of natural language processing in modern Chinese, some natural language processing methods are applied to ancient poetry. At the same time, in view of the difference between ancient poetry and modern Chinese, from the perspective of computer, integrated data mining, genetic algorithm, and other technologies and resources such as HowNet, it focuses on the application of text classification technology in the classification of poetry style.
In the process of creating poems, the different talents, temperaments, literary accomplishments, life experience, ideological realm, and ideological feelings of the literati and the ink guest will affect the content and expression of the poems written by the literati and ink guest, and they will also have the ability to Poems with different characteristics, therefore, do not have the same style of poems. However, in the process of appreciating classical poems, if you blindly pay attention to the individual differences between poems and ignore the common characteristics of the poems, it is likely to cause the problem of nihilism.
is article combines the intelligent computer algorithm to apply the text classification algorithm to the poetry style analysis and builds an intelligent classification system, which lays the foundation for the intelligent classification of poetry.

Related Work
Using computer technology to assist in the study of the field of classical poetry literature, some scholars have begun preliminary attempts and explorations early on. e construction of the classical poetry database and cultural knowledge base is in the computer research laboratories of some universities and research organizations [1]. With the increasing progress of natural language processing technology in the study of Chinese language, it can even gradually support the analysis of rhythm, emotional element, and style characteristics of classical poetry [2]. "Computational Poetics" is proposed in this context [3].
ere have been many research results on the related fields of poetry style. According to the literature [4] " e topic model-based corpus construction and computer-aided creation research," the topic model based on LDA uses the method of reference word recommendation to study and analyze the word characteristics in poetry, vocabulary semantic analysis, and style feature analysis. Literature [5] uses the vector space model (VSM) to represent the text of poems and proposes two types of classification models of classical poems, bold and graceful and graceful. e classification models are based on machine learning and natural language processing. Poetry styles are classified, and a good judgment effect has been achieved. According to literature [6] after segmenting the poems according to the poetry metric and statistical word segmentation methods, they established a poetry vocabulary database and used machine learning methods to analyze the characteristics of poetry styles, classification evaluation, and sentiment analysis. In addition, research in related fields has focused on the algorithm improvement of the poetry style machine classification model, in order to gradually improve the accuracy of the classification model for the poetry style evaluation. e early stage corpus construction and computer processing procedures have been very clear. Various research work is still in-depth [7]. It can be seen that there have been quite a lot of research studies on the classification and judgment of poetry style, which has accumulated rich experience for the classification and judgment of poetry style based on machine learning in this article. e handling of poems can actually be regarded as a text handling problem with a special content in form [8]. Literature [9] developed a "Poetry Computer Aided Research System," which takes the vocabulary in the poem as the main research unit to realize word retrieval, word frequency statistics, and image indexing. Literature [10] proposed a natural language processing technology based on word connection and used it for the understanding of poetry language. It successfully carried out a test of poetry vocabulary material labeling, a preliminary analysis test of poetry language, and an evaluation test of poem language boldness and graceful style. Literature [11] combined naive Bayes with the genetic algorithm, and put forward a calculation model for judging the bold and graceful style of classical poetry based on each character of the poem as the smallest unit, and tested the corpus in the classic poetry. Good results have been achieved. Literature [12] introduced Bayesian classification technology into poetry research from the subject point of view and achieved good experimental results. Literature [13] proposed a classification method of poem topics based on point mutual information and LDA and achieved a good classification effect on the relationship between poem topics and the evolution of the times. Literature [14] uses the vector space model (VSM) to convert the poetry text into a vector and selects the word feature through the chi-square test. Finally, the text classifier is constructed based on the naive Bayes and support vector machine algorithm, and the average classification accuracy rate reaches 74.7%. With the rise of deep learning, the literature [15] applied the RNN neural network to the generation of ancient Chinese poetry, and used the entire historical corpus of poetry as training corpus, adding certain constraints between the words and lines of the generated poetry to achieve it has a better effect than the traditional poetry generation system. Literature [16] uses the RNN model to generate poetry quatrains, and successfully adds an attention mechanism, so that the poetry can learn semantics, structure, rhyme, and other information at the same time. Literature [17] based on the RNN model, by optimizing the word vector of poetry, introducing attention mechanism and hybrid training, a model that can produce topic-related poems based on keywords has been obtained, and good results have been achieved.

Knowledge Representation of Intelligent Poetry Text Generation System
Like many other intelligent systems, knowledge representation is a very important key decision during system construction. We treat Chinese characters and works of art as images in a parametric form. Mathematically, the "image" of Calligraphy C is represented as a band-shaped image area covered by a series of ellipses. It means that this series of C is 2 Scientific Programming composed of num 0 ellipses P 1 , P 2 , . . . , P num0 . F0 � 1, 2, . . . , num 0 , (x i , y i ), and a i , b i are used as the center, semimajor axis, and segment semiaxis of ellipse P i , respectively. We define the text of traditional Chinese poetry as e above knowledge representation method is inspired by the method of the paper. In this paper, a band-shaped area is defined as an ellipse moving along a predefined curve.
We now turn to the concept of equivalence and use a formalized definition of the hierarchical representation of the text of poetry. If R is an equivalence relation defined in the A � a 1 , a 2 , . . . , a n field, that is to say, R is as follows [18]: Domain A can be decomposed into a series of subsets A 1 , A 2 , . . . , A m in relation R, which satisfy the following properties: In order to establish the hierarchical representation of poetry text, we introduced four equivalence relations R 1 , R 2 , R 3 , R 4 : R 1 : all the structural ellipses used to form the same original sign are equivalent to each other. R 2 : all the original strokes used to form the same combination sign are equivalent to each other. R 3 : all the combined strokes used to form the same radical are equivalent to each other. R 4 : all the radicals used to form the same Chinese character are equivalent to each other.
In other words, in a specific poetic text work C, there are a total of num 1 original strokes P 1,i $, $i ∈ F 1 . Moreover, C contains num 2 combined strokes P 2,i , i ∈ F 2 . We can say that C has num 3 radicals P 3,i , i ∈ F 3 . We can also say that C consists of num 4 words P 4,i , i ∈ F 4 . Obviously, when we use the granularity of a single word to apply comprehensive reasoning, num ≡ 1 [20]. Now, the hierarchical representation of traditional poetry text works can be formally described as follows: where the number of elements in the set M is |M|. erefore, the following hierarchical relationship expressed in poetry text works can be expressed as follows: is hierarchical representation describes how the poetry text works at the lowest level are composed of structural ellipses. Each higher level describes how to generate a representation of its current level from the information of the lower level. In essence, it is a tree-shaped knowledge representation.
At the 0th level of the hierarchical representation, the poetry text works are regarded as a series of ellipses, denoted as P 0 . ese ellipses are called structural ellipses for poetry text works. For each construction ellipse, it is denoted as P 0,i , and (x i , y i ) is taken as its center, and ai and bi are taken as its semimajor axis and semiminor axis, respectively. en, the image of the poetic text work C will be presented as a series of image areas covered by an ellipse.
If a lower-level element cannot be merged with other elements at the same level, it will be promoted to an adjacent Scientific Programming higher-level element. In the same way, it is also possible that a radical will be downgraded into a combined gesture, or even an original one. rough these upgrade and downgrade arrangements, we have obtained a unified 6-level hierarchical system, which will be used in the generation of poetry text.
We denote the first structural ellipse of the poem text work as P k,s , and its corresponding topological structure is T k,s . k � 1, 2, 3, 4, s ∈ F k°Tk,s contains topology information, and through it, We denote the bounding box of the image area occupied by element P k,s as C k · s � CX k,s $s$ CY k,s CH k,s CW k, s], k � 1, 2, 3, 4, s ∈ F k . Here, CX k,s , CY k,s , CH k,s , CW k,s are the x, y coordinates of the lower left corner of the bounding box C k,s and its height and width, respectively. All coordinates are in the world coordinate system. erefore, we have . TCR k,s and TCS k,s is the scaling and transition matrix, respectively. e strict mathematical definition of matrix TR k,z , TS k,z is as If k ≥ 1, P k,i m must be a combination of one or more construction elements one level lower. We call the latter substructural elements. All the information needed to combine P k,i is stored in T k,i , which is the topology constructor of P k,i . rough the topology constructor, we can build a oneto-one mapping of different levels of hierarchical representation. In other words, any hierarchical representation pixel x k,s y k , s T of the s-th structural element P k,s belonging to the k-th level can be uniquely mapped to the hierarchical representation pixel x l,t y l,t T of the c-th structural element P 1,t of the first level. Among them, l > k, 1, k � 0, 1, 2, 3, 4, ∃m j ∈ F k+j (j � 1, 2, . . . , 1 − k − 1)$ s.t. $P k,s ∈ P k+1,ml ∈ · · · ∈ P k+(1− k− 1),ml− k− 1 ∈ P 1,t .
If we introduce the operator ∇ b m,n , en, there will be a relationship: e s-th structural element of the k-th level of the hierarchical system is denoted as P k·r,s , and its parameter is denoted as E k·s , k � 0, 1, . . . , 4, s ∈ F k . We now introduce a new matrix operator ∇ c n , which can be used to generate an m × n l�1 d l -dimensional matrix M � (a i,j )m × n l�1 d l and n m × d 1 (l � 1, 2, . . . , n)-dimensional matrices M 1 � (a l,i,j ) m×d1 (l � 1, 2, . . . , n).
We further define a matrix operator ∇ d n : en, the hierarchy of poetry text works can be formally expressed as follows: Among them, At this time, the operator is defined as follows: Among them, col(E n,m ) is the number of columns of matrix E n,m , and 0 2×2 is an 2 × 2-dimensional zero matrix.
In the above equation, each E0, i represents an area covered by the constructed ellipse, and For an element higher than the 0th level, such as P k+1,1 , for all k > 0, it is composed of N k+1,1 adjacent lower-level elements: P k,11 , P k,12 , . . . , P k,1Nk+1,1 . e corresponding shape matrix E k+1,1 is deduced, which is obtained from the matrix E k,11 , E k,12 , . . . , E k,1Nk+1,1 by linking columns by column. Because the parameterized representation of constructing an ellipse is a 4 × 1-dimensional matrix, the abovementioned recommended connection method will accurately generate a matrix with only 4 rows at a higher level. Each row of the generated matrix is called the parameterized representation domain of the element. e different domains of an element can be inferred independently. e weight associated with the s-th field of the i-th source knowledge on the k-th level; that is, the weight of the i-th training example (p i k,l ) is denoted as w i l,s . w i l,s (s � 1, ..., 4) is the reasoning strength of p i k,l in synthetic reasoning. erefore, the set of similar reasoning strengths arranged in order constitutes the "view sequence" of the current comprehensive reasoning process.
is is what we said that different sequences of showing training examples will lead to different results of poetry text.
For the comprehensive reasoning process generated by novel poetry text works, we assume that n comprehensive source knowledge P k,11 , P k,12 , . . . , P k,ln at the k-th level participates in this reasoning process. Moreover, each comprehensive source knowledge consists of m components, where ∀i ≠ j; i, j � 1, 2, . . . , n⇒l i , l j ∈ F k , l i ≠ l j . erefore, we can use an m × 1-dimensioned matrix to represent a single comprehensive reasoning source and use an m × n i�1 l i -dimensioned matrix to represent all active sources in the current comprehensive reasoning. If we apply synthetic reasoning at the single-character level, then m ≡ 4. e t-th attribute of source knowledge is denoted as P k,li,t°, which has an associated strength W k,li,t in the process of comprehensive reasoning, and they have the following relationship: 1, 2, . . . , m). (14) In the intelligent poetry text generation system, this reasoning intensity can be adjusted through a graphical user interface.
e new knowledge generated in the synthetic reasoning process is denoted as P k,r , and its matrix form parameterization is denoted as E k,r°. To apply the principle of comprehensive reasoning process, all source knowledge in reasoning must have equal dimensions. at is to say, if we apply synthetic reasoning on source knowledge P k , s and P k,t , their corresponding matrix form parameterized representations (E k,s ) m1×n1 and (E k,t ) m2×n2 must satisfy the relationship n 1 � n 2 . is equal requirement is a soft constraint of the synthetic reasoning process. If it is violated, we can introduce a source knowledge equality operator ∇ e t to relax this soft constraint. is is very similar to the mapping problem in similar reasoning. Next, we will introduce a few symbols and define ∇ e t in a strict mathematical way. We first denote en, i� We can also obtain a discrete curve composed of the centers of all the covering ellipses for each structural element in the intelligent poetry text generation system, which can be expressed as P k . Its corresponding parameterization is expressed as E k , ls°. erefore, a dispersion curve acquisition method can be described as follows: en, an overview of the key columns of a matrix can be introduced and defined. If a curve C k has v + 1 key points and its coordinates are C k , 1se co,u0 , C k,1se co ul, . . . , C k,ls e co.uv , respectively, then the key column of E k,ls can be identified as E k,1se co .u0 , E k,1se co ,u1 , . . . , E k,1s e co.uv°. Aiming at the key point extraction of a given plane curve C k,ls , we use the algorithm introduced in this paper. Moreover, more refined key point extraction algorithms are introduced in, but they may cause more serious computational overhead.
We assume that now we have identified v + 1 key columns, which are the u 0 , u 1 , . . . u v -th matrix column, through the parameterized representation E k,ls of a matrix form of a comprehensive reasoning source P k,ls , where 1 � u 0 < u 1 < · · · < u v $$ � col(E k,ls ), s � 1, 2, . . . , n.
erefore, we can define the capacity equality operator of the comprehensive reasoning source ∇ e t as follows: Among them,  � 1, 2, . . . , n . (19) rough the operator ∇ f t , we can obtain the matrix representation of the superimposed comprehensive reasoning source: With this operator, we can further calculate the feature matrix of all comprehensive inference source knowledge: In the above equation, b, E k , nor are the matrix representations of standard source knowledge at the k-th level.
According to the user input intensity w k,li,t for different comprehensive reasoning sources, we can calculate the comprehensive reasoning viewpoint matrix: Among them, h � max col(E k,li )|i � 1, 2, . . . , n . I hxh is a hxh dimensional unit matrix. Now, we can generate a comprehensive reasoning feature result S k,r through the comprehensive reasoning process described by the following form: In the above equation, ⊗ is a comprehensive reasoning simulation operator. If the synthetic reasoning process models human creative thinking as a linear process, then E k ⊗ W k � E k · W k , where · is an ordinary matrix multiplication operator. If the comprehensive reasoning process models human creative thinking as a z-order polygon, then ⊗ will be defined as follows: We can also model creative thinking as a geometric average process, as shown in the equation of (25): Generally speaking, we can use the comprehensive reasoning model to overload the comprehensive reasoning simulation operator ⊗ to achieve the purpose of simulating different types of creative thinking.
Finally, by adding the shape of E k,nor , which is the standard structural element related to the inference result P k,nor in the process of comprehensive inference, we obtain the parameterized representation E k,r : E k,r � S k,r ⊗ ∇ e h E k,nor of P k,r , where E k,nor is the matrix form of the parameterized representation of the shape of P k,nor . e definition of operator ⊕ can be overloaded to realize different novel creative thinking activities in intelligent systems. Some simple synthetic reasoning simulation operators for topology constructors are as follows: (1) e arithmetic mean is (2) e geometric mean is (3) e harmonic mean is e integrated reasoning process proposed in this paper is essentially either a value process or an extrapolation process. In other words, w i is the interpolation weight or extrapolation weight of P i k,l , and the constraint n i�1 w i � 1 needs to be satisfied here.

Analysis of Poetry Style Based on Text Classification Algorithm
In the research of this paper, the judgment of poetry style based on machine learning, that is, the flow chart of the pattern recognition of poetry text, is shown in Figure 1. e development and design of the system are shown in Figure 2 according to the research and processing sequence.

Scientific Programming
Judging the style of poetry is similar to the general process of text classification. First, the algorithm needs to preprocess the poetry documents in the corpus and then map them to the vector space that can be directly processed by the computer. e algorithm selects the poem documents that have been styled in advance as the training corpus and the test corpus. Subsequently, the algorithm uses machine learning methods to generate model data for style classification. Finally, the algorithm builds a machine judging tool for poetry style on the basis of the model data tested on the test corpus. is tool can judge the style of other poetry documents in the corpus. e flow chart of style evaluation is shown in Figure 3.
Poems are composed of text content and belong to unstructured data. It is difficult to analyze them using quantitative analysis methods. It is necessary to introduce data indicators that can be measured to perform data analysis and processing. e commonly used method is to segment the text content and then count the word frequency data. For high-frequency words such as "Wanli," "Jiangshan," "Dongfeng," and "Twilight" that often appear in poems, they can generally express the emotional bias and style characteristics of the poet's choice of poetry imagery. In order to classify and aggregate the genres of poets and poets, this paper mainly uses the method of high-frequency word statistics to classify and aggregate the style characteristics of the poets. e cluster analysis of word style is shown in Figure 4.
In order to obtain word vectors with more efficient algorithms, Word2Vec can efficiently train on millions of word lists and hundreds of millions of datasets. e obtained training result-word vector can well measure the semantic relevance and similarity between words. Word2Vec includes two network models: CBOW (Continuous Bag-of-Words) model and Skip-Gram model. e network structure is shown in Figure 5. Skip-Gram can be seen as the reverse process of CBOW. e essence of the CBOW model is a feed forward neural network language model (Feed Forward NNLM).
RNN is a neural network designed specifically for serialization problems, and its basic network structure is shown in Figure 6.
is article summarizes the sequence learning methods of the above two statistical language models. e framework     of the joint language response model based on statistical learning is shown in Figure 7.
In the research of this paper, Brill's conversion learning method is used to cope with the generated context-sensitive rules in conjunction with the language. e flowchart of the learning algorithm is shown in Figure 8. e text visualization technology is mainly composed of three modules: text analysis and processing, visual design presentation, and interactive design, as shown in Figure 9. First, the algorithm collects text information, preprocesses data and expresses knowledge, and transforms it into a corresponding structured data format. en, the algorithm visually presents the information with graphics and color elements through visual coding. In the visual presentation, the algorithm should provide users with effective and reasonable visual presentation and interactive operations based on the user's cognitive characteristics. At the same time, the algorithm performs data operations on the visualized information elements through a reasonable interactive method to facilitate users to quickly and clearly understand the displayed information content, thereby realizing a complete visual design implementation process.
After constructing the above model, the effect of the model is verified, and the system function is verified based on actual needs. Moreover, this paper combines the simulation test to verify the effect of the poetry text classification and the poetry style verification of the system of this paper. e poetry text classification is shown in Table 1 and Figure 10.
From the above research, it can be seen that the poetry style analysis method based on the text classification algorithm proposed in this paper has a good classification effect. e experimental results of the poetry style analysis are shown in Table 2 and Figure 11.      From the above research, the effect of the poetry style analysis method based on the text classification algorithm proposed in this paper is very good, which meets the actual needs of poetry style analysis.

Conclusion
Before the classification of poetry text begins, the algorithm needs to represent the unstructured document data into a data form that the computer can understand. is requires the algorithm to perform corresponding preprocessing and feature representation of the document first and convert the unstructured or semistructured data form into a structured data form that can be processed by the computer. is includes a series of processes such as word segmentation, filtering of low-frequency words and forbidden words, feature representation, and feature extraction. e so-called word segmentation is to add a separator between each entry in a Chinese document to convert the continuous character stream form of the Chinese document into a discrete word stream form. At present, the main word segmentation methods used are forward and reverse maximum matching method, word-by-word traversal method, best matching method, and word frequency statistics method. In addition,    there are two-scan method, adjacency constraint method, and so on. is paper applies the text classification algorithm to the analysis of the style of poetry and constructs an intelligent classification system. From the research results, it can be seen that the poetry style analysis method based on the text classification algorithm proposed in this paper is very effective and meets the actual needs of poetry style analysis.

Data Availability
e labeled dataset used to support the findings of this study are available from the corresponding author upon request.

Conflicts of Interest
e author declares no conflicts of interest.