[go: up one dir, main page]

CN118797072A - Question-and-answer based network topology map generation method, device, medium and product - Google Patents

Question-and-answer based network topology map generation method, device, medium and product Download PDF

Info

Publication number
CN118797072A
CN118797072A CN202410541554.6A CN202410541554A CN118797072A CN 118797072 A CN118797072 A CN 118797072A CN 202410541554 A CN202410541554 A CN 202410541554A CN 118797072 A CN118797072 A CN 118797072A
Authority
CN
China
Prior art keywords
network topology
data
text
topology map
question
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410541554.6A
Other languages
Chinese (zh)
Inventor
丁志刚
祁亚楠
董昭
卜忠贵
冯征
肖子玉
王小捷
许菁
宋小明
陶曦玥
欧阳皓洁
陈�胜
杨彬
朱黎黎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Group Design Institute Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Design Institute Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Group Design Institute Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202410541554.6A priority Critical patent/CN118797072A/en
Publication of CN118797072A publication Critical patent/CN118797072A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/36Creation of semantic tools, e.g. ontology or thesauri
    • G06F16/367Ontology
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/3331Query processing
    • G06F16/334Query execution
    • G06F16/3344Query execution using natural language analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/151Transformation
    • G06F40/154Tree transformation for tree-structured or markup documents, e.g. XSLT, XSL-FO or stylesheets

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Animal Behavior & Ethology (AREA)
  • Machine Translation (AREA)

Abstract

本发明公开了一种基于问答的网络拓扑图生成方法、装置、介质及产品,根据用户输入的交互数据进行自动问答,生成对话数据;将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,得到拓扑图结构化数据;根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件;加载和渲染所述XML文件得到网络拓扑图。本申请方案网络拓扑图的生成无需依赖SSH命令,兼容性高,灵活性高,速度更快。

The present invention discloses a method, device, medium and product for generating a network topology map based on question and answer, which automatically asks and answers questions according to the interactive data input by the user to generate dialogue data; the entities and intentions in the automatic dialogue data are respectively mapped to the nodes and connection relationships in the topology map to obtain the structured data of the topology map; an XML document of the topology map is created according to the dom4j parsing package, the structured data of the topology map is added to the XML document to generate an XML file; the XML file is loaded and rendered to obtain the network topology map. The generation of the network topology map of the present application solution does not need to rely on SSH commands, has high compatibility, high flexibility and faster speed.

Description

基于问答的网络拓扑图生成方法、装置、介质及产品Question-and-answer based network topology map generation method, device, medium and product

技术领域Technical Field

本发明涉及计算机技术领域,具体地说,涉及一种基于问答的网络拓扑图生成方法、装置、介质及产品。The present invention relates to the field of computer technology, and in particular to a method, device, medium and product for generating a network topology diagram based on question and answer.

背景技术Background Art

网络拓扑图是一种用图形化表示网络结构的工具,它展示了网络中的设备和它们之间的连接方式。网络拓扑图中的节点代表网络中的设备,如路由器、交换机、服务器等,而连接线则表示设备之间的物理或逻辑连接。网络拓扑图可以帮了解和规划网络架构。A network topology diagram is a tool that graphically represents the structure of a network. It shows the devices in the network and how they are connected. The nodes in the network topology diagram represent the devices in the network, such as routers, switches, servers, etc., while the connecting lines represent the physical or logical connections between the devices. A network topology diagram can help you understand and plan the network architecture.

现有的网络拓扑图生成方法需要通过SSH(Secure Shell,安全外壳协议)命令登陆服务器,查看并记录下服务器上所有FC端口信息,然后通过SSH登陆存储设备,查看存储上所有FC(Fibre Channel,网状通道技术)端口信息,以及网络连接关系信息,通过比对服务器与存储设备的信息,查找出服务器FC端口与存储FC端口的连接拓扑关系,通过鼠标完成人机交互,画出拓扑图。The existing network topology map generation method requires logging into the server through the SSH (Secure Shell) command, checking and recording all FC port information on the server, and then logging into the storage device through SSH to check all FC (Fibre Channel) port information on the storage and network connection relationship information. By comparing the information of the server and the storage device, the connection topology relationship between the server FC port and the storage FC port is found, and the human-computer interaction is completed through the mouse to draw the topology map.

现有网络拓扑图生成方案依赖SSH命令,兼容性差,拓扑图生成过程灵活性差,速度较慢。The existing network topology map generation solution relies on SSH commands, which has poor compatibility, poor flexibility and slow speed in the topology map generation process.

发明内容Summary of the invention

与现有技术相比,本发明提出一种基于问答的网络拓扑图生成方法、装置、介质及产品,网络拓扑图的生成无需依赖SSH命令,兼容性高,灵活性高,速度更快。Compared with the prior art, the present invention proposes a method, device, medium and product for generating a network topology map based on question and answer. The generation of the network topology map does not need to rely on SSH commands, has high compatibility, high flexibility and faster speed.

本发明实施例提供一种基于问答的网络拓扑图生成方法,所述方法包括:An embodiment of the present invention provides a method for generating a network topology map based on question and answer, the method comprising:

根据用户输入的交互数据进行自动问答,生成对话数据;Automatically answer questions based on the interaction data input by the user to generate conversation data;

将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,得到拓扑图结构化数据;Mapping entities and intentions in the automatic dialogue data to nodes and connection relationships in a topological graph, respectively, to obtain topological graph structured data;

根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件;Creating an XML document of a topology map according to a dom4j parsing package, adding structured data of the topology map to the XML document, and generating an XML file;

加载和渲染所述XML文件得到网络拓扑图。The XML file is loaded and rendered to obtain a network topology diagram.

优选地,根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件,包括:Preferably, an XML document of a topology map is created according to a dom4j parsing package, and the structured data of the topology map is added to the XML document to generate an XML file, including:

遍历所述拓扑图结构化数据中节点和连接关系,并根据dom4j解析包创建对应的XML元素;Traverse the nodes and connection relationships in the topology structured data, and create corresponding XML elements according to the dom4j parsing package;

将创建的XML元素添加到所述XML文档中,添加节点和属性,得到XML文件。Add the created XML element to the XML document, add nodes and attributes, and obtain an XML file.

优选地,所述方法还包括:Preferably, the method further comprises:

使用预设的布局算法排列所述网络拓扑图中的节点。The nodes in the network topology graph are arranged using a preset layout algorithm.

进一步,使用预设的布局算法排列所述网络拓扑图中的节点,包括:Further, arranging the nodes in the network topology diagram using a preset layout algorithm includes:

获取所述网络拓扑图中的节点数量;Obtaining the number of nodes in the network topology graph;

根据所述网络拓扑图的布局和尺寸确定与圆形布局的半径;Determining the radius of the circular layout according to the layout and size of the network topology diagram;

根据节点的索引值计算所述网络拓扑图中的每一节点的角度值;Calculate the angle value of each node in the network topology diagram according to the index value of the node;

根据每一节点的角度值和半径确定不同节点的坐标位置;Determine the coordinate positions of different nodes according to the angle value and radius of each node;

将每一节点的坐标位置应用到所述网络拓扑图中,完成圆形布局。The coordinate position of each node is applied to the network topology diagram to complete the circular layout.

优选地,使用预设的布局算法排列所述网络拓扑图中的节点,包括:Preferably, arranging the nodes in the network topology diagram using a preset layout algorithm includes:

获取所述网络拓扑图中节点数量和连接关系;Obtain the number of nodes and connection relationships in the network topology diagram;

创建一个空的布局结果数据结构;Create an empty layout result data structure;

以所述网络拓扑图的根节点作为原点位置,遍历每一层的节点,计算子节点与所述根节点在垂直方向的距离,作为纵坐标;将预设的偏移距离作为每一子节点和其父节点的水平距离,确定子节点的横坐标;Taking the root node of the network topology as the origin, traverse the nodes of each layer, calculate the vertical distance between the child node and the root node as the vertical coordinate; take the preset offset distance as the horizontal distance between each child node and its parent node, and determine the horizontal coordinate of the child node;

将每一节点的横坐标和纵坐标作为位置信息保存到所述布局结果数据结构中;The horizontal coordinate and the vertical coordinate of each node are saved as position information in the layout result data structure;

将每一节点的坐标位置应用到所述网络拓扑图中,完成层次布局。The coordinate position of each node is applied to the network topology diagram to complete the hierarchical layout.

优选地,将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,生成拓扑图结构化数据,包括:Preferably, mapping entities and intentions in the automatic dialogue data to nodes and connection relationships in a topological graph respectively to generate topological graph structured data includes:

对所述自动对话数据中文本进行预处理,去除文本字符;Preprocessing the text in the automatic dialogue data to remove text characters;

识别预处理后的对话文本中的实体信息,映射为拓扑图中的节点;Identify entity information in the preprocessed conversation text and map it to nodes in the topology graph;

使用自然语言处理技术识别所述对话文本中的对话意图,映射为起始节点和目标节点的连接关系;Using natural language processing technology to identify the conversation intention in the conversation text, and mapping it to a connection relationship between a start node and a target node;

根据节点和对应的连接关系输出JSON格式的拓扑图结构化数据。Output topology structured data in JSON format based on nodes and corresponding connection relationships.

优选地,所述拓扑图结构化数据包括节点信息、连接信息以及模块信息;Preferably, the topology structured data includes node information, connection information and module information;

所述节点信息包括节点唯一标识、名称、类型以及层级信息;The node information includes node unique identification, name, type and level information;

所述连接信息包括连接的唯一标识、连接名称、连接类型、起始连接节点、目标连接节点以及其他各项连接信息;The connection information includes a unique identifier of the connection, a connection name, a connection type, a starting connection node, a target connection node, and other connection information;

所述模块信息包括当前模块信息,以及当前模块下所有节点、连线的列表。The module information includes the current module information and a list of all nodes and connections under the current module.

优选地,所述方法还包括:Preferably, the method further comprises:

对所述拓扑图结构化数据进行解析,将其转化为程序可识别的结构化数据;Parsing the topological map structured data and converting it into structured data recognizable by a program;

对所述对话数据进行信息提取,通过预设的关键词匹配算法计算提取的每一关键词在所述结构化数据和对话信息中的匹配程度,确定结构化数据和对话信息之间的整体匹配程度;Extracting information from the conversation data, calculating the matching degree of each extracted keyword in the structured data and the conversation information by using a preset keyword matching algorithm, and determining the overall matching degree between the structured data and the conversation information;

输出匹配程度高的拓扑图结构化数据。Output topological structured data with a high degree of matching.

优选地,所述方法还包括:Preferably, the method further comprises:

在前端基于bpmn.js库使用API端点和组件定义节点类型、连接类型和交互行为,创建拓扑图编辑器界面;On the front end, use API endpoints and components based on the bpmn.js library to define node types, connection types, and interaction behaviors, and create a topology editor interface;

通过事件监听和回调函数识别用户通过所述拓扑图编辑器界面输入的交互指令,执行所述交互指令。The interactive instructions input by the user through the topology diagram editor interface are identified through event monitoring and callback functions, and the interactive instructions are executed.

优选地,所述方法还包括:Preferably, the method further comprises:

基于在后端通过Spring Boot定义的API端点接收前端发送的拓扑图数据和拓扑请求,使用Spring Boot的控制器和服务层处理所述拓扑图数据,生成新的XML文件,返回前端。Based on receiving the topology map data and topology request sent by the front end through the API endpoint defined by Spring Boot on the back end, the topology map data is processed using the controller and service layer of Spring Boot, a new XML file is generated, and returned to the front end.

优选地,所述根据用户输入的交互数据进行自动问答,生成对话数据,包括:Preferably, the automatic question-answering based on the interactive data input by the user to generate the dialogue data includes:

将用户输入的交互数据进行语音识别,转换为自然语言文本;Perform speech recognition on the interactive data input by the user and convert it into natural language text;

将所述自然语言文本进行自然语言理解,提取得到当前文本的意图和槽值对;Performing natural language understanding on the natural language text to extract the intent and slot-value pairs of the current text;

对当前文本的意图和槽值对进行对话管理,得到响应动作;Perform dialogue management on the intent and slot value pairs of the current text to obtain response actions;

对所述响应动作进行自然语言生成,得到自然语言文本输出;Performing natural language generation on the response action to obtain a natural language text output;

将所述交互数据和所述自然语言文本输出作为所述对话数据。The interaction data and the natural language text are output as the conversation data.

优选地,将用户输入的交互数据进行语音识别,转换为自然语言文本,包括:Preferably, the interactive data input by the user is subjected to speech recognition and converted into natural language text, including:

对所述交互数据进行预处理;Preprocessing the interaction data;

对预处理后的交互数据的信号波形进行特征提取,得到语音特征;Extract features from the preprocessed signal waveform of the interactive data to obtain speech features;

通过预先训练得到的声学模型对所述语音特征进行识别,得到音素序列;Recognizing the speech features through a pre-trained acoustic model to obtain a phoneme sequence;

通过字典将所述音素序列转换为单词序列,通过预先训练的语言模型调整单词序列的顺序,得到识别结果作为所述自然语言文本。The phoneme sequence is converted into a word sequence through a dictionary, and the order of the word sequence is adjusted through a pre-trained language model to obtain a recognition result as the natural language text.

优选地,将所述自然语言文本进行自然语言理解,提取得到当前文本的意图和槽值对,包括:Preferably, the natural language text is subjected to natural language understanding to extract the intent and slot-value pairs of the current text, including:

将所述自然语言文本输入到预先训练的文本识别模型中,根据输出结果确定当前文本的意图和槽值对。The natural language text is input into a pre-trained text recognition model, and the intent and slot-value pairs of the current text are determined according to the output results.

