A method and apparatus for clustering topics of a regulatory text based on constraints

CN122885552APending Publication Date: 2026-10-09CENT SOUTH UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611383100.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-08
Publication Date
2026-10-09

AI Technical Summary

Benefits of technology

通过需求导向分析筛选出基础设施需求句,并利用需求类别软标签信息和分类置信度对语义聚类过程施加约束,使需求结构信息直接参与主题形成,在此基础上通过多主题数综合评价确定最优主题结构并输出主题画像。该方法能够从源头降低规范性文本中的输入噪声,使同类需求在主题空间中更易聚合、异类需求更易分离,并以客观可复现的方式输出主题关键词,从而显著提高主题聚类结果的一致性、稳定性和解释性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122885552A_ABST
    Figure CN122885552A_ABST
Patent Text Reader

Abstract

The application provides a demand constraint topic clustering method and device for normative text, which comprises the following steps: preprocessing original normative text to obtain a sentence-level text set, and performing demand-oriented analysis on the sentence-level text set to obtain an infrastructure demand sentence set; performing demand category probability classification on the infrastructure demand sentence set to obtain demand category soft label information; generating a semantic vector corresponding to the infrastructure demand sentence set, and performing demand constraint topic clustering in combination with the demand category soft label information and corresponding classification confidence to obtain a topic clustering result; analyzing the topic clustering result according to different topic numbers in a candidate topic number set to determine a target topic number with the highest comprehensive evaluation of the topic structure in the topic clustering result; and extracting keywords from the topic cluster corresponding to the target topic number in the topic clustering result to obtain topic portrait information of the original normative text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a method and apparatus for clustering demand-constrained topics in normative texts. Background Technology

[0002] Existing methods for topic analysis of normative texts typically vectorize the entire text, paragraphs, or sentences directly, then use K-Means, LDA, BERTopic, or other conventional clustering methods to form topic clusters, and finally generate topic keywords using TF-IDF, term frequency statistics, or manual summarization. While these methods are applicable to general text analysis tasks, they suffer from the following shortcomings when applied to normative texts: Normative texts contain numerous goal sentences, principle sentences, vision sentences, outcome sentences, and institutional expressions. While these sentences are relevant to the topic, they are not equivalent to actionable and implementable requirements. If requirement sentences are not identified first, clustering input can easily be mixed with a large number of macro-level statements, leading to blurred topic boundaries.

[0003] Existing clustering methods typically rely solely on the semantic similarity of sentence vectors for grouping, failing to fully utilize the information about the demand type to which sentences belong. For normative texts on urban climate resilience, there is some overlap in the semantic space between blue infrastructure, green infrastructure, gray infrastructure, and system governance demands. Relying solely on ordinary vector distance can easily lead to inconsistencies in demand attributes among sentences within the same cluster and instability at the boundaries between different clusters.

[0004] Many keyword optimization methods rely on manual thesaurus, subjective keyword deletion, and result-level post-processing. While these methods may improve the display effect locally, their stability and reproducibility are insufficient, making them difficult to use as a unified and scalable technical solution. Summary of the Invention

[0005] This application provides a method and apparatus for clustering demand-constrained topics in normative texts, which addresses the problems of high input noise, unutilized demand structure information, unstable topic clustering boundaries, and insufficient interpretability of results in existing normative text topic analysis methods.

[0006] The first aspect of this application provides a method for clustering demand-constraint topics in normative texts, the method comprising: The original normative text is preprocessed to obtain a sentence-level text set, and the sentence-level text set is subjected to demand-oriented analysis to obtain a set of infrastructure demand sentences. The set of infrastructure demand sentences is subjected to demand category probability classification to obtain demand category soft label information; Generate semantic vectors corresponding to the set of infrastructure demand sentences, and combine the soft label information of the demand categories and the corresponding classification confidence to perform demand constraint topic clustering to obtain topic clustering results; The topic clustering results are analyzed based on the different number of topics in the candidate topic set, and the number of topics with the highest comprehensive evaluation of topic structure in the topic clustering results is determined as the target topic number. Keyword extraction is performed on the topic clusters corresponding to the number of target topics in the topic clustering results to obtain the topic profile information of the original normative text.

[0007] Optionally, in the first implementation of the first aspect of this application, the step of preprocessing the original normative text to obtain a sentence-level text set, and performing demand-oriented analysis on the sentence-level text set to obtain an infrastructure requirement sentence set, includes: Based on the preset set of action words, question words, object words, and requirement sentence pattern templates, the sentence-level text set is filtered for requirement sentences to obtain a set of requirement sentences with clear requirements and a set of first boundary sentences with unclear requirements. The first set of boundary sentences is checked for requirement boundaries according to the preset large language model, and the boundary sentences that pass the requirement boundary check are merged into the set of requirement sentences. Based on the preset set of strong anchor words, weak anchor words, exclusion words, and infrastructure sentence pattern template, the set of demand sentences is identified to obtain the set of infrastructure demand sentences and the set of second boundary sentences with unclear infrastructure demand. Based on the sentence vector similarity between the infrastructure demand sentence set and the second boundary sentence set, an extended candidate set is obtained, and the extended candidate set is further confirmed by the large language model. The extended candidate sentences that pass the secondary confirmation are then incorporated into the infrastructure demand sentence set.

[0008] Optionally, in the second implementation of the first aspect of this application, the step of performing demand category probability classification on the set of infrastructure demand sentences to obtain demand category soft label information includes: Construct a set of requirement categories based on the preset requirement category definition information; Based on the set of demand categories and the preset classification prompt template, the large language model is invoked to perform demand category probability classification on each infrastructure demand sentence in the set of infrastructure demand sentences, obtain the initial probability value of each infrastructure demand sentence belonging to each preset demand category in the set of demand categories, and generate an initial demand category probability vector based on each initial probability value. Based on the maximum probability value in the initial demand category probability vector, determine the main label of each infrastructure demand sentence, and determine the classification confidence of each infrastructure demand sentence based on the maximum probability value; The initial demand category probability vector is normalized to obtain a demand category soft label vector, and demand category soft label information is constructed based on the demand category soft label vectors corresponding to all infrastructure demand sentences.

[0009] Optionally, in the third implementation of the first aspect of this application, the step of generating the semantic vector corresponding to the set of infrastructure demand sentences, and combining the soft label information of the demand categories and the corresponding classification confidence to perform demand constraint topic clustering to obtain the topic clustering result includes: Semantic encoding is performed on each infrastructure requirement sentence in the set of infrastructure requirement sentences to obtain the semantic vector of each infrastructure requirement sentence, and a sentence vector matrix is ​​constructed based on the semantic vectors of all infrastructure requirement sentences. Principal component analysis is performed on the sentence vector matrix to reduce its dimensionality based on the preset number of topic clusters, resulting in an initial low-dimensional subspace. Gaussian mixture model clustering is then performed in the initial low-dimensional subspace to obtain initial cluster labels. Based on the probability similarity of demand category between the demand category soft label vectors of any two samples in the demand category soft label information and the corresponding confidence in the classification confidence, a positive soft constraint set and a negative soft constraint set with continuous weights are constructed. The positive soft constraint set and the negative soft constraint set are constructed before entering the iteration process and remain fixed in each iteration of the same demand constraint topic clustering operation. The initial low-dimensional subspace is updated based on the preprocessed vector matrix, the initial clustering labels, the positive soft constraint set, and the negative soft constraint set. Gaussian mixture model clustering is then performed again in the updated demand constraint discriminant subspace to obtain the clustering labels for the current round. Convergence is determined based on the normalized mutual information between the cluster labels of the current round and the cluster labels of the previous round. When the convergence condition is met, the cluster labels of the current round are output as the topic clustering result.

[0010] Optionally, in the fourth implementation of the first aspect of this application, the step of updating the initial low-dimensional subspace based on the preprocessed vector matrix, the initial clustering labels, the positive soft constraint set, and the negative soft constraint set, and then performing Gaussian mixture model clustering again in the updated demand constraint discriminant subspace to obtain the clustering labels for the current round, includes: Based on the preprocessed vector matrix, the clustering labels of the current round, the positive soft constraint set, and the negative soft constraint set, determine the intra-class scatter matrix and inter-class scatter matrix of the next round; Construct a positive soft constraint divergence matrix based on the set of positive soft constraints, and construct a negative soft constraint divergence matrix based on the set of negative soft constraints. The positive soft constraint divergence matrix is ​​used to correct the intra-class divergence matrix to obtain the corrected intra-class divergence matrix, and the negative soft constraint divergence matrix is ​​used to correct the inter-class divergence matrix to obtain the corrected inter-class divergence matrix. The updated discriminant projection matrix is ​​determined based on the modified intra-class scatter matrix and the modified inter-class scatter matrix. The sentence vector matrix is ​​then projected onto the updated demand constraint discriminant subspace using the updated discriminant projection matrix. In the demand constraint discriminant subspace, Gaussian mixture model clustering is performed again to obtain the clustering labels for the current round.

