Application of Community Detection in Knowledge Base Question Answering in the Field of Electrical Safety
摘要
This study introduces a novel semantic parsing framework to enhance the retrieval accuracy of knowledge - based question answering (KBQA) systems in electrical safety, offering an effective solution for knowledge acquisition challenges in this domain. By refining the mapping between natural language expressions and knowledge base entities relations, and leveraging entity importance within communities to optimize performance, the framework achieves its goal. It employs parameter - efficient LoRA fine - tuning of large language models (LLMs) to adapt them to the specific domain, converting natural language questions into knowledge base queries. Using label propagation for community detection, the framework analyzes the topological features of the graph - structured knowledge base entities and calculates node centrality metrics to adjust mapping weights. Innovatively combining community detection with semantic parsing, this method effectively addresses traditional challenges in handling ambiguous entity names and unclear relation paths in electrical safety. The algorithm generates SPARQL query statements with an accuracy of 0.715, F1 score of 0.747, and Hits@1 of 0.764, significantly outperforming the LLMs model without community detection (Accuracy = 0.673, F1 = 0.719, Hits@1 = 0.721). Providing an optimized paradigm for balancing semantic understanding and knowledge reasoning, the dynamic weight adjustment mechanism meaningfully boosts KBQA system performance in specialized fields. This study is expected to chart new directions for intelligent Q&A research in electrical safety and propel technological advances in related areas.