优选地,所述文本识别模型训练过程包括:Preferably, the text recognition model training process includes:

收集对话数据,并进行预处理;Collect conversation data and perform preprocessing;

根据预处理后的对话数据的应用场景和需求,定义意图类别;Define intent categories based on the application scenarios and requirements of the preprocessed conversation data;

对每条对话数据标注出意图,并对对话数据中的槽值信息进行标注;Label the intent of each conversation data and the slot value information in the conversation data;

在标注后的对话数据中添加特殊字符,将标准后的对话数据转换为预设格式;Add special characters to the annotated conversation data and convert the standardized conversation data into a preset format;

将转换后的对话数据按照预设的划分比例划分出训练集、验证集和测试集;Divide the converted conversation data into training set, validation set and test set according to the preset division ratio;

根据划分的训练集和所述测试集对预设的BERT模型采用交叉熵损失函数进行训练,通过Adam作为优化器对所述BERT模型进行优化;The preset BERT model is trained using a cross entropy loss function according to the divided training set and the test set, and the BERT model is optimized by using Adam as an optimizer;

通过所述验证集对训练后的模型进行验证,根据验证的损失值调整所述BERT模型的超参数,直到验证集的模型损失值达到阈值要求,输出所述文本识别模型。The trained model is verified through the verification set, and the hyperparameters of the BERT model are adjusted according to the verified loss value until the model loss value of the verification set reaches the threshold requirement, and the text recognition model is output.

优选地,所述对当前文本的意图和槽值对进行对话管理,得到响应动作,包括:Preferably, the dialog management of the intent and slot value pairs of the current text to obtain a response action includes:

根据预存的对话历史和当前文本的意图和槽值对确定当前的会话状态;Determine the current conversation state based on the pre-stored conversation history and the intent and slot value pairs of the current text;

根据当前会话状态匹配预设的响应动作。Matches the preset response action according to the current session state.

进一步地,所述根据预存的对话历史和当前文本的意图和槽值对确定当前的会话状态,包括:Furthermore, determining the current session state according to the pre-stored conversation history and the intent and slot-value pairs of the current text includes:

在任务型人机对话中将每轮最新对话提取出的文本的意图和槽值对添加到对应的槽中,进行对话状态追踪,更新当前的对话状态。In task-based human-computer dialogue, the intention and slot value pairs of the text extracted from each latest round of dialogue are added to the corresponding slots to track the dialogue status and update the current dialogue status.

优选地,所述方法还包括:Preferably, the method further comprises:

当所述响应动作为询问动作时,基于当前对话状态向用户提问,引导用户回答关键槽值;When the response action is an inquiry action, questions are asked to the user based on the current dialog state, and the user is guided to answer the key slot value;

当所述响应动作为解答动作时,基于用户提问,在知识库中匹配答案文本;When the response action is an answer action, matching the answer text in the knowledge base based on the user's question;

当所述响应动作为绘图动作时,根据预设的拓扑图模板和槽值对,绘制对应的网络拓扑图。When the response action is a drawing action, a corresponding network topology map is drawn according to a preset topology map template and slot value pair.

优选地,所述对所述响应动作进行自然语言生成,得到自然语言文本输出,包括:Preferably, the generating the response action in natural language to obtain a natural language text output includes:

根据所述响应动作确定传达信息文本;Determine the text of the information to be communicated according to the response action;

组织所述传达信息中文本结构顺序;Organize the text structure sequence in the message being conveyed;

将组成文本结构顺序的文本信息聚合为文本语句;Aggregate text information that constitutes the text structure sequence into text sentences;

在聚合的文本语句的文本信息中添加连接词,组成自然语言;Adding conjunctions to the text information of the aggregated text sentences to form natural language;

根据所述自然语言的所属领域,确定拓展词汇,构成自然语言语句,得到自然语言文本输出。According to the domain to which the natural language belongs, an extended vocabulary is determined, a natural language sentence is constructed, and a natural language text output is obtained.

本发明实施例还提供一种基于问答的网络拓扑图生成装置,所述装置包括:The embodiment of the present invention further provides a network topology diagram generating device based on question and answer, the device comprising:

智能对话模块,用于根据用户输入的交互数据进行自动问答,生成对话数据;Intelligent dialogue module, used to automatically answer questions based on the interaction data input by the user and generate dialogue data;

数据映射模块,用于将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,得到拓扑图结构化数据;A data mapping module, used to map entities and intentions in the automatic dialogue data into nodes and connection relationships in a topological graph, respectively, to obtain topological graph structured data;

创建模块,用于根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件;A creation module is used to create an XML document of a topology map according to a dom4j parsing package, add the structured data of the topology map to the XML document, and generate an XML file;

加载模块,用于加载和渲染所述XML文件得到网络拓扑图。The loading module is used to load and render the XML file to obtain a network topology diagram.

优选地,所述创建模块用于:Preferably, the creation module is used to:

遍历所述拓扑图结构化数据中节点和连接关系,并根据dom4j解析包创建对应的XML元素;Traverse the nodes and connection relationships in the topology structured data, and create corresponding XML elements according to the dom4j parsing package;

将创建的XML元素添加到所述XML文档中,添加节点和属性,得到XML文件。Add the created XML element to the XML document, add nodes and attributes, and obtain an XML file.

优选地,所述装置还包括布局模块,用于:Preferably, the device further comprises a layout module, configured to:

使用预设的布局算法排列所述网络拓扑图中的节点。The nodes in the network topology graph are arranged using a preset layout algorithm.

优选地,所述布局模块具体用于:Preferably, the layout module is specifically used for:

获取所述网络拓扑图中的节点数量;Obtaining the number of nodes in the network topology graph;

根据所述网络拓扑图的布局和尺寸确定与圆形布局的半径;Determining the radius of the circular layout according to the layout and size of the network topology diagram;

根据节点的索引值计算所述网络拓扑图中的每一节点的角度值;Calculate the angle value of each node in the network topology diagram according to the index value of the node;

根据每一节点的角度值和半径确定不同节点的坐标位置;Determine the coordinate positions of different nodes according to the angle value and radius of each node;

将每一节点的坐标位置应用到所述网络拓扑图中,完成圆形布局。The coordinate position of each node is applied to the network topology diagram to complete the circular layout.

优选地,所述布局模块具体用于:Preferably, the layout module is specifically used for:

获取所述网络拓扑图中节点数量和连接关系;Obtain the number of nodes and connection relationships in the network topology diagram;

创建一个空的布局结果数据结构;Create an empty layout result data structure;

以所述网络拓扑图的根节点作为原点位置,遍历每一层的节点,计算子节点与所述根节点在垂直方向的距离,作为纵坐标;将预设的偏移距离作为每一子节点和其父节点的水平距离,确定子节点的横坐标;Taking the root node of the network topology as the origin, traverse the nodes of each layer, calculate the vertical distance between the child node and the root node as the vertical coordinate; take the preset offset distance as the horizontal distance between each child node and its parent node, and determine the horizontal coordinate of the child node;

将每一节点的横坐标和纵坐标作为位置信息保存到所述布局结果数据结构中;The horizontal coordinate and the vertical coordinate of each node are saved as position information in the layout result data structure;

将每一节点的坐标位置应用到所述网络拓扑图中,完成层次布局。The coordinate position of each node is applied to the network topology diagram to complete the hierarchical layout.

优选地,所述数据映射模块,用于:Preferably, the data mapping module is used to:

对所述自动对话数据中文本进行预处理,去除文本字符;Preprocessing the text in the automatic dialogue data to remove text characters;

识别预处理后的对话文本中的实体信息,映射为拓扑图中的节点;Identify entity information in the preprocessed conversation text and map it to nodes in the topology graph;

使用自然语言处理技术识别所述对话文本中的对话意图,映射为起始节点和目标节点的连接关系;Using natural language processing technology to identify the conversation intention in the conversation text, and mapping it to a connection relationship between a start node and a target node;

根据节点和对应的连接关系输出JSON格式的拓扑图结构化数据。Output topology structured data in JSON format based on nodes and corresponding connection relationships.

优选地,所述拓扑图结构化数据包括节点信息、连接信息以及模块信息;Preferably, the topology structured data includes node information, connection information and module information;

所述节点信息包括节点唯一标识、名称、类型以及层级信息;The node information includes node unique identification, name, type and level information;

所述连接信息包括连接的唯一标识、连接名称、连接类型、起始连接节点、目标连接节点以及其他各项连接信息;The connection information includes a unique identifier of the connection, a connection name, a connection type, a starting connection node, a target connection node, and other connection information;

所述模块信息包括当前模块信息,以及当前模块下所有节点、连线的列表。The module information includes the current module information and a list of all nodes and connections under the current module.

优选地,所述装置还包括辅助模块,具体用于:Preferably, the device further comprises an auxiliary module, specifically configured to:

对所述拓扑图结构化数据进行解析,将其转化为程序可识别的结构化数据;Parsing the topological map structured data and converting it into structured data recognizable by a program;

对所述对话数据进行信息提取,通过预设的关键词匹配算法计算提取的每一关键词在所述结构化数据和对话信息中的匹配程度,确定结构化数据和对话信息之间的整体匹配程度;Extracting information from the conversation data, calculating the matching degree of each extracted keyword in the structured data and the conversation information by using a preset keyword matching algorithm, and determining the overall matching degree between the structured data and the conversation information;

输出匹配程度高的拓扑图结构化数据。Output topological structured data with a high degree of matching.

优选地,所述装置还包括前端模块,具体用于:Preferably, the device further comprises a front-end module, specifically used for:

在前端基于bpmn.js库使用API端点和组件定义节点类型、连接类型和交互行为,创建拓扑图编辑器界面;On the front end, use API endpoints and components based on the bpmn.js library to define node types, connection types, and interaction behaviors, and create a topology editor interface;

通过事件监听和回调函数识别用户通过所述拓扑图编辑器界面输入的交互指令,执行所述交互指令。The interactive instructions input by the user through the topology diagram editor interface are identified through event monitoring and callback functions, and the interactive instructions are executed.

优选地,所述装置还包括后端模块,具体用于:Preferably, the device further comprises a back-end module, specifically configured to:

基于在后端通过Spring Boot定义的API端点接收前端发送的拓扑图数据和拓扑请求,使用Spring Boot的控制器和服务层处理所述拓扑图数据,生成新的XML文件,返回前端。Based on receiving the topology map data and topology request sent by the front end through the API endpoint defined by Spring Boot on the back end, the topology map data is processed using the controller and service layer of Spring Boot, a new XML file is generated, and returned to the front end.

优选地,所述智能对话模块具体用于:Preferably, the intelligent dialogue module is specifically used for:

将用户输入的交互数据进行语音识别,转换为自然语言文本;Perform speech recognition on the interactive data input by the user and convert it into natural language text;

将所述自然语言文本进行自然语言理解,提取得到当前文本的意图和槽值对;Performing natural language understanding on the natural language text to extract the intent and slot-value pairs of the current text;

对当前文本的意图和槽值对进行对话管理,得到响应动作;Perform dialogue management on the intent and slot value pairs of the current text to obtain response actions;

对所述响应动作进行自然语言生成,得到自然语言文本输出;Performing natural language generation on the response action to obtain a natural language text output;

将所述交互数据和所述自然语言文本输出作为所述对话数据。The interaction data and the natural language text are output as the conversation data.

优选地,所述智能对话模块具体用于:Preferably, the intelligent dialogue module is specifically used for:

对所述交互数据进行预处理;Preprocessing the interaction data;

对预处理后的交互数据的信号波形进行特征提取,得到语音特征;Extract features from the preprocessed signal waveform of the interactive data to obtain speech features;

通过预先训练得到的声学模型对所述语音特征进行识别,得到音素序列;Recognizing the speech features through a pre-trained acoustic model to obtain a phoneme sequence;

通过字典将所述音素序列转换为单词序列,通过预先训练的语言模型调整单词序列的顺序,得到识别结果作为所述自然语言文本。The phoneme sequence is converted into a word sequence through a dictionary, and the order of the word sequence is adjusted through a pre-trained language model to obtain a recognition result as the natural language text.

优选地,所述智能对话模块具体用于:Preferably, the intelligent dialogue module is specifically used for:

将所述自然语言文本输入到预先训练的文本识别模型中,根据输出结果确定当前文本的意图和槽值对。The natural language text is input into a pre-trained text recognition model, and the intent and slot-value pairs of the current text are determined according to the output results.

优选地,所述智能对话模块具体用于:Preferably, the intelligent dialogue module is specifically used for:

收集对话数据,并进行预处理;Collect conversation data and perform preprocessing;

根据预处理后的对话数据的应用场景和需求,定义意图类别;Define intent categories based on the application scenarios and requirements of the preprocessed conversation data;

对每条对话数据标注出意图,并对对话数据中的槽值信息进行标注;Label the intent of each conversation data and the slot value information in the conversation data;

在标注后的对话数据中添加特殊字符,将标准后的对话数据转换为预设格式;Add special characters to the annotated conversation data and convert the standardized conversation data into a preset format;

将转换后的对话数据按照预设的划分比例划分出训练集、验证集和测试集;Divide the converted conversation data into training set, validation set and test set according to the preset division ratio;

根据划分的训练集和所述测试集对预设的BERT模型采用交叉熵损失函数进行训练,通过Adam作为优化器对所述BERT模型进行优化;The preset BERT model is trained using a cross entropy loss function according to the divided training set and the test set, and the BERT model is optimized by using Adam as an optimizer;