[0011] Optionally, in the fifth implementation of the first aspect of this application, the step of analyzing the topic clustering results based on the different number of topics in the candidate topic set and determining the number of topics with the highest comprehensive evaluation of topic structure in the topic clustering results as the target number of topics includes: Based on each candidate topic number in the preset candidate topic number set, perform the requirement constraint topic clustering respectively to obtain the topic clustering result corresponding to each candidate topic number; Based on the topic clustering results corresponding to each number of candidate topics, calculate the set of topic structure evaluation indicators corresponding to each number of candidate topics. Based on the set of topic structure evaluation indicators corresponding to each candidate topic number, a comprehensive evaluation is performed on each candidate topic number, and the target topic number is determined based on the corresponding comprehensive evaluation results.

[0012] A second aspect of this application provides a demand-constraint topic clustering device for normative texts. This device is used to implement a demand-constraint topic clustering method for normative texts. The demand-constraint topic clustering device for normative texts includes: The analysis module is used to preprocess the original normative text to obtain a sentence-level text set, and to perform demand-oriented analysis on the sentence-level text set to obtain a set of infrastructure demand sentences. The classification module is used to perform probability classification of the infrastructure demand sentence set to obtain demand category soft label information; The clustering module is used to generate semantic vectors corresponding to the set of infrastructure demand sentences, and combine the soft label information of the demand categories and the corresponding classification confidence to perform demand constraint topic clustering to obtain topic clustering results; The determination module is used to analyze the topic clustering results based on the different number of topics in the candidate topic number set, and determine the number of topics with the highest comprehensive evaluation of topic structure in the topic clustering results as the target number of topics; The extraction module is used to extract keywords from the topic clusters corresponding to the number of target topics in the topic clustering results to obtain the topic profile information of the original normative text.

[0013] A third aspect of this application provides an electronic device, including a memory and a processor, wherein the processor is configured to execute a computer program stored in the memory, and when the processor executes the computer program, it implements the steps of the normative text requirement constraint topic clustering method provided in the first aspect of this application.

[0014] The fourth aspect of this application provides a computer-readable storage medium storing a computer program thereon. When the computer program is executed by a processor, it implements the steps of the normative text requirement constraint topic clustering method provided in the first aspect of this application.

[0015] Compared with the prior art, this application has the following beneficial effects: This method identifies infrastructure demand sentences through demand-oriented analysis and constrains the semantic clustering process using soft-label information of demand categories and classification confidence. This allows demand structure information to directly participate in topic formation. Based on this, the optimal topic structure is determined through comprehensive evaluation of multiple topic numbers, and topic profiles are output. This method can reduce input noise in normative texts from the source, making it easier to aggregate similar demands in the topic space and separate dissimilar demands. It also outputs topic keywords in an objective and reproducible manner, thereby significantly improving the consistency, stability, and interpretability of topic clustering results. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating the requirement-constrained topic clustering method for normative texts provided in this application embodiment; Figure 2 The core algorithm flowchart of the demand-constrained topic clustering method provided in the embodiments of this application is shown below. Figure 3 A schematic diagram of the program modules for a normative text-based topic clustering device provided in this application embodiment; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0018] To make the inventive objectives, features, and advantages of this application more apparent and understandable, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0019] To address the problems of high input noise, unutilized demand structure information, unstable topic clustering boundaries, and insufficient interpretability in existing normative text topic analysis methods, this application provides a demand-constrained topic clustering method for normative texts, such as... Figure 1 This is a flowchart illustrating the requirement constraint topic clustering method for normative texts provided in this embodiment. The requirement constraint topic clustering method for normative texts includes the following steps: Step 110: Preprocess the original normative text to obtain a sentence-level text set, and perform demand-oriented analysis on the sentence-level text set to obtain a set of infrastructure demand sentences.

[0020] Specifically, the acquired standardized text undergoes format standardization, invalid character removal, paragraph organization, and sentence segmentation to convert the text content into a sentence-level text set with sentences as the basic unit. Then, the sentences in the sentence-level text are analyzed for their requirement attributes. By combining action words, question words, object words, and requirement expression rules, texts with clear requirements such as construction, renovation, upgrading, and improvement are filtered to form a set of requirement sentences. Simultaneously, for texts with unclear requirement expressions or ambiguous semantic boundaries, a large language model is used for auxiliary judgment to improve the accuracy of requirement identification. After completing the requirement sentence identification, the requirement sentence set is further analyzed for infrastructure attributes based on relevant vocabulary features and expression methods in the infrastructure field. Text content related to infrastructure construction, operation, maintenance, and upgrading is then filtered out, ultimately obtaining the infrastructure requirement sentence set. Step 120: Perform demand category probability classification on the set of infrastructure demand sentences to obtain demand category soft label information.

[0021] Specifically, a set of demand categories is constructed based on pre-defined demand category definitions, such as blue infrastructure, green infrastructure, gray infrastructure, and system infrastructure. The number and names of demand categories can be set to three, four, five, or more categories depending on the specific application domain; a four-category system is merely a preferred embodiment in the urban infrastructure climate resilience scenario. Subsequently, the infrastructure demand sentences are input into a large language model, and combined with classification prompt templates, the model determines the probability that each demand sentence belongs to each demand category based on the semantic content of the text. This scheme obtains the probability values ​​corresponding to each demand category to form an initial demand category probability vector containing category distribution information. Simultaneously, the main demand category corresponding to the current demand sentence is determined based on the maximum probability value in the probability vector, and the maximum probability value is used as the classification confidence score to represent the reliability of the classification result. Further, the initial demand category probability vector is normalized to ensure that the probabilities of different demand categories meet a uniform scale requirement, thereby forming soft label information for demand categories.

[0022] Step 130: Generate semantic vectors corresponding to the set of infrastructure demand sentences, and perform demand constraint topic clustering by combining demand category soft label information and corresponding classification confidence to obtain topic clustering results.

[0023] Specifically, a semantic encoding model is used to vectorize infrastructure demand sentences, converting semantic information in the text into high-dimensional semantic vectors, thereby obtaining a sentence vector matrix that reflects the relevance of text content. Sentence vectors, demand category soft label information, and classification confidence are jointly analyzed. Based on the similarity of demand category probability distributions and classification reliability between different texts, soft constraint relationships for demand categories are constructed. When two texts have similar demand category distributions and high classification confidence, a positive soft constraint is established to bring them closer together in the topic space; when the demand categories of two texts differ significantly, a negative soft constraint is established to maintain their distinction in the topic space. Furthermore, the text feature space is adjusted according to the constructed soft constraint relationships, so that the text semantic representation not only considers the original semantic similarity but also integrates demand category association information, forming a demand-constrained topic space. Probabilistic clustering methods are then used in this space to obtain topic clustering results, thereby improving the consistency between the topic clustering results and the actual demand categories.

[0024] Step 140: Analyze the topic clustering results based on the different number of topics in the candidate topic set, and determine the number of topics with the highest comprehensive evaluation of topic structure in the topic clustering results as the target topic number.

[0025] Specifically, since the choice of the number of topics during topic clustering directly affects the granularity of the final result, a set of candidate topic numbers is pre-defined, and demand-constrained topic clustering is performed for each candidate topic number to obtain the corresponding topic partitioning results. Subsequently, the topic clusters formed under different topic numbers are comprehensively evaluated. Evaluation indicators can include multiple aspects such as topic consistency, cluster tightness, topic distinguishability, and topic stability. Specifically, topic consistency measures the degree of correlation between keywords and text content within the same topic; clustering evaluation indicators reflect the separation effect between different topics; and stability indicators determine the consistency of clustering results under different conditions. By comprehensively calculating multiple evaluation indicators, the topic structure evaluation results corresponding to each candidate topic number are obtained, and the topic number with the highest evaluation result is selected as the target topic number. This avoids the subjective influence caused by manually setting the topic number and improves the rationality of the topic clustering results.

[0026] Step 150: Extract keywords from the topic clusters corresponding to the number of target topics in the topic clustering results to obtain the topic profile information of the original normative text.

[0027] Specifically, based on the determined number of target topics, a corresponding number of topic clusters are obtained from the topic clustering results. Each topic cluster contains infrastructure requirement texts with high semantic relevance. Subsequently, keyword statistics and importance calculations are performed on the text within each topic cluster to identify words or phrases that represent the core meaning of the topic. To improve the accuracy of topic expression, keyword evaluation methods combining word frequency and text discrimination capabilities (including but not limited to category-based TF-IDF) can be used, ensuring that the extracted keywords not only have a high frequency of occurrence but also reflect the differences between different topics. After obtaining the topic keywords, the keyword information, topic category information, and corresponding text content are linked and organized to form the topic profile information of the normative text. This topic profile can intuitively reflect the main demand directions, topic distribution, and key construction content contained in the original normative text.

