Urban scene safety field text question and answer method and system

Through automated corpus extraction and thinking chain derivation mechanisms, a security knowledge graph is built, which solves the difficulty and accuracy of knowledge extraction of text Q&A solutions in the security field of urban market scenarios, and realizes a deep understanding of the text of safe scenes and improves security management. Efficiency and early warning accuracy.

CN119106118AInactive Publication Date: 2024-12-10THE ACAD OF TIANJIN UNIV HEFEI
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411070789.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-06
Publication Date
2024-12-10
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing text Q&A program in the security field of urban markets has the problems of high difficulty in extracting knowledge, slow response speed, low accuracy, poor interpretability, and inference methods that do not conform to rigorous security thinking logic, and it is difficult to meet actual needs.

Method used

Using automated corpus extraction, urban security field knowledge base and thinking chain derivation mechanism, we can collect and preprocess urban industry data sources, build a security knowledge graph, and use attention interaction network and thinking chain derivation model to generate answers to achieve the text of security scenarios. Deep understanding and intelligent Q&A.

Benefits of technology

Achieve deep understanding and intelligent Q&A of the text of security scenes, has strong generalization capabilities and interpretability, can handle complex security scene texts, provide clear and accurate answers, optimize and improve security management efficiency and level, and enhance security early warning. Accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119106118A_ABST
    Figure CN119106118A_ABST
Patent Text Reader

Abstract

The invention relates to a city scene safety field text question and answer method and system. The city scene security domain text question and answer method comprises the steps of collecting a city industry data source and preprocessing the city industry data source to obtain a first city security domain text; encoding the first city security domain text, importing the first city security domain text into a preset attention interaction network, and automatically extracting to obtain a first city security domain corpus; and performing structured processing on the first city safety corpus to obtain a second city safety field corpus, and constructing a city safety field knowledge base according to the second city safety field corpus and multivariate information data. According to the method, the key information and the resource position information in the text can be automatically identified, the thinking chain is constructed based on the key information and the resource position information, the answer to the question is gradually deduced, deep understanding and intelligent question answering of the security scene text are realized, and powerful guarantee is provided for city security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of text question answering, and in particular, to a method and system for text question answering in the field of urban scene safety. Background Art

[0002] The construction of traditional knowledge models mainly relies on the domain knowledge and experience of experts, combined with mathematical statistics and logical reasoning, to form a series of rule-based knowledge representation and reasoning methods. With the rapid development of big data and computing power, deep learning methods have begun to emerge in the construction of knowledge models. In recent years, with the rapid development of natural language processing (NLP) technology, the Transformer model has become the new favorite for the construction of knowledge models. The Transformer model realizes global dependency modeling of sequence data through the self-attention mechanism, which not only improves the expression and generalization capabilities of the model, but also can handle complex tasks such as long texts and cross-language. Through pre-training on a large-scale corpus, it has achieved significant performance improvements in many NLP tasks and promoted the application and development of knowledge models in the field of NLP.

[0003] In related technologies, with the acceleration of urbanization and the increasing demand for safety, the importance of text question-and-answer solutions for safety scenarios has become increasingly prominent. The big safety risk model is an important core in the base layer of the risk map, but existing technologies have problems such as high difficulty in extracting multi-source heterogeneous knowledge, slow response speed, low accuracy, poor interpretability, and reasoning methods that do not conform to rigorous safety thinking logic, making it difficult to meet actual needs.

[0004] Therefore, the above-mentioned text question-and-answer solution in the field of urban scene safety provided in the relevant technology has limitations, resulting in inaccurate text responses given when responding to user question requests, and there is room for further improvement. Summary of the invention

[0005] The present application provides a method and system for text question and answering in the field of urban scene safety, so as to at least solve the problem that the text question and answer solutions in the field of urban scene safety in the related technology have limitations, resulting in inaccurate text replies when responding to user question requests, and there is room for further improvement.

[0006] In a first aspect, the present application provides a text question answering method in the field of urban scene safety, the method comprising:

[0007] Collecting city industry data sources and preprocessing the city industry data sources to obtain first city security field text;

[0008] Encoding the first city safety domain text, and importing the first city safety domain text into a preset attention interaction network to automatically extract the first city safety domain corpus;

