Command and dispatch instruction generation method and system, computer equipment and storage medium
By receiving alarm information in real time, using language generation models and semantic feature vector technology, efficient and accurate command and dispatch instructions are generated, which solves the problems of complex cleaning of alarm data and insufficient data correlation in the existing technology, and achieves rapid response and efficient command generation in emergency situations.
Patent Information
- Application Number
- CN202510294002.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-13
- Publication Date
- 2025-06-10
AI Technical Summary
The prior art is complex and prone to errors in the cleaning process of alarm data, insufficient data correlation utilization, and inaccurate extraction of specific alarm information, resulting in low efficiency and accuracy of command generation, which cannot meet the needs of rapid response in emergencies.
By receiving alarm information in real time, using the language generation model to generate alarm summary, and mapping it to the semantic feature vector space, clustering to generate alarm command feature vector clusters, computing the similarity to match the target command feature vector cluster, and combining the language generation model to generate target command and dispatch instructions.
The cleaning process of police data is simplified, the accuracy of data processing is improved, the semantic correlation and complex relationship of police data is fully utilized, the efficiency and accuracy of police summary generation and command generation are optimized, and high-quality command and dispatch instructions are quickly generated to meet the needs of rapid response in emergencies.
Smart Images

Figure CN120123504A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of emergency command and dispatch, and particularly to a method, system, computer device and storage medium for generating command and dispatch instructions. Background Art
[0002] Command and dispatch is a crucial part of the public security system.
[0004] Although the existing technology provides certain support for the generation of command and dispatch instructions, it has the following deficiencies: (1) Problems based on traditional natural language processing methods: The parsing process is too complex, especially for scenarios with a large amount and diverse types of police situation information, making it difficult to efficiently process police situation data. In dealing with special types of cases and events, traditional methods cannot correctly extract relevant key information, resulting in inaccurate police situation analysis results. Due to relying on manual auxiliary judgment and instruction generation, the efficiency of generating instructions is low and cannot meet the requirements of rapid response in emergency situations. (2) Problems based on a single large language model: Data cleaning is complex and error-prone: Data cleaning is an important preprocessing step for the generation of command and dispatch instructions. The process of dealing with duplicate data, error data and outliers is cumbersome and time-consuming. Once processed improperly, it will directly affect the accuracy of subsequent analysis results.
[0005] Therefore, how to simplify the cleaning process of police situation data, improve the accuracy of data processing, make full use of the semantic relevance and complex relationships of police situation data, and at the same time optimize the efficiency and accuracy of police situation summary generation and instruction generation, and quickly generate high-quality command and dispatch instructions that meet the actual needs has become an important problem to be solved urgently. Summary of the Invention
[0006] In view of this, the embodiments of this application provide a method, system, computer device and storage medium for generating command and dispatch instructions, which can effectively solve the problems existing in the prior art, such as complex and error-prone cleaning of police situation data, insufficient utilization of data relevance, inaccurate extraction of specific police situation information, and low efficiency and accuracy of instruction generation.
[0007] In a first aspect, the embodiments of this application provide a method for generating command and dispatch instructions, including:
[0008] Receiving police situation information in real time, and inputting the police situation information into a language generation model to generate a police situation summary;
[0009] Clustering the semantic feature vectors in the semantic feature vector library to generate multiple clusters of police situation instruction feature vectors;
[0010] Map the police situation summary to the semantic feature vector space based on vectorization processing, and calculate the similarity between the semantic feature vector of the police situation summary and the police situation instruction feature vector clusters to obtain the target police situation instruction feature vector cluster that best matches the police situation summary;
[0011] Generate a target command and dispatch instruction through the language generation model based on the semantic feature vector of the police situation summary, the best-matching target police situation instruction feature vector cluster, and the police situation information.
[0012] In some embodiments, before the real-time reception of police situation information and inputting the police situation information into the language generation model to generate a police situation summary, it includes:
[0013] Collect historical police situation data, laws and regulations, and local regulations to form an initial instruction data set;
[0014] Preprocess the initial instruction data set to generate a police situation instruction knowledge base;
[0015] Map the police situation instruction texts in the police situation instruction knowledge base to the semantic feature vector space through an embedding model to generate a semantic feature vector library.
[0016] In some embodiments, the real-time reception of police situation information and inputting the police situation information into the language generation model to generate a police situation summary includes:
[0017] Input the real-time received police situation information into the language generation model to guide the language generation model to identify and extract the key content in the police situation information based on preset prompt words;
[0018] Use the self-attention mechanism of the language generation model to analyze the key content and content semantic relevance in the police situation information and generate the police situation summary.
[0019] In some embodiments, the real-time reception of police situation information and inputting the police situation information into the language generation model to generate a police situation summary further includes:
[0020] Through a dynamically generated prompt word template, adaptively adjust the prompt word content according to the type of the police situation information to optimize the recognition of the key content of the police situation information by the language generation model; and combine the weight distribution of the self-attention mechanism to preferentially extract the time, place, and event description in the police situation information to generate a police situation summary containing core elements.
[0021] In some embodiments, the clustering of the semantic feature vectors in the semantic feature vector library to generate multiple police situation instruction feature vector clusters includes:
[0022] Performing semantic similarity analysis on the semantic feature vectors based on a clustering algorithm, classifying the semantic feature vectors with semantic similarity greater than a preset similarity threshold into the same instruction feature vector cluster, and generating multiple groups of the police situation instruction feature vector clusters, where each police situation instruction feature vector cluster corresponds to a group of police situation instructions with similar semantic features.
[0023] In some embodiments, the method of mapping the police situation summary to the semantic feature vector space based on vectorization processing, calculating the similarity between the semantic feature vector of the police situation summary and the police situation instruction feature vector cluster, and obtaining the target police situation instruction feature vector cluster that best matches the police situation summary includes:
[0024] Performing vectorization processing on the police situation summary by using the embedding model to generate a semantic feature vector of the police situation summary;
[0025] Calculating the similarity between the semantic feature vector of the police situation summary and the police situation instruction feature vector cluster based on cosine similarity;
[0026] Determining the target police situation instruction feature vector cluster that best matches the police situation summary according to the similarity result value.
[0027] In some embodiments, the method of generating a target command and dispatch instruction based on the semantic feature vector of the police situation summary, the best-matched target police situation instruction feature vector cluster, and the police situation information through the language generation model includes:
[0028] Constructing a prompt, fusing the semantic feature vector of the police situation summary, the best-matched target police situation instruction feature vector cluster, and the police situation information into input content, and inputting the input content into the language generation model;
[0029] Generating a target command and dispatch instruction corresponding to the police situation information based on the prompt engineering of the language generation model.
[0030] In a second aspect, an embodiment of the present application provides a command and dispatch instruction generation system, including:
[0031] A summary generation module, configured to receive police situation information in real time, input the police situation information into a language generation model to generate a police situation summary;
[0032] A vector clustering module, configured to cluster the semantic feature vectors in the semantic feature vector library to generate multiple police situation instruction feature vector clusters;
[0033] A similarity matching module, configured to map the police situation summary to the semantic feature vector space based on vectorization processing, calculate the similarity between the semantic feature vector of the police situation summary and the police situation instruction feature vector cluster, and obtain the police situation instruction feature vector cluster that best matches the police situation summary;
[0034] An instruction generation module, configured to generate a target command and dispatch instruction through the language generation model based on the semantic feature vector of the police situation summary, the most matching target police situation instruction feature vector cluster, and the police situation information.
[0035] In a third aspect, an embodiment of the present application provides a computer device, which includes a processor and a memory. The memory stores a computer program, and the processor is configured to execute the computer program to implement the command and dispatch instruction generation method in the first aspect above.
[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, and when the computer program is executed on a processor, the command and dispatch instruction generation method in the first aspect above is implemented.
[0037] The embodiments of the present application have the following beneficial effects:
[0038] A command and dispatch instruction generation method, system, computer device, and storage medium of the present application can quickly extract the core elements of police situation information and improve the real-time performance and efficiency of police situation handling by receiving police situation information in real time and using a language generation model to generate a police situation summary. Secondly, by performing clustering analysis on the semantic feature vectors in the semantic feature vector library to generate multiple police situation instruction feature vector clusters, it is possible to effectively manage instruction information in a structured manner, simplify the instruction matching process, and improve the query efficiency. Thirdly, based on vectorization processing, the police situation summary is mapped to the semantic feature vector space, and the most matching target police situation instruction feature vector cluster is quickly selected through similarity calculation, thereby realizing efficient and accurate instruction retrieval. Finally, by combining the semantic feature vector of the police situation summary, the most matching target police situation instruction feature vector cluster, and the real-time police situation information, a prompt is constructed and the language generation model is used to generate a target command and dispatch instruction, which can comprehensively utilize historical data and real-time information to generate a command and dispatch instruction with accurate semantics and strong pertinence. The command and dispatch instruction generation method of the present application significantly improves the accuracy, intelligence, and efficiency of command and dispatch instruction generation, and provides a strong technical guarantee for the rapid response and decision support of emergency police situations. Description of the Drawings
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0040] Figure 1(a) shows an application scenario diagram of a method for generating a command and dispatch instruction according to an embodiment of the present application;
[0041] Figure 1(b) shows another application scenario diagram of a method for generating a command and dispatch instruction according to an embodiment of the present application;
[0042] Figure 2 shows a flowchart of a method for generating a command and dispatch instruction according to an embodiment of the present application;
[0043] Figure 3 shows a schematic diagram of generating a target command and dispatch instruction of a method for generating a command and dispatch instruction according to an embodiment of the present application;
[0044] Figure 4 shows a schematic structural diagram of a command and dispatch instruction generation system according to an embodiment of the present application. Detailed implementation manners
[0045] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments.
[0046] Generally, the components of the embodiments of the present application described and illustrated herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the claimed present application, but merely represents selected embodiments of the present application. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0047] In the following text, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are only intended to represent specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be construed as first excluding the existence or adding the possibility of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items. In addition, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0048] Unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of the present application belong. Terms such as those defined in commonly used dictionaries will be interpreted as having the same meaning as their contextual meaning in the relevant technical field and will not be interpreted as having an idealized or overly formal meaning unless clearly defined in various embodiments of the present application.
[0049] The following will describe in detail some embodiments of the present application with reference to the accompanying drawings. Without conflict, the following embodiments and the features in the embodiments may be combined with each other.
[0050] Considering the problems existing in the prior art, such as complex and error-prone cleaning of police situation data, insufficient utilization of data relevance, inaccurate extraction of specific police situation information, and low efficiency and accuracy of instruction generation, a method for generating command and dispatch instructions is proposed. By receiving police situation information in real time, combining with a language generation model to generate a police situation summary, and using an embedding model to transform the police situation summary into a semantic feature vector, similarity matching is performed with the historical police situation instruction feature vectors optimized by clustering to accurately obtain the instruction information most relevant to the current police situation. Subsequently, based on the police situation summary, historical instruction feature vectors, and classification information, a prompt is constructed to guide the language generation model to generate the target command and dispatch instruction, thereby realizing the intelligence, accuracy, and efficiency of police situation handling, and greatly improving the emergency police situation response speed and instruction generation quality.
[0051] A method for generating command and dispatch instructions provided by an embodiment of the present application can be applied in the following application environments. Specifically, the method for generating command and dispatch instructions of the present application is applied in the computer system shown in FIG. 1(a), and the system includes a client and a server. For example, a user inputs police situation information through the client and encapsulates the police situation information into request data and sends it to the server. After receiving the police situation information, the server first uses a language generation model to process the police situation information and extracts the core content to generate a police situation summary. Subsequently, the server calls an embedding model to map the police situation summary into a semantic feature vector, and calculates the similarity with the police situation instruction feature vector clusters that have been clustered and generated in the semantic feature vector library, and filters out the target police situation instruction feature vector cluster and relevant classification information that best match the current police situation summary. Based on the police situation summary, the most matching target police situation instruction feature vector cluster, and the police situation information, the server constructs a prompt and inputs it into the language generation model again, thereby generating the target command and dispatch instruction. The generated command and dispatch instruction is sent to the client by the server after being processed, and the client displays the instruction content in a visual form, as shown in FIG. 1(b). Through the close cooperation between the client and the server, the full-process processing from police situation information input to accurate instruction generation is realized, significantly improving the efficiency and accuracy of police situation command and dispatch.
[0052] Figure 2 A flow chart of a command and dispatch instruction generation method according to an embodiment of the present application is shown. Exemplarily, the command and dispatch instruction generation method includes the following steps:
[0053] Step S100, receiving the alarm information in real time, and inputting the alarm information into the language generation model to generate the alarm summary.
[0054] Exemplarily, the real-time received police information can be a text description, including relevant information such as time, location, and event. Subsequently, the received police information is passed as input to the language generation model, which extracts key information such as time, location, and nature of the event through semantic analysis and understanding of the text, and generates a concise summary to quickly convey the content of the police information. The generated police summary can provide concise and accurate information support for subsequent police classification, instruction generation, and command and dispatch, thereby improving the efficiency and response speed of police handling.
[0055] In an optional embodiment, before step S100, the alarm information is received in real time, and the alarm information is input into the language generation model to generate an alarm summary, including:
[0056] Collect historical police data, laws, regulations and local regulations to form an initial command data set.
[0057] For example, historical police data includes detailed records of previous cases or events, such as time, location, event type and handling measures; legal and regulatory data covers relevant national and local legal provisions, providing a legal basis for law enforcement and dispatch; local regulations contain rules and regulations related to specific regions to ensure that instruction generation conforms to regional characteristics. These multi-source data are unified and integrated to form a complete set of initial instruction data, laying the foundation for subsequent data processing, feature extraction and instruction generation, and achieving accuracy and standardization in the generation of police instructions.
[0058] Preprocess the initial command data set to generate a warning command knowledge base.
[0059] The initial instruction data set is preprocessed, and the preprocessing steps include removing noise data (e.g., irrelevant fields, redundant information, special characters, etc.), filtering out stop words that are irrelevant to the generation of police instructions (e.g., "的", "了", "是" and other common irrelevant words), and unstructured noise (e.g., special characters or redundant information). At the same time, the TF-IDF (Term Frequency-Inverse Document Frequency) algorithm is applied to process the police texts in the set, screen out the most representative words, remove irrelevant fields, and retain the most important information for the generation of police instructions.
[0060] For example, for a given police situation text d and a word t, calculate its TF-IDF value, that is, calculate the importance of each word:
[0061] TF-IDF(t, d) = TF(t, d) × IDF(t)
[0062] Where: TF(t, d) represents the ratio of the number of occurrences of word t in the police situation text d to the total number of words in the police situation text, reflecting the importance of the word in the police situation text. Its formula is:
[0063]
[0064] IDF(t): Represents the inverse document frequency of word t in the entire police situation text. Its formula is:
[0065]
[0066] By calculating the TF-IDF value of each word, the most representative keywords in the police situation text can be screened out, irrelevant fields can be removed, so as to retain the content that plays a key role in the generation of police situation instructions. These extracted keywords will be recorded in the knowledge base and used as important corpus for subsequent construction of prompt words and classification of police situation instructions.
[0067] After this preprocessing process, the police situation instruction data is stored in the police situation instruction knowledge base as a structured and refined data foundation, providing high-quality data support for subsequent semantic feature vectorization, clustering analysis, and generation of police situation instructions. Through this processing method, the accuracy and practicality of the police situation instruction knowledge base are ensured, and the efficiency and accuracy are greatly improved.
[0068] Map the police situation instruction text in the police situation instruction knowledge base to the semantic feature vector space through an embedding model to generate a semantic feature vector library.
[0069] Exemplarily, through the use of an embedding model to perform semantic feature vectorization processing on the police situation instruction text in the police situation instruction knowledge base, the text-form instructions are mapped to a high-dimensional semantic feature vector space. Specifically, the police situation instruction knowledge base can be represented as a set of police situation instructions D = {d 1 , d 2 ,..., d n}, where d i represents the i-th police situation instruction.
[0070] Using an embedding model E (for example, Word2Vec, BERT, or other pre-trained language models), each police situation instruction d i can be mapped to a k-dimensional semantic feature vector v i :
[0071] v i = E(d i )
[0072] where E represents an embedding model; d i represents the i-th police situation instruction, and the embedding model will convert it into a vector v with k-dimensional features i represents;
[0073] By capturing the semantic relationships and context information in the police situation instruction text, the embedding model generates a unique semantic feature vector for each instruction. Each dimension of the semantic feature vector represents the feature of the instruction text in a certain semantic dimension. Through this process, a semantic feature vector library is generated, which stores the vectorized representations of all police situation instruction texts. This vector library facilitates subsequent similarity calculation and clustering analysis, thus laying a semantic analysis foundation for instruction classification, matching, and generation. This process improves the semantic understanding ability of police situation instructions and realizes the transformation from text information to quantifiable mathematical representation.
[0074] In an optional embodiment, in step S100, the police situation information is received in real time and input into a language generation model to generate a police situation summary, including:
[0075] The police situation information received in real time is input into the language generation model to identify and extract the key content in the police situation information based on a preset prompt word.
[0076] Specifically, by designing a preset prompt word, the language generation model is guided to process the police situation information received in real time. The prompt word is a clear instruction used to help the language generation model focus on the core content in the police situation information. For example, general police situation prompt words: (1) Please briefly summarize the police situation content, including time, location, event description, and action requirements, etc.; (2) Please extract the core content in the police situation information and generate a one-sentence summary. Fire police situation prompt words: (1) Please summarize the occurrence time, location, fire situation, and whether emergency evacuation is required for the fire. (2) Extract the core information related to the fire, such as the fire location, fire scale, and rescue requirements. Traffic accident police situation prompt words: (1) Please extract the time, location, number of vehicles involved, casualties, and traffic impact of the traffic accident. Emergency medical event police situation prompt words: (1) Please describe the time, location, number of injured people, and whether medical support is required for the emergency medical event.
[0077] Through such prompt input, a language model (e.g., a model based on the Transformer architecture) can accurately extract key content from police situation information based on prompt engineering. The prompts can effectively guide the model to identify core elements such as time, location, and event description from the police situation information, making the generated police situation summary clear and targeted. In addition, these prompts can combine with the language model's ability to understand the context semantics of police situation information, thereby generating a police situation summary that meets the actual command and dispatch requirements, providing efficient data support and decision-making basis for subsequent command and dispatch.
[0078] Utilize the self-attention mechanism of the language generation model to analyze the key content and content semantic relevance in police situation information and generate a police situation summary.
[0079] Specifically, the self-attention mechanism is a technology that can measure the mutual relationship between various parts of the input information, and its calculation basis is the following formula:
[0080]
[0081] Among them, Q, K, and V are the matrices of query, key, and value respectively; d k is the dimension of the vector, used for scaling to ensure numerical stability; Calculate the inner product of the query matrix and the key matrix; softmax is a normalization function used to distribute the attention weights over each part of the input content.
[0082] During the analysis process, the police situation information is decomposed into a series of input vectors (e.g., x = {x1, x2... xn}), and the model uses the self-attention mechanism to calculate the semantic relevance between these inputs. By calculating the dot product of QK T , measure the similarity between each input vector and other vectors, and then convert these similarity values into weights through the softmax function. Finally, use these weights to perform weighted summation on the value matrix V to obtain a weighted output vector.
[0083] That is to say, the core of the self-attention mechanism is to dynamically allocate weights and calculate the relevance between different contents according to the context semantic structure of the police situation information. Through the interaction of the query matrix Q, the key matrix K, and the value matrix V, the self-attention mechanism can identify key content such as time, location, event description, and action requirements in the police situation information and assign higher weights to these core information. For example, in the input content, the part describing "the time, location, and fire situation of the fire" may obtain higher attention weights and thus be presented preferentially in the police situation summary.
[0084] Through this mechanism, the language generation model can effectively process complex or lengthy police situation descriptions, highlight the content highly relevant to police situation handling, and generate a concise and accurate police situation summary, providing precise basic information support for subsequent command and dispatch. This ability significantly improves the efficiency and accuracy of police situation information processing, enabling the model to perform better in dynamic and complex police situation scenarios.
[0085] In an alternative implementation, when receiving police situation information in real time and inputting the police situation information into the language generation model to generate a police situation summary, it further includes:
[0086] By means of a dynamically generated prompt template, adaptively adjust the prompt content according to the type of police situation information to optimize the recognition of key content of the police situation information by the language generation model; and in combination with the weight distribution of the self-attention mechanism, preferentially extract the time, location, and event description in the police situation information to generate a police situation summary containing core elements.
[0087] For example, the dynamic prompt template can be automatically adjusted according to the characteristics of different police situation types (such as fires, traffic accidents, robberies, etc.) to ensure that the model preferentially extracts the most relevant core information. For example, the prompt for a fire police situation may emphasize the location of the fire, the fire intensity, and the rescue requirements, while the prompt for a traffic accident focuses on the accident location, time, and traffic impact. At the same time, the self-attention mechanism assigns weights so that key information such as time, location, and event description obtains higher attention weights and is thus preferentially extracted and processed. Combining the functions of the dynamic prompt template and the self-attention mechanism, the language generation model can generate a police situation summary containing core elements, with a clear structure and accurate information, providing efficient support for subsequent command and dispatch.
[0088] Step S200: Cluster the semantic feature vectors in the semantic feature vector library to generate multiple police situation instruction feature vector clusters.
[0089] Exemplarily, by performing cluster analysis on the semantic feature vectors in the semantic feature vector library, vectors with similar semantics are grouped into one set to generate multiple police situation instruction feature vector clusters. The clustering process is based on semantic similarity, using an algorithm (such as KMeans or other clustering algorithms) to classify the features in the vector space, and vectors with high semantic similarity are assigned to the same cluster. Each feature vector cluster represents a set of police situation instructions with similar semantic features. For example, all instructions related to fire handling may be divided into one cluster, and instructions related to traffic accidents are divided into another cluster. Through this process, the police situation instruction data is structured into multiple feature vector clusters, providing a more efficient query and analysis basis for subsequent instruction matching and generation.
[0090] In an alternative embodiment, in step S200, the semantic feature vectors in the semantic feature vector library are clustered to generate multiple alarm instruction feature vector clusters, including:
[0091] Based on a clustering algorithm, semantic similarity analysis is performed on the semantic feature vectors, and the semantic feature vectors with semantic similarity greater than a preset similarity threshold are classified into the same instruction feature vector cluster, generating multiple groups of alarm instruction feature vector clusters. Among them, each alarm instruction feature vector cluster corresponds to a group of alarm instructions with similar semantic features.
[0092] Exemplarily, the vectors stored in the semantic feature vector library are analyzed, and a clustering algorithm (such as KMeans, hierarchical clustering, etc.) is used to classify based on whether the semantic similarity measure between vectors is greater than a preset similarity threshold (such as cosine similarity). For example, instruction A and instruction C both involve fire-related tasks, so their semantic similarity is higher than 0.85 and they are grouped into the same cluster. The core goal of clustering is to divide vectors with similar semantic features into the same group to reflect their semantic consistency in alarm instructions. For example, the semantic feature vectors of alarm instructions related to fires (such as "dispatch the fire brigade", "notify evacuation") may have high similarity and thus be classified into the same vector cluster; while alarm instructions related to traffic accidents (such as "arrange traffic control", "notify medical rescue") form another vector cluster.
[0093] For example, in the implementation process, the KMeans algorithm can be used to cluster and group the semantic feature vectors. Assume that the semantic feature vector library consists of the embedding vectors of each paragraph of multiple source alarm texts, and each embedding vector represents the semantic features of the paragraph. The goal of the KMeans algorithm is to minimize the sum of the squared errors between the vectors within the cluster and the cluster center, and its objective function can be defined as:
[0094]
[0095] where J(C) is the objective function, representing the total sum of squared errors within the cluster, used to measure the quality of the clustering result; k represents the number of clusters, that is, there are a total of k clusters; C i : the i-th cluster; μ i : the centroid of the i-th cluster, x represents the instruction embedding vector belonging to this cluster; ∥x - μ i ∥ 2 represents the square of the Euclidean distance between the data point x and the cluster center μ i .
[0096] The KMeans algorithm iteratively optimizes this objective function to maximize the cohesion within each cluster and minimize the difference across clusters, thereby generating multiple vector clusters with similar semantic features.
[0097] Each cluster of police situation instruction feature vectors represents a group of police situation instructions that are semantically closely related. This classification method can effectively simplify subsequent operations. For example, in the subsequent police situation matching process, applicable historical instructions can be directly retrieved from the cluster of feature vectors most relevant to the current police situation, without traversing and calculating the entire feature vector library, thereby significantly improving the query efficiency and the accuracy of instruction generation. Through this method, police situation instruction data is structured into multiple clusters of feature vectors, facilitating efficient analysis and matching, and ultimately supporting the intelligent processing and command and dispatch of police situations.
[0098] Step S300: Map the police situation summary to the semantic feature vector space based on vectorization processing, and calculate the similarity between the semantic feature vector of the police situation summary and the clusters of police situation instruction feature vectors to obtain the target cluster of police situation instruction feature vectors that best matches the police situation summary.
[0099] Exemplarily, through vectorization processing, the police situation summary is transformed from text form into a semantic feature vector and mapped into the semantic feature vector space for comparison with the clusters of police situation instruction feature vectors. The vectorization of the police situation summary is completed through an embedding model, which can capture the semantic features of the police situation summary and generate high-dimensional feature vectors. Subsequently, using a similarity calculation method (e.g., cosine similarity), the similarity between the semantic feature vector of the police situation summary and the clusters of police situation instruction feature vectors in the semantic feature vector space is compared. Through this process, the target cluster of police situation instruction feature vectors that is closest to the semantic features of the police situation summary can be identified. This most-matched target feature vector cluster represents the set of instructions in historical police situation instructions that are most suitable for the current police situation summary, thus providing a basis for subsequent intelligent instruction generation.
[0100] In an alternative embodiment, in step S300, mapping the police situation summary to the semantic feature vector space based on vectorization processing and calculating the similarity between the semantic feature vector of the police situation summary and the clusters of police situation instruction feature vectors to obtain the target cluster of police situation instruction feature vectors that best matches the police situation summary includes:
[0101] Use the embedding model to perform vectorization processing on the police situation summary to generate the semantic feature vector of the police situation summary.
[0102] The police situation summary is vectorized through an embedding model, converting it from text form to a mathematical representation (i.e., a semantic feature vector). The embedding model is a natural language processing technique (e.g., Word2Vec, BERT, etc.) that can capture semantic relationships and context information in the text. When processing the police situation summary, the embedding model maps each word or the entire sentence in the summary to a high-dimensional vector space to generate a feature vector with semantic meaning. This vector not only retains the key information in the police situation summary (e.g., time, location, event description, etc.) but also can express the semantic relevance between this information. For example, for the police situation summary "A fire occurred in XX Street and the fire was relatively large", the embedding model will generate a high-dimensional vector, and each dimension of the vector represents the eigenvalue of the summary in a certain semantic dimension. This vectorization process enables the police situation summary to participate in mathematical calculations, such as calculating the similarity with historical instruction vectors or classification processing. Through vectorization, the police situation summary is transformed from text content into a numerical form that is easy to process and compare, providing a semantic basis for subsequent police situation matching, classification, and instruction generation.
[0103] Calculate the similarity between the semantic feature vector of the police situation summary and the cluster of police situation instruction feature vectors based on cosine similarity, so as to determine the target police situation instruction feature vector cluster that best matches the police situation summary according to the similarity result value.
[0104] Cosine similarity measures the similarity between two vectors in a vector space by calculating the cosine value of the angle between them. The formula is as follows:
[0105]
[0106] where, v(P i ) and v(P j ) represent the semantic feature vector of the police situation summary and the police situation instruction feature vector respectively; v(P i )·v(P j ) is the dot product of the two vectors, representing the intensity of their common features; ‖v(P i )‖‖v(P j )‖ are the norms (lengths) of each vector, used for normalization calculation.
[0107] Result range: The cosine similarity value is [-1, 1], where: 1 means that the directions of the two vectors are completely the same (high semantic similarity); 0 means that the two vectors are orthogonal (no semantic correlation); -1 means that the directions of the two vectors are completely opposite (completely uncorrelated semantically).
[0108] First, convert the police situation summary into a semantic feature vector v(P i ) through the embedding model, and each vector v(P j)As a comparison object. For the police situation summary vector v(P i ) and each vector v(P j ) in the cluster of feature vectors, calculate the cosine similarity one by one to obtain the similarity value between each instruction feature vector and the police situation summary. According to the similarity result, set a threshold θ. Screen out all police situation instruction feature vectors with a cosine similarity greater than the threshold θ. For each cluster of feature vectors, select all vectors that meet the conditions to form a paragraph set S:
[0109] S = {P j ∣cosine_similarity(v(P i ),v(P j )) > θ}
[0110] In this way, the set S contains all instruction feature vectors that are highly similar to the semantic features of the police situation summary.
[0111] Step S400, based on the police situation summary semantic feature vector, the most matching target police situation instruction feature vector cluster, and the police situation information, generate a target command and dispatch instruction through a language generation model.
[0112] Specifically, the police situation summary semantic feature vector provides the key semantic information of the current police situation. The most matching target police situation instruction feature vector cluster provides instruction templates and empirical data related to historical similar police situations, while the police situation information contains the specific details input in real time. These input information are integrated through preset prompt words and input into the language generation model. The model uses its semantic analysis and generation capabilities, and based on the relevance of the input context and historical instructions, generates a complete command and dispatch instruction. The generated instruction not only accurately reflects the characteristics of the current police situation, but also combines historical experience and real-time requirements, providing fast and efficient decision-making support for actual emergency response, as Figure 3 shown.
[0113] In an optional embodiment, in step S400, based on the police situation summary semantic feature vector, the most matching target police situation instruction feature vector cluster, and the police situation information, generating a target command and dispatch instruction through a language generation model includes:
[0114] Construct prompt words, fuse the police situation summary semantic feature vector, the most matching target police situation instruction feature vector cluster, and the police situation information into input content, and input it into the language generation model.
[0115] Prompt words are the key to guiding language generation models to understand the input content and generate results, and are usually designed as clear task instructions or structured templates. For example, prompt words can include descriptions of the current police situation requirements, references to historical experiences, and specific goals for instruction generation. The semantic feature vector of the police situation summary provides a general semantic representation of the current police situation. The cluster of target police situation instruction feature vectors with the best match contains historical templates related to the current police situation, and the police situation information supplements the specific details of the real-time police situation. By integrating this information into the prompt words, the language generation model can accurately identify the semantic associations of the input content, combine historical experiences and real-time requirements, and generate an efficient, accurate, and practically operable command and dispatch instruction. This process improves the relevance and practicality of the model's generated results and provides strong support for police situation handling.
[0116] Based on the prompt word engineering of the language generation model, generate target command and dispatch instructions corresponding to the police situation information.
[0117] Prompt word engineering is to design specific guiding instructions or templates to help the language generation model understand the context of the input content and the output target. In this method, the prompt words combine the key content of the police situation information (such as time, location, nature of the event, and action requirements) to clarify the generation goal of the command and dispatch instructions. For example, the prompt words can include instructions such as "generate an emergency dispatch instruction based on the following police situation content to ensure timely handling" to help the model focus on extracting and processing the key information in the police situation. Through the guidance of the prompt words, the language generation model can combine the actual needs of the police situation information and generate a complete and highly relevant command and dispatch instruction, such as dispatching rescue forces, implementing evacuations, or coordinating resources. Making full use of the semantic understanding and generation capabilities of the language generation model to ensure that the generated command instructions are targeted and executable helps to respond to police situations quickly and efficiently.
[0118] The command and dispatch instruction generation method of the embodiment of the present application efficiently extracts the core content of complex police situation data by receiving police situation information in real time and generating a police situation summary; uses an embedding model to vectorize the police situation summary, and calculates the similarity through the cluster of police situation instruction feature vectors generated by clustering to quickly obtain the historical instructions most relevant to the current police situation; combines the police situation summary, the cluster of target police situation instruction feature vectors with the best match, and the police situation information to construct prompt words and generate target command and dispatch instructions through the language generation model, realizing the intelligence, precision, and efficiency of command and dispatch instruction generation. The command and dispatch instruction generation method of the embodiment of the present application overcomes the defects of complex parsing, difficult capture of semantic features, cumbersome data cleaning, and low efficiency of command and dispatch instruction generation in traditional methods, effectively improves the response speed of police situation handling and the quality of command and dispatch instruction generation, meets the actual needs of rapid decision-making and efficient dispatching in emergency scenarios, and provides more efficient and intelligent technical support for police situation command and dispatch.
[0119] The present application also provides a command and dispatch instruction generation system. As Figure 4 shown, the system includes:
[0120] An abstract generation module 41, configured to receive alarm information in real time, input the alarm information into a language generation model to generate an alarm abstract;
[0121] A vector clustering module 42, configured to cluster the semantic feature vectors in the semantic feature vector library to generate multiple alarm instruction feature vector clusters;
[0122] A similarity matching module 43, configured to map the alarm abstract to a semantic feature vector space based on vectorization processing, and calculate the similarity between the alarm abstract semantic feature vector and the alarm instruction feature vector clusters to obtain the target alarm instruction feature vector cluster that best matches the alarm abstract;
[0123] An instruction generation module 44, configured to generate a target command and dispatch instruction through the language generation model based on the alarm abstract semantic feature vector, the most matching target alarm instruction feature vector cluster, and the alarm information.
[0124] It can be understood that the system in this embodiment corresponds to the method in the above embodiment, and the optional items in the above embodiment also apply to this embodiment, so they will not be described repeatedly here.
[0125] The present application also provides a computer device. Exemplarily, the computer device includes a processor and a memory. The memory stores a computer program, and the processor runs the computer program to enable the device to execute the functions of the above command and dispatch instruction generation method or each module in the above command and dispatch instruction generation system.
[0126] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a central processing unit (CPU), a graphics processing unit (GPU), a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application.
[0127] The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), etc. Among them, the memory is used to store a computer program, and after receiving an execution instruction, the processor can execute the computer program accordingly.
[0128] This application also provides a computer-readable storage medium for storing the computer program used in the above terminal device. For example, the computer-readable storage medium may include, but is not limited to: various media such as USB flash drives, external hard drives, Read-Only Memory (ROM), Random Access Memory (RAM), magnetic disks, or optical discs that can store program codes.
[0129] In several embodiments provided in this application, it should be understood that the disclosed systems and methods can also be implemented in other ways. The system embodiments described above are merely illustrative. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architectures, functions, and operations of systems, methods, and computer program products according to multiple embodiments of this application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment, or a part of code, and the module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the structure diagram and / or flowchart, as well as the combination of blocks in the structure diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0130] In addition, in each embodiment of this application, the various functional modules or units can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.
[0131] When the above-mentioned functions are implemented in the form of software function modules and sold or used as independent products, they 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 a part of this 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 for causing a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
[0132] The above is only the specific implementation manner of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art within the technical scope disclosed by this application can easily think of changes or substitutions, which should all be covered within the protection scope of this application.
Claims
1. A command and dispatch instruction generation method, characterized in that: The method comprises: Receiving police information in real time, and inputting the police information into a language generation model to generate a police summary; Clustering the semantic feature vectors in the semantic feature vector library to generate multiple alarm command feature vector clusters; Mapping the police situation summary to a semantic feature vector space based on vectorization processing, and calculating the similarity between the semantic feature vector of the police situation summary and the police situation instruction feature vector cluster, to obtain a target police situation instruction feature vector cluster that best matches the police situation summary; Based on the semantic feature vector of the police situation summary, the target police situation instruction feature vector cluster and the police situation information, a target command and dispatch instruction is generated through the language generation model.
2. The command and dispatch instruction generation method according to claim 1, characterized in that: The method further includes receiving the alarm information in real time and inputting the alarm information into a language generation model to generate an alarm summary. Collect historical police data, laws, regulations and local ordinances to form an initial instruction data set; Preprocessing the initial command data set to generate a warning command knowledge base; The police instruction text in the police instruction knowledge base is mapped to the semantic feature vector space through an embedding model to generate the semantic feature vector library.
3. The command and dispatch instruction generation method according to claim 1, characterized in that: The real-time receiving of the alarm information and inputting the alarm information into the language generation model to generate the alarm summary include: Inputting the real-time received alarm information into the language generation model, so as to guide the language generation model to identify and extract key content in the alarm information based on preset prompt words; The self-attention mechanism of the language generation model is utilized to analyze the key content and content semantic relevance in the police information to generate the police summary.
4. The command and dispatch instruction generation method according to claim 3, characterized in that: The real-time receiving of the alarm information and inputting the alarm information into the language generation model to generate the alarm summary also includes: Through the dynamically generated prompt word template, the prompt word content is adaptively adjusted according to the type of the police information to optimize the language generation model's recognition of the key content of the police information; and combined with the weight distribution of the self-attention mechanism, the time, place and event descriptions in the police information are preferentially extracted to generate a police summary containing core elements.
5. The command and dispatch instruction generation method according to claim 1, characterized in that: The method of clustering the semantic feature vectors in the semantic feature vector library to generate multiple alarm command feature vector clusters includes: A semantic similarity analysis is performed on the semantic feature vectors based on a clustering algorithm, and the semantic feature vectors with semantic similarity greater than a preset similarity threshold are classified into the same instruction feature vector cluster, thereby generating a plurality of groups of the warning instruction feature vector clusters, wherein each of the warning instruction feature vector clusters corresponds to a group of warning instructions with similar semantic features.
6. The command and dispatch instruction generation method according to claim 1, characterized in that: The vectorization-based processing maps the police summary to a semantic feature vector space, and calculates the similarity between the semantic feature vector of the police summary and the police instruction feature vector cluster to obtain the target police instruction feature vector cluster that best matches the police summary, including: Vectorizing the police summary using an embedding model to generate a semantic feature vector of the police summary; Calculating the similarity between the semantic feature vector of the police situation summary and the feature vector cluster of the police situation instruction based on cosine similarity; The target alarm instruction feature vector cluster that best matches the alarm summary is determined according to the similarity result value.
7. The command and dispatch instruction generation method according to claim 1, characterized in that: The generating a target command and dispatch instruction through the language generation model based on the semantic feature vector of the police situation summary, the most matching target police situation instruction feature vector cluster and the police situation information includes: Construct prompt words, merge the semantic feature vector of the police situation summary, the most matching target police situation instruction feature vector cluster and the police situation information as input content, and input it into the language generation model; Based on the prompt word engineering of the language generation model, a target command and dispatch instruction corresponding to the alarm information is generated.
8. A command and dispatch instruction generation system, characterized in that: The system comprises: A summary generation module, used for receiving the alarm information in real time and inputting the alarm information into the language generation model to generate a alarm summary; A vector clustering module is used to cluster the semantic feature vectors in the semantic feature vector library to generate multiple alarm command feature vector clusters; A similarity matching module is used to map the police summary to a semantic feature vector space based on vectorization processing, and calculate the similarity between the semantic feature vector of the police summary and the police instruction feature vector cluster to obtain the target police instruction feature vector cluster that best matches the police summary; The instruction generation module is used to generate a target command and dispatch instruction through the language generation model based on the semantic feature vector of the police situation summary, the most matching target police situation instruction feature vector cluster and the police situation information.
9. A computer device, characterized in that: The computer device includes a processor and a memory, the memory stores a computer program, and the processor is used to execute the computer program to implement the command and dispatch instruction generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: It stores a computer program, which, when executed on a processor, implements the command and dispatch instruction generation method according to any one of claims 1-7.
Citation Information
Cited By
Scheduling instruction security verification method and system based on three-layer linkage mechanism
CN121257527A