[0028] It should be noted that the Large Language Model (LLM) in this invention refers to a general language understanding and generation model pre-trained on massive text data based on the Transformer architecture, such as the GPT series models, Wenxin Yiyan, Tongyi Qianwen, ChatGLM, etc. The pre-training architecture, fine-tuning methods, prompt-word driven inference (In-Context Learning), and softmax-based probability output mechanism of the Large Language Model are all well-known technologies in the field, and those skilled in the art can directly call and obtain classification results through publicly available API interfaces or open-source model weights.

[0029] In one optional implementation, the steps of preprocessing the original normative text to obtain a sentence-level text set, and performing demand-oriented analysis on the sentence-level text set to obtain an infrastructure demand sentence set include: filtering demand sentences in the sentence-level text set according to a preset set of action words, a set of question words, a set of object words, and a demand sentence pattern rule template to obtain a set of demand sentences with clear demands and a first boundary sentence set with unclear demands; performing demand boundary verification on the first boundary sentence set according to a preset large language model, and incorporating boundary sentences that pass the demand boundary verification into the demand sentence set; identifying infrastructure demand sentences in the demand sentence set according to a preset set of strong anchor words, a set of weak anchor words, a set of excluded words, and an infrastructure sentence pattern rule template to obtain an infrastructure demand sentence set and a second boundary sentence set with unclear infrastructure demands; obtaining an extended candidate set based on the sentence vector similarity between the infrastructure demand sentence set and the second boundary sentence set, and performing secondary verification on the extended candidate set using a large language model, and incorporating the extended candidate sentences that pass the secondary verification into the infrastructure demand sentence set.

[0030] In this embodiment, a demand-oriented analysis is performed on the preprocessed sentence-level text set. The analysis uses a set of action words, a set of question words, a set of object words, and a demand sentence structure rule template to jointly determine whether the text has clear demand expression characteristics. Specifically, the action word set describes words with task execution meanings, such as "build," "renovate," "improve," and "enhance," to identify whether there are explicit implementation actions in the text; the question word set identifies expressions reflecting current problems or unresolved issues, such as "shortcomings," "deficiencies," and "deficiencies," to determine whether there are objects that need improvement; the object word set identifies the specific objects affected by the demand, such as pipelines, roads, facilities, and public spaces, to confirm whether the demand content corresponds to specific construction or governance objects; and the demand sentence structure rule template describes the grammatical structure of the demand expression, such as "carry out + object + construction," "promote + object + renovation," and "strengthen + object + enhancement," and determines whether it conforms to the demand expression form by matching the word combination relationships in the sentence. In the specific implementation process, feature matching is performed on each text in the sentence-level text set to detect whether it contains action features, question features, and object features, and the demand matching result is calculated in conjunction with the demand sentence structure rule template. When a text simultaneously meets all explicit requirement characteristics, it is directly assigned to the set of explicit requirement sentences. When a text only partially meets the requirement conditions, or when the text has multiple possible semantic interpretations, it is retained as the first boundary sentence set where the requirement is ambiguous. The establishment of the first boundary sentence set can prevent the omission of valid requirement text due to the limitation of the rule matching range.

[0031] For the text in the first set of boundary sentences, a pre-defined large language model is used for further review of the demand boundaries. In this process, the large language model is used to understand the semantic context of the text and to further analyze the boundary sentences according to demand judgment rules. Specifically, the text in the first set of boundary sentences is input into the large language model, along with judgment constraints related to demand identification. This allows the large language model to determine whether a sentence expresses a clear demand by combining the behavioral description, target object, and contextual meaning. Compared to word-matching-based methods, the large language model can handle synonymous expressions, implicit demands, and complex sentence structures, thus identifying text where rule matching is difficult. When the large language model determines that a boundary sentence has a clear demand meaning, it merges the boundary sentence into the demand sentence set; when it determines that it only belongs to background description, policy objective statement, or non-executable content, it is not merged.

[0032] After obtaining the set of demand sentences, the text within it is further identified as an infrastructure demand sentence. This is achieved through a set of strong anchor words, a set of weak anchor words, a set of excluded words, and an infrastructure sentence structure template to determine whether the text belongs to the infrastructure domain. The strong anchor word set represents words directly related to infrastructure; when a text contains strongly related objects, it directly enhances the infrastructure attribute judgment result. The weak anchor word set represents related words that require further judgment in conjunction with the context; since these words may correspond to different domains, they need to be analyzed in conjunction with other features. The excluded word set filters content that does not fall within the scope of infrastructure construction, such as texts simply involving management systems, organizational mechanisms, or publicity work. The infrastructure sentence structure template determines whether the text reflects infrastructure-related behaviors such as construction, upgrading, renovation, and maintenance. In the implementation process, multi-dimensional feature matching is performed on each text in the demand sentence set. When a text satisfies strong anchor features or conforms to the infrastructure sentence structure rules, it is identified as part of the infrastructure demand sentence set. When a text only has some infrastructure-related features and its category cannot be directly determined, a second boundary sentence set with unclear infrastructure demand is formed.

[0033] For the text in the second boundary sentence set, an expanded candidate set is generated using sentence vector similarity. A sentence vector is a numerical vector that converts text content into semantic information. By calculating the distance or similarity between different sentence vectors, the semantic relationship between texts can be determined. Specifically, the text in the infrastructure demand sentence set is semantically encoded to generate corresponding sentence vector representations. Then, sentence vector representations are generated for the text in the second boundary sentence set, and the sentence vector similarity between the two types of text is calculated. When a second boundary sentence has a high sentence vector similarity to a certain infrastructure demand sentence in the semantic space, it indicates that the boundary sentence may imply infrastructure demand, and it is added to the expanded candidate set. The expanded candidate set is then further validated using a large language model. Candidate texts are input into the large language model, and semantic judgment is performed based on the already determined infrastructure demand sentence features, thereby further excluding texts that are semantically similar but do not actually belong to infrastructure demand. After this second validation, the qualified expanded candidate sentences are incorporated into the infrastructure demand sentence set, thus supplementing the scope of infrastructure demand texts.

[0034] In one optional implementation, the step of performing demand category probability classification on the infrastructure demand sentence set to obtain demand category soft label information includes: constructing a demand category set based on preset demand category definition information; calling a large language model to perform demand category probability classification on each infrastructure demand sentence in the infrastructure demand sentence set based on the demand category set and preset classification prompt templates, obtaining initial probability values ​​for each infrastructure demand sentence belonging to each preset demand category in the demand category set, and generating an initial demand category probability vector based on each initial probability value; determining the main label of each infrastructure demand sentence based on the maximum probability value in the initial demand category probability vector, and determining the classification confidence of each infrastructure demand sentence based on the maximum probability value; normalizing the initial demand category probability vector to obtain a demand category soft label vector, and constructing demand category soft label information based on the demand category soft label vectors corresponding to all infrastructure demand sentences.

[0035] In this embodiment, based on the types of infrastructure needs that the normative text analysis task focuses on, different demand categories are defined, and the semantic scope, judgment criteria, and typical expressions corresponding to each demand category are clarified, thereby forming a set of demand categories that can be used for classification. The demand category definition information is used to constrain the judgment criteria in the subsequent classification process, enabling the large language model to analyze infrastructure demand sentences according to unified category classification rules. For example, in the scenario of urban infrastructure planning text analysis, demand categories such as blue infrastructure, green infrastructure, gray infrastructure, and system infrastructure can be divided according to infrastructure attributes. Blue infrastructure corresponds to water resource-related facility construction needs, green infrastructure corresponds to ecological environment improvement-related needs, gray infrastructure corresponds to road and pipeline construction needs, and system infrastructure corresponds to management system and operation support-related needs. By constructing a set of demand categories, the subsequent classification process can be carried out around a clearly defined category scope, improving the consistency of demand category judgment.

[0036] After constructing the demand category set, individual infrastructure demand sentences, demand category definitions, and classification hint templates are input into the large language model. The classification hint templates define the model's analysis method and output format, allowing the model to determine the likelihood of the input text belonging to each demand category based on the category definitions in the demand category set. After semantic analysis, the large language model does not directly output a single category but instead outputs an initial probability value for each preset category in the demand category set. The initial probability value represents the degree of matching between the current infrastructure demand sentence and a specific demand category. For example, for the demand sentence "Promote the aging and renovation of urban gas pipeline networks," the large language model can determine a high correlation with the gray infrastructure category based on information such as "gas pipeline network" and "renovation" in the text, and output a correspondingly high initial probability value, while retaining the correlation probabilities for other categories. Subsequently, based on the initial probability values ​​for each category corresponding to each infrastructure demand sentence, an initial demand category probability vector is generated according to the category order in the demand category set to preserve the distribution relationship of the text across multiple demand categories.