通过所述验证集对训练后的模型进行验证,根据验证的损失值调整所述BERT模型的超参数,直到验证集的模型损失值达到阈值要求,输出所述文本识别模型。The trained model is verified through the verification set, and the hyperparameters of the BERT model are adjusted according to the verified loss value until the model loss value of the verification set reaches the threshold requirement, and the text recognition model is output.

优选地,所述智能对话模块具体用于:Preferably, the intelligent dialogue module is specifically used for:

根据预存的对话历史和当前文本的意图和槽值对确定当前的会话状态;Determine the current conversation state based on the pre-stored conversation history and the intent and slot value pairs of the current text;

根据当前会话状态匹配预设的响应动作。Matches the preset response action according to the current session state.

优选地,所述智能对话模块具体用于:Preferably, the intelligent dialogue module is specifically used for:

在任务型人机对话中将每轮最新对话提取出的文本的意图和槽值对添加到对应的槽中,进行对话状态追踪,更新当前的对话状态。In task-based human-computer dialogue, the intention and slot value pairs of the text extracted from each latest round of dialogue are added to the corresponding slots to track the dialogue status and update the current dialogue status.

优选地,所述智能对话模块具体还用于:Preferably, the intelligent dialogue module is further used for:

当所述响应动作为询问动作时,基于当前对话状态向用户提问,引导用户回答关键槽值;When the response action is an inquiry action, questions are asked to the user based on the current dialog state, and the user is guided to answer the key slot value;

当所述响应动作为解答动作时,基于用户提问,在知识库中匹配答案文本;When the response action is an answer action, matching the answer text in the knowledge base based on the user's question;

当所述响应动作为绘图动作时,根据预设的拓扑图模板和槽值对,绘制对应的网络拓扑图。When the response action is a drawing action, a corresponding network topology map is drawn according to a preset topology map template and slot value pair.

优选地,所述智能对话模块具体用于:Preferably, the intelligent dialogue module is specifically used for:

根据所述响应动作确定传达信息文本;Determine the text of the information to be communicated according to the response action;

组织所述传达信息中文本结构顺序;Organize the text structure sequence in the message being conveyed;

将组成文本结构顺序的文本信息聚合为文本语句;Aggregate text information that constitutes the text structure sequence into text sentences;

在聚合的文本语句的文本信息中添加连接词,组成自然语言;Adding conjunctions to the text information of the aggregated text sentences to form natural language;

根据所述自然语言的所属领域,确定拓展词汇,构成自然语言语句,得到自然语言文本输出。According to the domain to which the natural language belongs, an extended vocabulary is determined, a natural language sentence is constructed, and a natural language text output is obtained.

本发明实施例还提供一种基于问答的网络拓扑图生成装置,包括处理器、存储器以及存储在所述存储器中且被配置为由所述处理器执行的计算机程序,所述处理器执行所述计算机程序时实现如上述任一项实施例所述的一种基于问答的网络拓扑图生成方法。An embodiment of the present invention also provides a question-and-answer based network topology map generation device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements a question-and-answer based network topology map generation method as described in any of the above embodiments.

本发明实施例还提供一种计算机可读存储介质,所述计算机可读存储介质包括存储的计算机程序,其中,在所述计算机程序运行时控制所述计算机可读存储介质所在设备执行如上述任一项实施例所述的一种基于问答的网络拓扑图生成方法。An embodiment of the present invention also provides a computer-readable storage medium, which includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute a question-and-answer based network topology map generation method as described in any of the above embodiments.

本发明实施例还提供一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时实现上述任一项实施例所述的方法的步骤。An embodiment of the present invention further provides a computer program product, including a computer program/instruction, which implements the steps of the method described in any of the above embodiments when executed by a processor.

与现有技术相比,本发明提供一种基于问答的网络拓扑图生成方法、装置、介质及产品,根据用户输入的交互数据进行自动问答,生成对话数据;将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,得到拓扑图结构化数据;根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件;加载和渲染所述XML文件得到网络拓扑图。本申请方案网络拓扑图的生成无需依赖SSH命令,兼容性高,灵活性高,速度更快。Compared with the prior art, the present invention provides a method, device, medium and product for generating a network topology map based on question and answer, which automatically answers questions according to the interactive data input by the user to generate conversation data; the entities and intentions in the automatic conversation data are respectively mapped to nodes and connection relationships in the topology map to obtain structured data of the topology map; an XML document of the topology map is created according to the dom4j parsing package, and the structured data of the topology map is added to the XML document to generate an XML file; the XML file is loaded and rendered to obtain the network topology map. The generation of the network topology map of the present application solution does not need to rely on SSH commands, and has high compatibility, high flexibility and faster speed.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1本发明实施例提供的一种基于问答的网络拓扑图生成方法的流程示意图;FIG1 is a schematic diagram of a flow chart of a method for generating a network topology map based on question-answering provided by an embodiment of the present invention;

图2是本发明实施例提供的基于问答的网络拓扑图生成方法的另一流程示意图;2 is another schematic diagram of a flow chart of a method for generating a network topology map based on question-answering provided by an embodiment of the present invention;

图3是本发明实施例提供的自动语音识别过程的流程示意图;3 is a schematic diagram of a flow chart of an automatic speech recognition process provided by an embodiment of the present invention;

图4是本发明实施例提供的特征提取过程的流程示意图;FIG4 is a schematic diagram of a flow chart of a feature extraction process provided by an embodiment of the present invention;

图5是本发明实施例提供的自动语音识别过程的另一流程示意图;5 is another schematic diagram of a flow chart of an automatic speech recognition process provided by an embodiment of the present invention;

图6是本发明实施例提供的文本识别模型的训练流程示意图;FIG6 is a schematic diagram of a training process of a text recognition model provided by an embodiment of the present invention;

图7是本发明实施例提供的文本识别模型训练过程的原理示意图;FIG7 is a schematic diagram of the principle of a text recognition model training process provided by an embodiment of the present invention;

图8是本发明实施例提供的对话管理过程的流程示意图;8 is a flow chart of a dialog management process according to an embodiment of the present invention;

图9是本发明实施例提供的基于问答的网络拓扑图生成方法的又一流程示意图;9 is another schematic diagram of a flow chart of a method for generating a network topology map based on question and answer provided in an embodiment of the present invention;

图10是本发明实施例提供的自然语言文本输出过程的流程示意图;10 is a schematic diagram of a process of outputting a natural language text according to an embodiment of the present invention;

图11是本发明实施例提供的一种基于问答的网络拓扑图生成装置的结构示意图;11 is a schematic diagram of the structure of a network topology diagram generating device based on question-answering provided in an embodiment of the present invention;

图12是本发明实施例提供的一种基于问答的网络拓扑图生成装置的另一结构示意图。FIG. 12 is another schematic diagram of the structure of a network topology map generating device based on question and answer provided in an embodiment of the present invention.

具体实施方式DETAILED DESCRIPTION

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

参见图1,是本发明实施例提供的一种基于问答的网络拓扑图生成方法的流程示意图,所述方法包括步骤S1~S4;Referring to FIG. 1 , it is a flow chart of a method for generating a network topology map based on question and answer provided in an embodiment of the present invention, wherein the method comprises steps S1 to S4;

S1,根据用户输入的交互数据进行自动问答,生成对话数据;S1, automatically answer questions based on the interaction data input by the user to generate dialogue data;

S2,将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,得到拓扑图结构化数据;S2, mapping entities and intentions in the automatic dialogue data into nodes and connection relationships in a topological graph, respectively, to obtain topological graph structured data;

S3,根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件;S3, creating an XML document of a topology map according to a dom4j parsing package, adding the structured data of the topology map to the XML document, and generating an XML file;

S4,加载和渲染所述XML文件得到网络拓扑图。S4, loading and rendering the XML file to obtain a network topology diagram.

在本实施例具体实施时,本申请方案基于问答自动生成网络拓扑图,即在用户输入交互数据后,通过智能问答对用户输入的交互数据进行自动问答,输出问答结果,根据用户语音交互过程生成对话数据。In the specific implementation of this embodiment, the application scheme automatically generates a network topology diagram based on question and answer, that is, after the user inputs the interaction data, the interaction data input by the user is automatically answered through intelligent question and answer, the question and answer results are output, and the dialogue data is generated according to the user voice interaction process.

需要说明的是,所述交互数据包括用户通过自然语言、语音等输入方式,输入到设备中进行人机交互问答的对话数据。It should be noted that the interaction data includes dialogue data input by the user into the device through natural language, voice and other input methods for human-computer interactive question and answer.

通过使用自然语言处理和意图识别等技术,识别出所述自动对话数据中的实体和意图,把对话内容中的实体和意图映射为拓扑图中的节点和关系,生成拓扑图结构化数据;By using technologies such as natural language processing and intent recognition, entities and intents in the automatic conversation data are identified, and the entities and intents in the conversation content are mapped to nodes and relationships in a topological graph to generate topological graph structured data;

使用dom4j创建一个空的拓扑图XML文档,将所述拓扑图结构化数据中的节点和连接关系添加到XML文档中,逐步构建拓扑图XML文件的节点和关系,生成XML文件;Use dom4j to create an empty topology map XML document, add the nodes and connection relationships in the topology map structured data to the XML document, gradually construct the nodes and relationships of the topology map XML file, and generate an XML file;

将生成的拓扑图XML文档保存为文件。前端会使用bpmn.js提供的API,加载和渲染XML文件,将XML文件解析为拓扑图模型,将解析后的拓扑图模型渲染到页面中,展示给用户,完成网络拓扑图的生成。Save the generated topology map XML document as a file. The front end will use the API provided by bpmn.js to load and render the XML file, parse the XML file into a topology map model, render the parsed topology map model to the page, and display it to the user, completing the generation of the network topology map.

本申请方案通过自然语言对话、语音对话等交互方式将所需拓扑图需求输入后,自动提取和收集与拓扑图相关的数据,如节点之间的连接关系、设备信息和其他有用的信息,对数据进行处理和分析,以确定节点之间的连通性,根据数据分析结果,自动设计出合适的拓扑图结构,省去了在如今网络结构日益复杂的背景下,手工绘制拓扑图的复杂步骤,提升工作效率。After the required topology map requirements are input through natural language dialogue, voice dialogue and other interactive methods, the application solution automatically extracts and collects data related to the topology map, such as the connection relationship between nodes, device information and other useful information, processes and analyzes the data to determine the connectivity between the nodes, and automatically designs a suitable topology map structure based on the data analysis results, eliminating the complicated steps of manually drawing topology maps in the context of increasingly complex network structures today, thereby improving work efficiency.

在本发明提供的又一实施例中,所述步骤S3包括:In another embodiment provided by the present invention, the step S3 includes:

使用dom4j创建一个空的拓扑图XML文档对象,根据拓扑图结构化数据,遍历设备和连线信息,同时使用dom4j创建对应的XML元素,并将它们添加到拓扑图XML文档中,例如Element、Attribute等,来创建XML元素和属性,以此逐步构建拓扑图XML文件的节点和关系,添加节点和属性,形成层级结构,得到XML文档。Use dom4j to create an empty topology map XML document object. According to the topology map structured data, traverse the device and connection information. At the same time, use dom4j to create corresponding XML elements and add them to the topology map XML document, such as Element, Attribute, etc., to create XML elements and attributes, so as to gradually build the nodes and relationships of the topology map XML file, add nodes and attributes, form a hierarchical structure, and obtain an XML document.

在本发明提供的又一实施例中,在生成XML文件时,所述方法还包括:使用预设的布局算法排列所述网络拓扑图中的节点,将拓扑图中的节点按照设定形式进行排列。In another embodiment of the present invention, when generating the XML file, the method further includes: using a preset layout algorithm to arrange the nodes in the network topology map, and arranging the nodes in the topology map according to a set format.

预设的布局算法包括层级布局算法以及圆形布局算法,根据预设的算法,对网络拓扑图的节点进行排列,以便更好地展示节点之间的关系和结构。The preset layout algorithms include a hierarchical layout algorithm and a circular layout algorithm. According to the preset algorithms, the nodes of the network topology diagram are arranged to better display the relationship and structure between the nodes.

在本发明提供的又一实施例中,可采用圆形布局算法排列所述网络拓扑图中的节点,具体包括以下步骤:In another embodiment provided by the present invention, a circular layout algorithm may be used to arrange the nodes in the network topology diagram, specifically comprising the following steps:

获取拓扑图中的节点数量,假设为n。Get the number of nodes in the topology graph, assuming it is n.

计算圆的半径r,具体根据拓扑图的大小和布局需求来确定合适的半径值。Calculate the radius r of the circle and determine the appropriate radius value based on the size of the topology map and layout requirements.

对于每个节点,根据节点的索引值计算所述网络拓扑图的每一节点在圆上的角度值angle。angle=(2*π*i)/n,其中i表示节点的索引,从0到n-1。For each node, the angle value angle of each node on the circle of the network topology graph is calculated according to the index value of the node. angle = (2*π*i)/n, where i represents the index of the node, from 0 to n-1.

根据每一节点的角度值和半径计算每个节点在圆上的坐标位置,即计算节点在平面坐标系中的坐标(x,y),x=r*cos(angle),y=r*sin(angle)。The coordinate position of each node on the circle is calculated according to the angle value and radius of each node, that is, the coordinates (x, y) of the node in the plane coordinate system are calculated, x = r*cos(angle), y = r*sin(angle).

将每个节点的坐标位置应用到拓扑图中的节点上,完成圆形布局。Apply the coordinate position of each node to the nodes in the topology map to complete the circular layout.

将拓扑图中的节点按照圆形的形式进行排列,以便更好地展示节点之间的关系和结构。Arrange the nodes in the topology diagram in a circular form to better display the relationship and structure between the nodes.

