<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd">
<article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article">
 <front>
  <journal-meta>
   <journal-id journal-id-type="publisher-id">
    jdaip
   </journal-id>
   <journal-title-group>
    <journal-title>
     Journal of Data Analysis and Information Processing
    </journal-title>
   </journal-title-group>
   <issn pub-type="epub">
    2327-7211
   </issn>
   <issn publication-format="print">
    2327-7203
   </issn>
   <publisher>
    <publisher-name>
     Scientific Research Publishing
    </publisher-name>
   </publisher>
  </journal-meta>
  <article-meta>
   <article-id pub-id-type="doi">
    10.4236/jdaip.2024.124032
   </article-id>
   <article-id pub-id-type="publisher-id">
    jdaip-137513
   </article-id>
   <article-categories>
    <subj-group subj-group-type="heading">
     <subject>
      Articles
     </subject>
    </subj-group>
    <subj-group subj-group-type="Discipline-v2">
     <subject>
      Computer Science 
     </subject>
     <subject>
       Communications, Physics 
     </subject>
     <subject>
       Mathematics
     </subject>
    </subj-group>
   </article-categories>
   <title-group>
    Enhancing BERTopic with Pre-Clustered Knowledge: Reducing Feature Sparsity in Short Text Topic Modeling
   </title-group>
   <contrib-group>
    <contrib contrib-type="author" xlink:type="simple">
     <name name-style="western">
      <surname>
       Qian
      </surname>
      <given-names>
       Wang
      </given-names>
     </name>
    </contrib>
    <contrib contrib-type="author" xlink:type="simple">
     <name name-style="western">
      <surname>
       Biao
      </surname>
      <given-names>
       Ma
      </given-names>
     </name>
    </contrib>
   </contrib-group> 
   <aff id="affnull">
    <addr-line>
     aGlorious Sun School of Business and Management, Donghua University, Shanghai, China
    </addr-line> 
   </aff> 
   <pub-date pub-type="epub">
    <day>
     06
    </day> 
    <month>
     09
    </month>
    <year>
     2024
    </year>
   </pub-date> 
   <volume>
    12
   </volume> 
   <issue>
    04
   </issue>
   <fpage>
    597
   </fpage>
   <lpage>
    611
   </lpage>
   <history>
    <date date-type="received">
     <day>
      23,
     </day>
     <month>
      October
     </month>
     <year>
      2024
     </year>
    </date>
    <date date-type="published">
     <day>
      18,
     </day>
     <month>
      October
     </month>
     <year>
      2024
     </year> 
    </date> 
    <date date-type="accepted">
     <day>
      18,
     </day>
     <month>
      November
     </month>
     <year>
      2024
     </year> 
    </date>
   </history>
   <permissions>
    <copyright-statement>
     © Copyright 2014 by authors and Scientific Research Publishing Inc. 
    </copyright-statement>
    <copyright-year>
     2014
    </copyright-year>
    <license>
     <license-p>
      This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/
     </license-p>
    </license>
   </permissions>
   <abstract>
    Modeling topics in short texts presents significant challenges due to feature sparsity, particularly when analyzing content generated by large-scale online users. This sparsity can substantially impair semantic capture accuracy. We propose a novel approach that incorporates pre-clustered knowledge into the BERTopic model while reducing the l2 norm for low-frequency words. Our method effectively mitigates feature sparsity during cluster mapping. Empirical evaluation on the StackOverflow dataset demonstrates that our approach outperforms baseline models, achieving superior Macro-F1 scores. These results validate the effectiveness of our proposed feature sparsity reduction technique for short-text topic modeling.
   </abstract>
   <kwd-group> 
    <kwd>
     Topic Model
    </kwd> 
    <kwd>
      BERTopic
    </kwd> 
    <kwd>
      Short Text
    </kwd> 
    <kwd>
      Feature Sparsity
    </kwd> 
    <kwd>
      Cluster
    </kwd>
   </kwd-group>
  </article-meta>
 </front>
 <body>
  <sec id="s1">
   <title>1. Introduction</title>
   <p>With the rapid development of technology, massive information on the Internet is growing exponentially, and the amount of unstructured text data is increasing. For text data mining, traditional research perspectives are mostly based on long texts, such as news, posts, etc. However, with the functional evolution of platforms and changes in user behavior habits, short text comments can be found everywhere on microblogs, short videos, e-commerce, and other types of platforms. The investigation of topics in short texts is crucial for content analysis; therefore, how to quickly and accurately mine information contained in short texts has been an issue of interest in recent years. The information embedded in the text is an issue that deserved attention in recent years.</p>
   <p>Topic modeling is one of the most important techniques in text mining, which is widely used in information retrieval <xref ref-type="bibr" rid="scirp.137513-1">
     [1]
    </xref> <xref ref-type="bibr" rid="scirp.137513-2">
     [2]
    </xref>, content recommendation <xref ref-type="bibr" rid="scirp.137513-3">
     [3]
    </xref> <xref ref-type="bibr" rid="scirp.137513-4">
     [4]
    </xref>, and intelligence analysis <xref ref-type="bibr" rid="scirp.137513-5">
     [5]
    </xref>. Traditional topic models, such as PLSA and LDA, usually reveal potential topics in text corpora by implicitly capturing document-level word co-occurrence patterns. However, unlike the information-rich long documents traditionally studied, most words in short texts appear only once, which is not enough to support the acquisition of associative information, presenting sparse semantic features and more noise, making the topic modeling problem for this type of text challenging. Therefore, it is an important issue in information processing of short text to effectively mine implicit information so that topic modeling can be better applied to short text and improve the clustering accuracy. For the topic modeling problem of short texts, most of the early research alleviates sparsity by extending short texts, using external knowledge, enhancing topic hypotheses, etc. However, heuristic data aggregation methods are highly dependent on data, and external knowledge is equally dependent on their accuracy. The bi-term co-occurrence model is prone to mixing redundant information and still faces the feature sparsity problem. Self-aggregation-based models, although they can capture topic information to some extent, cannot achieve high accuracy in clustering due to ineffective utilization of contextual information, bags of words may not accurately represent documents, etc.</p>
   <p>With wide application of language models, their ability to learn complex linguistic structures and semantic laws is applied to the topic modeling field to make up for shortcomings in semantic captures, such as LDA + SentenceBERT <xref ref-type="bibr" rid="scirp.137513-6">
     [6]
    </xref>, GA + WGSDMM <xref ref-type="bibr" rid="scirp.137513-7">
     [7]
    </xref>, LDA/GSDMM + BERT <xref ref-type="bibr" rid="scirp.137513-8">
     [8]
    </xref>, etc. When using advanced language modeling to process long texts, it can learn long-distance dependencies and capture complex structures and deep semantics through a large number of parameters and deep network structures, thus improving the ability to grasp the text as a whole. This performs very effectively in understanding and analyzing long articles, news, etc. However, when these models are applied to short text processing, the sparsity problem still exists. The lack of contextual information still makes it difficult to provide rich features for model learning, and the brevity of short texts also leads to increased semantic ambiguity. Therefore, comprehension and topic modeling of short texts remains an urgent problem. It is necessary to develop new methods that are more suitable for the characteristics of short texts to improve semantic comprehension and accuracy.</p>
   <p>In 2022, BERTopic was proposed, which uses advanced language models and class-based TF-IDF to generate topic representations. It outperforms other classical topic models, such as LDA, in terms of topic consistency, diversity, and runtime. However, BERTopic is oriented to regular text and still adopts regular processing even when dealing with short texts with sparse features, which easily leads to overfitting and affects the accuracy of the topic assignment. Moreover, in the semantic vector space generated using language models, the l2 paradigm of low-frequency words is larger, i.e., they are farther away from the origin. The sparse distribution makes them show significant anisotropy, and thus, there is still room for improvement in BERTopic with short texts. Based on the aforementioned idea of combining the language model and topic information, this paper tries to improve the clustering process of BERTopic by utilizing pre-clustered knowledge. Adding more features to measure sentence similarity, feature fusion, and dimensionality reduction are performed to mitigate the effect of l2 paradigms for low-frequency words and to improve the accuracy of topic assignments in short texts.</p>
  </sec><sec id="s2">
   <title>2. Related Work</title>
   <sec id="s2_1">
    <title>2.1. Traditional Short-Text Topic Model</title>
    <p>In general, topic models are commonly used to extract topic information from text corpora. Traditional topic models use word cooccurrence information to identify topics, such as LSA <xref ref-type="bibr" rid="scirp.137513-9">
      [9]
     </xref>, PLSA <xref ref-type="bibr" rid="scirp.137513-10">
      [10]
     </xref>, etc. Especially LDA <xref ref-type="bibr" rid="scirp.137513-11">
      [11]
     </xref>, which has good generalization ability and extensibility, is widely used to discover hidden topics from text corpora. However, this approach is more suitable for long texts with rich topic matter <xref ref-type="bibr" rid="scirp.137513-12">
      [12]
     </xref>. Texts from the Internet are usually very short with limited contexts, and most of the above models and their variants do not take into account the specificity of short texts, and thus face serious data sparsity problems when applied to short texts.</p>
    <p>A common solution to this problem is to extend short texts and aggregate them into lengthy pseudo-documents to enrich the representations of short texts, e.g., based on user groups <xref ref-type="bibr" rid="scirp.137513-13">
      [13]
     </xref>, based on synonyms <xref ref-type="bibr" rid="scirp.137513-14">
      [14]
     </xref>, based on the time of text publication <xref ref-type="bibr" rid="scirp.137513-15">
      [15]
     </xref> <xref ref-type="bibr" rid="scirp.137513-16">
      [16]
     </xref>, etc. Alternatively, it is extended using external knowledge, such as WordNet <xref ref-type="bibr" rid="scirp.137513-17">
      [17]
     </xref>, transfer learning with the help of long texts <xref ref-type="bibr" rid="scirp.137513-18">
      [18]
     </xref>, and so on. Other methods are modified in mathematical theory for short texts, such as the bi-term topic model BTM <xref ref-type="bibr" rid="scirp.137513-19">
      [19]
     </xref>, which uses bi-term co-occurrence information to model the corpus generation process.</p>
    <p>GSDMM is an unsupervised topic model. It is solved in a similar way to LDA, except that it assumes that each document contains only one potential topic. Such an assumption is more in line with the actual situation of short texts such as comments, headlines, and other types of short texts. The model is based on the Dirichlet Multinominal Mixture Model (DMM), which generates documents and approximates the solution using collapsed Gibbs sampling. GSDMM implements clustering based on the two principles of completeness and consistency, and its performance is significantly better than that of K-means, HAC, and DMAFP. The model assumes that documents are generated according to a mixed polynomial distribution and that topics and documents correspond to one another.</p>
    <p>However, these approaches are based on statistical knowledge and cannot solve the ambiguity problem. That is, multiple expressions of a certain meaning may be classified under different topics. Comprehension bias affects the accuracy of the results, so language models are gradually being used to explore more effective solution strategies.</p>
   </sec>
   <sec id="s2_2">
    <title>2.2. Short-Text Topic Models Using Language Models</title>
    <p>Effective embeddings can help recognize information at the syntactic and semantic levels <xref ref-type="bibr" rid="scirp.137513-20">
      [20]
     </xref> and enhance the semantic consistency of topics in short texts, so embedding-based techniques have been gradually used to improve topic modeling in recent years. For example, Fan et al. <xref ref-type="bibr" rid="scirp.137513-21">
      [21]
     </xref> classified short texts based on word embeddings with bi-directional GRU, WETM <xref ref-type="bibr" rid="scirp.137513-22">
      [22]
     </xref> and JEA-LDA <xref ref-type="bibr" rid="scirp.137513-23">
      [23]
     </xref> discovered structural information about topics and words based on word embeddings, and Jia et al. <xref ref-type="bibr" rid="scirp.137513-24">
      [24]
     </xref> used sentence embeddings and CNN to cluster textual features. In addition, embedding information can be combined with methods for extending text. For example, VAETM <xref ref-type="bibr" rid="scirp.137513-25">
      [25]
     </xref> inferred potential representations of topic distributions of short texts by combining word embeddings with external knowledge; ETM <xref ref-type="bibr" rid="scirp.137513-26">
      [26]
     </xref> inferred topics by aggregating short texts into pseudo-documents using word embeddings and applying Markov Random Field Regularization models.</p>
    <p>Language models facilitate the development of topic modeling <xref ref-type="bibr" rid="scirp.137513-27">
      [27]
     </xref>. BERTopic <xref ref-type="bibr" rid="scirp.137513-28">
      [28]
     </xref> is a topic model that performs clustering based on embeddings. It transforms documents into dense vector representations using the pre-trained language model SentenceBERT <xref ref-type="bibr" rid="scirp.137513-29">
      [29]
     </xref>, dimensionality reduction using the UMAP algorithm <xref ref-type="bibr" rid="scirp.137513-30">
      [30]
     </xref>, clustering with HDBSCAN <xref ref-type="bibr" rid="scirp.137513-31">
      [31]
     </xref>, and finally, applying a class-based variant of TF-IDF to extract the topic representation of each cluster. However, when dealing with a large number of short texts, sparse features introduce bias to clusters exclusively by the similarity of sentence embeddings, which makes it difficult for the language model in BERTopic to fully understand semantics.</p>
    <p>
     <xref ref-type="bibr" rid="scirp.137513-"></xref>Some studies introduce topic knowledge into advanced language models, where learning multi-dimensional features contributes to a comprehensive text understanding of the complex properties. Nguyen et al. <xref ref-type="bibr" rid="scirp.137513-6">
      [6]
     </xref> used LDA to obtain probabilistic topic vectors for comment texts and integrated sentence embeddings from SentenceBERT to identify topics; Agarwal et al. <xref ref-type="bibr" rid="scirp.137513-7">
      [7]
     </xref> used GA algorithm to improve WGSDMM for web service clustering; Peinelt et al. <xref ref-type="bibr" rid="scirp.137513-8">
      [8]
     </xref> proposed tBERT model to improve the performance of BERT in semantic similarity detection using topic models such as LDA and GSDMM. Liu et al. <xref ref-type="bibr" rid="scirp.137513-32">
      [32]
     </xref> combined GSDMM with SBERT to effectively extract topics and overall semantic features of short texts. Performs targeted classification tasks that require manual labeling and training. Although the proposed method in this paper also introduces pre-clustered topic knowledge, the splicing is different and it performs entirely in an unsupervised manner without prior labeled data.</p>
   </sec>
  </sec><sec id="s3">
   <title>3. Methodology</title>
   <p>The vectors extracted by BERTopic only consider semantic similarity, so in this paper, we use pre-clustered topic knowledge to supplement the original algorithm. This makes the topic assignment result more reasonable and enhances the ability to extract more accurate topics. In the following, we first analyze the existing problems of BERTopic and put forward the motivation, then introduce the new method of similarity computation that introduces pre-clustered knowledge. Finally, the specific process of the improved algorithm is described in detail.</p>
   <sec id="s3_1">
    <title>3.1. Motivation</title>
    <p>The purpose of topic modeling is to cluster texts based on their semantic relationships. Given a document collection 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mover accent="true"> 
       <mi>
         d 
       </mi> 
       <mo>
         → 
       </mo> 
      </mover> 
     </math> containing D short texts, perform clustering to get the result 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         Z 
       </mi> 
       <mo>
         = 
       </mo> 
       <mrow> 
        <mo>
          { 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            z 
          </mi> 
          <mn>
            1 
          </mn> 
         </msub> 
         <mo>
           , 
         </mo> 
         <mo>
           ⋯ 
         </mo> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            z 
          </mi> 
          <mi>
            D 
          </mi> 
         </msub> 
        </mrow> 
        <mo>
          } 
        </mo> 
       </mrow> 
      </mrow> 
     </math>, where 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          z 
        </mi> 
        <mi>
          d 
        </mi> 
       </msub> 
       <mo>
         ∈ 
       </mo> 
       <mrow> 
        <mo>
          { 
        </mo> 
        <mrow> 
         <mn>
           1 
         </mn> 
         <mo>
           , 
         </mo> 
         <mn>
           2 
         </mn> 
         <mo>
           , 
         </mo> 
         <mo>
           ⋯ 
         </mo> 
         <mo>
           , 
         </mo> 
         <mi>
           K 
         </mi> 
        </mrow> 
        <mo>
          } 
        </mo> 
       </mrow> 
      </mrow> 
     </math> is the topic to which document d belongs and K is the number of topics. Finally, the topic-word distribution representation is constructed based on the importance of the word w in topic z. There are some problems with clustering using text similarity in the clustering process. This paper aims to improve the vector representation used for similarity computation. We use pre-clustered knowledge to reduce the intra-cluster distance and increase the inter-cluster distance, to improve the objective, the optimization problem of clustering accuracy, which is measured by Macro-F1.</p>
    <p>Specifically, short texts have more low-frequency words, and their vectors are characterized by large l2 norms, making the distribution sparse. Therefore, in the automatic clustering phase of BERTopic, the density-based HDBSCAN algorithm can discover more and finer-grained clusters. When the number of automatic clusters is larger, it needs to be mapped to a pre-specified number of clusters, a process that requires cosine similarity. However, the characteristics of low-frequency words make the vector space present a narrow cone, showing anisotropy in the spatial distribution, which interferes with the calculation of cosine similarity. The short text has more low-frequency words, which leads to bias in topic vectors due to the uneven distribution of word frequencies. This affects the accuracy of the mapping results based on cosine similarity, so there is room for improvement of the native BERTopic. Moreover, it is challenging to mitigate the effect of anisotropy while maintaining semantic relevance.</p>
   </sec>
   <sec id="s3_2">
    <title>3.2. Similarity Calculation Method with Pre-Clustered Knowledge</title>
    <p>Cosine similarity is a common method for calculating semantic similarity. For embeddings A and B, the cosine similarity is calculated as shown in Equation (1). The denominator represents the modulus of two embeddings, which can also be regarded as the l2 norm, i.e., the distance from the origin.</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mrow> 
         <mtext>
           sim 
         </mtext> 
        </mrow> 
        <mrow> 
         <mtext>
           cos 
         </mtext> 
        </mrow> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mfrac> 
        <mrow> 
         <mi>
           A 
         </mi> 
         <mo>
           ⋅ 
         </mo> 
         <mi>
           B 
         </mi> 
        </mrow> 
        <mrow> 
         <mrow> 
          <mo>
            ‖ 
          </mo> 
          <mi>
            A 
          </mi> 
          <mo>
            ‖ 
          </mo> 
         </mrow> 
         <mrow> 
          <mo>
            ‖ 
          </mo> 
          <mi>
            B 
          </mi> 
          <mo>
            ‖ 
          </mo> 
         </mrow> 
        </mrow> 
       </mfrac> 
      </mrow> 
     </math> (1)</p>
    <p>Specifically, according to Li et al. <xref ref-type="bibr" rid="scirp.137513-33">
      [33]
     </xref>, language models can use word co-occurrence as a proxy for semantic similarity. Given the context c, the modeling process of language models can be simplified as:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         p 
       </mi> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <mi>
           x 
         </mi> 
         <mo>
           | 
         </mo> 
         <mi>
           c 
         </mi> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
       <mo>
         = 
       </mo> 
       <mfrac> 
        <mrow> 
         <mi>
           exp 
         </mi> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mrow> 
           <msubsup> 
            <mi>
              h 
            </mi> 
            <mi>
              c 
            </mi> 
            <mtext>
              T 
            </mtext> 
           </msubsup> 
           <msub> 
            <mi>
              W 
            </mi> 
            <mi>
              x 
            </mi> 
           </msub> 
          </mrow> 
          <mo>
            ) 
          </mo> 
         </mrow> 
        </mrow> 
        <mrow> 
         <msub> 
          <mstyle mathsize="140%" displaystyle="true"> 
           <mo>
             ∑ 
           </mo> 
          </mstyle> 
          <msup> 
           <mi>
             x 
           </mi> 
           <mo>
             ′ 
           </mo> 
          </msup> 
         </msub> 
         <mtext>
             
         </mtext> 
         <msubsup> 
          <mi>
            h 
          </mi> 
          <mi>
            c 
          </mi> 
          <mtext>
            T 
          </mtext> 
         </msubsup> 
         <msub> 
          <mi>
            W 
          </mi> 
          <msup> 
           <mi>
             x 
           </mi> 
           <mo>
             ′ 
           </mo> 
          </msup> 
         </msub> 
        </mrow> 
       </mfrac> 
      </mrow> 
     </math> (2)</p>
    <p>The similarity of sentence embeddings can be regarded as the similarity of context embeddings 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msubsup> 
        <mi>
          h 
        </mi> 
        <mi>
          c 
        </mi> 
        <mtext>
          T 
        </mtext> 
       </msubsup> 
       <msub> 
        <mi>
          h 
        </mi> 
        <msup> 
         <mi>
           c 
         </mi> 
         <mo>
           ′ 
         </mo> 
        </msup> 
       </msub> 
      </mrow> 
     </math>, and the dot product of context embeddings 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          h 
        </mi> 
        <mi>
          c 
        </mi> 
       </msub> 
      </mrow> 
     </math> and word embeddings 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          w 
        </mi> 
        <mi>
          x 
        </mi> 
       </msub> 
      </mrow> 
     </math> is used as a proxy in Equation (2). According to Li et al. <xref ref-type="bibr" rid="scirp.137513-33">
      [33]
     </xref>, in a well-trained language model, 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msubsup> 
        <mi>
          h 
        </mi> 
        <mi>
          c 
        </mi> 
        <mtext>
          T 
        </mtext> 
       </msubsup> 
       <msub> 
        <mi>
          W 
        </mi> 
        <mi>
          x 
        </mi> 
       </msub> 
      </mrow> 
     </math> can be approximately decomposed as:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msubsup> 
        <mi>
          h 
        </mi> 
        <mi>
          c 
        </mi> 
        <mtext>
          T 
        </mtext> 
       </msubsup> 
       <msub> 
        <mi>
          W 
        </mi> 
        <mi>
          x 
        </mi> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mtext>
         PMI 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <mi>
           x 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           c 
         </mi> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
       <mo>
         + 
       </mo> 
       <mtext>
         logp 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mi>
          x 
        </mi> 
        <mo>
          ) 
        </mo> 
       </mrow> 
       <mo>
         + 
       </mo> 
       <msub> 
        <mi>
          λ 
        </mi> 
        <mi>
          c 
        </mi> 
       </msub> 
      </mrow> 
     </math> (3)</p>
    <p>where PMI(x,c) denotes pointwise mutual information between x and c. This metric is semantically meaningful, so context vectors imply semantically relevant interactions due to higher-order word co-occurrence relations. Thus the cosine similarity can represent the semantic relations of sentences in the vector space. However, logp(x) represents the probability of the occurrence of word x. Low-frequency words have a larger l2 norm and are sparsely distributed, making the shape of vectors in the embedding space a narrow cone, characterized by anisotropy. In short texts, the occurrence probability of low-frequency words is larger, so it will cause bias in the semantic information captured by context vectors in higher-order space because of the distributional characteristics of word frequency.</p>
    <p>Considering fewer short text features, this paper introduces pre-clustered knowledge to weaken the influence of word frequency through interaction between different features. In the pre-clustering phase, several potential problems may arise when the external corpus is used. On the one hand, pre-clustering is an unsupervised process and cannot adjust the learning direction of the model in contrast to supervised learning with predefined labels. Using an external corpus may introduce noise and data matching between two different data sources can complicate simple problems. On the other hand, the original corpus and external corpus may have large differences in feature space, which is not comparable in feature representation, and it is difficult to judge algorithmic effects with l2 paradigm. Based on the above considerations, this paper uses the original corpus as the object of pre-clustering to maintain simplicity and effectiveness. It is used as an improvement strategy to combine the topic knowledge from classical short-text clustering algorithms with semantic embeddings, but this also destroys the original semantic space and leads to inconsistency. The feature matrix being too large will also lead to the problem of large computation and long model fitting time, so the dimensionality reduction process is necessary before fusion to reduce the noise in data and prevent overfitting. The specific steps are as follows:</p>
    <p>1) Get topic vectors by a short-text clustering algorithm, and reduce dimension;</p>
    <p>2) Get semantic embeddings by a language model, and reduce dimension;</p>
    <p>3) Splice embeddings, and compute similarity using cosine.</p>
    <p>Taking vectors incorporating pre-clustered knowledge as the final representation of each document, the l2 paradigm of vectors under the same topic is reduced, and the spatial distribution is denser which alleviates anisotropy. In this way, the cosine similarity measure is more reasonable, which can improve the accuracy of the clustering results.</p>
   </sec>
   <sec id="s3_3">
    <title>3.3. G-BERTopic Algorithm</title>
    <p>In brief, get topic vectors by a classical short-text clustering algorithm, and splice them and semantic embeddings in the cluster remapping phase of BERTopic, so that short texts on the same topic are more likely to be assigned into the same cluster. <xref ref-type="fig" rid="fig1">
      Figure 1
     </xref> is the overall structure of BERTopic with pre-clustered knowledge.</p>
    <p>When it is desired to cluster documents into class K, the process is shown below:</p>
    <fig id="fig1" position="float">
     <label>Figure 1</label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.137513-"></xref>Figure 1. Algorithm flow chart.</title>
     </caption>
     <graphic mimetype="image" position="float" xlink:type="simple" xlink:href="https://html.scirp.org/file/2870750-rId34.jpeg?20241121022616" />
    </fig>
    <p>1) Get Embeddings</p>
    <p>Use a classical short-text topic model to obtain the vector matrix of the topic<xref ref-type="bibr" rid="scirp.137513-#REF _Ref181286841 h  * MERGEFORMAT">
      <sup>1</sup>
     </xref> and denote it as 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         g 
       </mi> 
       <mo>
         ∈ 
       </mo> 
       <msup> 
        <mi>
          R 
        </mi> 
        <mrow> 
         <mi>
           D 
         </mi> 
         <mo>
           × 
         </mo> 
         <mi>
           K 
         </mi> 
        </mrow> 
       </msup> 
      </mrow> 
     </math>. The topic vectors are generally sparse, so to minimize redundancy, use an auto-encoder to map it to lower dimensionality, and denote it as 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msup> 
        <mi>
          g 
        </mi> 
        <mstyle mathvariant="bold" mathsize="normal"> 
         <mi>
           r 
         </mi> 
        </mstyle> 
       </msup> 
       <mo>
         ∈ 
       </mo> 
       <msup> 
        <mi>
          R 
        </mi> 
        <mrow> 
         <mi>
           D 
         </mi> 
         <mo>
           × 
         </mo> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mrow> 
           <mrow> 
            <mi>
              K 
            </mi> 
            <mo>
              / 
            </mo> 
            <mn>
              2 
            </mn> 
           </mrow> 
          </mrow> 
          <mo>
            ) 
          </mo> 
         </mrow> 
        </mrow> 
       </msup> 
      </mrow> 
     </math>：</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msup> 
        <mstyle mathvariant="bold" mathsize="normal"> 
         <mi>
           g 
         </mi> 
        </mstyle> 
        <mstyle mathvariant="bold" mathsize="normal"> 
         <mi>
           r 
         </mi> 
        </mstyle> 
       </msup> 
       <mo>
         = 
       </mo> 
       <mtext>
         AutoEncoder 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mstyle mathvariant="bold" mathsize="normal"> 
         <mi>
           g 
         </mi> 
        </mstyle> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> (4)</p>
    <p>Sentences are fed into a pre-trained model SentenceBERT to generate semantic embeddings e. Use UMAP to reduce dimension, preserving the global structure while retaining local semantic features, and denote it as 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msup> 
        <mi>
          e 
        </mi> 
        <mi>
          r 
        </mi> 
       </msup> 
       <mo>
         ∈ 
       </mo> 
       <msup> 
        <mi>
          R 
        </mi> 
        <mrow> 
         <mi>
           D 
         </mi> 
         <mo>
           × 
         </mo> 
         <mn>
           128 
         </mn> 
        </mrow> 
       </msup> 
      </mrow> 
     </math>:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"> <mrow> 
       <mstyle mathsize="normal" mathvariant="bold"> 
        <mi>
          e 
        </mi> 
       </mstyle> 
       <mo>
         = 
       </mo> 
       <mtext>
         SentenceBERT 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mover accent="true"> 
         <mi>
           d 
         </mi> 
         <mo>
           → 
         </mo> 
        </mover> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> (5)</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msup> 
        <mi>
          e 
        </mi> 
        <mi>
          r 
        </mi> 
       </msup> 
       <mo>
         = 
       </mo> 
       <mi>
         U 
       </mi> 
       <mi>
         M 
       </mi> 
       <mi>
         A 
       </mi> 
       <mi>
         P 
       </mi> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mi>
          e 
        </mi> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> (6)</p>
    <p>2) Cluster</p>
    <p>The optimal clustering results are automatically generated using the HDBSCAN algorithm on semantic embeddings 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msup> 
        <mi>
          e 
        </mi> 
        <mi>
          r 
        </mi> 
       </msup> 
      </mrow> 
     </math>, where 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         T 
       </mi> 
       <mo>
         ∈ 
       </mo> 
       <msup> 
        <mi>
          R 
        </mi> 
        <mrow> 
         <mi>
           D 
         </mi> 
         <mo>
           × 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
       </msup> 
      </mrow> 
     </math> denotes corresponding labels after automatic clustering.</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         T 
       </mi> 
       <mo>
         = 
       </mo> 
       <mtext>
         HDBSCAN 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <msup> 
          <mi>
            e 
          </mi> 
          <mi>
            r 
          </mi> 
         </msup> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> (7)</p>
    <p>When 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mrow> 
        <mo>
          | 
        </mo> 
        <mi>
          T 
        </mi> 
        <mo>
          | 
        </mo> 
       </mrow> 
       <mo>
         &gt; 
       </mo> 
       <mi>
         K 
       </mi> 
      </mrow> 
     </math>, clusters mapping is required. Splice dimensionality reduced semantic embeddings with topic vectors as 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <msup> 
       <mi>
         e 
       </mi> 
       <mo>
         ′ 
       </mo> 
      </msup> 
     </math>, and takes the mean value under the same topic as the representation 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          t 
        </mi> 
        <mi>
          k 
        </mi> 
       </msub> 
      </mrow> 
     </math> for each topic:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msup> 
        <mi>
          e 
        </mi> 
        <mo>
          ′ 
        </mo> 
       </msup> 
       <mo>
         = 
       </mo> 
       <mtext>
         concat 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <msup> 
          <mi>
            e 
          </mi> 
          <mi>
            r 
          </mi> 
         </msup> 
         <mo>
           , 
         </mo> 
         <msup> 
          <mi>
            g 
          </mi> 
          <mi>
            r 
          </mi> 
         </msup> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> (8)</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msup> 
        <mi>
          e 
        </mi> 
        <mi>
          r 
        </mi> 
       </msup> 
       <mo>
         = 
       </mo> 
       <mtext>
         UMAP 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mi>
          e 
        </mi> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> (9)</p>
    <p>The distance matrix is computed through cosine similarity among topic representations and fed into Agglomerative Clustering algorithm for further clustering, to get new cluster labels 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <msup> 
       <mi>
         T 
       </mi> 
       <mo>
         ′ 
       </mo> 
      </msup> 
     </math>:</p>
    <p>
     <math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mtext>
         distance 
       </mtext> 
       <mo>
         = 
       </mo> 
       <mn>
         1 
       </mn> 
       <mo>
         − 
       </mo> 
       <msub> 
        <mrow> 
         <mtext>
           sim 
         </mtext> 
        </mrow> 
        <mrow> 
         <mtext>
           cos 
         </mtext> 
        </mrow> 
       </msub> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mi>
          t 
        </mi> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> (10)</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msup> 
        <mi>
          e 
        </mi> 
        <mi>
          r 
        </mi> 
       </msup> 
       <mo>
         = 
       </mo> 
       <mtext>
         UMAP 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mi>
          e 
        </mi> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> (11)</p>
    <p>where the diagonal of distance is filled using zeros. Mapping the labels yields the final clustering result Z. Update the representation of each topic.</p>
    <p>3) Topic Words</p>
    <p>Generalize the classical TF-IDF as c-TF-IDF for the clustering granularity. It treats sentences under the same cluster as a whole and extracts important words to construct the topic-word representation. The importance score is shown in the following equation:</p>
    <p>
     <xref ref-type="bibr" rid="scirp.137513-"></xref> 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          W 
        </mi> 
        <mrow> 
         <mi>
           w 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           z 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mi>
         t 
       </mi> 
       <msub> 
        <mi>
          f 
        </mi> 
        <mrow> 
         <mi>
           w 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           z 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         ⋅ 
       </mo> 
       <mi>
         log 
       </mi> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <mn>
           1 
         </mn> 
         <mo>
           + 
         </mo> 
         <mfrac> 
          <mi>
            A 
          </mi> 
          <mrow> 
           <mi>
             t 
           </mi> 
           <msub> 
            <mi>
              f 
            </mi> 
            <mi>
              w 
            </mi> 
           </msub> 
          </mrow> 
         </mfrac> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> (12)</p>
    <p>where 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         t 
       </mi> 
       <msub> 
        <mi>
          f 
        </mi> 
        <mrow> 
         <mi>
           w 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           z 
         </mi> 
        </mrow> 
       </msub> 
      </mrow> 
     </math> denotes the co-occurrence frequency of word w in topic z, and A denotes the average number of words across all topics.</p>
   </sec>
  </sec><sec id="s4">
   <title>4. Experiment</title>
   <p>In this section, we will launch experiments on the StackOverflow dataset. GSDMM is chosen as the pre-clustered algorithm, and the improved model G- BERTopic is compared with baselines on metrics such as Macro-F1, topic coherence, DBI, etc. Experimental results demonstrate the superiority of BERTopic introducing pre-clustered knowledge on Macro-F1.</p>
   <sec id="s4_1">
    <title>4.1. Basic Settings</title>
    <p>Dataset: StackOverflow is a well-known community for programmers to learn and share. The dataset collects post-question titles on different topics. For each topic, 100 pieces of data are extracted, satisfying lengths of 5 to 40. After conversion to lowercase, stemming extraction and lexical reduction, the basic attributes are shown in <xref ref-type="table" rid="table1">
      Table 1
     </xref>.</p>
    <p>Baseline: To evaluate the effectiveness of G-BERTopic, the following baselines are selected for comparison in this paper.</p>
    <p>
     <xref ref-type="bibr" rid="scirp.137513-"></xref></p>
    <table-wrap id="table1">
     <label>
      <xref ref-type="table" rid="table1">
       Table 1
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.137513-"></xref>Table 1. Dataset description.</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="25.17%"><p style="text-align:center">Number of Topics</p></td> 
       <td class="custom-bottom-td acenter" width="20.08%"><p style="text-align:center">Total Number</p></td> 
       <td class="custom-bottom-td acenter" width="17.30%"><p style="text-align:center">Max Length</p></td> 
       <td class="custom-bottom-td acenter" width="19.64%"><p style="text-align:center">Min Length</p></td> 
       <td class="custom-bottom-td acenter" width="17.80%"><p style="text-align:center">Avg Length</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="25.17%"><p style="text-align:center">20</p></td> 
       <td class="custom-top-td acenter" width="20.08%"><p style="text-align:center">2000</p></td> 
       <td class="custom-top-td acenter" width="17.30%"><p style="text-align:center">16</p></td> 
       <td class="custom-top-td acenter" width="19.64%"><p style="text-align:center">3</p></td> 
       <td class="custom-top-td acenter" width="17.80%"><p style="text-align:center">6</p></td> 
      </tr> 
     </table>
    </table-wrap>
   </sec>
   <sec id="s4_2">
    <title>4.2. Evaluation Metrics</title>
    <p>The model proposed in this paper consists of two parts: cluster generation and topic representation, so the evaluation metrics are selected for these two aspects. For cluster quality, it includes internal and external evaluation metrics, where internal quality evaluates the cluster structure and external quality relies on the accuracy of topic assignment accuracy <xref ref-type="bibr" rid="scirp.137513-34">
      [34]
     </xref>. Topic representation is evaluated by choosing semantic coherence in this paper.</p>
    <p>In this paper, the following evaluation metrics were chosen and the results are the mean values of 10 experiments.</p>
    <p>Macro-F1 is an external evaluation metric for datasets that are not affected by data imbalance. We take the same number of samples for each category of the StackOverflow dataset. It is defined as:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mrow> 
         <mtext>
           F1 
         </mtext> 
        </mrow> 
        <mrow> 
         <mtext>
           macro 
         </mtext> 
        </mrow> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mtext>
         2 
       </mtext> 
       <mo>
         ⋅ 
       </mo> 
       <mfrac> 
        <mrow> 
         <msub> 
          <mrow> 
           <mtext>
             Precision 
           </mtext> 
          </mrow> 
          <mrow> 
           <mtext>
             macro 
           </mtext> 
          </mrow> 
         </msub> 
         <mo>
           ⋅ 
         </mo> 
         <msub> 
          <mrow> 
           <mtext>
             Recall 
           </mtext> 
          </mrow> 
          <mrow> 
           <mtext>
             macro 
           </mtext> 
          </mrow> 
         </msub> 
        </mrow> 
        <mrow> 
         <msub> 
          <mrow> 
           <mtext>
             Precision 
           </mtext> 
          </mrow> 
          <mrow> 
           <mtext>
             macro 
           </mtext> 
          </mrow> 
         </msub> 
         <mo>
           + 
         </mo> 
         <msub> 
          <mrow> 
           <mtext>
             Recall 
           </mtext> 
          </mrow> 
          <mrow> 
           <mtext>
             macro 
           </mtext> 
          </mrow> 
         </msub> 
        </mrow> 
       </mfrac> 
      </mrow> 
     </math> (12)</p>
    <p>where 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mrow> 
         <mtext>
           Precision 
         </mtext> 
        </mrow> 
        <mrow> 
         <mtext>
           macro 
         </mtext> 
        </mrow> 
       </msub> 
      </mrow> 
     </math> and 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mrow> 
         <mtext>
           Recall 
         </mtext> 
        </mrow> 
        <mrow> 
         <mtext>
           macro 
         </mtext> 
        </mrow> 
       </msub> 
      </mrow> 
     </math> are the average values of 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mrow> 
         <mtext>
           Precision 
         </mtext> 
        </mrow> 
        <mi>
          i 
        </mi> 
       </msub> 
      </mrow> 
     </math> and 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mrow> 
         <mtext>
           Recall 
         </mtext> 
        </mrow> 
        <mi>
          i 
        </mi> 
       </msub> 
      </mrow> 
     </math> for each category. 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mrow> 
         <mtext>
           F1 
         </mtext> 
        </mrow> 
        <mrow> 
         <mtext>
           macro 
         </mtext> 
        </mrow> 
       </msub> 
      </mrow> 
     </math> takes the value in the range of 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mrow> 
        <mo>
          [ 
        </mo> 
        <mrow> 
         <mn>
           0 
         </mn> 
         <mo>
           , 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
        <mo>
          ] 
        </mo> 
       </mrow> 
      </mrow> 
     </math>. The higher the score, the better the clustering quality.</p>
    <p>NMI(Normalized Mutual Information) is a normalization of MI used to measure the degree of consistency of two clusters, and belongs to external evaluation metrics. It is defined as:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mtext>
         NMI 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <mi>
           X 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           Y 
         </mi> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
       <mo>
         = 
       </mo> 
       <mfrac> 
        <mrow> 
         <mtext>
           MI 
         </mtext> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mrow> 
           <mi>
             X 
           </mi> 
           <mo>
             , 
           </mo> 
           <mi>
             Y 
           </mi> 
          </mrow> 
          <mo>
            ) 
          </mo> 
         </mrow> 
        </mrow> 
        <mrow> 
         <mi>
           F 
         </mi> 
         <mrow> 
          <mo>
            ( 
          </mo> 
          <mrow> 
           <mi>
             H 
           </mi> 
           <mrow> 
            <mo>
              ( 
            </mo> 
            <mi>
              X 
            </mi> 
            <mo>
              ) 
            </mo> 
           </mrow> 
           <mo>
             , 
           </mo> 
           <mi>
             H 
           </mi> 
           <mrow> 
            <mo>
              ( 
            </mo> 
            <mi>
              Y 
            </mi> 
            <mo>
              ) 
            </mo> 
           </mrow> 
          </mrow> 
          <mo>
            ) 
          </mo> 
         </mrow> 
        </mrow> 
       </mfrac> 
      </mrow> 
     </math> (13)</p>
    <p>where 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         X 
       </mi> 
       <mo>
         = 
       </mo> 
       <mrow> 
        <mo>
          { 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            x 
          </mi> 
          <mn>
            1 
          </mn> 
         </msub> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            x 
          </mi> 
          <mn>
            2 
          </mn> 
         </msub> 
         <mo>
           , 
         </mo> 
         <mo>
           ⋯ 
         </mo> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            x 
          </mi> 
          <mi>
            k 
          </mi> 
         </msub> 
        </mrow> 
        <mo>
          } 
        </mo> 
       </mrow> 
      </mrow> 
     </math> is assigned topics, 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         Y 
       </mi> 
       <mo>
         = 
       </mo> 
       <mrow> 
        <mo>
          { 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mn>
            1 
          </mn> 
         </msub> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mn>
            2 
          </mn> 
         </msub> 
         <mo>
           , 
         </mo> 
         <mo>
           ⋯ 
         </mo> 
         <mo>
           , 
         </mo> 
         <msub> 
          <mi>
            y 
          </mi> 
          <mi>
            k 
          </mi> 
         </msub> 
        </mrow> 
        <mo>
          } 
        </mo> 
       </mrow> 
      </mrow> 
     </math> is true topics, and 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mtext>
         MI 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <mi>
           X 
         </mi> 
         <mo>
           , 
         </mo> 
         <mi>
           Y 
         </mi> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> is the mutual information of X and Y, reflecting the degree of correlation of the two. 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         H 
       </mi> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mo>
          ⋅ 
        </mo> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> the entrop and 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mi>
         F 
       </mi> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mo>
          ⋅ 
        </mo> 
        <mo>
          ) 
        </mo> 
       </mrow> 
      </mrow> 
     </math> is a normalization function. NMI takes values in the range of 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mrow> 
        <mo>
          [ 
        </mo> 
        <mrow> 
         <mn>
           0 
         </mn> 
         <mo>
           , 
         </mo> 
         <mn>
           1 
         </mn> 
        </mrow> 
        <mo>
          ] 
        </mo> 
       </mrow> 
      </mrow> 
     </math>. The higher the score, the better the clustering quality.</p>
    <p>DB (Davies-Bouldin) is an internal evaluation index, which measures differences between clusters and closeness within clusters. It is defined as:</p>
    <p>
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mtext>
         DB 
       </mtext> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mi>
          k 
        </mi> 
        <mo>
          ) 
        </mo> 
       </mrow> 
       <mo>
         = 
       </mo> 
       <mfrac> 
        <mrow> 
         <msubsup> 
          <mstyle mathsize="140%" displaystyle="true"> 
           <mo>
             ∑ 
           </mo> 
          </mstyle> 
          <mrow> 
           <mi>
             i 
           </mi> 
           <mo>
             = 
           </mo> 
           <mn>
             1 
           </mn> 
          </mrow> 
          <mi>
            k 
          </mi> 
         </msubsup> 
         <munder> 
          <mrow> 
           <mi>
             max 
           </mi> 
          </mrow> 
          <mrow> 
           <mi>
             j 
           </mi> 
           <mo>
             . 
           </mo> 
           <mi>
             j 
           </mi> 
           <mo>
             ≠ 
           </mo> 
           <mi>
             i 
           </mi> 
          </mrow> 
         </munder> 
         <mrow> 
          <mo>
            { 
          </mo> 
          <mrow> 
           <mfrac> 
            <mrow> 
             <msub> 
              <mi>
                S 
              </mi> 
              <mi>
                i 
              </mi> 
             </msub> 
             <mo>
               + 
             </mo> 
             <msub> 
              <mi>
                S 
              </mi> 
              <mi>
                j 
              </mi> 
             </msub> 
            </mrow> 
            <mrow> 
             <msub> 
              <mi>
                d 
              </mi> 
              <mrow> 
               <mi>
                 i 
               </mi> 
               <mi>
                 j 
               </mi> 
              </mrow> 
             </msub> 
            </mrow> 
           </mfrac> 
          </mrow> 
          <mo>
            } 
          </mo> 
         </mrow> 
        </mrow> 
        <mi>
          k 
        </mi> 
       </mfrac> 
      </mrow> 
     </math> (14)</p>
    <p>where 
     <math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          S 
        </mi> 
        <mi>
          i 
        </mi> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mrow> 
        <mo>
          ( 
        </mo> 
        <mrow> 
         <mrow> 
          <mn>
            1 
          </mn> 
          <mo>
            / 
          </mo> 
          <mi>
            n 
          </mi> 
         </mrow> 
        </mrow> 
        <mo>
          ) 
        </mo> 
       </mrow> 
       <mstyle displaystyle="true"> 
        <msub> 
         <mo>
           ∑ 
         </mo> 
         <mrow> 
          <mi>
            x 
          </mi> 
          <mo>
            ∈ 
          </mo> 
          <msub> 
           <mi>
             C 
           </mi> 
           <mi>
             i 
           </mi> 
          </msub> 
         </mrow> 
        </msub> 
        <mrow> 
         <mrow> 
          <mo>
            ‖ 
          </mo> 
          <mrow> 
           <mi>
             x 
           </mi> 
           <mo>
             − 
           </mo> 
           <msub> 
            <mi>
              z 
            </mi> 
            <mi>
              i 
            </mi> 
           </msub> 
          </mrow> 
          <mo>
            ‖ 
          </mo> 
         </mrow> 
        </mrow> 
       </mstyle> 
      </mrow> 
     </math> measures tightness in cluster 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          C 
        </mi> 
        <mi>
          i 
        </mi> 
       </msub> 
      </mrow> 
     </math>, 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          d 
        </mi> 
        <mrow> 
         <mi>
           i 
         </mi> 
         <mi>
           j 
         </mi> 
        </mrow> 
       </msub> 
       <mo>
         = 
       </mo> 
       <mrow> 
        <mo>
          ‖ 
        </mo> 
        <mrow> 
         <msub> 
          <mi>
            z 
          </mi> 
          <mi>
            i 
          </mi> 
         </msub> 
         <mo>
           − 
         </mo> 
         <msub> 
          <mi>
            z 
          </mi> 
          <mi>
            j 
          </mi> 
         </msub> 
        </mrow> 
        <mo>
          ‖ 
        </mo> 
       </mrow> 
      </mrow> 
     </math> measures the dispersion between 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          C 
        </mi> 
        <mi>
          i 
        </mi> 
       </msub> 
      </mrow> 
     </math> and 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          C 
        </mi> 
        <mi>
          j 
        </mi> 
       </msub> 
      </mrow> 
     </math>. 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          n 
        </mi> 
        <mi>
          i 
        </mi> 
       </msub> 
      </mrow> 
     </math> denotes the number of samples in 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          C 
        </mi> 
        <mi>
          i 
        </mi> 
       </msub> 
      </mrow> 
     </math>, 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          z 
        </mi> 
        <mi>
          i 
        </mi> 
       </msub> 
      </mrow> 
     </math> is the center of mass of 
     <math xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <msub> 
        <mi>
          C 
        </mi> 
        <mi>
          i 
        </mi> 
       </msub> 
      </mrow> 
     </math>, and 
     <math display="inline" xmlns="http://www.w3.org/1998/Math/MathML"> <mrow> 
       <mrow> 
        <mo>
          ‖ 
        </mo> 
        <mo>
          ⋯ 
        </mo> 
        <mo>
          ‖ 
        </mo> 
       </mrow> 
      </mrow> 
     </math> denotes Euclidean distance. The smaller the value, the better the quality of clustering.</p>
    <p>Coherence measures the coherence of the topic. In this paper, we use the idea proposed by Röder et al. <xref ref-type="bibr" rid="scirp.137513-35">
      [35]
     </xref>, which utilizes the topic representation and reference corpus to determine the contextual features of each topic word. The higher the value, the better the topic modeling results.</p>
   </sec>
   <sec id="s4_3">
    <title>
     <xref ref-type="bibr" rid="scirp.137513-"></xref>4.3. Results</title>
    <p>The comparison results are shown in <xref ref-type="table" rid="table2">
      Table 2
     </xref>. Note that the external evaluation metrics need to compare the original topics with the predicted topics, so we use the Hungarian Algorithm for matching. Experiments show that G-BERTopic has superior metrics on the StackOverflow dataset, with Macro-F1 of 0.661, which is 0.16 better than the original BERTopic and maintains the best or second best in other metrics. The results show that the incorporation of pre-clustered topic knowledge improves accuracy while ensuring semantic coherence, proving effectiveness of G-BERTopic.</p>
    <p>
     <xref ref-type="bibr" rid="scirp.137513-"></xref>Table 2. Comparison of indicators.</p>
    <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
     <tr> 
      <td class="custom-bottom-td acenter" width="19.13%"><p style="text-align:center"></p></td> 
      <td class="custom-bottom-td acenter" width="20.85%"><p style="text-align:center">Macro-F1</p></td> 
      <td class="custom-bottom-td acenter" width="20.85%"><p style="text-align:center">NMI</p></td> 
      <td class="custom-bottom-td acenter" width="18.33%"><p style="text-align:center">DBI</p></td> 
      <td class="custom-bottom-td acenter" width="20.85%"><p style="text-align:center">Coherence</p></td> 
     </tr> 
     <tr> 
      <td class="custom-top-td acenter" width="19.13%"><p style="text-align:center">LDA</p></td> 
      <td class="custom-top-td acenter" width="20.85%"><p style="text-align:center">0.126</p></td> 
      <td class="custom-top-td acenter" width="20.85%"><p style="text-align:center">0.084</p></td> 
      <td class="custom-top-td acenter" width="18.33%"><p style="text-align:center">12.063</p></td> 
      <td class="custom-top-td acenter" width="20.85%"><p style="text-align:center">0.377</p></td> 
     </tr> 
     <tr> 
      <td class="acenter" width="19.13%"><p style="text-align:center">BTM</p></td> 
      <td class="acenter" width="20.85%"><p style="text-align:center">0.231</p></td> 
      <td class="acenter" width="20.85%"><p style="text-align:center">0.235</p></td> 
      <td class="acenter" width="18.33%"><p style="text-align:center">8.060</p></td> 
      <td class="acenter" width="20.85%"><p style="text-align:center">0.301</p></td> 
     </tr> 
     <tr> 
      <td class="acenter" width="19.13%"><p style="text-align:center">BERTopic</p></td> 
      <td class="acenter" width="20.85%"><p style="text-align:center"><u>0</u><u>.496</u></p></td> 
      <td class="acenter" width="20.85%"><p style="text-align:center"><u>0.616</u></p></td> 
      <td class="acenter" width="18.33%"><p style="text-align:center">3.167</p></td> 
      <td class="acenter" width="20.85%"><p style="text-align:center">0.344</p></td> 
     </tr> 
     <tr> 
      <td class="acenter" width="19.13%"><p style="text-align:center">G-BERTopic</p></td> 
      <td class="acenter" width="20.85%"><p style="text-align:center">0.661</p></td> 
      <td class="acenter" width="20.85%"><p style="text-align:center">0.662</p></td> 
      <td class="acenter" width="18.33%"><p style="text-align:center"><u>3</u><u>.263</u></p></td> 
      <td class="acenter" width="20.85%"><p style="text-align:center"><u>0</u><u>.365</u></p></td> 
     </tr> 
    </table>
    <p>Experiments were conducted by incorporating pre-clustered topic knowledge at different phases of BERTopic, and the results are shown in <xref ref-type="table" rid="table3">
      Table 3
     </xref>. The result shows that the highest accuracy rate is after clustering, which justifies the algorithm, that is, the first clustering phase should not be destructed. The dimension reduction phase is a key step that affects the clustering results by performing a low-dimensional dense vectorized representation of documents. Therefore, adding topic information in the first two cases, whether before dimension reduction or after dimension reduction before clustering, affects the intuition of clustering based on semantic similarity, i.e., adding other features instead blurs the semantic understanding. The purpose of generating topic vectors after the first clustering is to obtain a comprehensive representation, so splicing topic-related vectors from GSDMM in the second clustering phase can add more effective knowledge to improve the accuracy of clustering.</p>
    <p>Since word embeddings and sentence embeddings share the same high-dimensional space and short texts are characterized by more low-frequency words, word embeddings are used here instead of sentence embeddings to verify whether the addition of pre-clustered knowledge improves the anisotropy. In this paper, l2 norm of different word frequencies is calculated to compare the distance from the origin before and after the improvement, as shown in <xref ref-type="table" rid="table4">
      Table 4
     </xref>. From the results, it can be seen that word frequency brings bias to the semantic space, because low-frequency words are distributed farther than high-frequency words. After splicing the topic knowledge, l2 norms are all reduced to different degrees, indicating that this approach makes the vector distribution more tightly, which alleviates that bias to some extent.</p>
    <p>
     <xref ref-type="bibr" rid="scirp.137513-"></xref>Table 3. The effect of incorporating pre-clustered knowledge at different stages.</p>
    <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
     <tr> 
      <td class="custom-bottom-td acenter" width="63.65%"><p style="text-align:center">Splice Position</p></td> 
      <td class="custom-bottom-td acenter" width="19.24%"><p style="text-align:center">Macro-F1</p></td> 
      <td class="custom-bottom-td acenter" width="17.11%"><p style="text-align:center">NMI</p></td> 
     </tr> 
     <tr> 
      <td class="custom-top-td acenter" width="63.65%"><p style="text-align:center">Before dimension reduction</p></td> 
      <td class="custom-top-td acenter" width="19.24%"><p style="text-align:center">0.515</p></td> 
      <td class="custom-top-td acenter" width="17.11%"><p style="text-align:center">0.545</p></td> 
     </tr> 
     <tr> 
      <td class="acenter" width="63.65%"><p style="text-align:center">After dimension reduction before clustering</p></td> 
      <td class="acenter" width="19.24%"><p style="text-align:center">0.626</p></td> 
      <td class="acenter" width="17.11%"><p style="text-align:center">0.651</p></td> 
     </tr> 
     <tr> 
      <td class="acenter" width="63.65%"><p style="text-align:center">After clustering</p></td> 
      <td class="acenter" width="19.24%"><p style="text-align:center">0.659</p></td> 
      <td class="acenter" width="17.11%"><p style="text-align:center">0.662</p></td> 
     </tr> 
    </table>
    <p>
     <xref ref-type="bibr" rid="scirp.137513-"></xref></p>
    <table-wrap id="table2">
     <label>
      <xref ref-type="table" rid="table2">
       Table 2
      </xref></label>
     <caption>
      <title>
       <xref ref-type="bibr" rid="scirp.137513-"></xref>Table 4. SSE of different word frequency groups.</title>
     </caption>
     <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
      <tr> 
       <td class="custom-bottom-td acenter" width="35.45%"><p style="text-align:center">Word Frequency</p></td> 
       <td class="custom-bottom-td acenter" width="14.50%"><p style="text-align:center">(0, 100)</p></td> 
       <td class="custom-bottom-td acenter" width="15.54%"><p style="text-align:center">[100, 500)</p></td> 
       <td class="custom-bottom-td acenter" width="16.48%"><p style="text-align:center">[500, 1000)</p></td> 
       <td class="custom-bottom-td acenter" width="18.03%"><p style="text-align:center">[1000, 2790)</p></td> 
      </tr> 
      <tr> 
       <td class="custom-top-td acenter" width="35.45%"><p style="text-align:center">l2-norm<sub>SBERT</sub></p></td> 
       <td class="custom-top-td acenter" width="14.50%"><p style="text-align:center">4.53</p></td> 
       <td class="custom-top-td acenter" width="15.54%"><p style="text-align:center">9.07</p></td> 
       <td class="custom-top-td acenter" width="16.48%"><p style="text-align:center">10.14</p></td> 
       <td class="custom-top-td acenter" width="18.03%"><p style="text-align:center">19.18</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="35.45%"><p style="text-align:center">l2-norm<sub>SBERT+GSDMM</sub></p></td> 
       <td class="acenter" width="14.50%"><p style="text-align:center">4.21</p></td> 
       <td class="acenter" width="15.54%"><p style="text-align:center">8.41</p></td> 
       <td class="acenter" width="16.48%"><p style="text-align:center">9.40</p></td> 
       <td class="acenter" width="18.03%"><p style="text-align:center">17.79</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="35.45%"><p style="text-align:center">3-NN inertia<sub>SBERT</sub></p></td> 
       <td class="acenter" width="14.50%"><p style="text-align:center">1.05</p></td> 
       <td class="acenter" width="15.54%"><p style="text-align:center">3.92</p></td> 
       <td class="acenter" width="16.48%"><p style="text-align:center">5.66</p></td> 
       <td class="acenter" width="18.03%"><p style="text-align:center">25.09</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="35.45%"><p style="text-align:center">3-NN inertia<sub>SBERT+GSDMM</sub></p></td> 
       <td class="acenter" width="14.50%"><p style="text-align:center">1.03</p></td> 
       <td class="acenter" width="15.54%"><p style="text-align:center">3.85</p></td> 
       <td class="acenter" width="16.48%"><p style="text-align:center">5.54</p></td> 
       <td class="acenter" width="18.03%"><p style="text-align:center">24.36</p></td> 
      </tr> 
      <tr> 
       <td class="acenter" width="35.45%"><p style="text-align:center">diff</p></td> 
       <td class="acenter" width="14.50%"><p style="text-align:center">0.02</p></td> 
       <td class="acenter" width="15.54%"><p style="text-align:center">0.07</p></td> 
       <td class="acenter" width="16.48%"><p style="text-align:center">0.12</p></td> 
       <td class="acenter" width="18.03%"><p style="text-align:center">0.73</p></td> 
      </tr> 
     </table>
    </table-wrap>
    <p>For different word frequencies, different components are grouped into 3 clusters by k-means, and SSE is calculated as the degree of closeness in the vector space. From the results, high-frequency words are denser than low-frequency words. So, the sparse distribution of low-frequency words will lead to some gaps in the semantic space, making the similarity of embeddings not accurately represent the semantics of sentences. The method in this paper reduces the sum of squares of the distances of word embeddings to cluster centroids in different degrees, and the lower the frequency, the better the effect. This proves that the method proposed in this paper can alleviate this sparsity and make the vector representation semantically smoother, which in turn improves the accuracy of clustering.</p>
    <p>In conclusion, the experiment proves that adding pre-clustered knowledge in the process of secondary clustering can improve the clustering accuracy of BERTopic.</p>
   </sec>
   <sec id="s4_4">
    <title>4.4. Discussion</title>
    <p>BERTopic separates clustering and topic representation, where the language model can be replaced with the state-of-the-art. Similarly, G-BERTopic can combine BERTopic with different classical topic models. The results in <xref ref-type="table" rid="table5">
      Table 5
     </xref> show that Macro-F1 is significantly improved after the combination compared to the native algorithm, and it remains comparable in NMI and Coherence. For the internal metric DBI, it is worse because the addition of features affects semantic space, but it has been shown in Section 4.3 that adding new features helps mitigate anisotropy and can improve clustering accuracy, so such a loss is worthwhile. It proves that incorporating pre-clustered knowledge in BERTopic can improve the clustering effect. The reason for choosing GSDMM is that the two are more consistent in their assumptions, i.e., they both assume that a document contains only one topic. In addition, due to portability, the effect of topic assignment can be further improved by replacing the self-aggregating topic model with a more advanced one.</p>
    <p>
     <xref ref-type="bibr" rid="scirp.137513-"></xref>Table 5. Comparison of BERTopic combined with different pre-clustered models.</p>
    <table class="MsoTableGrid custom-table" border="0" cellspacing="0" cellpadding="0"> 
     <tr> 
      <td class="custom-bottom-td acenter" width="22.60%"><p style="text-align:center">Model</p></td> 
      <td class="custom-bottom-td acenter" width="19.34%"><p style="text-align:center">Macro-F1</p></td> 
      <td class="custom-bottom-td acenter" width="19.35%"><p style="text-align:center">NMI</p></td> 
      <td class="custom-bottom-td acenter" width="19.35%"><p style="text-align:center">DBI</p></td> 
      <td class="custom-bottom-td acenter" width="19.35%"><p style="text-align:center">Coherence</p></td> 
     </tr> 
     <tr> 
      <td class="custom-top-td acenter" width="22.60%"><p style="text-align:center">BERTopic</p></td> 
      <td class="custom-top-td acenter" width="19.34%"><p style="text-align:center">0.496</p></td> 
      <td class="custom-top-td acenter" width="19.35%"><p style="text-align:center">0.616</p></td> 
      <td class="custom-top-td acenter" width="19.35%"><p style="text-align:center">3.167</p></td> 
      <td class="custom-top-td acenter" width="19.35%"><p style="text-align:center">0.344</p></td> 
     </tr> 
     <tr> 
      <td class="acenter" width="22.60%"><p style="text-align:center">BERTopic<sub>+</sub><sub>GSDMM</sub></p></td> 
      <td class="acenter" width="19.34%"><p style="text-align:center">0.661</p></td> 
      <td class="acenter" width="19.35%"><p style="text-align:center">0.662</p></td> 
      <td class="acenter" width="19.35%"><p style="text-align:center">3.263</p></td> 
      <td class="acenter" width="19.35%"><p style="text-align:center">0.365</p></td> 
     </tr> 
     <tr> 
      <td class="acenter" width="22.60%"><p style="text-align:center">BERTopic<sub>+</sub><sub>BTM</sub></p></td> 
      <td class="acenter" width="19.34%"><p style="text-align:center">0.666</p></td> 
      <td class="acenter" width="19.35%"><p style="text-align:center">0.659</p></td> 
      <td class="acenter" width="19.35%"><p style="text-align:center">3.250</p></td> 
      <td class="acenter" width="19.35%"><p style="text-align:center">0.365</p></td> 
     </tr> 
     <tr> 
      <td class="acenter" width="22.60%"><p style="text-align:center">BERTopic<sub>+</sub><sub>LDA</sub></p></td> 
      <td class="acenter" width="19.34%"><p style="text-align:center">0.663</p></td> 
      <td class="acenter" width="19.35%"><p style="text-align:center">0.661</p></td> 
      <td class="acenter" width="19.35%"><p style="text-align:center">3.221</p></td> 
      <td class="acenter" width="19.35%"><p style="text-align:center">0.360</p></td> 
     </tr> 
    </table>
   </sec>
  </sec><sec id="s5">
   <title>5. Conclusions</title>
   <p>To alleviate the significant anisotropy in BERTopic, this paper proposes the G-BERTopic, which adds topic features to semantic embeddings from pre-clustered knowledge. It improves the topic assignment process to make the vector space denser, by reducing the l2 norm of low-frequency words. Through comparative experiments on the StackOverflow dataset, Macro-F1 of G-BERTopic is improved by 1.5%, which outperforms other baselines, demonstrating its effectiveness in extracting topic information. Based on the algorithm in this paper, valuable information can be extracted from massive short texts for opinion mining, social media monitoring, public opinion management, etc. It can efficiently identify core viewpoints and emotional tendencies, such as comments, and timely understand the direction of public emotions, which can help enterprises and the government to understand feedback and adjust their strategies on time.</p>
   <p>The method proposed in this paper can effectively improve clustering quality. However, this model still has limitations. For example, the internal metrics are not large compared with the original BERTopic. In addition, the introduction of external knowledge inevitably destroys the original semantic space and increases complexity, which can be further improved by expression consistency, or adopting graph alignment. Or, introduce more specialized domain knowledge to explore whether the effect will be improved in domain-specific topic modeling.</p>
  </sec><sec id="s6">
   <title>Acknowledgements</title>
   <p>The authors thank the anonymous reviewers for their helpful comments.</p>
  </sec><sec id="s7">
   <title>NOTES</title>
   <p><sup>1</sup>The pre-clustering scheme used in this paper is GSDMM: <xref ref-type="bibr" rid="scirp.137513-https://github.com/rwalk/gsdmm">
     https://github.com/rwalk/gsdmm
    </xref>.</p>
  </sec>
 </body><back>
  <ref-list>
   <title>References</title>
   <ref id="scirp.137513-ref1">
    <label>1</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Li, X., Mao, J., Ma, W., Liu, Y., Zhang, M., Ma, S., et al. (2021) Topic-Enhanced Knowledge-Aware Retrieval Model for Diverse Relevance Estimation. Proceedings of the Web Conference 2021, Ljubljana, 19-23 April 2021, 756-767. &gt;https://doi.org/10.1145/3442381.3449943
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref2">
    <label>2</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Adlakha, V., Dhuliawala, S., Suleman, K., de Vries, H. and Reddy, S. (2022) TopiOCQA: Open-Domain Conversational Question Answering with Topic Switching. Transactions of the Association for Computational Linguistics, 10, 468-483. &gt;https://doi.org/10.1162/tacl_a_00471
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref3">
    <label>3</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Sejwal, V.K. and Abulaish, M. (2022) A Hybrid Recommendation Technique Using Topic Embedding for Rating Prediction and to Handle Cold-Start Problem. Expert Systems with Applications, 209, Article 118307. &gt;https://doi.org/10.1016/j.eswa.2022.118307
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref4">
    <label>4</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Cao, B., Xiao, Q., Zhang, X. and Liu, J. (2019) An API Service Recommendation Method via Combining Self-Organization Map-Based Functionality Clustering and Deep Factorization Machine-Based Quality Prediction. Chinese Journal of Computers, 42, 1367-1383.
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref5">
    <label>5</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Xi, X., Guo, Y., Song, X. and Wang, J. (2021) Research on the Technical Similarity Visualization Based on Word2vec and LDA Topic Model. Journal of the China Society for Scientific and Technical Information, 40, 974-983.
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref6">
    <label>6</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Ruan, G. and Huang, Y. (2023) Topic Recognition of Comment Text Based on Sense Bert and LDA. Journal of Modern Information, 43, 46-53.
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref7">
    <label>7</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Agarwal, N., Sikka, G. and Awasthi, L.K. (2023) WGSDMM+GA: A Genetic Algorithm-Based Service Clustering Methodology Assimilating Dirichlet Multinomial Mixture Model with Word Embedding. Future Generation Computer Systems, 145, 254-266. &gt;https://doi.org/10.1016/j.future.2023.03.028
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref8">
    <label>8</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Peinelt, N., Nguyen, D. and Liakata, M. (2020) tBERT: Topic Models and BERT Joining Forces for Semantic Similarity Detection. Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, Online, 5-10 July 2020, 7047-7055. &gt;https://doi.org/10.18653/v1/2020.acl-main.630
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref9">
    <label>9</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Salton, G., Wong, A. and Yang, C.S. (1975) A Vector Space Model for Automatic Indexing. Communications of the ACM, 18, 613-620. &gt;https://doi.org/10.1145/361219.361220
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref10">
    <label>10</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Hofmann, T. (1999) Probabilistic Latent Semantic Analysis. Proceedings of the Fifteenth Conference on Uncertainty in Artificial Intelligence, Stockholm, 30 July-1 August 1999, 289-296.
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref11">
    <label>11</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Blei, D.M., Ng, A. and Jordan, M.I. (2003) Latent Dirichlet Allocation. Journal of Machine Learning Research, 3, 993-1022. 
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref12">
    <label>12</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Yu, H., Fan, S., Wu, L. and Ma, Z. (2022) Review Inquiry and IPO Information Disclosure under the Registration System of Science and Technology Board—Text Analysis Based on LDA Subject Model. Journal of Management Sciences in China, 25, 45-62. &gt;https://doi.org/10.19920/j.cnki.jmsc.2022.08.003
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref13">
    <label>13</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Feng, J., Rao, Y., Xie, H., Wang, F.L. and Li, Q. (2019) User Group Based Emotion Detection and Topic Discovery over Short Text. World Wide Web, 23, 1553-1587. &gt;https://doi.org/10.1007/s11280-019-00760-3
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref14">
    <label>14</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Hong, L. and Davison, B.D. (2010) Empirical Study of Topic Modeling in Twitter. Proceedings of the First Workshop on Social Media Analytics, Washington DC, 25-28 July 2010, 80-88. &gt;https://doi.org/10.1145/1964858.1964870
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref15">
    <label>15</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Diao, Q., Jiang, J., Zhu, F. and Lim, E.P. (2012) Finding Bursty Topics from Microblogs. Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics, Jeju Island, 8-14 July 2012, 536-544.
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref16">
    <label>16</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Zhang, Q., Gong, Y., Sun, X. and Huang, X. (2014) Time-Aware Personalized Hashtag Recommendation on Social Media. Proceedings of COLING 2014, the 25th International Conference on Computational Linguistics: Technical Papers, Dublin, 23-29 August 2014, 203-212.
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref17">
    <label>17</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Nguyen, H.T., Duong, P.H. and Cambria, E. (2019) Learning Short-Text Semantic Similarity with Word Embeddings and External Knowledge Sources. Knowledge-Based Systems, 182, Article 104842. &gt;https://doi.org/10.1016/j.knosys.2019.07.013
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref18">
    <label>18</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Jin, O., Liu, N.N., Zhao, K., Yu, Y. and Yang, Q. (2011) Transferring Topical Knowledge from Auxiliary Long Texts for Short Text Clustering. Proceedings of the 20th ACM International Conference on Information and Knowledge Management, Glasgow, 24-28 October 2011, 775-784. &gt;https://doi.org/10.1145/2063576.2063689
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref19">
    <label>19</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Yan, X., Guo, J., Lan, Y. and Cheng, X. (2013) A Biterm Topic Model for Short Texts. Proceedings of the 22nd international conference on World Wide Web, Rio de Janeiro, 13-17 May 2013, 1445-1456. &gt;https://doi.org/10.1145/2488388.2488514
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref20">
    <label>20</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Yang, D., Li, N., Zou, L. and Ma, H. (2022) Lexical Semantics Enhanced Neural Word Embeddings. Knowledge-Based Systems, 252, Article 109298. &gt;https://doi.org/10.1016/j.knosys.2022.109298
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref21">
    <label>21</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Fan, H. and Li, P. (2021) Sentiment Analysis of Short Text Based on FastText Word Vector and Bidirectional GRU Recurrent Neural Network. Information Science, 39, 15-22. &gt;https://doi.org/10.13833/j.issn.1007-7634.2021.04.003
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref22">
    <label>22</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Rashid, J., Kim, J., Hussain, A. and Naseem, U. (2023) WETM: A Word Embedding-Based Topic Model with Modified Collapsed Gibbs Sampling for Short Text. Pattern Recognition Letters, 172, 158-164. &gt;https://doi.org/10.1016/j.patrec.2023.06.007
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref23">
    <label>23</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Qin, T., Liu, Z. and Chen, K. (2020) Topic Model Combining Topic Word Embedding and Attention Mechanism. Computer Engineering, 46, 104-108. &gt;https://doi.org/10.19678/j.issn.1000-3428.0055952
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref24">
    <label>24</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Jia, J., Wang, H., Ren, K. and Kang, W. (2022) Research on Text Clustering Based on Sentence Vector and Convolutional Neural Network. Computer Engineering and Ap-plications, 58, 123-128.
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref25">
    <label>25</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Zhao, X., Wang, D., Zhao, Z., Liu, W., Lu, C. and Zhuang, F. (2021) A Neural Topic Model with Word Vectors and Entity Vectors for Short Texts. Information Processing&amp;Management, 58, Article 102455. &gt;https://doi.org/10.1016/j.ipm.2020.102455
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref26">
    <label>26</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Qiang, J., Chen, P., Wang, T. and Wu, X. (2017) Topic Modeling over Short Texts by Incorporating Word Embeddings. Advances in Knowledge Discovery and Data Mining, Jeju, 23-26 May 2017, 363-374. &gt;https://doi.org/10.1007/978-3-319-57529-2_29
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref27">
    <label>27</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Bianchi, F., Terragni, S. and Hovy, D. (2021) Pre-Training Is a Hot Topic: Contextualized Document Embeddings Improve Topic Coherence. Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), Online, 1-6 August 2021, 759-766. &gt;https://doi.org/10.18653/v1/2021.acl-short.96
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref28">
    <label>28</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Grootendorst, M. (2022) BERTopic: Neural Topic Modeling with a Class-Based TF-IDF Procedure. arXiv:2203.05794. 
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref29">
    <label>29</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Reimers, N. and Gurevych, I. (2019) Sentence-BERT: Sentence Embeddings Using Siamese BERT-Networks. Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), Hong Kong, 3-7 November 2019, 3982-3992. &gt;https://doi.org/10.18653/v1/d19-1410
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref30">
    <label>30</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     McInnes, L., Healy, J., Saul, N. and Großberger, L. (2018) UMAP: Uniform Manifold Approximation and Projection. Journal of Open Source Software, 3, Article 861. &gt;https://doi.org/10.21105/joss.00861
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref31">
    <label>31</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     McInnes, L., Healy, J. and Astels, S. (2017) Hdbscan: Hierarchical Density Based Clustering. The Journal of Open Source Software, 2, Article 205. &gt;https://doi.org/10.21105/joss.00205
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref32">
    <label>32</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Liu, H. and Wang, Y. (2022) Clustering Short Text Classification Based on Fusion of BERT and GSDMM. Computer Systems&amp;Applications, 31, 267-272. &gt;https://doi.org/10.15888/j.cnki.csa.008307
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref33">
    <label>33</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Li, B., Zhou, H., He, J., Wang, M., Yang, Y. and Li, L. (2020) On the Sentence Embeddings from Pre-Trained Language Models. Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), Online, 16-20 November 2020, 9119-9130. &gt;https://doi.org/10.18653/v1/2020.emnlp-main.733
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref34">
    <label>34</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Hu, Q., Shen, J., Wang, K., Du, J. and Du, Y. (2022) A Web Service Clustering Method Based on Topic Enhanced Gibbs Sampling Algorithm for the Dirichlet Multinomial Mixture Model and Service Collaboration Graph. Information Sciences, 586, 239-260. &gt;https://doi.org/10.1016/j.ins.2021.11.087
    </mixed-citation>
   </ref>
   <ref id="scirp.137513-ref35">
    <label>35</label>
    <mixed-citation publication-type="other" xlink:type="simple">
     Röder, M., Both, A. and Hinneburg, A. (2015) Exploring the Space of Topic Coherence Measures. Proceedings of the Eighth ACM International Conference on Web Search and Data Mining, Shanghai, 2-6 February 2015, 399-408. &gt;https://doi.org/10.1145/2684822.2685324
    </mixed-citation>
   </ref>
  </ref-list>
 </back>
</article>