[0037] The primary label for each infrastructure demand sentence is determined based on the maximum probability value in the initial demand category probability vector. The probability values ​​in the initial demand category probability vector are compared, and the demand category with the highest probability is selected as the primary label for the current text, representing the demand category that the text best matches. Simultaneously, the maximum probability value is used as the classification confidence score to describe the reliability of the classification result by the large language model. A higher maximum probability value indicates a strong semantic match between the text and the corresponding demand category, resulting in a clearer classification result. When the probabilities of multiple demand categories are relatively close, it indicates that the text may simultaneously involve multiple demand directions, leading to some uncertainty in the classification result. For example, the demand sentence "constructing ecological stormwater regulation facilities" may involve both green infrastructure and blue infrastructure. The large language model can assign high probabilities to both categories, with the category corresponding to the maximum probability value serving as the primary label. The probabilistic relationship between the two categories is preserved for subsequent soft constraint construction.

[0038] The initial demand category probability vector is normalized to obtain a demand category soft label vector. Demand category soft label information is then constructed based on the demand category soft label vectors corresponding to all infrastructure demand sentences. Normalization converts the initial probability values ​​corresponding to different texts into a probability representation within a uniform range, allowing the category probabilities of each infrastructure demand sentence to be compared according to the same standard. The processed demand category soft label vector no longer represents only a specific category but retains the probability distribution information of a text belonging to multiple demand categories. Subsequently, the demand category soft label vectors corresponding to all infrastructure demand sentences are summarized to form demand category soft label information, which reflects the demand category relationships among the texts in the entire set of infrastructure demand sentences. In subsequent topic clustering, the similarity of the soft label vectors between different texts can be used to determine the proximity relationships between demand categories, thereby constructing demand constraints and participating in topic space optimization.

[0039] In this way, the demand category probabilistic classification process transforms the semantic understanding capability of the large language model into structured probabilistic information. It can not only obtain the main demand category to which each infrastructure demand sentence belongs, but also retain the degree of correlation between the text and multiple demand categories. This allows demand category information to participate in the subsequent demand constraint topic clustering process in the form of soft labels, thereby improving the consistency between the topic segmentation results and the actual demand structure.

[0040] In one optional implementation, the steps of generating semantic vectors corresponding to a set of infrastructure demand sentences and performing demand constraint topic clustering based on demand category soft label information and corresponding classification confidence scores to obtain topic clustering results include: semantically encoding each infrastructure demand sentence in the set of infrastructure demand sentences to obtain a semantic vector for each infrastructure demand sentence, and constructing a sentence vector matrix based on the semantic vectors of all infrastructure demand sentences; performing a first-stage principal component analysis on the sentence vector matrix to obtain a dimensionality reduction matrix corresponding to the sentence vector matrix, and preprocessing the dimensionality reduction matrix to obtain a preprocessed vector matrix; performing a second-stage principal component analysis on the preprocessed vector matrix according to a preset number of topic clusters to obtain an initial low-dimensional subspace, and performing Gaussian mixture model clustering in the initial low-dimensional subspace to obtain initial cluster labels; and performing demand category soft label information... The probability similarity of demand category soft label vectors between any two samples whose classification confidence is greater than or equal to a preset confidence threshold is used to construct a positive soft constraint set and a negative soft constraint set with continuous weights. The positive and negative soft constraint sets are constructed before entering the iteration process and remain fixed in each iteration of the same demand constraint topic clustering operation. The initial low-dimensional subspace is updated based on the preprocessed vector matrix, the initial clustering label, the positive soft constraint set, and the negative soft constraint set. Gaussian mixture model clustering is then performed again in the updated demand constraint discriminant subspace to obtain the clustering label for the current round. Convergence is determined based on the normalized mutual information between the clustering label of the current round and the clustering label of the previous round. When the convergence condition is met, the clustering label of the current round is output as the topic clustering result.

[0041] In this embodiment, as Figure 2 As shown, for the demand constraint topic clustering process, a semantic encoding model is used to extract features from each infrastructure demand sentence, mapping the construction object, implementation behavior, demand objective, and contextual semantic relationships in the text to a high-dimensional vector space, resulting in corresponding semantic vectors. Since a single demand sentence is represented as a fixed-dimensional numerical vector after encoding, the semantic vectors corresponding to all infrastructure demand sentences are arranged in text order to form a sentence vector matrix. The sentence vector matrix is ​​used to uniformly represent the distribution of all demand texts in the semantic space, providing a data foundation for dimensionality reduction and topic clustering. For example, in the scenario of urban infrastructure planning text analysis, the semantic encoding of promoting the renovation of urban drainage pipe networks and improving the construction of rainwater storage facilities shows a high correlation between their corresponding semantic vectors in the vector space, as both involve water environment facility construction needs.

[0042] After obtaining the sentence vector matrix, a first-stage principal component analysis (PCA) is performed to obtain the corresponding dimensionality-reduced matrix. This first-stage PCA is used for preliminary compression of the original semantic vector space. By analyzing the changes in features across different dimensions of the sentence vector matrix, principal component directions that retain the main semantic information are extracted, and the dimensionality-reduced matrix is ​​constructed based on the selected principal components. Since the vectors generated by semantic encoding have a high dimensionality, some dimensions may contain information overlap or have weak topic differentiation capabilities. Therefore, the first-stage PCA reduces the data dimensionality, minimizing redundant information in subsequent calculations. After obtaining the dimensionality-reduced matrix, it undergoes preprocessing, including feature scaling and matrix format conversion, to ensure that the data across different dimensions maintains an input format suitable for subsequent discriminant analysis, forming a preprocessed vector matrix. This preprocessed vector matrix serves as the foundational data for subsequent topic space optimization, preserving important semantic differences between the required texts while reducing computational complexity.

[0043] After obtaining the preprocessed vector matrix, a second-stage principal component analysis (PCA) is performed on the preprocessed vector matrix according to the preset number of topic clusters to obtain an initial low-dimensional subspace. Gaussian mixture model (GMM) clustering is then performed in this initial low-dimensional subspace to obtain initial cluster labels. The second-stage PCA differs from the first-stage PCA; it primarily serves to further extract feature directions beneficial for topic differentiation based on the preset number of topic clusters. The principal component dimensions to be retained are determined based on the number of target topics, ensuring that the dimensionality-reduced space better suits the topic segmentation requirements, thus obtaining the initial low-dimensional subspace. The preprocessed vector matrix is ​​mapped to the initial low-dimensional subspace, and probabilistic clustering is performed using a Gaussian mixture model. A Gaussian mixture model is a probability-based clustering method that describes the characteristics of different topic clusters through a combination of multiple Gaussian distributions. This allows each text to obtain a probability of belonging to a different topic cluster, and the initial cluster label is determined based on the highest probability. For example, for infrastructure planning texts, the initial low-dimensional subspace can make the spatial distribution of road construction needs, water facility needs, and ecological construction needs more clearly distinguishable.

[0044] After obtaining the initial clustering labels, for any two infrastructure demand sentences in the two sets of infrastructure demand sentences with a classification confidence level greater than or equal to a preset confidence threshold, each infrastructure demand sentence is treated as a sample. The corresponding demand category soft label vector is obtained from the demand category soft label information, and the demand category probability similarity between their demand category soft label vectors is calculated to determine the proximity relationship between the two samples in terms of demand category attributes. When two samples have similar demand category distributions, that is, the demand category probability similarity between the demand category soft label vectors of the two samples is greater than or equal to the preset positive soft constraint demand category probability similarity threshold, the sample pair formed by these two samples is determined as a candidate positive soft constraint. The demand category probability similarity of all candidate positive soft constraint sample pairs is sorted from high to low to determine the top M candidate positive soft constraints. The positive soft constraint weight of each sample pair in the top M candidate positive soft constraints is determined based on the demand category probability similarity and the classification confidence level of the corresponding sample. A positive soft constraint set is constructed based on the M sample pairs and their corresponding positive soft constraint weights.

[0045] When two samples have significantly different demand category distributions (i.e., the demand category probability similarity between the soft label vectors of the two samples is less than or equal to the negative soft constraint demand category probability similarity threshold), the sample pair formed by these two samples is identified as a candidate negative soft constraint. The demand category probability similarity of all candidate negative soft constraint sample pairs is sorted from low to high to determine the top N candidate negative soft constraints. The negative soft constraint weight of each sample pair in the top N candidate positive soft constraints is determined based on the demand category probability similarity and the classification confidence of the corresponding sample. A negative soft constraint set is constructed based on the N sample pairs and their corresponding negative soft constraint weights. The positive soft constraint demand category probability similarity threshold is greater than the negative soft constraint demand category probability similarity threshold. The positive soft constraint set is used to enhance the clustering relationship between texts with similar categories, while the negative soft constraint set is used to enhance the separation relationship between texts with different categories. Both the positive and negative soft constraint sets are constructed before entering the iteration process and remain fixed throughout each iteration of the same demand constraint topic clustering operation.