[0009] Structurally processing the first urban safety corpus to obtain a second urban safety domain corpus, and constructing an urban safety domain knowledge base based on the second urban safety domain corpus and multivariate information data;

[0010] A thought chain deduction model is constructed based on the urban safety domain knowledge base and deployed to the urban safety business scenario. When responding to user requests, a search is performed in the urban safety domain knowledge base and an answer is generated through the thought chain deduction model.

[0011] Optionally, the preprocessing includes: removing redundant information, performing word segmentation and part-of-speech tagging.

[0012] Optionally, encoding the first city safety domain text, and importing the first city safety domain text into a preset attention interaction network to extract high-quality first city safety domain corpus includes:

[0013] Capturing sequence information and context dependency in the first city security domain text, and encoding the first city security domain text according to the sequence information and the context dependency to obtain a second city security domain text;

[0014] Performing attention weight allocation calculation on the second city safety field text to obtain attention weight data between different text parts in the second city safety field text;

[0015] The first city safety domain corpus is extracted from the second city safety domain text according to the second city safety domain text and the attention weight data.

[0016] Optionally, constructing a knowledge base in the field of urban safety based on the second urban safety corpus and multivariate information data includes:

[0017] Based on the second urban safety domain corpus and multivariate information data, construct a knowledge element and entity relationship network in the urban safety domain;

[0018] Importing the knowledge element and the entity relationship network into a preset security knowledge graph for weighted fusion to generate a security knowledge graph;

[0019] A knowledge representation model is constructed based on the security knowledge graph, and the knowledge elements are imported into the knowledge representation model for classification and association during knowledge integration to form a knowledge base in the field of urban security.

[0020] Optionally, the multivariate information data includes: advice and guidance from experts in the field of urban safety, policies and regulations, standard procedures, accident case analysis, equipment maintenance and emergency response measures.

[0021] Optionally, the entity relationship network is expressed as:

[0022]

[0023] In the formula, E t Represents the entity at time t; R t Represents the relationship at time t; A t represents the attribute set at time t; e t Indicates a newly added entity; r t Indicates a newly added relationship; a t Indicates a newly added attribute.

[0024] Optionally, the graph attention network is expressed as:

[0025]

[0026] In the formula, α ij Represents the attention weight obtained after normalization; and are the representations of nodes i and j respectively; W represents the shared parameters of the projection matrix, which is used to increase the dimension of the features of each vertex; || means that the features are concatenated and then mapped with a to obtain the correlation coefficient between each vertex; k is the attention coefficient; LeakyRelu represents the loss function, which allows small negative gradients to pass.

[0027] Optionally, the urban safety domain knowledge is constructed, and then,

[0028] The updated second city safety corpus and multivariate information data are regularly imported into the city safety domain knowledge base to dynamically update the city safety domain knowledge base.

[0029] In a second aspect, the present application provides a text question answering system in the field of urban scene safety, the system comprising:

[0030] A data collection module, used for collecting and preprocessing urban industry data sources to obtain a first urban safety field text;

[0031] A corpus extraction module is used to encode the first city safety field text, and import the first city safety field text into a preset attention interaction network to extract the first city safety field corpus;

[0032] A knowledge base construction module, configured to obtain a second urban safety domain corpus by structurally processing the first urban safety domain corpus, and to construct an urban safety domain knowledge base based on the second urban safety domain corpus and multivariate information data;

[0033] The text answer generation module is used to build a thought chain deduction model based on the urban security field knowledge base and deploy it to the urban security business scenario. When responding to user requests, it performs retrieval in the urban security field knowledge base and generates text answers through the thought chain deduction model.

[0034] In a third aspect, the present application provides an electronic device, comprising: a memory, a processor, and

[0035] A computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the text question-answering method in the field of urban scene safety provided in the first aspect is implemented.

[0036] Compared with related technologies, the urban scene safety field text question answering method and system provided by this application have at least the following technical effects:

[0037] Through automated corpus extraction, urban safety knowledge base and thought chain deduction mechanism, it can automatically identify key information and resource location information in the text, build a thought chain based on this information, and gradually deduce the answers to the questions, thus achieving a deep understanding of the safety scenario text and intelligent question and answer. At the same time, it also has strong generalization ability and interpretability, can handle various complex safety scenario texts, and provide users with clear and accurate answers. In this way, it optimizes and improves the efficiency and level of safety management, enhances the accuracy of safety warnings, and provides strong guarantees for urban safety.

[0038] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0040] Figure 1 is a flow chart of a text question-answering method in the field of urban scene safety according to an exemplary embodiment;

[0041] Figure 2 is a flowchart of step S102 according to an exemplary embodiment;

[0042] Figure 3 is a flowchart of step S103 according to an exemplary embodiment;

[0043] Figure 4 is a flowchart of step S104 according to an exemplary embodiment;

[0044] Figure 5 It is a block diagram of a text question-answering system in the field of urban scene safety according to an exemplary embodiment.

[0045] Figure 6 An output example is generated for a security scenario solution according to an exemplary embodiment. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0047] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.

[0048] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0049] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantitative limitation, and may represent the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0050] In related technologies, with the acceleration of urbanization and the increasing demand for safety, the importance of text question-and-answer solutions for safety scenarios has become increasingly prominent. The big model of safety risk is an important core in the base layer of the risk map, but existing technologies have problems such as high difficulty in extracting knowledge from multiple sources and heterogeneity, slow response speed, low accuracy, poor interpretability, and reasoning methods that do not conform to rigorous safety thinking logic, making it difficult to meet actual needs.

[0051] Based on the above situation, an embodiment of the present invention provides a text question-answering method and system in the field of urban scene safety, which is described in detail below in conjunction with specific embodiments and drawings.

[0052] Example 1

[0053] An embodiment of the present invention provides a text question-answering method in the field of urban scene safety. Figure 1 FIG. 1 is a flow chart of a text question-answering method in the field of urban scene safety according to an exemplary embodiment. Figure 1 As shown, the method includes:

[0054] S101, collecting city industry data sources and preprocessing the city industry data sources to obtain a first city security field text;

[0055] In this embodiment, the urban industry data source is unstructured data, and the preprocessing includes: removing redundant information, performing word segmentation and part-of-speech tagging, thereby realizing the automatic collection, knowledge extraction, screening, conversion, cleaning, classification and marking of unstructured data, which not only ensures the high quality and accuracy of the extracted corpus, but also greatly improves the efficiency of corpus extraction, providing a data basis for subsequent knowledge base construction and model training.

[0056] S102, encoding the first city safety domain text, and importing the first city safety domain text into a preset attention interaction network to automatically extract and obtain the first city safety domain corpus;

[0057] Specifically, Figure 2 is a flowchart of step S102 according to an exemplary embodiment; Figure 2 , step S102 includes:

[0058] S1021, capturing sequence information and context dependency in the first city security domain text, and encoding the first city security domain text according to the sequence information and the context dependency to obtain a second city security domain text;

[0059] S1022, performing attention weight allocation calculation on the second city safety field text to obtain attention weight data between different text parts in the second city safety field text;

[0060] S1023. Extract the first city safety domain corpus from the second city safety domain text based on the second city safety domain text and the attention weight data.

[0061] S103, performing structured processing on the first city safety corpus to obtain a second city safety domain corpus, and constructing a city safety domain knowledge base based on the second city safety domain corpus and multivariate information data;

[0062] Specifically, Figure 3 is a flowchart of step S103 according to an exemplary embodiment; Figure 3 , step S103 includes:

[0063] S1031. Structurally process the first city safety corpus to obtain a second city safety domain corpus;

[0064] S1032. Constructing a knowledge element and entity relationship network in the field of urban safety based on the second urban safety field corpus and multivariate information data;

[0065] In this embodiment, the multi-dimensional information data includes: suggestions and guidance from experts in the field of urban safety, policies and regulations, standard procedures, accident case analysis, equipment maintenance and emergency response measures.

[0066] Specifically, the entity relationship network is expressed as:

[0067]

[0068] In the formula, E t Represents the entity at time t; R t Represents the relationship at time t; A t represents the attribute set at time t; e t Indicates a newly added entity; r t Indicates a newly added relationship; a t Indicates a newly added attribute.