在本发明提供的又一实施例中,可采用层次布局算法排列所述网络拓扑图中的节点,具体包括以下步骤:In another embodiment provided by the present invention, a hierarchical layout algorithm may be used to arrange the nodes in the network topology diagram, specifically comprising the following steps:

获取拓扑图中的设备节点数量和线缆的关联关系。Get the relationship between the number of device nodes and cables in the topology diagram.

创建一个空的布局结果数据结构,用于存储每个节点的位置信息。Create an empty layout result data structure to store the position information of each node.

找到拓扑图中的根节点(没有父节点的节点),将其作为第一层的节点,对于根节点,将其位置设置为初始位置,即作为原点位置。Find the root node (node without a parent node) in the topology graph and use it as the node of the first layer. For the root node, set its position to the initial position, that is, as the origin position.

遍历每一层的节点:对于当前层的每个节点,计算其与所述根节点在垂直方向的距离,作为y坐标。计算其父节点的位置,并在父节点的基础上进行偏移,以确保节点的层次结构关系,将预设的偏移距离作为每一子节点和其父节点的水平距离,确定子节点的横坐标;Traverse the nodes of each layer: For each node in the current layer, calculate its vertical distance from the root node as the y coordinate. Calculate the position of its parent node and offset it based on the parent node to ensure the hierarchical relationship of the nodes. Use the preset offset distance as the horizontal distance between each child node and its parent node to determine the horizontal coordinate of the child node;

将每个节点的位置信息保存到布局结果数据结构中。Save the position information of each node into the layout result data structure.

将布局结果应用到拓扑图中的节点上,完成层次布局。Apply the layout results to the nodes in the topology graph to complete the hierarchical layout.

使用层次布局算法,按照层次结构将节点进行布局,以展示节点之间的父子关系和层次结构。Using the hierarchical layout algorithm, the nodes are laid out according to the hierarchical structure to show the parent-child relationship and hierarchical structure between the nodes.

在本发明提供的又一实施例中,上述步骤S2具体包括:In another embodiment provided by the present invention, the above step S2 specifically includes:

对所述自动对话数据中对话内容进行文本预处理,包括去除停用词、标点符号和特殊字符等。The text preprocessing is performed on the conversation content in the automatic conversation data, including removing stop words, punctuation marks and special characters.

识别对话中的实体信息,如设备、线缆、模块等,并将识别到的实体信息作为拓扑图中的节点或元素。Identify entity information in the conversation, such as devices, cables, modules, etc., and use the identified entity information as nodes or elements in the topology map.

使用自然语言处理技术识别所述对话文本中的对话意图,映射为起始节点和目标节点的连接关系,确定拓扑图中的不同业务流程。The natural language processing technology is used to identify the conversation intention in the conversation text, map it to the connection relationship between the starting node and the target node, and determine the different business processes in the topology map.

根据节点和对应的连接关系输出JSON格式的拓扑图结构化数据。Output topology structured data in JSON format based on nodes and corresponding connection relationships.

本申请方案通过定义拓扑图中的设备节点类型和线缆连接类型,如起始连接节点、目标连接节点等,并根据对话内容中的实体和意图,将其映射为拓扑图中的节点和关系,输出JSON格式的拓扑图结构化数据,用于进行网络拓扑图的构建。The present application scheme defines the device node types and cable connection types in the topology map, such as the starting connection node, the target connection node, etc., and maps them to nodes and relationships in the topology map according to the entities and intentions in the conversation content, and outputs the topology map structured data in JSON format for constructing the network topology map.

在本发明提供的又一实施例中,拓扑图结构化数据包含以下几种类型,节点信息、连接信息以及模块信息;In another embodiment provided by the present invention, the topology structured data includes the following types: node information, connection information and module information;

节点信息,包含设备节点唯一标识、名称、类型、层级信息(设备节点在拓扑图中的层级位置)。Node information includes the unique identifier, name, type, and hierarchical information of the device node (the hierarchical position of the device node in the topology map).

连接信息,包含连接的唯一标识、连接名称、连接类型、起始连接节点、目标连接节点、其他各项连接信息等。Connection information includes the unique connection identifier, connection name, connection type, starting connection node, target connection node, and other connection information.

模块信息:包含当前模块信息,模块下所有节点、连线的列表。Module information: Contains the current module information and a list of all nodes and connections under the module.

通过收集与拓扑图相关的各项信息,并将其转化为上方结构化的数据形式存储,以便后续的处理及分析。By collecting various information related to the topology map and converting it into the structured data format above for storage, it is convenient for subsequent processing and analysis.

在本发明提供的又一实施例中,本申请还通过对话模板辅助获取结构化数据,具体辅助获取拓扑图结构化数据:In another embodiment provided by the present invention, the present application also assists in obtaining structured data through a dialogue template, specifically assists in obtaining topology structured data:

对预先存储的拓扑图结构化数据进行解析,将其转化为程序可识别的数据结构。在将用户输入的对话信息进行提取后,通过关键词匹配算法计算每个关键词在拓扑图结构化数据和对话信息中的匹配程度。本模块综合考虑所有关键词的匹配程度,计算拓扑图数据和对话信息之间的整体匹配程度,最终能够输出匹配程度高的拓扑图结构化信息,实现对拓扑图结构化数据过滤,提高拓扑图结构化数据质量。Parse the pre-stored topology structured data and convert it into a data structure that can be recognized by the program. After extracting the dialogue information input by the user, calculate the matching degree of each keyword in the topology structured data and the dialogue information through the keyword matching algorithm. This module comprehensively considers the matching degree of all keywords, calculates the overall matching degree between the topology data and the dialogue information, and finally outputs the topology structured information with a high matching degree, realizes the filtering of the topology structured data, and improves the quality of the topology structured data.

在本发明提供的又一实施例中,本申请方案还利用前端的Bpmn.js库进行网络拓扑图构建,具体地:In another embodiment provided by the present invention, the present application solution also uses the front-end Bpmn.js library to construct a network topology map, specifically:

集成bpmn.js库到前端应用中,使用bpmn.js的API和组件,定义节点类型、连接类型和交互行为;通过引入相关依赖和资源文件来创建拓扑图编辑器界面。Integrate the bpmn.js library into the front-end application, use the bpmn.js API and components to define node types, connection types, and interaction behaviors; create a topology editor interface by introducing related dependencies and resource files.

通过事件监听和回调函数识别用户通过所述拓扑图编辑器界面输入的交互指令,执行所述交互指令,实现对拓扑图的编辑、保存和导出功能。The interactive instructions input by the user through the topology map editor interface are identified through event monitoring and callback functions, and the interactive instructions are executed to realize the editing, saving and exporting functions of the topology map.

本实施例将自动化解析逻辑网络拓扑图为结构化数据的方法、Web前端技术相结合用于提高网络规划设计的工作质量效率的整体解决方案,应用Web技术,通过主流Web浏览器即可使用,通用性强,使用React前端框架执行画布交互,拖拽式操作具有较高灵活性和易用性。基于在线Web应用搭建了集中化统一维护管理平台架构,为统一网络建设业务管理和数据标准化奠定了平台基础。This embodiment combines the method of automatically parsing the logical network topology diagram into structured data with Web front-end technology to provide an overall solution for improving the work quality and efficiency of network planning and design. It applies Web technology and can be used through mainstream Web browsers. It has strong versatility and uses the React front-end framework to perform canvas interaction. The drag-and-drop operation has high flexibility and ease of use. A centralized unified maintenance management platform architecture is built based on online Web applications, laying a platform foundation for unified network construction business management and data standardization.

在本发明提供的又一实施中,本申请方案还利用后端使用Spring Boot进行网络拓扑图构建,具体地:In another implementation provided by the present invention, the present application solution also uses Spring Boot in the backend to construct a network topology diagram, specifically:

后端使用Spring Boot,配置相关依赖和路由。定义API端点,用于接收前端发送的拓扑图数据和请求。使用Spring Boot的控制器和服务层,处理前端请求并生成拓扑图的XML数据,生成新的XML文件,返回前端。The backend uses Spring Boot to configure related dependencies and routes. Define API endpoints to receive topology data and requests sent by the frontend. Use Spring Boot's controller and service layer to process frontend requests and generate XML data for the topology map, generate a new XML file, and return it to the frontend.

利用前端的Bpmn.js库、后端的Spring Boot框架和DOM4J库构建XML文件,实现智能对话自动生成拓扑图的功能。将用户选择的智能对话模板转换为拓扑图的结构化数据或通过智能对话自动生成拓扑图结构化数据。The XML file is constructed by using the front-end Bpmn.js library, the back-end Spring Boot framework and the DOM4J library to realize the function of automatically generating the topology map through intelligent dialogue. The intelligent dialogue template selected by the user is converted into the structured data of the topology map or the structured data of the topology map is automatically generated through intelligent dialogue.

在本发明提供的又一实施例中,本发明在进行自动对话处理时,参见图2,是本发明实施例提供的基于问答的网络拓扑图生成方法的另一流程示意图。In another embodiment of the present invention, when the present invention performs automatic dialogue processing, refer to FIG2 , which is another flowchart of the method for generating a network topology diagram based on question and answer provided by an embodiment of the present invention.

生成对话数据具体包括以下步骤,即自动语音识别(Automatic SpeechRecognition,ASR)、自然语言理解(Natural Language Understanding,NLU)、对话管理(Dialogue Management,DM)和自然语言生成(Natural Language Generation,NLG)四部分。Generating dialogue data specifically includes the following steps, namely automatic speech recognition (ASR), natural language understanding (NLU), dialogue management (DM) and natural language generation (NLG).

其中,自动语音识别ASR的作用将用户输入的交互数据进行语音识别,转换为自然语言文本。Among them, the role of automatic speech recognition ASR is to perform speech recognition on the interactive data input by the user and convert it into natural language text.

自然语言理解NLU的作用是将自然语言转换成机器可以处理的领域,将所述自然语言文本进行自然语言理解,提取得到当前文本的意图和槽值对。The role of natural language understanding (NLU) is to convert natural language into a field that can be processed by machines, perform natural language understanding on the natural language text, and extract the intent and slot-value pairs of the current text.

对话管理DM的作用是决定装置需要采取的动作或策略,即对当前文本的意图和槽值对进行对话管理,得到响应动作。The role of dialogue management (DM) is to determine the action or strategy that the device needs to take, that is, to conduct dialogue management on the intent and slot value pairs of the current text to obtain response actions.

自然语言生成NLG对所述响应动作进行自然语言生成,得到自然语言文本输出,得到系统回复,即将输出的动作转换成使用自然语言表示的文本结果。Natural language generation (NLG) performs natural language generation on the response action to obtain a natural language text output and a system reply, that is, converting the output action into a text result expressed in natural language.

对所述响应动作进行自然语言生成,得到自然语言文本输出。Natural language generation is performed on the response action to obtain a natural language text output.

通过与用户进行多轮交互,从而提取用户话语中关于网络拓扑结构的结构化信息。By conducting multiple rounds of interactions with users, we can extract structured information about the network topology from the user's utterances.

在本发明提供的又一实施例中,自动语音识别时,具体执行以下步骤:In another embodiment of the present invention, during automatic speech recognition, the following steps are specifically performed:

为实现智能问答模块,使用语音识别技术(Automatic Speech Recognition,ASR),将用户语音转换为文本。语音识别技术包括语音信号预处理、特征提取、模式匹配和查找模式库等四个部分,首先需要对输入的语音进行预处理,然后提取语音的特征,在此基础上建立语音识别所需的模板。To realize the intelligent question-answering module, speech recognition technology (Automatic Speech Recognition, ASR) is used to convert user speech into text. Speech recognition technology includes four parts: speech signal preprocessing, feature extraction, pattern matching, and searching for pattern libraries. First, the input speech needs to be preprocessed, and then the speech features are extracted. On this basis, the template required for speech recognition is established.

语音识别装置构建过程整体上分为训练和识别两部分。训练过程通常离线完成,通过对预先收集好的大量语音、语言数据库进行信号处理和知识挖掘,获取语音识别装置所需要的“声学模型”和“语言模型”;而识别过程通常在线完成,对用户输入的实时语音进行自动识别。识别过程通常又可以分为“前端”和“后端”两大模块:“前端”模块主要的作用是进行端点检测(去除多余的静音和非说话声)、降噪、特征提取等;“后端”模块的作用是利用训练好的“声学模型”和“语言模型”对用户说话的特征向量进行统计模式识别(又称“解码”),得到其包含的文字信息,此外,后端模块还存在一个“自适应”的反馈模块,可以对用户的语音进行自学习,从而对“声学模型”和“语音模型”进行必要的“校正”,进一步提高识别的准确率。The construction process of a speech recognition device is generally divided into two parts: training and recognition. The training process is usually completed offline, by performing signal processing and knowledge mining on a large number of pre-collected speech and language databases to obtain the "acoustic model" and "language model" required by the speech recognition device; while the recognition process is usually completed online, automatically recognizing the real-time speech input by the user. The recognition process can usually be divided into two major modules: the "front-end" and the "back-end". The main function of the "front-end" module is to perform endpoint detection (removing redundant silence and non-speech sounds), noise reduction, feature extraction, etc.; the function of the "back-end" module is to use the trained "acoustic model" and "language model" to perform statistical pattern recognition (also known as "decoding") on the feature vector of the user's speech to obtain the text information it contains. In addition, the back-end module also has an "adaptive" feedback module that can self-learn the user's speech, thereby performing necessary "corrections" on the "acoustic model" and "speech model" to further improve the recognition accuracy.