[0046] After obtaining the positive and negative soft constraint sets, the preprocessed vector matrix and initial cluster labels are used as the basic data for the current topic clustering results. These sets are then combined to determine the constraint information used for updating the discriminative subspace. Based on the topic clustering relationships reflected by the current cluster labels and the demand category association relationships reflected by the soft constraint sets, the discriminative projection direction corresponding to the current discriminative subspace is updated. This updated projection direction considers both the distinguishing relationships between current topic clusters and the association relationships between demand categories. The updated discriminative projection matrix is ​​then used to project the preprocessed vector matrix, mapping the infrastructure demand sentences to the updated demand constraint discriminative subspace. Gaussian mixture model clustering is then performed again in the demand constraint discriminative subspace to obtain the cluster labels for the current round.

[0047] After completing the current round of clustering, convergence is determined based on the normalized mutual information between the current round's cluster labels and the previous round's cluster labels. Normalized mutual information measures the degree of information consistency between two clustering results. By comparing the changes in topic partitioning across different iteration rounds, it determines whether the subspace optimization has reached a stable state. When the consistency between the current round's cluster labels and the previous round's cluster labels reaches a preset convergence condition, iteration stops, and the current round's cluster labels are output as the topic clustering result.

[0048] It should be noted that positive soft-constraint sample pairs ( i,j The weight of ) is defined as: , Negative soft constraint sample pairs ( i,j The weight of ) is defined as: , in, i,j Samples corresponding to infrastructure demand sentences, This represents the probabilistic similarity of demand categories, which is calculated using cosine similarity after normalizing the soft label vector of the demand categories for each sample. Indicates sample Classification confidence, Indicates sample The classification confidence level.

[0049] In one optional implementation, the step of updating the initial low-dimensional subspace based on the preprocessed vector matrix, initial cluster labels, positive soft constraint set, and negative soft constraint set, and then performing Gaussian mixture model clustering again in the updated demand constraint discriminant subspace to obtain the cluster labels for the current round, includes: determining the intra-class scatter matrix and inter-class scatter matrix for the current round based on the preprocessed vector matrix, the cluster labels for the current round, the positive soft constraint set, and the negative soft constraint set; and constructing the positive soft constraint scatter matrix based on the positive soft constraint set. The negative soft constraint divergence matrix is ​​constructed based on the negative soft constraint set. The intra-class divergence matrix is ​​corrected using the positive soft constraint divergence matrix to obtain the corrected intra-class divergence matrix, and the inter-class divergence matrix is ​​corrected using the negative soft constraint divergence matrix to obtain the corrected inter-class divergence matrix. The updated discriminant projection matrix is ​​determined based on the corrected intra-class divergence matrix and the corrected inter-class divergence matrix. The preprocessed vector matrix is ​​projected onto the demand constraint discriminant subspace using the updated discriminant projection matrix. Gaussian mixture model clustering is performed again in the demand constraint discriminant subspace to obtain the clustering labels for the current round.

[0050] In this embodiment, the intra-class scatter matrix and inter-class scatter matrix for the current round are determined based on the preprocessed vector matrix, the clustering label of the current round, the positive soft constraint set, and the negative soft constraint set. The preprocessed vector matrix represents the feature distribution of each infrastructure demand sentence in the semantic space, and the clustering label of the current round identifies the topic cluster to which each text belongs. After dividing the samples according to the clustering labels, the degree of feature difference between samples within the same topic cluster is calculated to obtain the intra-class scatter matrix. The intra-class scatter matrix describes the density of text distribution within the same topic; its value reflects the dispersion of samples within the topic cluster. The smaller the corresponding element in the matrix, the more concentrated the text within the same topic. At the same time, the inter-class scatter matrix is ​​calculated based on the feature differences between samples from different topic clusters to describe the degree of separation between different topics, thereby enhancing the distinguishing ability between different topics. During the calculation process, the clustering label of the current round serves as the basis for sample category division, enabling the intra-class scatter matrix and inter-class scatter matrix to be dynamically updated as the clustering results change.

[0051] After obtaining the basic intra-class and inter-class scatter matrices, a positive soft constraint scatter matrix is ​​constructed based on the positive soft constraint set, and a negative soft constraint scatter matrix is ​​constructed based on the negative soft constraint set. The positive soft constraint set stores text sample relationships with similar demand category attributes, and also includes positive soft constraint weights determined by the similarity of demand category soft labels and classification confidence. Based on the sample pair relationships in the positive soft constraint set, the feature differences between texts with similar demand attributes are calculated, and weighted according to the corresponding positive soft constraint weights to form the positive soft constraint scatter matrix. This matrix reflects the text relationships that need further aggregation, used to enhance the association between similar texts of demand categories. Correspondingly, a negative soft constraint scatter matrix is ​​calculated based on the sample relationships in the negative soft constraint set. The negative soft constraint set records text relationships with significant differences in demand categories. By calculating the feature differences between texts with different demand attributes and combining them with constraint weights, a negative soft constraint scatter matrix is ​​formed, used to represent text relationships that need enhanced differentiation. For example, in the scenario of urban infrastructure demand analysis, both the renovation of urban gas pipelines and the construction of urban road facilities belong to the construction demand of engineering facilities, and the clustering relationship between the two can be enhanced by positive soft constraints; while the construction of ecological wetlands and the renovation of gas pipelines have different demand attributes, and the spatial differentiation can be enhanced by negative soft constraints.

[0052] After obtaining the positive and negative soft-constraint divergence matrices, the original intra-class and inter-class divergence matrices are corrected using the soft-constraint divergence matrices. Specifically, the positive soft-constraint divergence matrix is ​​introduced into the intra-class divergence calculation process to adjust text relationships with similar demand categories but large original semantic distances, bringing samples with the same demand attributes closer together in the topic space, resulting in the corrected intra-class divergence matrix. Simultaneously, the negative soft-constraint divergence matrix is ​​introduced into the inter-class divergence calculation process to enhance the relationships between samples with significant differences in demand categories, maintaining greater distinguishability between texts of different demand categories in the spatial representation, resulting in the corrected inter-class divergence matrix. In this way, the corrected divergence matrix not only reflects the semantic distribution relationships of the text itself but also integrates the prior constraint information provided by the soft labels of demand categories, making the topic space more consistent with the characteristics of infrastructure demand classification.

[0053] After obtaining the corrected intra-class and inter-class scatter matrices, an updated discriminant projection matrix is ​​determined based on these two corrected scatter matrices. This discriminant projection matrix retains the topic cluster differentiation information while introducing the soft constraint relationship of demand categories into the projection direction of the feature space. The preprocessed vector matrix is ​​then projected using the updated discriminant projection matrix, mapping the original sample features to the updated demand-constrained discriminant subspace. This new spatial representation simultaneously includes textual semantic information and demand category constraint information. After completing the construction of the demand-constrained discriminant subspace, Gaussian mixture model clustering is re-performed within it to obtain the cluster labels for the current round. Since the demand-constrained discriminant subspace has already undergone demand constraint optimization, the text features input to the Gaussian mixture model have adjusted the distribution relationship in the original semantic space. The Gaussian mixture model recalculates the probability that each text belongs to a different topic cluster based on the new spatial distribution and determines the cluster label for the current round based on the highest probability. If the clustering label of the current round does not meet the preset convergence condition, the clustering label of the current round is used as the clustering label of the subsequent iteration. Based on the updated clustering label, the intra-class scatter matrix and inter-class scatter matrix are recalculated, the discriminant projection matrix is ​​redetermined, and Gaussian mixture model clustering is performed again. The positive soft constraint set and the negative soft constraint set remain unchanged until the clustering result meets the convergence condition.

[0054] By using the above method, the subspace update process transforms the soft label information of demand categories into computable mathematical constraints, and corrects the influence of the text space structure through the scatter matrix. This allows the topic clustering process to not only divide based on the semantic similarity of the text, but also to optimize by combining the demand attribute relationships in the normative text. This improves the consistency of demand within topic clusters and the ability to distinguish between different topics, making the final topic clustering results more in line with the infrastructure demand analysis scenario.