[0069] In this embodiment, combined with entity relationship network expression, NLP toolkit (Jieba word segmentation) is used for word segmentation, part-of-speech tagging, and named entities, and entity relationship networks are used to identify the relationship between entities in the corpus text. On the basis of structured knowledge extraction, entities, relationships, and attributes are converted into text sequences; at the same time, word embedding technology (Word2Vec) is used to convert the words and sentences of relationships and entities into vector representations. The text vector and its metadata information are imported into the vector database, and the corresponding index vector database is established. Using efficient index structure and query algorithm, it can quickly search according to vector similarity.

[0070] S1033, importing the knowledge element and the entity relationship network into a preset security knowledge graph for weighted fusion to generate a security knowledge graph;

[0071] In this embodiment, the security knowledge graph has a graph attention network inside. The graph attention network is a neural network algorithm for processing graph structure data. It can assign different attention weights according to the relationship between nodes in the graph, so as to better capture the dependency relationship between nodes in the graph. When new knowledge is updated into the knowledge graph, the entities, relationships and attributes in the graph will change. Therefore, the graph attention network learns the associations between the representations of the same entities or relationships in different new and old knowledge graphs, and assigns weights to these associations; when users ask questions later, the model will search for text vectors similar to the question vector in the vector database.

[0072] The graph attention network is expressed as:

[0073]

[0074] In the formula, α ij Represents the attention weight obtained after normalization; and are the representations of nodes i and j respectively; W represents the shared parameters of the projection matrix, which is used to increase the dimension of the features of each vertex; || means that the features are concatenated and then mapped with a to obtain the correlation coefficient between each vertex; k is the attention coefficient; LeakyRelu represents the loss function, which allows small negative gradients to pass.

[0075] Using these weights, we perform weighted fusion on entity and relationship representations from different knowledge graphs, update the knowledge graph to obtain a new, fused knowledge graph representation, capture semantic information and graph structure information at different levels, and complete a deeper update of the knowledge graph, so that the security knowledge graph has good scalability to adapt to knowledge graph data of different sizes and types.

[0076] S1034, constructing a knowledge representation model based on the safety knowledge graph, and importing the knowledge elements into the knowledge representation model for classification and association during knowledge integration to form a knowledge base in the field of urban safety;

[0077] In this embodiment, knowledge engineering technology is combined with security knowledge graphs to build a knowledge base architecture and design reasonable knowledge representation models, such as ontology, knowledge graphs, etc., to graphically display the internal connections and logical structures between various types of knowledge, establish a strict ontology and attribute system, clarify the definitions of concepts, relationships and rules, and ensure the standardization and consistency of the knowledge base. At the same time, in the knowledge integration stage, structured knowledge elements are imported into the knowledge representation model for classification and association, forming a comprehensive and logically rigorous knowledge base in the field of urban safety.

[0078] Furthermore, in this embodiment, the corpus of the urban safety knowledge base covers a wide range of content, from policies and regulations, standard procedures, accident case analysis to equipment maintenance, emergency response measures, etc. After word segmentation, relationship extraction, and attribute extraction, a comprehensive, logically rigorous, and dynamically updated safety knowledge graph is formed, and an index-efficient text vector library is formed. In addition, this technical solution further expands the scope of research, and can generate a professional terminology list in the field of urban safety, further enriching the content of the urban safety knowledge base, and providing more comprehensive knowledge support for the thinking chain derivation model.

[0079] Further, after constructing the knowledge in the field of urban safety,

[0080] A dynamic update mechanism and an attention interaction network are introduced to regularly extract and obtain the first city safety domain corpus, structure the first city safety domain corpus, update the second city safety domain corpus and multi-information data, and regularly use the updated second city safety domain corpus and multi-information data as training input data to regularly update the city safety domain knowledge base, thereby realizing dynamic updating of data and continuous training and improvement.

[0081] S104: construct a thought chain deduction model based on the urban safety domain knowledge base and deploy it to the urban safety business scenario. When responding to user requests, perform a search in the urban safety domain knowledge base and generate an answer through the thought chain deduction model.

[0082] Specifically, Figure 4 is a flowchart of step S104 according to an exemplary embodiment; Figure 4 , step S104 includes:

[0083] S1041. Use large-scale data sets to train basic language models, such as language models based on the Transformer architecture;

[0084] S1042. Introduce chain of thought technology (CoT) into the basic language model, construct a chain of thought deduction model, so that the chain of thought deduction model can generate a chain of thought containing reasoning steps and conclusions through semantic analysis and syntactic parsing. Specifically, the chain of thought can simulate the human thinking process, provide a clear reasoning path for the model, and effectively enhance the accuracy and generalization ability of the chain of thought deduction model; and for specific tasks, fine-tune the trained basic language model, and by building a domain sub-knowledge base, designing retrieval strategies, etc., the chain of thought deduction model can more accurately utilize urban safety domain knowledge;

[0085] S1043, deploy the optimized thought chain deduction model to the urban security field scenario, respond to user requests in real time, perform retrieval in the urban security field knowledge base and generate answers through the thought chain deduction model. Through continuous iterative optimization, the model performance and user experience are improved, promoting the implementation and innovation of artificial intelligence in multiple vertical fields.

[0086] In this embodiment, the two mechanisms of retrieval and generation are combined. When faced with complex security issues, the model can retrieve relevant information from the constructed urban security field knowledge base in real time, and combine its existing language understanding and generation capabilities to provide users with accurate and professional answers and solutions. At the same time, in order to better meet the security needs of the urban security industry, the large language model fine-tuning technology is used to fine-tune the existing large language model (LLM) to the urban security industry, forming an overall method for the security vertical field. This method not only inherits the powerful capabilities of LLM, but also has professional knowledge and skills in the field of urban security, and can better understand and handle tasks and problems related to urban security.

[0087] To sum up, the urban scene safety field text question and answer method provided by the embodiment of the present invention can automatically identify key information and resource location information in the text through automatic corpus extraction, urban safety field knowledge base and thought chain deduction mechanism, and build a thought chain based on the key information and resource location information, and gradually derive the answer to the question, thereby realizing a deep understanding of the safety scene text and intelligent question and answer. At the same time, it also has strong generalization ability and interpretability, can handle various complex safety scene texts, and provide users with clear and accurate answers. In this way, it optimizes and improves the efficiency and level of security management, enhances the accuracy of security warnings, and provides strong protection for urban safety.

[0088] Example 2

[0089] Embodiment 2 of the present invention provides a text question-answering system in the field of urban scene safety. Figure 5 FIG. 1 is a block diagram of a text question answering system in the field of urban scene safety according to an exemplary embodiment. Figure 5 As shown, the present application provides a text question answering system in the field of urban scene safety, the system comprising:

[0090] The data collection module 201 is used to collect the city industry data source and pre-process the city industry data source to obtain the first city security field text;

[0091] A corpus extraction module 202 is used to encode the first city safety field text, and import the first city safety field text into a preset attention interaction network to extract the first city safety field corpus;

[0092] Specifically, refer to the attached Figure 5 ,The attention interaction network includes: encoding layer, hybrid common attention layer and interaction prediction layer;

[0093] The encoding layer is used to capture the sequence information and context dependency in the first city safety domain text, and encode the first city safety domain text according to the sequence information and the context dependency to obtain the second city safety domain text represented by a high-dimensional vector;

[0094] The hybrid common attention layer is used to perform attention weight allocation calculation on the second city safety field text to obtain attention weight data between different text parts in the second city safety field text;

[0095] The interactive prediction layer is used to extract high-quality corpus in the safety field of the first city from the safety field text of the second city based on the safety field text of the second city and the attention weight data;

[0096] The knowledge base construction module 203 is used to obtain a second urban safety domain corpus by structurally processing the first urban safety domain corpus, and to construct an urban safety domain knowledge base based on the second urban safety domain corpus and multivariate information data;

[0097] The text answer generation module 204 is used to build a thought chain deduction model based on the urban security field knowledge base and deploy it to the urban security business scenario. When responding to user requests, it performs retrieval in the urban security field knowledge base and generates a text answer through the thought chain deduction model.

[0098] Specifically, the urban scene safety field text question answering method uses NVIDIA V100 Tensor Core GPU, and the model code is built based on Python and Pytorch framework. The initial value of the model learning rate is about 0.02, and it changes with the increase of the number of iterations. The change formula is:

[0099]

[0100] In the formula, step is the current training number; epoch is the total number of training times, α is the empirical parameter, and Lr is the learning rate. Since the data set is small, this time the total number of iterations is set to 100.

[0101] 1. Evaluation indicators

[0102] This embodiment uses automated corpus extraction technology and generates a test data set based on the recommendations of domain experts. Imitating general text model industry standards, the test set covers question and answer generation, multiple-choice sorting, and reasoning. For the multiple-choice sorting task, the goal is to select the most appropriate response operation from a given set of security scenario operations based on the provided context. The criterion is the normalized likelihood of the number of characters in the solution generation result. The likelihood formula can be expressed as:

[0103] P(completion|context) / P(completion|"Answer:")

[0104] Where P(completion|“Answer:”) is the probability that the model gives a correct answer when only the answer context is given, which is used for normalization; and P(completion|context) is the probability that the model gives a correct answer when a specific context is given.

[0105] 2. Experimental performance comparison

[0106] The method proposed in this embodiment is evaluated and compared with the most advanced method currently. Table 1 shows the comparative experimental results of the method. It can be seen that the two error performances of this embodiment on a specific power data set are better than those of other methods or models, and a good prediction effect is achieved.

[0107] Table 1. Comparative experimental results of security scenario solution generation

[0108] Model / parameter quantity 0-shot 1-shot 5-shot 64-shot GPT3 / 174B 14.4 23.0 - 29.7 Gopher / 281B 10.2 - 24.6 28.2 Chinchilla / 70B 16.1 - 31.4 35.5 PaLM / 8B 8.4 10.7 - 14.3 PaLM / 62B 18.1 26.4 - 27.5 PaLM / 542B 18.2 29.3 - 39.4 RLSM(Ours) / 7B 13.6 15.6 18.7 22.2 RLSM(Ours) / 15B 25.2 27.8 33.1 37.0 RLSM(Ours) / 22B 24.5 32.4 36.0 36.6

[0109] For 1-shot and 5-shot tests, the testing method is to provide 1 or 5 text examples generated by safety scenarios as input to the system for pattern learning, and at the same time input a test question about the safety scenario. The system then uses the above text as input to generate the text of the solution. It is understandable that for 0-shot, no examples are provided, only the generation task description and test question are provided, and the model generates the solution in an open manner.

[0110] It can be seen from the experimental results table (Table 1) that this system has better generation effects on questions and answers of security scenario solutions under the same or similar model parameters. The present application can use smaller model parameters to obtain similar generation effects as general models with large parameters. Especially for 0-shot problems, this system has achieved better test performance due to the combination of knowledge vectors extracted from the security field knowledge base. At the same time, due to the professional domain knowledge construction and thinking chain training of the knowledge graph for urban safety scenarios, this system can achieve good question and answer effects under the premise of a small number of model parameters, thereby greatly reducing the deployment hardware cost and reducing computing resource requirements, while facilitating the expansion of the question and answer system in a distributed environment. Refer to the attached Figure 6 , Figure 6 This is an example of generating an output of a security scenario solution according to an exemplary embodiment. The example of generating an output of a security scenario solution of this system has good generation effect and test performance.

[0111] The urban scene safety field text question and answer system provided in Example 2 of the present invention can automatically identify key information and resource location information in the text through automatic corpus extraction, urban safety field knowledge base and thought chain deduction mechanism, and build a thought chain based on the key information and resource location information, and gradually derive the answers to the questions, thereby achieving a deep understanding of the safety scene text and intelligent question and answer. At the same time, it also has strong generalization ability and interpretability, can handle various complex safety scene texts, and provide users with clear and accurate answers. In this way, it optimizes and improves the efficiency and level of security management, enhances the accuracy of security warnings, and provides strong protection for urban safety.

[0112] Example 3

[0113] Embodiment 3 of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the text question-and-answer method in the field of urban scene safety provided in the first aspect above when executing the computer program.

[0114] In a possible implementation, the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of the urban scene safety field text question and answer method in Example 1.

[0115] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.