参见图3,是本发明实施例提供的自动语音识别过程的流程示意图。语音识别的输入一般是时域的语音信号,数学上一般用向量表示;输出为文本,用token进行表示。在一般情况下,输入语音信号的长度会大于输出文本token的长度。See Figure 3, which is a flow chart of the automatic speech recognition process provided by an embodiment of the present invention. The input of speech recognition is generally a speech signal in the time domain, which is generally represented by a vector in mathematics; the output is text, which is represented by a token. In general, the length of the input speech signal is greater than the length of the output text token.

首先进行语音信号预处理,声音信号本质上是一种波,实际的语音输入环境以及其他影响因素导致输入的语音信号不全是有意义的,因此首先需要对输入的语音信号进行过滤,切除掉首尾段的静音部分,降低对后续步骤造成的干扰。First, the voice signal is preprocessed. The sound signal is essentially a wave. The actual voice input environment and other influencing factors cause the input voice signal to be incomplete and meaningful. Therefore, the input voice signal needs to be filtered first to cut off the silent part at the beginning and end to reduce the interference to the subsequent steps.

在智能问答任务场景中,考虑到实际的工作环境中噪声影响较小,所以选用较为简单的基于能量的方法来去除沉默部分,通过去除平均能量低于整段输入语音的平均能量的0.01倍的帧,来完成对沉默部分的去除。本实施例使用LTSD(Long-term SpectralDivergence,长时谱能量差异)算法通过将语音分解为重叠帧,并根据该帧中存在语音活动的可能性对每个帧进行打分,通过将概率进行累计,进而提取出所有具有语音活动的间隔。In the intelligent question-answering task scenario, considering that the noise impact in the actual working environment is relatively small, a relatively simple energy-based method is used to remove the silent part, and the silent part is removed by removing the frames whose average energy is lower than 0.01 times the average energy of the entire input speech. This embodiment uses the LTSD (Long-term Spectral Divergence) algorithm to decompose the speech into overlapping frames, and score each frame according to the possibility of speech activity in the frame, and then accumulate the probabilities to extract all intervals with speech activity.

再进行特征提取,特征提取是语音识别的重要环节,它通过分析语音信号的波形,提取出能够表征语音信号特征的参数,将每一帧波形变成一个包含声音信息的多维向量,以便于后续的模式匹配和识别。Then feature extraction is performed. Feature extraction is an important part of speech recognition. It analyzes the waveform of the speech signal, extracts parameters that can characterize the characteristics of the speech signal, and converts each frame of the waveform into a multidimensional vector containing sound information to facilitate subsequent pattern matching and recognition.

使用MFCC(梅尔频率倒谱系数)作为特征提取方法,该方法主要用于交互数据特征提取和降低运算维度。参见图4,是本发明实施例提供的特征提取过程的流程示意图。首先对语音输入进行预加重、分帧、加窗,并进行快速傅里叶变化,即FFT变换,对变换结果取绝对值或平方值,再进行Mel滤波,通过离散余弦变换DCT后,提取动态特征,得到特征向量,完成特征提取。MFCC (Mel Frequency Cepstral Coefficient) is used as a feature extraction method, which is mainly used for interactive data feature extraction and reducing the operation dimension. Referring to Figure 4, it is a flow chart of the feature extraction process provided by an embodiment of the present invention. First, the speech input is pre-emphasized, framed, and windowed, and a fast Fourier transform, i.e., FFT, is performed. The absolute value or square value of the transformation result is taken, and then Mel filtering is performed. After discrete cosine transform DCT, dynamic features are extracted to obtain feature vectors to complete feature extraction.

而后进行模式匹配,模式匹配是语音识别的核心步骤,它通过将输入的语音特征与预先训练好的语音识别模型进行匹配,得到最佳的匹配结果。Then pattern matching is performed. Pattern matching is the core step of speech recognition. It obtains the best matching result by matching the input speech features with the pre-trained speech recognition model.

本实施例可选择性的使用隐马尔科夫模型实现模式匹配以处理时序数据,并使用维特比算法在已搭建好的状态网络中搜索一条最佳路径。This embodiment may selectively use a hidden Markov model to implement pattern matching to process time series data, and use a Viterbi algorithm to search for an optimal path in the established state network.

通过声学模型、字典和语言模型确定匹配结果,通过预先训练得到的声学模型对所述语音特征进行识别,得到音素序列;Determine the matching result through the acoustic model, dictionary and language model, and recognize the speech feature through the pre-trained acoustic model to obtain a phoneme sequence;

通过字典将所述音素序列转换为单词序列,通过预先训练的语言模型调整单词序列的顺序,得到识别结果作为所述自然语言文本The phoneme sequence is converted into a word sequence through a dictionary, and the order of the word sequence is adjusted through a pre-trained language model to obtain a recognition result as the natural language text

具体地,声学模型AM通过对大量的交互数据训练获得,输入的是特征向量,输出为音素信息。声学模型通常使用隐马尔可夫模型(HMM)来表示,在语音识别中,声学模型通过HMM来描述语音信号中各个音素之间的转换概率。Specifically, the acoustic model AM is obtained by training a large amount of interactive data, with feature vectors as input and phoneme information as output. The acoustic model is usually represented by a hidden Markov model (HMM). In speech recognition, the acoustic model uses HMM to describe the transition probability between each phoneme in the speech signal.

字典是一个包含所有可能出现的音素的集合,是字或者词与音素的对应。在语音识别中,字典的作用是将声学模型输出的音素序列转换成具体的单词序列。举例来讲,对于中文语音识别来说,字典就是拼音和汉字的对应。A dictionary is a set of all possible phonemes, which is the correspondence between characters or words and phonemes. In speech recognition, the role of the dictionary is to convert the phoneme sequence output by the acoustic model into a specific word sequence. For example, for Chinese speech recognition, the dictionary is the correspondence between pinyin and Chinese characters.

语言模型是语音识别的另一个重要组成部分,它通过分析语音信号的上下文信息,得到语音信号中各个词语之间的关系,调整声学模型输出的单词序列,使其更符合实际的语言使用习惯,从而提高语音识别的准确率。本实施例使用条件随机场(ConditionalRandom Fields,CRF)构建语言模型,它通过建立语音信号中各个词语之间的条件概率分布,得到语音信号中各个词语之间的关系。The language model is another important component of speech recognition. It obtains the relationship between each word in the speech signal by analyzing the context information of the speech signal, and adjusts the word sequence output by the acoustic model to make it more in line with the actual language usage habits, thereby improving the accuracy of speech recognition. This embodiment uses conditional random fields (CRF) to build a language model, which obtains the relationship between each word in the speech signal by establishing the conditional probability distribution between each word in the speech signal.

参见图5,是本发明实施例提供的自动语音识别过程的另一流程示意图。在语音识别时,用户语音输入进行识别得到语音信号,将语音信号划分为不同地信号帧,对信号帧进行特征提取,得到特征向量。声学模型、字典和语言模型共同组成了识别引擎。识别引擎接收输入的语音特征,通过声学模型得到音素序列,然后通过字典将音素序列转换成单词序列,最后通过语言模型调整单词序列,得到最终的识别结果。在当前通过语音输入的方式输入用户需求的智能问答模块中。Refer to Figure 5, which is another flow chart of the automatic speech recognition process provided by an embodiment of the present invention. During speech recognition, the user's speech input is recognized to obtain a speech signal, the speech signal is divided into different signal frames, and the signal frames are feature extracted to obtain a feature vector. The acoustic model, dictionary and language model together constitute the recognition engine. The recognition engine receives the input speech features, obtains a phoneme sequence through the acoustic model, and then converts the phoneme sequence into a word sequence through the dictionary, and finally adjusts the word sequence through the language model to obtain the final recognition result. In the intelligent question and answer module where user needs are currently input through voice input.

在本发明提供的又一实施例中,自然语言理解NLU是人机对话的关键组成部分。NLU的主要任务是理解和解析ASR输出的用户自然语言文本,将非结构化的语言数据转换为结构化的模型可以理解的数据形式。NLU的基本目标是提取用户语句中的关键信息:用户意图和槽值。前者建模为意图识别任务,后者建模为槽填充任务,自然语言理解过程具体包括以下步骤:In another embodiment provided by the present invention, natural language understanding NLU is a key component of human-computer dialogue. The main task of NLU is to understand and parse the user's natural language text output by ASR, and convert unstructured language data into a data form that can be understood by a structured model. The basic goal of NLU is to extract key information from user sentences: user intent and slot value. The former is modeled as an intent recognition task, and the latter is modeled as a slot filling task. The natural language understanding process specifically includes the following steps:

意图识别主要目标是从用户的自然语言输入中提取出具体的意图,通常被建模为分类任务。槽填通常被定义为一个序列标注问题。参见表1,是一种用户话语、用户意图和槽值对的对应关系表。The main goal of intent recognition is to extract specific intent from the user's natural language input, which is usually modeled as a classification task. Slot filling is usually defined as a sequence labeling problem. See Table 1, which is a correspondence table of user utterances, user intents, and slot value pairs.

表1对应关系表Table 1 Correspondence table

用户话语User Quotes 我想做一个IT云的网络拓扑图I want to make a network topology diagram for an IT cloud 用户意图User Intent 绘制网络拓扑图Draw a network topology diagram 槽值对Slot-value pairs 领域=IT云Field = IT Cloud

意图识别主要目标是从用户的自然语言输入中提取出具体的意图,通常被建模为分类任务。槽填通常被定义为一个序列标注问题。The main goal of intent recognition is to extract specific intent from the user's natural language input, which is usually modeled as a classification task. Slot filling is usually defined as a sequence labeling problem.

将所述自然语言文本输入到预先训练的文本识别模型中,根据输出结果确定当前文本的意图和槽值对,完成文本识别。The natural language text is input into a pre-trained text recognition model, and the intent and slot-value pairs of the current text are determined according to the output results to complete the text recognition.

在本发明提供的又一实施例中,在文本识别模型训练时,具体执行以下步骤:In another embodiment provided by the present invention, when training the text recognition model, the following steps are specifically performed:

为了对BERT进行微调,首先需要构造一批训练数据。基于大规模的人人对话数据,实现半自动构建有监督训练数据。参见图6,是本发明实施例提供的文本识别模型的训练流程示意图。In order to fine-tune BERT, we first need to construct a batch of training data. Based on large-scale human-to-human conversation data, we can semi-automatically construct supervised training data. See Figure 6, which is a schematic diagram of the training process of the text recognition model provided by an embodiment of the present invention.

数据构建流程主要包含六个步骤:The data construction process mainly includes six steps:

数据收集,数据主要来源于两个部分,一个是线上模板方式累积的大量真实对话数据,另一个是大语言模型在给定领域知识下,设计特定的prompt辅助生成对话数据。Data collection,The data mainly comes from two parts. One is a large amount of real conversation data accumulated in an online template way, and the other is a large language model that designs specific prompts to assist in generating conversation data based on given domain knowledge.

数据预处理:对收集的数据进行清洗与预处理。一般包括修正语言错误,标准化缩写词和表情符号,删除特殊字符和噪声等。Data preprocessing: Clean and preprocess the collected data, which generally includes correcting language errors, standardizing abbreviations and emoticons, removing special characters and noise, etc.

意图定义:根据具体的应用场景和需求,定义出一组将要识别的用户意图类别,如"绘制网络拓扑图"、"定义POD类型"、"修改设备链接"等。Intent definition: Based on the specific application scenarios and requirements, define a set of user intent categories to be identified, such as "drawing a network topology map", "defining POD type", "modifying device links", etc.

数据标注:针对每条对话数据,确定用户的主要意图,并标注出对应的类别。进一步,需要对话语中的槽值信息进行标注,比如"领域"和"POD类型""等。数据标注通常需要严谨的可执行标注规则以及专业的人工标注团队。随着大语言模型的发展,大模型在未见领域上具有非常强的泛化能力,可以用于辅助用户意图和槽值信息的提取,只需人工标注团队对大模型的标注结果进行修正,可以极大提高标注效率。Data labeling: For each conversation data, determine the user's main intention and mark the corresponding category. Furthermore, it is necessary to label the slot value information in the discourse, such as "domain" and "POD type". Data labeling usually requires rigorous executable labeling rules and a professional manual labeling team. With the development of large language models, large models have very strong generalization capabilities in unseen fields and can be used to assist in the extraction of user intentions and slot value information. The manual labeling team only needs to correct the labeling results of the large model, which can greatly improve the labeling efficiency.

BERT预处理:将标注好的对话数据转化为BERT能够理解的输入格式。通常包括添加特殊字符(如'[CLS]’和'[SEP]’)、分词等。BERT preprocessing: Convert the annotated conversation data into an input format that BERT can understand. This usually includes adding special characters (such as '[CLS]' and '[SEP]'), word segmentation, etc.

划分数据集:将标注好的数据按照预设的划分比例随机分为训练集、验证集和测试集,优选地可选择的比例为8:1:1用于模型训练和模型验证,参见表2,是数据集的示例表。Divide the data set: randomly divide the labeled data into training set, validation set and test set according to the preset division ratio. Preferably, the ratio can be selected as 8:1:1 for model training and model verification. See Table 2, which is an example table of the data set.

表2数据集示例表Table 2 Dataset example table