[0055] It should be noted that the intra-cluster scatter matrix corresponding to the current clustering result is defined as follows: , The inter-class scatter matrix is ​​defined as: , Based on the set of positive soft constraints M, construct the positive soft constraint divergence matrix: , Based on the set of negative soft constraints N, construct the negative soft constraint divergence matrix: , Correcting the intra-class divergence matrix using positive soft-constraint divergence: , Correcting the inter-class divergence matrix using negative soft-constraint divergence: , in, For the preprocessing vector matrix, the first... One sample, For the preprocessing vector matrix, the first... One sample, This represents the Kth topic cluster. The total number of samples, Indicates the first The sample set of the Kth topic cluster in each iteration. This represents the positive soft constraint adjustment coefficient. Indicates the negative soft constraint adjustment coefficient, superscript This indicates the transpose operation.

[0056] After obtaining the corrected intra-class scatter matrix and the corrected inter-class scatter matrix Then, solve the following generalized eigenvalue problem: , in, Represents the generalized eigenvector. This represents the corresponding generalized eigenvalues, sorted from largest to smallest, and the top [values] are selected. The generalized eigenvectors constitute the first... t +1 round of discriminant projection matrix: , Preprocessed vector matrix Projected onto the demand constraint discriminant subspace: , in, This refers to the dimension of each sample vector after the first stage of dimensionality reduction. To determine the subspace for requirement constraints, corresponding to Figure 2 The constrained subspace in.

[0057] In one optional implementation, the step of analyzing the topic clustering results based on the different number of topics in the candidate topic set and determining the number of topics with the highest comprehensive evaluation of topic structure in the topic clustering results as the target number of topics includes: performing demand-constrained topic clustering for each candidate topic in the preset candidate topic set to obtain the topic clustering result corresponding to each candidate topic; calculating the topic structure evaluation index set corresponding to each candidate topic based on the topic clustering result corresponding to each candidate topic; comprehensively evaluating each candidate topic based on the topic structure evaluation index set corresponding to each candidate topic, and determining the target number of topics based on the corresponding comprehensive evaluation result.

[0058] In this embodiment, demand-constrained topic clustering is performed for each candidate topic in a preset set of candidate topic numbers to obtain topic clustering results under different topic numbers. Specifically, multiple possible topic cluster numbers are preset, for example, the topic number set is set as {3, 5, 7, 10}, indicating that the infrastructure demand text is attempted to be divided into 3, 5, 7, and 10 topic clusters, respectively. For each candidate topic number, this number is used as the input for the topic cluster number in the Gaussian mixture model clustering, and clustering calculation is performed using the aforementioned demand constraint-optimized demand constraint discriminant subspace to obtain the topic clustering results under the corresponding topic number. Since different topic numbers will cause changes in the granularity of text division, it is necessary to save the clustering labels, topic cluster division, and text distribution within each topic for each candidate topic number to provide a data foundation for subsequent topic structure evaluation.

[0059] After obtaining the topic clustering results corresponding to different numbers of candidate topics, a set of topic structure evaluation indicators is calculated for each topic clustering result. The set of topic structure evaluation indicators is used to measure the rationality of the clustering results from multiple perspectives, including indicators such as topic consistency, cluster density, topic discrimination ability, and result stability. Specifically, topic consistency evaluates the degree of association between text content and keywords within the same topic cluster, reflecting whether the semantics within a topic are concentrated; cluster density evaluates the distance relationship between texts within the same topic cluster, used to determine whether samples within a topic have high similarity; topic discrimination ability evaluates the degree of difference between different topic clusters, used to determine whether different topics have clear boundaries; and result stability evaluates whether the clustering results remain consistent under different conditions. By calculating the above indicators for the topic clustering results corresponding to each number of candidate topics, a corresponding set of topic structure evaluation indicators is formed.

[0060] A comprehensive evaluation is conducted based on the set of evaluation indicators corresponding to the number of candidate topics, and the target number of topics is determined according to the comprehensive evaluation results. In practice, different evaluation indicators are uniformly processed to allow comparison within the same evaluation scope. Then, according to preset comprehensive evaluation rules, each indicator is integrated and calculated to obtain the comprehensive evaluation result corresponding to each number of candidate topics. The higher the comprehensive evaluation result, the better the topic structure formed by that number of candidate topics performs in terms of internal consistency, topic distinguishability, and overall stability. For example, in the scenario of urban infrastructure demand text analysis, setting 3 topics may lead to the merging of different demands such as roads, water, and ecology, resulting in insufficient topic distinguishability; setting 10 topics may lead to the over-splitting of similar construction demands. Therefore, the number of topics that best reflects the actual demand structure is selected as the target number of topics through comprehensive evaluation.

[0061] By using the above method, we can avoid the impact of manually specifying the number of topics on the clustering results, and make the topic selection process automatically determined based on the topic structure evaluation results, thereby obtaining topic partitioning results that are more in line with the distribution characteristics of normative text requirements.

[0062] In one optional implementation, the following steps are taken: First, a set of infrastructure requirement sentences corresponding to each topic cluster is obtained based on the topic clustering results corresponding to the optimal number of topics. Second, textual features are extracted from the infrastructure requirement sentences in each topic cluster to obtain a set of candidate keywords corresponding to each topic cluster. Third, based on the word frequency information of each candidate keyword in the corresponding topic cluster and its distinguishability in different topic clusters, the keyword weight value corresponding to each candidate keyword is calculated. Fourth, based on the keyword weight values ​​corresponding to each candidate keyword, the candidate keywords in each topic cluster are sorted, and candidate keywords that meet the preset quantity requirements are selected as the topic keywords corresponding to each topic cluster. Fifth, based on the topic keywords corresponding to each topic cluster, the infrastructure requirement sentences associated with the topic cluster, and the topic cluster identification information, topic profile information corresponding to the original normative text is constructed.

[0063] In this embodiment, based on the aforementioned optimal number of topics and the corresponding topic clustering labels, the set of infrastructure demand sentences is re-divided, and infrastructure demand sentences with the same topic labels are grouped into the same topic cluster. The topic clustering labels are used to identify the topic category to which each infrastructure demand sentence belongs; therefore, a correspondence between topic clusters and demand sentences can be established based on the label information. After the division, each topic cluster contains several infrastructure demand sentences with similar semantic features and demand attributes, and retains the corresponding topic cluster identification information. For example, in the scenario of urban infrastructure planning text analysis, after demand-constrained topic clustering, topic clusters such as road facility renewal, drainage facility improvement, and ecological space construction can be formed, each topic cluster corresponding to a set of infrastructure demand sentences in a different direction.

[0064] After obtaining the set of infrastructure demand sentences corresponding to each topic cluster, text analysis is performed on the infrastructure demand sentences contained within each topic cluster to extract words or phrases that reflect the topic content as candidate keywords. The text feature extraction process can combine word frequency, word location in the text, and the relationship between words and the semantic content of the topic cluster to filter key content in the demand sentences. Through this process, a large amount of text information within the topic cluster is converted into a representative set of candidate keywords. Since different topic clusters correspond to different demand directions, the candidate keyword sets generated for each topic cluster also have different semantic features. For example, candidate keywords in the road infrastructure renewal topic cluster may include road reconstruction, road network optimization, and traffic facilities, while candidate keywords in the drainage infrastructure improvement topic cluster may include drainage pipe networks, stormwater regulation, and sewage treatment.

[0065] After obtaining the candidate keyword set, the frequency of each candidate keyword in its corresponding topic cluster is counted. The association strength between the keyword and the current topic cluster is determined using word frequency information. Subsequently, the distribution of the candidate keyword in other topic clusters is analyzed to determine whether it can effectively distinguish the current topic from other topics. Keywords that appear frequently in one topic cluster but less frequently in others have higher keyword weights, indicating that they accurately express the characteristics of the current topic. By combining word frequency information and topic differentiation in keyword weight calculation, the problem of overly broad topic expression based solely on high-frequency words can be avoided, making the extracted keywords more consistent with the actual semantic meaning of the topic cluster.

[0066] Based on the keyword weight values ​​corresponding to each candidate keyword, the candidate keywords in each topic cluster are sorted, and the candidate keywords that meet the preset number requirements are selected as the topic keywords for each topic cluster. The candidate keywords in each topic cluster are arranged in descending order of keyword weight values, and then, according to the preset number of keywords, the top-ranking keywords are selected as topic keywords. Topic keywords are used to summarize the core demand direction corresponding to the topic cluster and serve as the main content in subsequent topic profile information. For example, for the topic cluster of road infrastructure renewal, after sorting by keyword weight, keywords such as road reconstruction, road network improvement, and traffic facility renewal can be selected as topic keywords for this topic cluster to express the infrastructure construction direction corresponding to this topic.

