As the scale and complexity of spatiotemporal data continue to grow rapidly, the use of geospatial modeling on the Google Earth Engine (GEE) platform presents dual challenges: improving the coding efficiency of domain experts and enhancing the coding capabilities of interdisciplinary users. To address these challenges and improve the performance of large language models (LLMs) in geospatial code generation tasks, we propose a framework for building a geospatial operator knowledge base tailored to the GEE JavaScript API. This framework consists of an operator syntax knowledge table, an operator relationship frequency table, an operator frequent pattern knowledge table, and an operator relationship chain knowledge table. By leveraging Abstract Syntax Tree (AST) techniques and frequent itemset mining, we systematically extract operator knowledge from 185,236 real GEE scripts and syntax documentation, forming a structured knowledge base. Experimental results demonstrate that the framework achieves over 90% accuracy, recall, and F1 score in operator knowledge extraction. When integrated with the Retrieval-Augmented Generation (RAG) strategy for LLM-based geospatial code generation tasks, the knowledge base improves performance by 20-30%. Ablation studies further quantify the necessity of each knowledge table in the knowledge base construction. This work provides robust support for the advancement and application of geospatial code modeling techniques, offering an innovative approach to constructing domain-specific knowledge bases that enhance the code generation capabilities of LLMs, and fostering the deeper integration of generative AI technologies within the field of geoinformatics.
翻译:随着时空数据的规模和复杂性持续快速增长,在Google Earth Engine(GEE)平台上进行地理空间建模面临双重挑战:提升领域专家的编码效率与增强跨学科用户的编码能力。为应对这些挑战并提升大型语言模型(LLM)在地理空间代码生成任务中的性能,我们提出了一种针对GEE JavaScript API构建地理空间算子知识库的框架。该框架由算子语法知识表、算子关系频率表、算子频繁模式知识表以及算子关系链知识表组成。通过利用抽象语法树(AST)技术与频繁项集挖掘方法,我们从185,236个真实GEE脚本及语法文档中系统性地提取算子知识,构建了结构化的知识库。实验结果表明,该框架在算子知识提取任务中实现了超过90%的准确率、召回率与F1分数。当该知识库与检索增强生成(RAG)策略结合,应用于基于LLM的地理空间代码生成任务时,性能提升了20-30%。消融实验进一步量化了知识库构建中各知识表的必要性。本工作为地理空间代码建模技术的发展与应用提供了有力支撑,为构建增强LLM代码生成能力的领域专用知识库提供了创新思路,并推动了生成式人工智能技术在地理信息科学领域的深度融合。