参见图7,是本发明实施例提供的文本识别模型训练过程的原理示意图。使用BERT模型结构,该模型是在原始Transformer模型的基础上设计的多层双向Transformer编码器,其输入是WordPiece的词向量表示、位置表示和片段表示的组合。一个特殊的分类字符([CLS])被插入作为第一个词,而一个特殊的词([SEP])被添加作为最后一个词。BERT模型采用两种策略在大规模无标签文本上进行预训练。BERT模型使用第一个特殊标记[CLS]来输出的隐状态来预测用户意图,将所有词最后一层的输出进行softmax来预测序列标签,其中:B表示当前词是某个实体的开始;I表示当前词在某个实体内部,但并非起始位置;O表示当前词不属于任何实体。BERT模型采用交叉熵损失函数进行训练,使用Adam作为优化器,所有超参数都根据验证集上的损失值来进行调整。选择在验证集上表现最好的模型作为最终的模型。See Figure 7, which is a schematic diagram of the principle of the text recognition model training process provided by an embodiment of the present invention. The BERT model structure is used. The model is a multi-layer bidirectional Transformer encoder designed on the basis of the original Transformer model, and its input is a combination of the word vector representation, position representation and fragment representation of WordPiece. A special classification character ([CLS]) is inserted as the first word, and a special word ([SEP]) is added as the last word. The BERT model uses two strategies to pre-train on large-scale unlabeled text. The BERT model uses the hidden state output by the first special tag [CLS] to predict user intent, and performs softmax on the output of the last layer of all words to predict the sequence label, where: B indicates that the current word is the beginning of an entity; I indicates that the current word is inside an entity, but not at the starting position; O indicates that the current word does not belong to any entity. The BERT model is trained using the cross entropy loss function, using Adam as the optimizer, and all hyperparameters are adjusted according to the loss value on the validation set. The model with the best performance on the validation set is selected as the final model.

相比于传统的基于RNN架构的NLU模型而言,本实施例使用的基于Transformer架构的BERT模型训练更快且具有更好的泛化性,结构也更简洁,适用于垂直领域NLU模型的构建。Compared with the traditional NLU model based on the RNN architecture, the BERT model based on the Transformer architecture used in this embodiment is faster to train and has better generalization, and has a simpler structure, which is suitable for the construction of NLU models in vertical fields.

在本发明提供的又一实施例中,对话管理DM的主要任务是根据NLU模块中提取得到的意图和槽值完成动作决策。将对话管理DM分为对话状态追踪DST和对话策略优化DPO两个子模块实现。参见图8,是本发明实施例提供的对话管理过程的流程示意图。In another embodiment provided by the present invention, the main task of the dialogue management DM is to complete the action decision according to the intent and slot value extracted from the NLU module. The dialogue management DM is divided into two sub-modules: dialogue state tracking DST and dialogue strategy optimization DPO. See Figure 8, which is a flowchart of the dialogue management process provided by an embodiment of the present invention.

在进行对话管理时,对话状态追踪DST负责根据对话历史和用户输入确定当前的对话状态,对话策略优化DPO负责根据当前的对话状态做出最合适的响应动作。When managing dialogues, dialogue state tracking (DST) is responsible for determining the current dialogue state based on dialogue history and user input, and dialogue policy optimization (DPO) is responsible for making the most appropriate response action based on the current dialogue state.

在本发明提供的又一实施例中,在任务型人机对话中,对话状态是DST维护的一系列槽和槽值,对话状态追踪DST确定当前的会话状态时,具体包括以下步骤:In another embodiment provided by the present invention, in a task-based human-computer dialogue, the dialogue state is a series of slots and slot values maintained by the DST. When the dialogue state tracking DST determines the current session state, the following steps are specifically included:

在任务型人机对话中,将每轮最新对话提取出的文本的意图和槽值对添加到对应的槽中;In task-based human-computer dialogue, the intent and slot value pairs of the text extracted from each latest dialogue are added to the corresponding slots;

完成对话状态的更新,更新当前的对话状态。Complete the update of the conversation status and update the current conversation status.

在本发明提供的又一实施例中,对话过程视为马尔可夫决策过程,即影响当前装置动作决策的因素仅与当前对话状态有关,而与历史对话状态无关,因此DST仅维护当前对话状态。DST维护的对话状态通过索引表实现。在对话开始时,装置根据用户选择的需要绘制网络拓扑图的领域,初始化对话状态。初始对话状态是一个索引键为绘制该领域网络拓扑图所有所需参数的的槽名,索引值均为空的索引表。在索引表中,部分槽被定义为关键槽,对应完成网络拓扑图绘制的必需参数。经过多轮对话后,当所有关键槽都被填充完毕后,装置将根据预定拓扑图模板和槽值参数,绘制出对应的网络拓扑图。In another embodiment provided by the present invention, the dialogue process is regarded as a Markov decision process, that is, the factors affecting the current device action decision are only related to the current dialogue state, and have nothing to do with the historical dialogue state, so DST only maintains the current dialogue state. The dialogue state maintained by DST is implemented through an index table. At the beginning of the dialogue, the device initializes the dialogue state according to the domain of the network topology map selected by the user. The initial dialogue state is an index table in which the index key is the slot name of all the parameters required to draw the network topology map of the domain, and the index value is empty. In the index table, some slots are defined as key slots, corresponding to the necessary parameters for completing the drawing of the network topology map. After multiple rounds of dialogue, when all the key slots are filled, the device will draw the corresponding network topology map according to the predetermined topology map template and slot value parameters.

对话策略优化DPO采用预定规则的方法设计并基于有限状态自动机(FSA)实现。在对话过程中,DPO根据DST维护的当前对话状态执行预先设定好的响应动作。动作分为三大类:询问动作、解答动作、绘图动作。参见表3,是各个动作的功能表。The dialogue strategy optimization DPO is designed using a predetermined rule method and implemented based on a finite state automaton (FSA). During the dialogue process, the DPO executes pre-set response actions based on the current dialogue state maintained by the DST. The actions are divided into three categories: inquiry actions, answer actions, and drawing actions. See Table 3 for a table of the functions of each action.

表3动作功能表Table 3 Action function table

动作类Action 功能Function 询问ask 基于当前对话状态向用户提问,引导用户回答关键槽值Ask users questions based on the current conversation state and guide them to answer key slot values 解答answer 根据用户的提问,在知识库中匹配答案以解答问题Based on the user's question, match the answer in the knowledge base to answer the question 绘图Drawing 根据预定拓扑图模板和槽值参数,绘制出对应的网络拓扑图Draw the corresponding network topology diagram according to the predetermined topology diagram template and slot value parameters

在完整的一个对话过程中,装置的核心任务是通过多轮提问引导用户填充关键槽值,次要任务是随时解答用户的提问。另外,当用户不能完整描述所需组网架构时,自动推荐与之相似的模板供用户选择,参见图9,是本发明实施例提供的基于问答的网络拓扑图生成方法的又一流程示意图。In a complete conversation process, the core task of the device is to guide the user to fill in the key slot value through multiple rounds of questions, and the secondary task is to answer the user's questions at any time. In addition, when the user cannot fully describe the required networking architecture, a similar template is automatically recommended for the user to choose. See Figure 9, which is another flow chart of the method for generating a network topology map based on question and answer provided by an embodiment of the present invention.

询问态内的状态转移通过绘图参数槽的更新实现,询问态和解答态之间的状态转移通过意图槽的更新实现,当所有关键槽填充完毕后,对话状态从询问态转移到绘图态。在三种动作对应不同状态下,采取动作的实现方法不同。The state transition within the inquiry state is realized by updating the drawing parameter slot, and the state transition between the inquiry state and the answer state is realized by updating the intention slot. When all key slots are filled, the dialogue state is transferred from the inquiry state to the drawing state. In the three actions corresponding to different states, the implementation method of taking actions is different.

当对话状态为询问态时,采用询问动作。基于下一个需要用户填充的关键槽生成问题,向用户提问以获取对应槽值。当用户不能准确回答时,该槽将被填充入特殊符号,以标记为不确定状态。When the dialog state is in the inquiry state, the inquiry action is used. A question is generated based on the next key slot that needs to be filled by the user, and the user is asked to obtain the corresponding slot value. When the user cannot answer accurately, the slot will be filled with a special symbol to mark it as an uncertain state.

当对话状态为解答态时,本实施例采用解答动作。通过链接外置知识库,知识库中存储了大量的问题-答案对。用户的提问语句先被转换为句向量,与知识库中的问题向量进行相似度匹配,再将相似度最高的问题对应的答案返回给用户。句向量和问题向量分别通过将提问语句和问题输入到BERT中,取[CLS]符号对应向量得到。由于BERT在大规模语料上经过了预训练,语义接近的语句输入到BERT中后,其[CLS]符号输出的向量在语义空间上的距离接近。因此,可进一步采用余弦距离度量两个句向量的语义相似度。另外,为了节省计算开销,可以将问题向量提前存储在知识库中。在解答完用户的提问后,本实施例将自动回退到先前的询问态并向用户重新提问。When the dialog state is the answer state, this embodiment adopts the answer action. By linking the external knowledge base, a large number of question-answer pairs are stored in the knowledge base. The user's question statement is first converted into a sentence vector, and the similarity is matched with the question vector in the knowledge base, and then the answer corresponding to the question with the highest similarity is returned to the user. The sentence vector and the question vector are respectively input into BERT by inputting the question statement and the question into BERT, and obtaining the vector corresponding to the [CLS] symbol. Since BERT has been pre-trained on a large-scale corpus, after the semantically similar sentences are input into BERT, the distance between the vectors output by their [CLS] symbols in the semantic space is close. Therefore, the cosine distance can be further used to measure the semantic similarity of the two sentence vectors. In addition, in order to save computational overhead, the question vector can be stored in the knowledge base in advance. After answering the user's question, this embodiment will automatically fall back to the previous inquiry state and ask the user again.

当对话状态为绘图态时,装置采用绘图动作。如果没有关键槽为不确定状态,装置将调用绘图接口,完成网络拓扑图绘制。否则,装置将计算已确定的绘图参数和模板预定参数的相似度,取最相似的数个模板返回给用户,供用户选择。When the dialog state is the drawing state, the device adopts the drawing action. If no key slot is in an uncertain state, the device will call the drawing interface to complete the network topology drawing. Otherwise, the device will calculate the similarity between the determined drawing parameters and the template preset parameters, and take the most similar templates and return them to the user for selection.

在本发明提供的又一实施例中,自然语言生成(Natural Language Generation,NLG)是自然语言处理的(Natural Language Process,NLP)的一个子类别,主要目的是将结构化的数据自动转换为人类可读文本的软件过程。面向网络拓扑图生成的智能问答模块属于任务型对话装置,任务型对话中的NLG就是在NLU(领域分类和意图识别、槽值填充)、DST、DPL的基础上,根据学习到的策略来生成对话回复,一般回复包括澄清需求、引导用户、询问、确认、对话结束语等。In another embodiment provided by the present invention, natural language generation (NLG) is a subcategory of natural language processing (NLP), and its main purpose is to automatically convert structured data into human-readable text. The intelligent question-answering module for network topology generation belongs to a task-based dialogue device. The NLG in the task-based dialogue is to generate dialogue replies based on the learned strategies based on NLU (domain classification and intent recognition, slot value filling), DST, and DPL. The general replies include clarifying requirements, guiding users, asking, confirming, and concluding dialogues.

参见图10,是本发明实施例提供的自然语言文本输出过程的流程示意图。自然语言文本输出过程分为6个步骤:See Figure 10, which is a flow chart of the natural language text output process provided by an embodiment of the present invention. The natural language text output process is divided into 6 steps:

步骤1,内容确定(Content Determination),通常数据中传达的信息比最终传达的信息要多,NLG决定哪些信息应该包含在正在构建的文本中;Step 1, Content Determination: Usually the data conveys more information than what is ultimately conveyed, and NLG decides what information should be included in the text being constructed.

步骤2,文本结构(Text Structuring),确定好哪些信息需要传达后,NLG装置需要合理地组织文本的结构顺序;Step 2: Text Structuring. After determining what information needs to be conveyed, the NLG device needs to organize the text structure order reasonably.

步骤3,句子聚合(Sentence Aggregation),不是每一条信息都需要一个独立的句子表达,NLG装置需要将多个信息合并到一个句子中进行连贯表达;Step 3: Sentence Aggregation: Not every piece of information needs to be expressed in an independent sentence. The NLG device needs to merge multiple pieces of information into one sentence for coherent expression.

步骤4,语法化(Lexicalisation),当每一句的内容确定后,NLG装置通过在各种信息之间添加连接词,将信息组织成自然语言;Step 4: grammaticalization. Once the content of each sentence is determined, the NLG device organizes the information into natural language by adding connectives between various information.

步骤5,参考表达式生成(Referring Expression Generation),NLG装置需要识别出内容的领域,并使用该领域的词汇来构成完整的句子;Step 5, Referring Expression Generation, the NLG device needs to identify the domain of the content and use the vocabulary of the domain to form a complete sentence;

步骤6,语言实现(Linguistic Realisation),当所有相关的单词和短语都已经确定后,NLG装置将信息输入模板,获得结构良好、表达准确的完整句子。参见表4,是当前任务场景下实现流程示例表;Step 6, Linguistic Realisation, when all relevant words and phrases have been determined, the NLG device inputs the information into the template to obtain a complete sentence with good structure and accurate expression. See Table 4, which is an example of the implementation process in the current task scenario;

表4流程示例表Table 4 Process example table

本实施例使用基于模板的NLG生成方法,主要应用场景为通过对话装置从用户获取生成网络拓扑图的相关结构化信息。基于模板的NLG方法主要发挥两个作用,分别是向用户传递构建网络拓扑图的相关信息和进行用户问询。This embodiment uses a template-based NLG generation method, and the main application scenario is to obtain relevant structured information for generating a network topology map from a user through a dialogue device. The template-based NLG method mainly plays two roles, namely, delivering relevant information for building a network topology map to the user and conducting user inquiries.