[0067] After obtaining the topic keywords corresponding to each topic cluster, a topic profile is constructed based on the topic keywords, the infrastructure requirement sentences associated with each topic cluster, and the topic cluster identifier information. Specifically, the topic cluster identifier is used as the topic index, the topic keywords are used as the topic semantic description information, and the content of the infrastructure requirement sentences in that topic cluster is associated to form a structured topic profile result. The generated topic profile information can simultaneously reflect the topic category, the core content of the topic, and the corresponding textual basis, making the distribution of infrastructure requirements in the original normative text intuitively expressed. Through the above processing, the topic clustering results are further transformed into understandable and analyzable topic information, realizing the transformation from text data to topic feature representation and improving the interpretability of the normative text requirement analysis results.

[0068] This application provides a method for clustering normative texts based on demand constraints. It filters infrastructure demand sentences through demand-oriented analysis and uses soft-label information of demand categories and classification confidence to constrain the semantic clustering process, allowing demand structure information to directly participate in topic formation. Based on this, it determines the optimal topic structure and outputs topic profiles through comprehensive evaluation of multiple topic numbers. This method can reduce input noise in normative texts from the source, making it easier to aggregate similar demands in the topic space and separate dissimilar demands. It also outputs topic keywords in an objective and reproducible manner, thereby significantly improving the consistency, stability, and interpretability of topic clustering results.

[0069] Figure 3 This application provides a method for clustering normative text requirements-constrained topics, which can be used to implement the method for clustering normative text requirements-constrained topics in the foregoing embodiments. For example... Figure 3 As shown, the requirement constraint topic clustering device of this normative text mainly includes: Analysis module 10 is used to preprocess the original normative text to obtain a sentence-level text set, and to perform demand-oriented analysis on the sentence-level text set to obtain a set of infrastructure demand sentences; Classification module 20 is used to perform probability classification of the infrastructure demand sentence set to obtain demand category soft label information; Clustering module 30 is used to generate semantic vectors corresponding to the set of infrastructure demand sentences, and combine demand category soft label information and corresponding classification confidence to perform demand constraint topic clustering to obtain topic clustering results; The determination module 40 is used to analyze the topic clustering results based on the different number of topics in the candidate topic number set, and determine the number of topics with the highest comprehensive evaluation of topic structure in the topic clustering results as the target topic number; The extraction module 50 is used to extract keywords from the topic clusters corresponding to the number of target topics in the topic clustering results, and obtain the topic profile information of the original normative text.

[0070] In one optional implementation, the analysis module is specifically used to: filter requirement sentences in the sentence-level text set according to a preset set of action words, a set of question words, a set of object words, and a requirement sentence pattern rule template, to obtain a set of requirement sentences with clear requirements and a first boundary sentence set with unclear requirements; perform requirement boundary verification on the first boundary sentence set according to a preset large language model, and merge the boundary sentences that pass the requirement boundary verification into the requirement sentence set; identify infrastructure requirement sentences in the requirement sentence set according to a preset set of strong anchor words, a set of weak anchor words, a set of excluded words, and an infrastructure sentence pattern rule template, to obtain a set of infrastructure requirement sentences and a second boundary sentence set with unclear infrastructure requirements; obtain an extended candidate set based on the sentence vector similarity between the infrastructure requirement sentence set and the second boundary sentence set, and perform a second confirmation on the extended candidate set through the large language model, and merge the extended candidate sentences that pass the second confirmation into the infrastructure requirement sentence set.

[0071] In one optional implementation, the classification module is specifically used for: constructing a set of demand categories based on preset demand category definition information; calling a large language model to perform demand category probability classification on each infrastructure demand sentence in the set of infrastructure demand sentences based on the set of demand categories and preset classification prompt templates, obtaining the initial probability value of each infrastructure demand sentence belonging to each preset demand category in the set of demand categories, and generating an initial demand category probability vector based on each initial probability value; determining the main label of each infrastructure demand sentence based on the maximum probability value in the initial demand category probability vector, and determining the classification confidence of each infrastructure demand sentence based on the maximum probability value; normalizing the initial demand category probability vector to obtain a demand category soft label vector, and constructing demand category soft label information based on the demand category soft label vectors corresponding to all infrastructure demand sentences.

[0072] In one optional implementation, the clustering module includes: a determining unit, configured to determine the intra-class scatter matrix and inter-class scatter matrix of the current round based on the preprocessed vector matrix, the clustering labels of the current round, the positive soft constraint set, and the negative soft constraint set; a constructing unit, configured to construct the positive soft constraint scatter matrix based on the positive soft constraint set, and construct the negative soft constraint scatter matrix based on the negative soft constraint set; a correcting unit, configured to correct the intra-class scatter matrix using the positive soft constraint scatter matrix to obtain the corrected intra-class scatter matrix, and correct the inter-class scatter matrix using the negative soft constraint scatter matrix to obtain the corrected inter-class scatter matrix; the determining unit is further configured to determine the updated discriminant projection matrix based on the corrected intra-class scatter matrix and the corrected inter-class scatter matrix, and project the preprocessed vector matrix onto the updated demand constraint discriminant subspace using the updated discriminant projection matrix; and a clustering unit, configured to re-perform Gaussian mixture model clustering in the demand constraint discriminant subspace to obtain the clustering labels of the current round.

[0073] In an optional implementation, the clustering module is further configured to: determine the intra-class scatter matrix and inter-class scatter matrix of the current round based on the preprocessed vector matrix, the cluster labels of the current round, the positive soft constraint set, and the negative soft constraint set; construct a positive soft constraint scatter matrix based on the positive soft constraint set, and construct a negative soft constraint scatter matrix based on the negative soft constraint set; correct the intra-class scatter matrix using the positive soft constraint scatter matrix to obtain a corrected intra-class scatter matrix, and correct the inter-class scatter matrix using the negative soft constraint scatter matrix to obtain a corrected inter-class scatter matrix; determine the updated discriminant projection matrix based on the corrected intra-class scatter matrix and the corrected inter-class scatter matrix, and project the preprocessed vector matrix onto the updated demand constraint discriminant subspace using the updated discriminant projection matrix; and re-perform Gaussian mixture model clustering in the demand constraint discriminant subspace to obtain the cluster labels of the current round.

[0074] In one optional implementation, the determining module is specifically used to: perform demand-constrained topic clustering for each candidate topic in a preset set of candidate topic numbers, and obtain the topic clustering result corresponding to each candidate topic number; calculate the topic structure evaluation index set corresponding to each candidate topic number based on the topic clustering result corresponding to each candidate topic number; perform a comprehensive evaluation of each candidate topic number based on the topic structure evaluation index set corresponding to each candidate topic number, and determine the target topic number based on the corresponding comprehensive evaluation result.

[0075] According to the normative text demand-constrained topic clustering device provided in this application, infrastructure demand sentences are screened through demand-oriented analysis, and the semantic clustering process is constrained by demand category soft label information and classification confidence. This allows demand structure information to directly participate in topic formation. Based on this, the optimal topic structure is determined through comprehensive evaluation of multiple topic numbers, and topic profiles are output. This method can reduce input noise in normative texts from the source, making it easier to aggregate similar demands in the topic space and separate dissimilar demands. It also outputs topic keywords in an objective and reproducible manner, thereby significantly improving the consistency, stability, and interpretability of topic clustering results.

[0076] According to the scheme provided in this application Figure 4 An electronic device is provided as an embodiment of this application. This electronic device can be used to implement the requirement-constrained topic clustering method for normative texts in the foregoing embodiments, mainly including: The system includes a memory 401, a processor 402, and a computer program 403 stored on the memory 401 and executable on the processor 402. The memory 401 and the processor 402 are communicatively connected. When the processor 402 executes the computer program 403, it implements the requirement constraint topic clustering method for normative texts described in the foregoing embodiments. The number of processors can be one or more.

[0077] The memory 401 can be a high-speed random access memory (RAM) or a non-volatile memory, such as a disk storage device. The memory 401 is used to store executable program code, and the processor 402 is coupled to the memory 401.

[0078] Furthermore, embodiments of this application also provide a computer-readable storage medium, which may be disposed in the electronic device described in the above embodiments, and the computer-readable storage medium may be as described above. Figure 4 The memory in the illustrated embodiment.

[0079] The computer-readable storage medium stores a computer program that, when executed by a processor, implements the requirement-constrained topic clustering method for normative text described in the foregoing embodiments. Furthermore, the computer-readable storage medium can also be various media capable of storing program code, such as a USB flash drive, external hard drive, read-only memory (ROM), RAM, magnetic disk, or optical disk.

[0080] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0081] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0082] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for clustering topics constrained by requirements in normative texts, characterized in that, include: The original normative text is preprocessed to obtain a sentence-level text set, and the sentence-level text set is subjected to demand-oriented analysis to obtain a set of infrastructure demand sentences. The set of infrastructure demand sentences is subjected to demand category probability classification to obtain demand category soft label information; Generate semantic vectors corresponding to the set of infrastructure demand sentences, and combine the soft label information of the demand categories and the corresponding classification confidence to perform demand constraint topic clustering to obtain topic clustering results; The topic clustering results are analyzed based on the different number of topics in the candidate topic set, and the number of topics with the highest comprehensive evaluation of topic structure in the topic clustering results is determined as the target topic number. Keyword extraction is performed on the topic clusters corresponding to the number of target topics in the topic clustering results to obtain the topic profile information of the original normative text.