[0116] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0117] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A text question answering method in the field of urban scene safety, characterized in that: The method comprises: Collecting city industry data sources and preprocessing the city industry data sources to obtain first city security field text; Encoding the first city safety domain text, and importing the first city safety domain text into a preset attention interaction network to automatically extract the first city safety domain corpus; Structurally processing the first urban safety corpus to obtain a second urban safety domain corpus, and constructing an urban safety domain knowledge base based on the second urban safety domain corpus and multivariate information data; A thought chain deduction model is constructed based on the urban safety domain knowledge base and deployed to the urban safety business scenario. When responding to user requests, a search is performed in the urban safety domain knowledge base and an answer is generated through the thought chain deduction model.

2. The text question answering method according to claim 1, characterized in that: The preprocessing includes: removing redundant information, performing word segmentation and part-of-speech tagging.

3. The text question answering method according to claim 1, characterized in that: The encoding process of the first city safety domain text and importing the first city safety domain text into a preset attention interaction network to extract high-quality first city safety domain corpus includes: Capturing sequence information and context dependency in the first city security domain text, and encoding the first city security domain text according to the sequence information and the context dependency to obtain a second city security domain text; Performing attention weight allocation calculation on the second city safety field text to obtain attention weight data between different text parts in the second city safety field text; The first city safety domain corpus is extracted from the second city safety domain text according to the second city safety domain text and the attention weight data.

4. The text question answering method according to claim 1, characterized in that: The step of constructing a knowledge base in the field of urban safety based on the second urban safety corpus and the multivariate information data includes: Based on the second urban safety domain corpus and multivariate information data, construct a knowledge element and entity relationship network in the urban safety domain; Importing the knowledge element and the entity relationship network into a preset security knowledge graph for weighted fusion to generate a security knowledge graph; A knowledge representation model is constructed based on the security knowledge graph, and the knowledge elements are imported into the knowledge representation model for classification and association during knowledge integration to form a knowledge base in the field of urban security.

5. The text question answering method according to claim 4, characterized in that: The multi-dimensional information data includes: advice and guidance from experts in the field of urban safety, policies and regulations, standard procedures, accident case analysis, equipment maintenance and emergency response measures.

6. The text question answering method according to claim 4, characterized in that: The entity relationship network is expressed as: In the formula, E t Represents the entity at time t; R t Represents the relationship at time t; A t represents the attribute set at time t; e t Indicates a newly added entity; r t Indicates a newly added relationship; a t Indicates a newly added attribute.

7. The text question answering method according to claim 4, characterized in that: The graph attention network is expressed as: In the formula, α ij Represents the attention weight obtained after normalization; and are the representations of nodes i and j respectively; W represents the shared parameters of the projection matrix, which is used to increase the dimension of the features of each vertex; || means that the features are concatenated and then mapped with a to obtain the correlation coefficient between the vertices; k is the attention coefficient; LeakyRelu represents the loss function, which allows small negative gradients to pass.

8. The text question answering method according to claim 1, characterized in that: After constructing the urban safety domain knowledge, The updated second city safety corpus and multivariate information data are regularly imported into the city safety domain knowledge base to dynamically update the city safety domain knowledge base.

9. A text question answering system in the field of urban scene safety, characterized in that: The system comprises: A data collection module, used for collecting and preprocessing urban industry data sources to obtain a first urban safety field text; A corpus extraction module is used to encode the first city safety field text, and import the first city safety field text into a preset attention interaction network to extract the first city safety field corpus; A knowledge base construction module, configured to obtain a second urban safety domain corpus by structurally processing the first urban safety domain corpus, and to construct an urban safety domain knowledge base based on the second urban safety domain corpus and multivariate information data; The text answer generation module is used to build a thought chain deduction model based on the urban security field knowledge base and deploy it to the urban security business scenario. When responding to user requests, it performs retrieval in the urban security field knowledge base and generates text answers through the thought chain deduction model.

10. An electronic device, characterized in that: include: Memory; processor; And a computer program stored on the memory and executable on the processor, wherein when the processor executes the computer program, the text question-answering method in the field of urban scene safety as described in any one of claims 1 to 8 is implemented.

Citation Information

Cited By

  • Generative large model-based power network security intelligent consultation system

    CN119886326A