具体的实现方法中,可根据对话管理(DM)模块中的用户意图(intention)进行分类,并针对用户传递的信息、问询的槽位,提前通过人工的方式设计好对应的模板,模板中的槽位一般使用“<占位符>”进行表达,在实际生成自然语言文本的时候,将模板中的槽位使用获取到的对应的值进行替换。In the specific implementation method, the user intention in the dialogue management (DM) module can be classified, and the corresponding templates can be manually designed in advance for the information transmitted by the user and the slots of the inquiry. The slots in the template are generally expressed using "<placeholder>". When the natural language text is actually generated, the slots in the template are replaced with the corresponding values obtained.

表5对话模块Table 5 Dialogue modules

基于模板的NLG方法工作原理简单且回复精准,在使用之前需要预先了解任务需求,通过人工的方式设定不同的对话场景,并根据每个对话场景设计对应的对话模板,模板的某些成分是固定的,模板中预设的槽位则需要根据对话管理(DM)模块的输出进行填充。The template-based NLG method has a simple working principle and accurate responses. Before using it, it is necessary to understand the task requirements in advance, set different dialogue scenarios manually, and design corresponding dialogue templates based on each dialogue scenario. Some components of the template are fixed, and the preset slots in the template need to be filled according to the output of the dialogue management (DM) module.

在实际的使用过程中,需要维护当前任务的对话模板集合,当业务场景进行扩展时,可通过增加新模板到模板集合中进行扩展和维护。In actual use, it is necessary to maintain the dialog template collection of the current task. When the business scenario is expanded, it can be expanded and maintained by adding new templates to the template collection.

参见图11,是本发明实施例提供的一种基于问答的网络拓扑图生成装置的结构示意图,所述装置包括:Referring to FIG. 11 , it is a schematic diagram of the structure of a network topology diagram generating device based on question-answering provided by an embodiment of the present invention, wherein the device comprises:

智能对话模块,用于根据用户输入的交互数据进行自动问答,生成对话数据;Intelligent dialogue module, used to automatically answer questions based on the interaction data input by the user and generate dialogue data;

数据映射模块,用于将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,得到拓扑图结构化数据;A data mapping module, used to map entities and intentions in the automatic dialogue data into nodes and connection relationships in a topological graph, respectively, to obtain topological graph structured data;

创建模块,用于根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件;A creation module is used to create an XML document of a topology map according to a dom4j parsing package, add the structured data of the topology map to the XML document, and generate an XML file;

加载模块,用于加载和渲染所述XML文件得到网络拓扑图。The loading module is used to load and render the XML file to obtain a network topology diagram.

需要说明的是,本实施例提供的基于问答的网络拓扑图生成装置,能够执行上述任一实施例提供的基于问答的网络拓扑图生成方法的所有步骤与功能,在此对该装置的具体功能不作赘述。It should be noted that the question-and-answer based network topology map generation device provided in this embodiment can execute all the steps and functions of the question-and-answer based network topology map generation method provided in any of the above embodiments, and the specific functions of the device will not be described in detail here.

参见图12,是本发明实施例提供的一种基于问答的网络拓扑图生成装置的另一结构示意图。所述基于问答的网络拓扑图生成装置包括:处理器、存储器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,例如一种基于问答的网络拓扑图生成程序。所述处理器执行所述计算机程序时实现上述各个一种基于问答的网络拓扑图生成方法实施例中的步骤,例如图1所示的步骤S1~S4。或者,所述处理器执行所述计算机程序时实现上述各装置实施例中各模块的功能。Refer to Figure 12, which is another structural schematic diagram of a network topology map generation device based on question and answer provided in an embodiment of the present invention. The network topology map generation device based on question and answer includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a network topology map generation program based on question and answer. When the processor executes the computer program, it implements the steps in each of the above-mentioned embodiments of the network topology map generation method based on question and answer, such as steps S1 to S4 shown in Figure 1. Alternatively, when the processor executes the computer program, it implements the functions of each module in the above-mentioned device embodiments.

示例性的,所述计算机程序可以被分割成一个或多个模块,所述一个或者多个模块被存储在所述存储器中,并由所述处理器执行,以完成本发明。所述一个或多个模块可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述所述计算机程序在所述一种基于问答的网络拓扑图生成装置中的执行过程。例如,所述计算机程序可以被分割成若干模块,各模块具体功能在上述任一实施例提供的一种基于问答的网络拓扑图生成方法中已作详细说明,在此对该装置的具体功能不作赘述。Exemplarily, the computer program can be divided into one or more modules, and the one or more modules are stored in the memory and executed by the processor to complete the present invention. The one or more modules can be a series of computer program instruction segments that can perform specific functions, and the instruction segments are used to describe the execution process of the computer program in the network topology map generation device based on question and answer. For example, the computer program can be divided into several modules, and the specific functions of each module have been described in detail in the network topology map generation method based on question and answer provided in any of the above embodiments, and the specific functions of the device will not be repeated here.

所述一种基于问答的网络拓扑图生成装置可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述一种基于问答的网络拓扑图生成装置可包括,但不仅限于,处理器、存储器。本领域技术人员可以理解,所述示意图仅仅是一种基于问答的网络拓扑图生成装置的示例,并不构成对一种基于问答的网络拓扑图生成装置的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述一种基于问答的网络拓扑图生成装置还可以包括输入输出设备、网络接入设备、总线等。The network topology map generating device based on question and answer can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The network topology map generating device based on question and answer can include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the schematic diagram is only an example of a network topology map generating device based on question and answer, and does not constitute a limitation of a network topology map generating device based on question and answer. It can include more or fewer components than shown in the figure, or combine certain components, or different components. For example, the network topology map generating device based on question and answer can also include input and output devices, network access devices, buses, etc.

所称处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器是所述一种基于问答的网络拓扑图生成装置的控制中心,利用各种接口和线路连接整个一种基于问答的网络拓扑图生成装置的各个部分。The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the network topology map generating device based on question and answer, and uses various interfaces and lines to connect the various parts of the entire network topology map generating device based on question and answer.