2. The method for clustering demand-constrained topics in normative texts according to claim 1, characterized in that, The steps of preprocessing the original normative text to obtain a sentence-level text set, and performing demand-oriented analysis on the sentence-level text set to obtain a set of infrastructure demand sentences include: Based on the preset set of action words, question words, object words, and requirement sentence pattern templates, the sentence-level text set is filtered for requirement sentences to obtain a set of requirement sentences with clear requirements and a set of first boundary sentences with unclear requirements. The first set of boundary sentences is checked for requirement boundaries according to the preset large language model, and the boundary sentences that pass the requirement boundary check are merged into the set of requirement sentences. Based on the preset set of strong anchor words, weak anchor words, exclusion words, and infrastructure sentence pattern template, the set of demand sentences is identified to obtain the set of infrastructure demand sentences and the set of second boundary sentences with unclear infrastructure demand. Based on the sentence vector similarity between the infrastructure demand sentence set and the second boundary sentence set, an extended candidate set is obtained, and the extended candidate set is further confirmed by the large language model. The extended candidate sentences that pass the secondary confirmation are then incorporated into the infrastructure demand sentence set.

3. The method for clustering demand-constrained topics in normative texts according to claim 2, characterized in that, The step of performing demand category probability classification on the set of infrastructure demand sentences to obtain demand category soft label information includes: Construct a set of requirement categories based on the preset requirement category definition information; Based on the set of demand categories and the preset classification prompt template, the large language model is invoked to perform demand category probability classification on each infrastructure demand sentence in the set of infrastructure demand sentences, obtain the initial probability value of each infrastructure demand sentence belonging to each preset demand category in the set of demand categories, and generate an initial demand category probability vector based on each initial probability value. Based on the maximum probability value in the initial demand category probability vector, determine the main label of each infrastructure demand sentence, and determine the classification confidence of each infrastructure demand sentence based on the maximum probability value; The initial demand category probability vector is normalized to obtain a demand category soft label vector, and demand category soft label information is constructed based on the demand category soft label vectors corresponding to all infrastructure demand sentences.

4. The method for clustering normative texts based on demand constraints according to claim 3, characterized in that, The step of generating semantic vectors corresponding to the set of infrastructure demand sentences, and performing demand constraint topic clustering by combining the soft label information of the demand categories and the corresponding classification confidence scores to obtain topic clustering results includes: Semantic encoding is performed on each infrastructure requirement sentence in the set of infrastructure requirement sentences to obtain the semantic vector of each infrastructure requirement sentence, and a sentence vector matrix is ​​constructed based on the semantic vectors of all infrastructure requirement sentences. A first-stage principal component analysis is performed on the sentence vector matrix to obtain the dimension-reduced matrix corresponding to the sentence vector matrix, and the dimension-reduced matrix is ​​preprocessed to obtain a preprocessed vector matrix; Based on the preset number of topic clusters, the preprocessed vector matrix is ​​subjected to a second-stage principal component analysis to obtain an initial low-dimensional subspace, and Gaussian mixture model clustering is performed in the initial low-dimensional subspace to obtain initial cluster labels. Based on the probability similarity of demand category between the demand category soft label vectors of any two samples whose classification confidence is greater than or equal to a preset confidence threshold in the demand category soft label information, a positive soft constraint set and a negative soft constraint set with continuous weights are constructed. The positive soft constraint set and the negative soft constraint set are constructed before entering the iteration process and remain fixed in each iteration of the same demand constraint topic clustering operation. The initial low-dimensional subspace is updated based on the preprocessed vector matrix, the initial clustering labels, the positive soft constraint set, and the negative soft constraint set. Gaussian mixture model clustering is then performed again in the updated demand constraint discriminant subspace to obtain the clustering labels for the current round. Convergence is determined based on the normalized mutual information between the cluster labels of the current round and the cluster labels of the previous round. When the convergence condition is met, the cluster labels of the current round are output as the topic clustering result.

5. The method for clustering demand-constrained topics in normative texts according to claim 4, characterized in that, The step of updating the initial low-dimensional subspace based on the preprocessed vector matrix, the initial clustering labels, the positive soft constraint set, and the negative soft constraint set, and then performing Gaussian mixture model clustering again in the updated demand constraint discriminant subspace to obtain the clustering labels for the current round, includes: Based on the preprocessed vector matrix, the clustering label of the current round, the positive soft constraint set, and the negative soft constraint set, determine the intra-class scatter matrix and inter-class scatter matrix of the current round; Construct a positive soft constraint divergence matrix based on the set of positive soft constraints, and construct a negative soft constraint divergence matrix based on the set of negative soft constraints. The positive soft constraint divergence matrix is ​​used to correct the intra-class divergence matrix to obtain the corrected intra-class divergence matrix, and the negative soft constraint divergence matrix is ​​used to correct the inter-class divergence matrix to obtain the corrected inter-class divergence matrix. The updated discriminant projection matrix is ​​determined based on the modified intra-class scatter matrix and the modified inter-class scatter matrix. The preprocessed vector matrix is ​​then projected onto the updated demand constraint discriminant subspace using the updated discriminant projection matrix. In the demand constraint discriminant subspace, Gaussian mixture model clustering is performed again to obtain the clustering labels for the current round.

6. The method for clustering demand-constrained topics in normative texts according to claim 1, characterized in that, The step of analyzing the topic clustering results based on the different number of topics in the candidate topic set, and determining the number of topics with the highest comprehensive evaluation of topic structure in the topic clustering results as the target number of topics, includes: Based on each candidate topic number in the preset candidate topic number set, perform the requirement constraint topic clustering respectively to obtain the topic clustering result corresponding to each candidate topic number; Based on the topic clustering results corresponding to each number of candidate topics, calculate the set of topic structure evaluation indicators corresponding to each number of candidate topics. Based on the set of topic structure evaluation indicators corresponding to each candidate topic number, a comprehensive evaluation is performed on each candidate topic number, and the target topic number is determined based on the corresponding comprehensive evaluation results.

7. A topic clustering device for demand constraints in normative texts, characterized in that, The normative text demand constraint topic clustering device is used to implement the normative text demand constraint topic clustering method of claim 1, and the normative text demand constraint topic clustering device includes: The analysis module is used to preprocess the original normative text to obtain a sentence-level text set, and to perform demand-oriented analysis on the sentence-level text set to obtain a set of infrastructure demand sentences. The classification module is used to perform probability classification of the infrastructure demand sentence set to obtain demand category soft label information; The clustering module is used to generate semantic vectors corresponding to the set of infrastructure demand sentences, and combine the soft label information of the demand categories and the corresponding classification confidence to perform demand constraint topic clustering to obtain topic clustering results; The determination module is used to analyze the topic clustering results based on the different number of topics in the candidate topic number set, and determine the number of topics with the highest comprehensive evaluation of topic structure in the topic clustering results as the target number of topics; The extraction module is used to extract keywords from the topic clusters corresponding to the number of target topics in the topic clustering results to obtain the topic profile information of the original normative text.

8. The normative text requirement constraint topic clustering device according to claim 7, characterized in that, The clustering module includes: The determination unit is used to determine the intra-class scatter matrix and inter-class scatter matrix of the current round based on the preprocessed vector matrix, the cluster label of the current round, the positive soft constraint set, and the negative soft constraint set. A construction unit is used to construct a positive soft constraint divergence matrix based on the positive soft constraint set, and to construct a negative soft constraint divergence matrix based on the negative soft constraint set. The correction unit is used to correct the intra-class divergence matrix using the positive soft constraint divergence matrix to obtain a corrected intra-class divergence matrix, and to correct the inter-class divergence matrix using the negative soft constraint divergence matrix to obtain a corrected inter-class divergence matrix. The determining unit is further configured to determine the updated discriminant projection matrix based on the modified intra-class scatter matrix and the modified inter-class scatter matrix, and project the preprocessed vector matrix onto the updated demand constraint discriminant subspace through the updated discriminant projection matrix; Clustering units are used to re-cluster the Gaussian mixture model in the demand constraint discriminant subspace to obtain the clustering labels for the current round.

9. An electronic device, characterized in that, Includes memory and processor, of which: The processor is used to execute computer programs stored in the memory; When the processor executes the computer program, it implements the steps in the normative text requirement constraint topic clustering method according to any one of claims 1 to 6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps in the requirement-constrained topic clustering method for normative texts as described in any one of claims 1 to 6.