## 3 Models of Vector Presentation of Text Documents Using Lexical and Semantic Approaches
It should be noted that in order to construct the TF-IDF presentation of texts, we can use inverse and smoothed occurrence frequencies of text objects based on their lexical (taking into account the term occurrence frequency) or semantic (taking into account the node degree instead of the term occurrence frequency) analysis and the normalized or standardized occurrence frequency of documents in the text corpus. The general formula for calculating TF-IDF is as follows (1):  
\[\text{TF}-\text{IDF}=tf(t,d)*idf(t,D), \tag{1}\]  
where \(tf(t,d)\) and \(idf(t,D)\) can be calculated in various ways which can affect the accuracy of subsequent clustering. Here, \(t\) is the term; \(d\) is the document; and \(D\) is the corpus of documents. We can use frequencies such as the following:  
1. The occurrence frequency (2) of a term in the document or the node/term order in the document semantic network: \[tf(t,\ d)=\frac{n_{t}}{\sum_{k}n_{k}},\] (2) where \(n_{t}\) is the number of term occurrences (or node degrees) in the document; \(\sum_{k}n_{k}\) is the total number of terms (or node degrees) in the document; and k is equal to the number of unique words or terms in the document;
2. The double normalized occurrence frequency (3) of a term in the document or the node/term degree in the document semantic network with a coefficient of 0.5: \[tf(t,\ d)=\frac{1}{2}\bigg{\{}1+\frac{n_{t}}{\max(n_{k})}\bigg{\}},\] (3) where \(n_{t}\) is the number of term occurrences (or node degrees) in the document, and \(max(n_{k})\) is the number of occurrences of the most frequently occurring term in the document (or node degrees);
3. The inverse document (or node degree) frequency (4): \[idf(t,\ D)=\log\frac{|D|}{|\{d_{i}\in D\mid t\in\ d_{i}\}|},\] (4) where \(|D|\) is the number of documents, and \(|\{d_{i}\in D\mid t\in\ d_{i}\}|\) is the number of documents where term/node \(t\) appears;
4. The smoothed inverse document frequency (5): \[idf(t,\ D)=\log\bigg{(}1+\frac{|D|}{|\{d_{i}\in D\mid t\in\ d_{i}\}|}\bigg{)}\] (5) where \(|D|\) is the number of documents, and \(|\{d_{i}\in D\mid t\in\ d_{i}\}|\) is the number of documents where term/node \(t\) appears;
5. The probabilistic inverse document frequency, as in Equation (6): \[idf(t,\ D)=\log\bigg{\{}\frac{|D|-|\{d_{i}\in D\mid t\in\ d_{i}\}|}{|\{d_{i}\in D \mid t\in\ d_{i}\}|}\bigg{\}}.\] (6)  
In the semantic approach, the occurrence frequency of terms is replaced by the node degree of the semantic graph in the document network (graph nodes are document terms). The inverse and smoothed inverse document frequencies are calculated in the same way as in the lexical approach, whereas \(n_{k}\) is determined as the sum of degrees for a given node in the entire document; \(\sum_{k}n_{k}\) is the total number of node/term degrees in the document; and \(\max(n_{k})\) is the total number of degrees of the most frequently occurring node/term in the document. The use of IDF allows one to reduce the weight of the frequently used words and terms and thus increase the value of the words and terms that most accurately convey the unique meaning of the document. The appearance of certain terms or words in the text is characterized by Zipf's law. Applying a logarithm to the frequencies of occurrence of terms linearizes their distribution, but does not affect the relative ranking and gives small numerical values that are more convenient to use in calculations. After calculating the TF-IDF matrices for a corpus of texts, we can perform a pairwise calculation of their cosine similarity (cosine of the angle between two vectors in node/term vector presentation) using the standard Equation (7):  
Figure 2:0  
where \(x_{i}\) is the value of the \(i\)-th element of the first vector; \(y_{i}\) is the value of the \(i\)-th element of the second vector; and \(n\) is the number of elements in the vector (number of terms in the vocabulary).