所述存储器可用于存储所述计算机程序和/或模块,所述处理器通过运行或执行存储在所述存储器内的计算机程序和/或模块,以及调用存储在存储器内的数据,实现所述一种基于问答的网络拓扑图生成装置的各种功能。所述存储器可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(SecureDigital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory can be used to store the computer program and/or module, and the processor realizes various functions of the network topology map generating device based on question and answer by running or executing the computer program and/or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

其中,所述一种基于问答的网络拓扑图生成装置集成的模块如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质等。Wherein, if the module integrated in the network topology map generating device based on question and answer is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.

本发明实施例还提供一种计算机程序产品,包括计算机程序/指令,该计算机程序/指令被处理器执行时实现上述任一项实施例所述的方法的步骤。An embodiment of the present invention further provides a computer program product, including a computer program/instruction, which implements the steps of the method described in any of the above embodiments when executed by a processor.

需要说明的是,本实施例提供的计算机程序产品,能够执行上述任一实施例提供的基于问答的网络拓扑图生成方法的所有步骤与功能,在此对该装置的具体功能不作赘述。It should be noted that the computer program product provided in this embodiment can execute all the steps and functions of the question-and-answer based network topology map generation method provided in any of the above embodiments, and the specific functions of the device are not described in detail here.

应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention, and these improvements and modifications are also considered to be within the protection scope of the present invention.

Claims (22)

1.一种基于问答的网络拓扑图生成方法,其特征在于,所述方法包括:1. A method for generating a network topology diagram based on question and answer, characterized in that the method comprises: 根据用户输入的交互数据进行自动问答,生成对话数据;Automatically answer questions based on the interaction data input by the user to generate conversation data; 将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,得到拓扑图结构化数据;Mapping entities and intentions in the automatic dialogue data to nodes and connection relationships in a topological graph, respectively, to obtain topological graph structured data; 根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件;Creating an XML document of a topology map according to a dom4j parsing package, adding structured data of the topology map to the XML document, and generating an XML file; 加载和渲染所述XML文件得到网络拓扑图。The XML file is loaded and rendered to obtain a network topology diagram. 2.根据权利要求1所述的基于问答的网络拓扑图生成方法,其特征在于,根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件,包括:2. The method for generating a network topology map based on question and answer according to claim 1 is characterized in that an XML document of a topology map is created according to a dom4j parsing package, and the structured data of the topology map is added to the XML document to generate an XML file, comprising: 遍历所述拓扑图结构化数据中节点和连接关系,并根据dom4j解析包创建对应的XML元素;Traverse the nodes and connection relationships in the topology structured data, and create corresponding XML elements according to the dom4j parsing package; 将创建的XML元素添加到所述XML文档中,添加节点和属性,得到XML文件。Add the created XML element to the XML document, add nodes and attributes, and obtain an XML file. 3.根据权利要求1所述的基于问答的网络拓扑图生成方法,其特征在于,所述方法还包括:3. The method for generating a network topology diagram based on question and answer according to claim 1, characterized in that the method further comprises: 使用预设的布局算法排列所述网络拓扑图中的节点。The nodes in the network topology graph are arranged using a preset layout algorithm. 4.根据权利要求3所述的基于问答的网络拓扑图生成方法,其特征在于,使用预设的布局算法排列所述网络拓扑图中的节点,包括:4. The method for generating a network topology map based on question and answer according to claim 3, wherein the nodes in the network topology map are arranged using a preset layout algorithm, comprising: 获取所述网络拓扑图中的节点数量;Obtaining the number of nodes in the network topology graph; 根据所述网络拓扑图的布局和尺寸确定与圆形布局的半径;Determining the radius of the circular layout according to the layout and size of the network topology diagram; 根据节点的索引值计算所述网络拓扑图中的每一节点的角度值;Calculate the angle value of each node in the network topology diagram according to the index value of the node; 根据每一节点的角度值和半径确定不同节点的坐标位置;Determine the coordinate positions of different nodes according to the angle value and radius of each node; 将每一节点的坐标位置应用到所述网络拓扑图中,完成圆形布局。The coordinate position of each node is applied to the network topology diagram to complete the circular layout. 5.根据权利要求3所述的基于问答的网络拓扑图生成方法,其特征在于,使用预设的布局算法排列所述网络拓扑图中的节点,包括:5. The method for generating a network topology map based on question and answer according to claim 3, wherein the nodes in the network topology map are arranged using a preset layout algorithm, comprising: 获取所述网络拓扑图中节点数量和连接关系;Obtain the number of nodes and connection relationships in the network topology diagram; 创建一个空的布局结果数据结构;Create an empty layout result data structure; 以所述网络拓扑图的根节点作为原点位置,遍历每一层的节点,计算子节点与所述根节点在垂直方向的距离,作为纵坐标;将预设的偏移距离作为每一子节点和其父节点的水平距离,确定子节点的横坐标;Taking the root node of the network topology as the origin, traverse the nodes of each layer, calculate the vertical distance between the child node and the root node as the ordinate; taking the preset offset distance as the horizontal distance between each child node and its parent node, determine the abscissa of the child node; 将每一节点的横坐标和纵坐标作为位置信息保存到所述布局结果数据结构中;The horizontal coordinate and the vertical coordinate of each node are saved as position information in the layout result data structure; 将每一节点的坐标位置应用到所述网络拓扑图中,完成层次布局。The coordinate position of each node is applied to the network topology diagram to complete the hierarchical layout. 6.根据权利要求3所述的基于问答的网络拓扑图生成方法,其特征在于,将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,生成拓扑图结构化数据,包括:6. The method for generating a network topology map based on question and answer according to claim 3, characterized in that the entities and intentions in the automatic dialogue data are respectively mapped to nodes and connection relationships in the topology map to generate topology map structured data, including: 对所述自动对话数据中文本进行预处理,去除文本字符;Preprocessing the text in the automatic dialogue data to remove text characters; 识别预处理后的对话文本中的实体信息,映射为拓扑图中的节点;Identify entity information in the preprocessed conversation text and map it to nodes in the topology graph; 使用自然语言处理技术识别所述对话文本中的对话意图,映射为起始节点和目标节点的连接关系;Using natural language processing technology to identify the conversation intention in the conversation text, and mapping it to a connection relationship between a start node and a target node; 根据节点和对应的连接关系输出JSON格式的拓扑图结构化数据。Output topology structured data in JSON format based on nodes and corresponding connection relationships. 7.根据权利要求1所述的基于问答的网络拓扑图生成方法,其特征在于,所述拓扑图结构化数据包括节点信息、连接信息以及模块信息;7. The method for generating a network topology map based on question and answer according to claim 1, wherein the topology map structured data includes node information, connection information and module information; 所述节点信息包括节点唯一标识、名称、类型以及层级信息;The node information includes node unique identification, name, type and level information; 所述连接信息包括连接的唯一标识、连接名称、连接类型、起始连接节点、目标连接节点以及其他各项连接信息;The connection information includes a unique identifier of the connection, a connection name, a connection type, a starting connection node, a target connection node, and other connection information; 所述模块信息包括当前模块信息,以及当前模块下所有节点、连线的列表。The module information includes the current module information and a list of all nodes and connections under the current module. 8.根据权利要求1所述的基于问答的网络拓扑图生成方法,其特征在于,所述方法还包括:8. The method for generating a network topology diagram based on question and answer according to claim 1, characterized in that the method further comprises: 对所述拓扑图结构化数据进行解析,将其转化为程序可识别的结构化数据;Parsing the topological map structured data and converting it into structured data recognizable by a program; 对所述对话数据进行信息提取,通过预设的关键词匹配算法计算提取的每一关键词在所述结构化数据和对话信息中的匹配程度,确定结构化数据和对话信息之间的整体匹配程度;Extracting information from the conversation data, calculating the matching degree of each extracted keyword in the structured data and the conversation information by using a preset keyword matching algorithm, and determining the overall matching degree between the structured data and the conversation information; 输出匹配程度高的拓扑图结构化数据。Output topological structured data with a high degree of matching. 9.根据权利要求1所述的基于问答的网络拓扑图生成方法,其特征在于,所述方法还包括:9. The method for generating a network topology diagram based on question and answer according to claim 1, characterized in that the method further comprises: 在前端基于bpmn.js库使用API端点和组件定义节点类型、连接类型和交互行为,创建拓扑图编辑器界面;On the front end, use API endpoints and components based on the bpmn.js library to define node types, connection types, and interaction behaviors, and create a topology editor interface; 通过事件监听和回调函数识别用户通过所述拓扑图编辑器界面输入的交互指令,执行所述交互指令。The interactive instructions input by the user through the topology diagram editor interface are identified through event monitoring and callback functions, and the interactive instructions are executed. 10.根据权利要求1所述的基于问答的网络拓扑图生成方法,其特征在于,所述方法还包括:10. The method for generating a network topology diagram based on question and answer according to claim 1, characterized in that the method further comprises: 基于在后端通过Spring Boot定义的API端点接收前端发送的拓扑图数据和拓扑请求,使用Spring Boot的控制器和服务层处理所述拓扑图数据,生成新的XML文件,返回前端。Based on receiving the topology map data and topology request sent by the front end through the API endpoint defined by Spring Boot on the back end, the topology map data is processed using the controller and service layer of Spring Boot, a new XML file is generated, and returned to the front end. 11.根据权利要求1所述的基于问答的网络拓扑图生成方法,其特征在于,所述根据用户输入的交互数据进行自动问答,生成对话数据,包括:11. The method for generating a network topology map based on question and answer according to claim 1, characterized in that the step of automatically answering questions based on the interactive data input by the user to generate the dialogue data comprises: 将用户输入的交互数据进行语音识别,转换为自然语言文本;Perform speech recognition on the interactive data input by the user and convert it into natural language text; 将所述自然语言文本进行自然语言理解,提取得到当前文本的意图和槽值对;Performing natural language understanding on the natural language text to extract the intent and slot-value pairs of the current text; 对当前文本的意图和槽值对进行对话管理,得到响应动作;Perform dialogue management on the intent and slot value pairs of the current text to obtain response actions; 对所述响应动作进行自然语言生成,得到自然语言文本输出;Performing natural language generation on the response action to obtain a natural language text output; 将所述交互数据和所述自然语言文本输出作为所述对话数据。The interaction data and the natural language text are output as the conversation data. 12.根据权利要求11所述的基于问答的网络拓扑图生成方法,其特征在于,将用户输入的交互数据进行语音识别,转换为自然语言文本,包括:12. The method for generating a network topology map based on question and answer according to claim 11, characterized in that the interactive data input by the user is subjected to speech recognition and converted into natural language text, comprising: 对所述交互数据进行预处理;Preprocessing the interaction data; 对预处理后的交互数据的信号波形进行特征提取,得到语音特征;Extract features from the preprocessed signal waveform of the interactive data to obtain speech features; 通过预先训练得到的声学模型对所述语音特征进行识别,得到音素序列;Recognizing the speech features through a pre-trained acoustic model to obtain a phoneme sequence; 通过字典将所述音素序列转换为单词序列,通过预先训练的语言模型调整单词序列的顺序,得到识别结果作为所述自然语言文本。The phoneme sequence is converted into a word sequence through a dictionary, and the order of the word sequence is adjusted through a pre-trained language model to obtain a recognition result as the natural language text. 13.根据权利要求11所述的基于问答的网络拓扑图生成方法,其特征在于,将所述自然语言文本进行自然语言理解,提取得到当前文本的意图和槽值对,包括:13. The method for generating a network topology map based on question-answering according to claim 11, characterized in that the natural language text is subjected to natural language understanding to extract the intent and slot-value pairs of the current text, comprising: 将所述自然语言文本输入到预先训练的文本识别模型中,根据输出结果确定当前文本的意图和槽值对。The natural language text is input into a pre-trained text recognition model, and the intent and slot-value pairs of the current text are determined according to the output results. 14.根据权利要求13所述的基于问答的网络拓扑图生成方法,其特征在于,所述文本识别模型训练过程包括:14. The method for generating a network topology map based on question and answer according to claim 13, wherein the text recognition model training process comprises: 收集对话数据,并进行预处理;Collect conversation data and perform preprocessing; 根据预处理后的对话数据的应用场景和需求,定义意图类别;Define intent categories based on the application scenarios and requirements of the preprocessed conversation data; 对每条对话数据标注出意图,并对对话数据中的槽值信息进行标注;Label the intent of each conversation data and the slot value information in the conversation data; 在标注后的对话数据中添加特殊字符,将标准后的对话数据转换为预设格式;Add special characters to the annotated conversation data and convert the standardized conversation data into a preset format; 将转换后的对话数据按照预设的划分比例划分出训练集、验证集和测试集;Divide the converted conversation data into training set, validation set and test set according to the preset division ratio; 根据划分的训练集和所述测试集对预设的BERT模型采用交叉熵损失函数进行训练,通过Adam作为优化器对所述BERT模型进行优化;The preset BERT model is trained using a cross entropy loss function according to the divided training set and the test set, and the BERT model is optimized by using Adam as an optimizer; 通过所述验证集对训练后的模型进行验证,根据验证的损失值调整所述BERT模型的超参数,直到验证集的模型损失值达到阈值要求,输出所述文本识别模型。The trained model is verified through the verification set, and the hyperparameters of the BERT model are adjusted according to the verified loss value until the model loss value of the verification set reaches the threshold requirement, and the text recognition model is output. 15.根据权利要求11所述的基于问答的网络拓扑图生成方法,其特征在于,所述对当前文本的意图和槽值对进行对话管理,得到响应动作,包括:15. The method for generating a network topology map based on question and answer according to claim 11, wherein the step of performing dialog management on the intent and slot value pairs of the current text to obtain a response action comprises: 根据预存的对话历史和当前文本的意图和槽值对确定当前的会话状态;Determine the current conversation state based on the pre-stored conversation history and the intent and slot value pairs of the current text; 根据当前会话状态匹配预设的响应动作。Matches the preset response action according to the current session state. 16.根据权利要求15所述的基于问答的网络拓扑图生成方法,其特征在于,所述根据预存的对话历史和当前文本的意图和槽值对确定当前的会话状态,包括:16. The method for generating a network topology map based on question and answer according to claim 15, wherein determining the current session state according to the pre-stored conversation history and the intent and slot value pairs of the current text comprises: 在任务型人机对话中将每轮最新对话提取出的文本的意图和槽值对添加到对应的槽中,进行对话状态追踪,更新当前的对话状态。In task-based human-computer dialogue, the intention and slot value pairs of the text extracted from each latest round of dialogue are added to the corresponding slots to track the dialogue status and update the current dialogue status. 17.根据权利要求15所述的基于问答的网络拓扑图生成方法,其特征在于,所述方法还包括:17. The method for generating a network topology diagram based on question and answer according to claim 15, characterized in that the method further comprises: 当所述响应动作为询问动作时,基于当前对话状态向用户提问,引导用户回答关键槽值;When the response action is an inquiry action, questions are asked to the user based on the current dialog state, and the user is guided to answer the key slot value; 当所述响应动作为解答动作时,基于用户提问,在知识库中匹配答案文本;When the response action is an answer action, matching the answer text in the knowledge base based on the user's question; 当所述响应动作为绘图动作时,根据预设的拓扑图模板和槽值对,绘制对应的网络拓扑图。When the response action is a drawing action, a corresponding network topology map is drawn according to a preset topology map template and slot value pair. 18.根据权利要求11所述的基于问答的网络拓扑图生成方法,其特征在于,所述对所述响应动作进行自然语言生成,得到自然语言文本输出,包括:18. The method for generating a network topology diagram based on question and answer according to claim 11, wherein the step of generating a natural language for the response action to obtain a natural language text output comprises: 根据所述响应动作确定传达信息文本;Determine the text of the information to be communicated according to the response action; 组织所述传达信息中文本结构顺序;Organize the text structure sequence in the message being conveyed; 将组成文本结构顺序的文本信息聚合为文本语句;Aggregate text information that constitutes the text structure sequence into text sentences; 在聚合的文本语句的文本信息中添加连接词,组成自然语言;Adding conjunctions to the text information of the aggregated text sentences to form natural language; 根据所述自然语言的所属领域,确定拓展词汇,构成自然语言语句,得到自然语言文本输出。According to the domain to which the natural language belongs, an extended vocabulary is determined, a natural language sentence is constructed, and a natural language text output is obtained. 19.一种基于问答的网络拓扑图生成装置,其特征在于,所述装置包括:19. A network topology diagram generation device based on question and answer, characterized in that the device comprises: 智能对话模块,用于根据用户输入的交互数据进行自动问答,生成对话数据;Intelligent dialogue module, used to automatically answer questions based on the interaction data input by the user and generate dialogue data; 数据映射模块,用于将所述自动对话数据中的实体和意图分别映射为拓扑图中的节点和连接关系,得到拓扑图结构化数据;A data mapping module, used to map entities and intentions in the automatic dialogue data into nodes and connection relationships in a topological graph, respectively, to obtain topological graph structured data; 创建模块,用于根据dom4j解析包创建拓扑图的XML文档,将所述拓扑图结构化数据添加到XML文档中,生成XML文件;A creation module is used to create an XML document of a topology map according to a dom4j parsing package, add the structured data of the topology map to the XML document, and generate an XML file; 加载模块,用于加载和渲染所述XML文件得到网络拓扑图。The loading module is used to load and render the XML file to obtain a network topology diagram. 20.一种基于问答的网络拓扑图生成装置,其特征在于,包括处理器、存储器以及存储在所述存储器中且被配置为由所述处理器执行的计算机程序,所述处理器执行所述计算机程序时实现如权利要求1至18中任意一项所述的基于问答的网络拓扑图生成方法。20. A question-and-answer based network topology map generation device, characterized in that it comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements the question-and-answer based network topology map generation method as described in any one of claims 1 to 18. 21.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质包括存储的计算机程序,其中,在所述计算机程序运行时控制所述计算机可读存储介质所在设备执行如权利要求1至18中任意一项所述的基于问答的网络拓扑图生成方法。21. A computer-readable storage medium, characterized in that the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the question-and-answer based network topology map generation method as described in any one of claims 1 to 18. 22.一种计算机程序产品,包括计算机程序/指令,其特征在于,该计算机程序/指令被处理器执行时实现权利要求1~18中任意一项所述方法的步骤。22. A computer program product, comprising a computer program/instruction, characterized in that when the computer program/instruction is executed by a processor, the steps of the method according to any one of claims 1 to 18 are implemented.
CN202410541554.6A 2024-04-30 2024-04-30 Question-and-answer based network topology map generation method, device, medium and product Pending CN118797072A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410541554.6A CN118797072A (en) 2024-04-30 2024-04-30 Question-and-answer based network topology map generation method, device, medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410541554.6A CN118797072A (en) 2024-04-30 2024-04-30 Question-and-answer based network topology map generation method, device, medium and product

Publications (1)

Publication Number Publication Date
CN118797072A true CN118797072A (en) 2024-10-18

Family

ID=93022603

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410541554.6A Pending CN118797072A (en) 2024-04-30 2024-04-30 Question-and-answer based network topology map generation method, device, medium and product

Country Status (1)

Country Link
CN (1) CN118797072A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119743400A (en) * 2025-01-24 2025-04-01 紫金山实验室 A network topology image analysis method, device, equipment and readable storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119743400A (en) * 2025-01-24 2025-04-01 紫金山实验室 A network topology image analysis method, device, equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN114547329B (en) Method for establishing pre-trained language model, semantic parsing method and device
US11182556B1 (en) Applied artificial intelligence technology for building a knowledge base using natural language processing
CN118170894B (en) A knowledge graph question answering method, device and storage medium
CN115495563A (en) Intelligent conversational method and server based on form data retrieval
US20220414463A1 (en) Automated troubleshooter
WO2022022746A1 (en) Intent recognition method and intent recognition system having self learning capability
CN106446045B (en) User portrait construction method and system based on dialogue interaction
CN118433311B (en) Telephone customer service processing method and system based on personalized robot
CN109857846B (en) Method and device for matching user question and knowledge point
CN111930912A (en) Dialogue management method, system, device and storage medium
CN120371854B (en) A structured query language generation method, device, equipment and storage medium
CN119759598B (en) Intelligent scheduling method of computing network resources based on large model intention perception
CN117033540A (en) Report generation method, device, electronic equipment and media
CN118113831A (en) Question and answer data processing method, device, electronic device and storage medium
CN120256546A (en) Retrieval response method, device, storage medium, electronic device and program product
CN118673113A (en) Intelligent question-answering system and method based on large model and knowledge graph
CN118760750A (en) A method and device for optimizing retrieval of colloquial text content
CN118797072A (en) Question-and-answer based network topology map generation method, device, medium and product
CN118210903B (en) Language large model enhanced retrieval device
CN114036268A (en) Task type multi-turn dialogue method and system based on intention gate
CN116186259A (en) Session cue scoring method, device, equipment and storage medium
CN114239555A (en) Training method of keyword extraction model and related device
US20250232117A1 (en) Large language model augmentation with definite finite automaton
CN120804139B (en) Query statement processing method, device, vehicle and storage medium
CN118535715B (en) Automatic reply method, device and storage medium based on tree structure knowledge base

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination