Village folk custom activity question and answer method and device combining large model and SQL query

By combining large language models and SQL queries, and leveraging the structured query capabilities of relational databases, the problems of unstable recall rates and internet data reliability in querying information on village folk activities were solved, resulting in a significant improvement in the accuracy and credibility of the information.

CN122309537APending Publication Date: 2026-06-30CHINA ACAD OF URBAN PLANNING & DESIGN

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHINA ACAD OF URBAN PLANNING & DESIGN
Filing Date
2026-02-04
Publication Date
2026-06-30

Smart Images

  • Figure CN122309537A_ABST
    Figure CN122309537A_ABST
Patent Text Reader

Abstract

This application discloses a method and apparatus for answering questions about village folk activities, combining a large-scale model and SQL queries. The client-side method includes: receiving a user-inputted question-and-answer request for village folk activities, the request carrying a question description text; using a preset large-scale language model, extracting information from the question description text according to time, location, folk activity name, and folk activity content to obtain key information in JSON format; calling a POST service to send the JSON-formatted key information to the server; enabling the server to construct and execute an SQL query statement based on the JSON-formatted key information to retrieve folk activity records that meet the conditions from a relational database; and using the preset large-scale language model to refine the folk activity records, generating and displaying the final answer text corresponding to the question description text. Therefore, using the embodiments of this application, the accuracy and stability of the answers can be ensured. At the same time, the accuracy and credibility of the information are significantly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of intelligent question-answering technology, and in particular to a question-answering method and apparatus for village folk activities that combines large models and SQL queries. Background Technology

[0002] With the rise of cultural tourism, more and more tourists are showing great interest in the folk activities of traditional villages. When planning their trips, tourists often need to know information about the folk activities of specific villages, such as the time, location, and specific content of the activities.

[0003] Currently, the query method involves converting the data on folk activities in traditional villages into a vector database, and then using a pre-defined large language model to retrieve data from the vector database to generate answers. In addition to using proprietary data, relevant data is also searched on the internet.

[0004] However, since the pre-defined large language model is a probabilistic model, the recall rate of the answers can lead to unstable results. Repeated adjustments to the Top K and Score thresholds are necessary to improve recall, but excessively high recall may introduce incorrect answers, while excessively low recall may filter out correct answers. Furthermore, the reliability of relevant data on the internet is difficult to control, easily leading to AI illusions. That is, the model may generate seemingly reasonable but false content that does not conform to objective facts, seriously affecting the accuracy and credibility of the information. Summary of the Invention

[0005] This application provides a method and apparatus for question-and-answering related to village folk activities, combining a large model and SQL queries. To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments. Its sole purpose is to present some concepts in a simple form as a prelude to the detailed description that follows.

[0006] In a first aspect, embodiments of this application provide a question-and-answer method for village folk activities that combines a large model and SQL queries, applied to a client-side application. The method includes: Receive user input from the client regarding village folk activities Q&A requests, which include a question description text. Using a pre-defined large language model, information is extracted from the problem description text according to time, location, name of folk activity, and content of folk activity, resulting in key information in JSON format; The POST service is called to send key information in JSON format to the server; the server then constructs and executes an SQL query based on the key information in JSON format to retrieve folk activity records that meet the conditions from the relational database. The relational database stores folk activity information of traditional villages and supports querying via SQL query statements. Using a pre-defined large language model, the records of folk activities are polished to generate and display the final answer text corresponding to the question description text.

[0007] Optionally, a relational database can be generated by following these steps: Obtain information sheets about traditional villages from the website of the Digital Museum of Traditional Villages; By using a pre-defined large language model and a pre-defined format, the long text data of folk activities in each village in the traditional village information table is split into a data structure with folk activities as the unit, resulting in the split data of folk activities for each village. The split data of folk activities includes a first field representing the time of the folk activity, a second field representing the location of the folk activity, a third field representing the name of the folk activity, and a fourth field representing the content of the folk activity. The data on folk activities in each village are broken down and standardized, and the standardized data is stored in a relational database. The relational database contains a table structure for storing information on folk activities.

[0008] Optionally, generate a preset format by following these steps: Obtain a preliminary survey document on tourist needs; Based on the tourist demand document, an application scenario analysis was conducted to obtain the time, location, name, and content of the folk activities. Construct a ternary data structure based on the time, location, name, and content of folk activities; The triplet data structure is used as the default format.

[0009] Optionally, the method also includes: Obtain test question description text and standard answers for system testing; Generate test response text corresponding to the test question description text; Semantic similarity analysis was performed on the test response text and the standard answer using the embedding vector method to obtain semantic similarity. The similarity level is determined based on semantic similarity and a preset semantic similarity range; A warning message is generated when the text of the similarity level indicator test response differs from the standard answer; The warning information will be sent to the warning client for display.

[0010] Optionally, using a pre-defined large language model, information is extracted from the problem description text according to time, location, name of the folk activity, and content of the folk activity, resulting in key information in JSON format, including: Obtain the first prompt keyword for extracting key information about village folk activities. Key information about village folk activities includes time, location, name of folk activity, and content of folk activity. Input the problem description text and the first prompt word into the preset large language model to extract information from the problem description text based on the first prompt word; Output the key information in JSON format corresponding to the problem description text.

[0011] Optionally, information extraction is performed on the problem description text based on the first cue word, including: Intent pattern recognition is performed on the problem description text to identify the target intent pattern implied in the problem description text. The target intent pattern includes at least one of exact match, fuzzy query, comparison query or combined condition query. Based on the target intent pattern, automatically adapt to the specific task instruction of the first prompt word; Create multiple types of key information identifiers based on specific task instructions; Extract the attribute information of each type of key information identifier from the problem description text to obtain the key information in JSON format corresponding to the problem description text.

[0012] Optionally, construct and execute SQL query statements based on key information in JSON format, including: Parse the key information in the JSON format to obtain time information representing the time of the folk activity, location information representing the location of the folk activity, name information representing the name of the folk activity, and content information representing the content of the folk activity; By using a pre-defined semantic-data mapping rule base, time information, location information, name information, and content information are converted into standardized query elements that can be directly used for database field comparison. The standardized query elements are populated into the preset SQL query template to obtain the SQL query statement; Execute the SQL query statement.

[0013] Optionally, using a pre-defined large language model, the records of folk activities are polished to generate and display the final answer text corresponding to the question description text, including: Obtain secondary clues for refining the copy; The records of folk activities and the second prompt words are input into a preset large language model to refine the records of folk activities based on the second prompt words; Output the final answer text corresponding to the question description text; Display the final answer text.

[0014] Optionally, the preset large language model includes a first polishing submodule, a second polishing submodule, and a third polishing submodule; the second prompt word includes structure verification instructions, style instructions, and logic optimization instructions; Polishing records of folk activities based on the second cue word includes: Input the folk activity record and structure verification command into the first polishing submodule to restructure the folk activity record and generate a basic polished text containing clear time, place, activity name, core content and cultural meaning; Input the basic polished text, style instructions, and user profile information into the second polishing submodule to rewrite the basic polished text in a stylized manner that conforms to the target context, and generate a stylized intermediate text. Input the stylized intermediate copy and logic optimization instructions into the third polishing submodule to optimize the paragraph logic, causal or temporal relationships between sentences, opening and closing remarks of the stylized intermediate copy, and adjust the sentence complexity and length to obtain the optimized copy. By using keyword / entity matching and preset rules, the records of folk activities and the optimized copy are automatically compared to check whether any statements that are inconsistent with the facts of the folk activities records have been introduced during the process of style adaptation and logic optimization, and the verification results are obtained. When the verification results indicate that the optimized text does not include any statements that are inconsistent with the facts of the folk activity records, the final answer text corresponding to the problem description text will be generated.

[0015] Secondly, embodiments of this application provide a question-and-answer device for village folk activities that combines a large model and SQL queries. The device includes: The request receiving module is used to receive user input from the client regarding village folk activities Q&A requests, which include a question description text. The JSON format key information output module is used to extract information from the problem description text according to time, location, folk activity name, and folk activity content using a preset large language model, and obtain key information in JSON format. The SQL query module is used to call the POST service to send key information in JSON format to the server. The server then constructs and executes an SQL query based on the key information in JSON format to retrieve folk activity records that meet the criteria from the relational database. The relational database stores folk activity information of traditional villages and supports querying via SQL query statements. The answer text display module is used to refine folk activity records using a preset large language model, and generate and display the final answer text corresponding to the question description text.

[0016] The technical solutions provided in this application embodiment may include the following beneficial effects: In this embodiment, on the one hand, information is extracted from the question description text using a pre-defined large language model, and the extracted results are converted into key information in JSON format. Then, the server constructs and executes an SQL query to retrieve folk activity records that meet the conditions from a relational database. This process avoids directly relying on the probabilistic model of the large language model for retrieval, but instead utilizes the structured query capabilities of the relational database, ensuring the accuracy and stability of the answers. On the other hand, a dedicated relational database is constructed by intelligently splitting and structuring the folk activity information of traditional villages using a pre-defined large language model. When answering user questions, the system relies only on reliable data in this database, avoiding the use of unreliable internet data. This effectively avoids AI illusions and ensures that the generated answers are based on real and reliable data, thereby significantly improving the accuracy and credibility of the information.

[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0019] Figure 1 This is a flowchart illustrating a method for answering questions about village folk activities that combines a large model and SQL queries, as provided in an embodiment of this application. Figure 2 This is a schematic diagram of the settings interface for extracting key information in JSON format provided in an embodiment of this application; Figure 3 This is a schematic diagram of the parameter setting interface for a POST service provided in an embodiment of this application; Figure 4 This is a schematic diagram of an interface for generating a final answer text, provided in an embodiment of this application. Figure 5 This is a schematic diagram of a scoring test result provided in an embodiment of this application; Figure 6 This is a schematic diagram of a question-and-answer process for village folk activities that combines a large model and SQL queries, provided in an embodiment of this application. Figure 7 This is a schematic diagram of the structure of a village folk activity question-and-answer device that combines a large model and SQL query, provided in an embodiment of this application; Figure 8This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0020] The following description and accompanying drawings fully illustrate specific embodiments of this application to enable those skilled in the art to practice them.

[0021] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.

[0022] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0023] In the description of this application, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship.

[0024] Currently, the query method involves converting the data on folk activities in traditional villages into a vector database, and then using a pre-defined large language model to retrieve data from the vector database to generate answers. In addition to using proprietary data, relevant data is also searched on the internet.

[0025] The inventors realized that because the pre-defined large language model is a probabilistic model, the recall rate of the answers leads to unstable results. Repeated adjustments to the Top K and Score thresholds are necessary to improve recall, but excessively high recall may introduce incorrect answers, while excessively low recall may filter out correct answers. The reliability of relevant data on the internet is difficult to control, easily leading to AI illusions. That is, the model may generate seemingly reasonable but false content that does not conform to objective facts, seriously affecting the accuracy and credibility of information.

[0026] To address the existing technical problems, this application provides a method and apparatus for answering questions about village folk activities that combines a large language model and SQL queries, thereby resolving the issues mentioned above. In this application's embodiments, on one hand, information is extracted from the question description text using a pre-set large language model, and the extracted results are converted into key information in JSON format. Then, an SQL query is constructed and executed on the server side to retrieve folk activity records that meet the conditions from a relational database. This process avoids directly relying on the probabilistic model of the large language model for retrieval, instead utilizing the structured query capabilities of the relational database to ensure the accuracy and stability of the answers. On the other hand, a dedicated relational database is constructed by intelligently splitting and structuring the folk activity information of traditional villages using a pre-set large language model. When answering user questions, the system relies only on reliable data in this database, avoiding the use of unreliable internet data. This effectively avoids AI illusions and ensures that the generated answers are based on real and reliable data, thereby significantly improving the accuracy and credibility of the information. Exemplary embodiments are described in detail below.

[0027] The following will be combined with the appendix Figure 1 -Appendix Figure 6 This application provides a detailed description of the question-and-answer method for village folk activities that combines a large model and SQL queries, as provided in the embodiments of this application. This method can be implemented using a computer program and can run on a village folk activity question-and-answer device based on the von Neumann architecture that combines a large model and SQL queries. This computer program can be integrated into an application or run as a standalone utility application.

[0028] Please see Figure 1 This document provides a flowchart illustrating a question-and-answer method for village folk activities that combines a large model and SQL queries, applicable to a client-side application. For example... Figure 1 As shown, the method in this application embodiment includes the following steps: S101, Receive the user input client's village folk activity Q&A request, the village folk activity Q&A request carries the question description text; The client is the user interface or platform used to directly input questions and receive answers. For example, a mobile application interface specifically designed for querying information about village folk activities. A village folk activity Q&A request is a request initiated by the user through the client to obtain specific information about village folk activities. This request contains the specific question or requirement the user wants to query. The question description text is the specific question content entered by the user on the client, expressed in text form, describing the question the user wants to query about village folk activities. For example, "I want to know what traditional folk activities are held in XX village during the Spring Festival?"

[0029] In some embodiments of this application, the user opens a client (such as a mobile application or webpage). They enter their query in the client's input box, for example: "I want to know what traditional folk activities are held in XX village during the Spring Festival?" The user clicks the "Submit" or "Query" button, generating a question-and-answer request for village folk activities that includes a description of the query.

[0030] S102, using a pre-set large language model, extracts information from the problem description text according to time, location, name of folk activity, and content of folk activity, and obtains key information in JSON format; The pre-trained large language model is a pre-trained language model capable of understanding and processing natural language text. It possesses multiple capabilities, including text generation, information extraction, and semantic understanding. Models like GPT can handle various natural language tasks. Information extraction is the process of identifying and extracting key information from text. In this scenario, the goal of information extraction is to extract key information such as time, location, names of folk activities, and content of folk activities from the question description text. For example, from the question "I want to know what traditional folk activities are held in XX village during the Spring Festival?", the extraction would be time (Spring Festival), location (XX village), and activity type (traditional folk activities). JSON (JavaScript Object Notation) is a lightweight data-interchange format used for structured data representation.

[0031] In some embodiments of this application, the specific process of extracting key information in JSON format from the problem description text according to time, location, name of folk activity, and content of folk activity using a preset large language model includes: obtaining a first prompt word for extracting key information of village folk activities, the key information of village folk activities including time, location, name of folk activity, and content of folk activity; inputting the problem description text and the first prompt word into the preset large language model to extract information from the problem description text based on the first prompt word; and outputting the key information in JSON format corresponding to the problem description text.

[0032] The first prompt word is a specific prompt or instruction designed to extract key information about village folk activities. It guides the large language model to more accurately extract key information from the question description text. For example, "Please extract the time, location, name of the folk activity, and content of the folk activity from the question." Key information about village folk activities is important information extracted from the question description text, including time, location, name of the folk activity, and content of the folk activity. For example, time (Spring Festival), location (XX village), name of the folk activity (dragon dance), content of the folk activity (dragon dance performance).

[0033] Specifically, the process of extracting information from the problem description text based on the first prompt word includes: performing intent pattern recognition on the problem description text to identify the target intent pattern implicit in the text, where the target intent pattern includes at least one of exact match, fuzzy query, comparison query, or combined condition query; automatically adapting the specific task instruction to the first prompt word based on the target intent pattern; creating multiple types of key information identifiers based on the specific task instruction; and extracting the attribute information of each type of key information identifier from the problem description text to obtain the corresponding JSON format key information. The settings interface for JSON format key information extraction is shown below. Figure 2 As shown.

[0034] In one possible implementation, the system predefines a prompt word to guide the large language model in extracting key information. For example: "Please extract the time, location, name of the folk activity, and content of the folk activity from the question." The user-inputted question description text and the first prompt word are input into the predefined large language model. For example, the question description text is: "I want to know what traditional folk activities are held in XX village during the Spring Festival," and the first prompt word is: "Please extract the time, location, name of the folk activity, and content of the folk activity from the question." The large language model analyzes the question description text based on the first prompt word and extracts the key information. For example, the model might extract: (Time: Spring Festival), (Location: XX village), (Name of folk activity: Traditional folk activity), (Content of folk activity: Dragon dance performance). The output JSON format is as follows: { "time": "Spring Festival", "location": "XX Village", "activity_name": "Traditional Folk Activities", "activity_content": "Dragon Dance Performance" }

[0035] Specifically, the first prompt words used to extract key information about village folk activities are as follows: # Role You are a professional information extraction engine, specializing in accurately extracting key information such as time, location, and event / holiday names from user queries. Your output will serve as input for downstream programs, therefore **it must strictly adhere to the specified JSON format**.

[0036] # Task Analyze the user's input question `{{#sys.query#}}`, and extract and standardize the following three types of information: ## 1. Extracting Time Information (`time`) - **Rule**: Calculate all relative times based on the reference date `{{#1762853292353.text#}}`.

[0037] - **Specific processing logic**: - **Absolute date / month**: Extracts numbers directly. For example, "May" -> `[{"month":5}]` - **Relative time period**: - `Recent`: Current month and next month. Example output: `[{"month":11}, {"month":12}]` - `This month`: The current month. Example output: `[{"month":11}]` - `Next Month`: The following month. Example output: `[{"month":12}]` - `Next Week`: Calculates the dates from next Monday to next Sunday. Example output: `[{"month":11,"day":17}, {"month":11, "day":18}, ..., {"month":11, "day":23}]` - **If the question does not explicitly mention a time, an empty list `[]` will be returned.** ## 2. Location Information Extraction (position) - **Rule:** Identify place names and complete their higher-level administrative divisions (province, city, county) whenever possible. Town and village level information should only be completed if explicitly mentioned or if the location is a well-known place.

[0038] - **Target Format:** `{"province": "", "city": "", "county": "", "town": "", "village": ""}` Example: Input "Guangzhou" -> Output `{"province": "Guangdong", "city": "Guangzhou", "county": "", "town": "", "village": ""}` Input "Xidi Village" -> Output `{"province": "Anhui", "city": "Huangshan", "county": "Yixian", "town": "", "village": "Xidi Village"}` (assuming knowledge completion is used) - **Leave the corresponding field blank if the location is unclear or cannot be completed.** ## 3. Extracting Folk Custom Names / Content (`activity`) - **Rules**: Please identify and extract the **specific event or holiday name** from user questions, following these rules: - Extract only when the **specific name** is explicitly mentioned in the question. - Terms such as "folk activities," "festival activities," and "traditional activities" are general terms and do not refer to specific activities / festivals. Please do not extract them.

[0039] Example: - Input "Where are the autumn harvest activities?" -> Output `["Autumn Harvest"]` Input "What are the characteristics of Chinese New Year and Mid-Autumn Festival?" -> Output `["Chinese New Year", "Mid-Autumn Festival"]` - Input "Where are the folk activities?" -> Output `[]` - **If not mentioned, return an empty list `[]`.** # Output Format You must output only one strict, parsable JSON object, in the following format, without any further interpretation: { "time": [ {"month": number or empty, "day": number or empty} ], "position": { "province": "string", "city": "string", "county": "string", "town": "string", "village": "string" }, "activity": ["string1", "string2", ...] } # Example ## Example 1 User input: "Are there any autumn harvest activities in Xidi Village recently?" Expected output: { "time": [{"month": 11}, {"month": 12}], "position": {"province": "Anhui", "city": "Huangshan", "county": "Yixian", "town": "", "village": "Xidi Village"}, "activity": ["Autumn Sunning"] } ## Example 2 User input: "What traditional festivals are happening in Guangzhou next week?" Expected output: { "time": [{"month": 11, "day": 17}, {"month": 11, "day": 18}, {"month": 11, "day": 19}, {"month": 11, "day": 20}, {"month": 11, "day": 21},{"month": 11, "day": 22}, {"month": 11, "day": 23}], "position": {"province": "Guangdong", "city": "Guangzhou", "county": "", "town": "", "village": ""}, "activity": [] } ## Example 3 User input: "How's the weather today?" Expected output: { "time": [], "position": {}, "activity": [].

[0040] S103, call the POST service to send key information in JSON format to the server; so that the server can construct and execute an SQL query statement based on the key information in JSON format to retrieve folk activity records that meet the conditions from the relational database. The relational database stores folk activity information of traditional villages and supports querying through SQL query statements; POST is an HTTP request method used to send data to a server, such as submitting forms or uploading files. In this application, the POST service is used to send key information in JSON format generated by the client to the server. SQL (Structured Query Language) is a declarative programming language used to manage relational databases. SQL queries are used to retrieve, insert, update, or delete data from a database. A relational database is a database system that uses tables to store data, organized in rows and columns, and supports querying and management via SQL statements. An example is the PostgreSQL database system. Folk activity records are data records that meet certain criteria retrieved from a relational database, containing detailed information about the folk activities queried by the user.

[0041] In some embodiments of this application, the specific process of constructing and executing an SQL query statement based on JSON format key information includes: parsing the JSON format key information to obtain time information representing the time of the folk activity, location information representing the location of the folk activity, name information representing the name of the folk activity, and content information representing the content of the folk activity; converting the time information, location information, name information, and content information into standardized query elements that can be directly used for database field comparison through a preset semantic-data mapping rule base; filling the standardized query elements into a preset SQL query template to obtain an SQL query statement; and executing the SQL query statement.

[0042] In one possible implementation, the "HTTP - Get Target Information" tool is invoked, and the key information (in JSON format) extracted in the previous step is input to request data from the backend service.

[0043] http: / / 192.168.12.77:8000 / festival_search is a POST service that uses the data in the request body (the key information extracted in the previous step) to construct an SQL statement, accurately retrieve records of folk activities that meet the requirements from the database, and return them to the client in a standard format. The parameter settings interface for the POST service is as follows: Figure 3 As shown.

[0044] In some embodiments of this application, the specific process of generating a relational database includes: obtaining a traditional village information table from a traditional village digital museum website; using a preset large language model and preset format, splitting the long text data of folk activities of each village in the traditional village information table into a data structure with folk activities as units, to obtain the folk activity split data of each village; the folk activity split data includes a first field for representing the time of the folk activity, a second field for representing the location of the folk activity, a third field for representing the name of the folk activity, and a fourth field for representing the content of the folk activity; standardizing the folk activity split data of each village, and storing the standardized data in a relational database, wherein the relational database contains a table structure for storing folk activity information.

[0045] The traditional village information table is organized by village and contains 58 fields, covering various aspects such as the village's basic identifiers, geographical environment, historical evolution, population and economy, cultural characteristics, products and landscapes, and documents. The data in the "Folk Activities" field is stored in long text format, introducing the rich and colorful folk activities in the village.

[0046] One possible implementation involves using information extraction techniques based on a large language model. The DeepSeek API is called to break down the "folk activities" information for each village into data structures based on folk activities, following the format "<festival name><festival time><content description>".

[0047] Because large language models exhibit a degree of instability during text segmentation, the results are not always output in a standard format. Therefore, this application optimizes prompt words to improve output quality. First, it reads text files from a specified folder and parses the content line by line. Then, it identifies lines starting with "-" as "names of folk activities," with subsequent lines representing information such as "description" and "time" for the activity. Finally, it stores the parsed results in a dictionary named "festivals," returning structured data containing information on all folk activities. Second, it develops a more adaptable data standardization and database insertion program to improve data processing efficiency. The application includes Python code for database operations based on pymysql, encompassing two core functions: creating data tables and inserting data. First, the `create_table` function connects to the database, then deletes the existing target table, and finally executes the SQL statement to create the table. Then, the `insert_data` function connects to the database and inserts records from the data list into the target table according to specified fields.

[0048] Specifically, the process of generating the preset format includes: obtaining a pre-researched tourist demand document; analyzing the application scenario based on the tourist demand document to obtain the time, location, and name of the folk activity; constructing a triplet data structure using the time, location, and name of the folk activity; and using the triplet data structure as the preset format.

[0049] S104 uses a pre-set large language model to refine the records of folk activities, generate and display the final answer text corresponding to the question description text.

[0050] In some embodiments of this application, the specific process of refining folk activity records using a preset large language model to generate and display the final answer text corresponding to the question description text includes: obtaining second prompt words for refining the text; inputting the folk activity records and the second prompt words into the preset large language model to refine the folk activity records based on the second prompt words; outputting the final answer text corresponding to the question description text; and displaying the final answer text. The interface for generating the final answer text is as follows: Figure 4 As shown.

[0051] The preset large language model includes a first polishing submodule, a second polishing submodule, and a third polishing submodule; the second prompt word includes structure verification instructions, style instructions, and logic optimization instructions.

[0052] Specifically, the process of refining folk activity records based on the second prompt word includes: inputting the folk activity record and structure verification instructions into the first refining submodule to restructure the folk activity record and generate a basic refined text containing clear time, location, activity name, core content, and cultural connotation; inputting the basic refined text, style instructions, and user profile information into the second refining submodule to rewrite the basic refined text in a style that conforms to the target context and generate a stylized intermediate text; and inputting the stylized intermediate text and logic optimization instructions into the third refining submodule. Within this block, the paragraph logic, causal or temporal relationships between sentences, opening remarks, and closing remarks of the stylized intermediate text are optimized, and sentence complexity and length are adjusted to obtain optimized text. Through keyword / entity matching and preset rules, the folk activity records and optimized text are automatically compared to check whether any statements inconsistent with the folk activity records have been introduced during the style adaptation and logic optimization process, and the verification results are obtained. When the verification results indicate that the optimized text has not introduced any statements inconsistent with the folk activity records, the final answer text corresponding to the question description text is generated.

[0053] The second prompt word is as follows: # Role You are an enthusiastic "Traditional Village Culture Ambassador," responsible for vividly introducing the cultural festivals of traditional villages to users.

[0054] # Processing Procedure - Please strictly follow this order ## Step 1: Anomaly Detection (Prioritize Handling) First, check for the following abnormal conditions; **if any condition is met, immediately terminate the subsequent process:** 1. **Data Error:** If the value of `body.result` is "error" or a similar error indicator. 2. **No result:** If the value of `body.result.num` is equal to 0. **Abnormal Situation Response Template:** We're sorry, but we haven't found any information related to traditional village folk activities that match your question. This may be because: There are currently no records for the region or holiday you requested. Data is being updated. The search criteria are quite specific. We suggest you try adjusting your search keywords, or try searching again later.

[0055] Step Two: Normal Situation Handling Only after confirming that there are **no abnormalities** should the following process be continued: ### Core Instructions 1. **Strictly Data-Driven:** Your answer must be 100% based on the data provided in `body.result.data`. Fabricating, speculating, or adding any information that does not exist in the data is strictly prohibited.

[0056] 2. **Answer Structure:** Your answer must consist of the following two parts: *(1) First, answer the user's question directly and concisely.

[0057] *(2) Then, using vivid and engaging language, introduce folk activities in villages as units.

[0058] ### Data Processing Rules 1. **Result Count Hint**: At the beginning of section (2), the user must be informed: "We have found [num] interesting folk activity information for you!" 2. **Introduction to quantity limits**: If the value of `body.result.num` is greater than 5, then: *In Part (2), the first 5 data points are described in detail in words only (summarized by village).

[0059] *After the text description, **a table containing all the results will be added.**

[0060] 3. **Content Organization**: *The description must be done on a village-by-village basis, integrating different folk activities within the same village into a single description.

[0061] *In the introduction, the **link to the village's Digital Museum (url field)** should be included naturally.

[0062] 4. **Word limit:** The text portion (excluding tables) **cannot exceed 1000 words.

[0063] ### Normal Output Format [This is a concise, direct answer to the user's question.] We found [num] interesting folk activities for you! [This section describes festivals using vivid language, organized by village. If num > 5, only the festivals corresponding to the first 5 data points will be described.] [If num > 5, add a table at the end:] | Village Name | Village Address | Name of Folk Activity | Date of Folk Activity | Activity Description | Digital Museum Link | | ... (Lists all rows of data in body.result.data)... | --- # Data Examples and Field Descriptions The `body` data you receive will be in the following format: json { "result": { "fields": ['cid','village','address','jqmc','jqrq','hdms','url'], "data": [ [Village ID, Village Name, Village Address, Name of Folk Activity, Date of Folk Activity, Activity Description, Digital Museum Link] / / ... More rows of data... ], "num": 10 } Now, please begin answering the user's `question`: `{{#sys.query#}}` based on the rules above and the provided `body` data `{{#1762855596958.body#}}`.

[0064] Furthermore, the system needs to be tested and verified. The specific process of testing and verification includes: obtaining test question description text and standard answers for system testing; generating test answer text corresponding to the test question description text; performing semantic similarity analysis on the test answer text and standard answers using the embedding vector method to obtain semantic similarity; determining the similarity level based on the semantic similarity and a preset semantic similarity interval; generating warning information when the similarity level indicates that the test answer text and the standard answer are different; and sending the warning information to the warning client for display.

[0065] In one possible implementation, the results of intelligent responses are scored using the embedding vector method, with the large model being bge-m3:latest under the Ollama framework.

[0066] The scoring criteria are divided into three levels: consistent, similar, and different, with each level corresponding to a different score. If the score is below 60, it is considered unqualified. The output of Dify will be referred to as "intelligent answer" below, while the manually extracted standard answer will be referred to as "answer".

[0067] Similarity: 80-100 points. The core meaning of the two texts is basically the same. For example, the answer is "Singing opera, a grand entertainment show performed by villagers on the village stage." The intelligent answer is "During the Spring Festival, a grand entertainment show directed and performed by villagers will be staged on the village stage in northern cities." The similarity between these two sets of texts can be judged as 85-95 points.

[0068] Similarity: 60-79 points. The two texts share some information, but differ in expression or details. For example, the answer is "Visit the Forbidden City to learn about ancient Chinese imperial palace architecture." The intelligent response is: "The Forbidden City in Beijing was the royal palace of the Ming and Qing dynasties, and its architecture is magnificent." The similarity between these two sets of texts can be determined to be 65-75 points.

[0069] Differences: 0-59 points. The two texts share almost no semantic content. For example, the answer is "Making braised pork requires pork belly and soy sauce," while the AI ​​response is "The weather is nice today, perfect for a walk." The similarity between these two sets of texts can be determined as 10-30 points.

[0070] The sample questions are categorized into three types: unknown location, unknown time, and unknown activity, with 5 questions in each category, totaling 15 questions. The average similarity score of the 15 questions is 84 points, and the average response time is approximately 4.7 seconds. For example... Figure 5 As shown.

[0071] For example Figure 6 As shown, Figure 6 This application provides a schematic diagram of a question-and-answer process for village folk activities, combining a large language model and SQL queries. First, a tourist needs survey is conducted to understand their requirements for information on folk activities. Based on the survey results, possible application scenarios are analyzed, such as: Scenario 1: Tourists do not know the time of the folk activity. Scenario 2: Tourists do not know the location of the folk activity. Scenario 3: Tourists are unfamiliar with the name or content of the folk activity. Based on these application scenarios, a requirements analysis is performed to determine the functions the system needs to implement. A large language model is used to intelligently segment long texts and extract key information, such as: Field 1: Time of the folk activity. Field 2: Location of the folk activity. Field 3: Name of the folk activity. Field 4: Content of the folk activity. The extracted key information is stored in a database to provide data support for subsequent queries. A PostgreSQL database is built to store folk activity information and supports queries via SQL statements. Tourists submit questions through the system, such as inquiring about detailed information about a specific folk activity. The large language model extracts key information from the tourists' questions, such as time, location, and name. The extracted key information is sent to the server via a POST service to request the corresponding data. The server constructs an SQL query based on the received key information and retrieves records of folk activities that meet the criteria from the database. The SQL query is executed in the database to retrieve relevant folk activity records. The retrieved folk activity records are then returned to the user. A large language model is used to refine the retrieved records, generating more user-friendly output text. To evaluate the quality of the system's responses, scoring criteria are defined, such as: Consistency (80-100 points): semantically largely the same; Similarity (60-79 points): semantically partially the same; Dissimilarity (0-59 points): no shared semantics. The system-generated answers are compared with standard answers to assess their accuracy. A semantic analysis model is used to evaluate the answers, ensuring their accuracy and relevance. Based on the evaluation results, conclusions are drawn to further optimize the system.

[0072] In this embodiment, on the one hand, information is extracted from the question description text using a pre-defined large language model, and the extracted results are converted into key information in JSON format. Then, the server constructs and executes an SQL query to retrieve folk activity records that meet the conditions from a relational database. This process avoids directly relying on the probabilistic model of the large language model for retrieval, but instead utilizes the structured query capabilities of the relational database, ensuring the accuracy and stability of the answers. On the other hand, a dedicated relational database is constructed by intelligently splitting and structuring the folk activity information of traditional villages using a pre-defined large language model. When answering user questions, the system relies only on reliable data in this database, avoiding the use of unreliable internet data. This effectively avoids AI illusions and ensures that the generated answers are based on real and reliable data, thereby significantly improving the accuracy and credibility of the information.

[0073] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.

[0074] Please see Figure 7 This illustration shows a schematic diagram of a village folk activity question-and-answer device combining a large model and SQL queries, provided in an exemplary embodiment of this application. This device, combining a large model and SQL queries, can be implemented as all or part of an electronic device through software, hardware, or a combination of both. The device 1 includes a request receiving module 10, a JSON-formatted key information output module 20, an SQL query module 30, and an answer text display module 40.

[0075] Request receiving module 10 is used to receive a question and answer request for village folk activities input by the user from the client. The question and answer request for village folk activities carries a question description text. The JSON format key information output module 20 is used to extract information from the problem description text according to time, location, folk activity name, and folk activity content using a preset large language model, and obtain key information in JSON format. The SQL query module 30 is used to call the POST service to send key information in JSON format to the server. This allows the server to construct and execute an SQL query statement based on the key information in JSON format, in order to retrieve folk activity records that meet the conditions from the relational database. The relational database stores folk activity information of traditional villages and supports querying via SQL query statements. The answer text display module 40 is used to refine the folk activity records using a preset large language model, and generate and display the final answer text corresponding to the question description text.

[0076] It should be noted that the village folk activity question-and-answer device combining large models and SQL queries provided in the above embodiments is only illustrated by the division of the above functional modules when executing the village folk activity question-and-answer method combining large models and SQL queries. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the village folk activity question-and-answer device combining large models and SQL queries provided in the above embodiments belongs to the same concept as the village folk activity question-and-answer method embodiment combining large models and SQL queries. The implementation process is detailed in the method embodiment and will not be repeated here.

[0077] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0078] In this embodiment, on the one hand, information is extracted from the question description text using a pre-defined large language model, and the extracted results are converted into key information in JSON format. Then, the server constructs and executes an SQL query to retrieve folk activity records that meet the conditions from a relational database. This process avoids directly relying on the probabilistic model of the large language model for retrieval, but instead utilizes the structured query capabilities of the relational database, ensuring the accuracy and stability of the answers. On the other hand, a dedicated relational database is constructed by intelligently splitting and structuring the folk activity information of traditional villages using a pre-defined large language model. When answering user questions, the system relies only on reliable data in this database, avoiding the use of unreliable internet data. This effectively avoids AI illusions and ensures that the generated answers are based on real and reliable data, thereby significantly improving the accuracy and credibility of the information.

[0079] This application also provides a computer-readable medium having program instructions stored thereon, which, when executed by a processor, implement the village folk activity question-and-answer method combining large models and SQL queries provided in the above-described method embodiments.

[0080] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the village folk activity question-and-answer method combining large models and SQL queries from the various method embodiments described above.

[0081] Please see Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 8 As shown, the electronic device 1000 may include: at least one processor 1001, at least one network interface 1004, a user interface 1003, a memory 1005, and at least one communication bus 1002.

[0082] The communication bus 1002 is used to realize the connection and communication between these components.

[0083] The user interface 1003 may include a display screen and a camera. Optionally, the user interface 1003 may also include a standard wired interface and a wireless interface.

[0084] The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface).

[0085] The processor 1001 may include one or more processing cores. The processor 1001 connects to various parts within the electronic device 1000 using various interfaces and lines. It executes various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 1005, and by calling data stored in the memory 1005. Optionally, the processor 1001 may be implemented using at least one hardware form selected from Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1001 may integrate one or more of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the modem may also be implemented as a separate chip, without being integrated into the processor 1001.

[0086] The memory 1005 may include random access memory (RAM) or read-only memory. Optionally, the memory 1005 may include a non-transitory computer-readable storage medium. The memory 1005 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 1005 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch function, sound playback function, image playback function, etc.), instructions for implementing the above-described method embodiments, etc.; the data storage area may store data involved in the above-described method embodiments, etc. Optionally, the memory 1005 may also be at least one storage system located remotely from the aforementioned processor 1001. Figure 8 As shown, the memory 1005, which serves as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a village folk activity Q&A application that combines large models and SQL queries.

[0087] exist Figure 8 In the illustrated electronic device 1000, the user interface 1003 is mainly used to provide an input interface for the user and to obtain the user's input data; while the processor 1001 can be used to call the village folk activity question and answer application stored in the memory 1005, which combines a large model and SQL queries, and specifically perform the following operations: Receive user input from the client regarding village folk activities Q&A requests, which include a question description text. Using a pre-defined large language model, information is extracted from the problem description text according to time, location, name of folk activity, and content of folk activity, resulting in key information in JSON format; The POST service is called to send key information in JSON format to the server; the server then constructs and executes an SQL query based on the key information in JSON format to retrieve folk activity records that meet the conditions from the relational database. The relational database stores folk activity information of traditional villages and supports querying via SQL query statements. Using a pre-defined large language model, the records of folk activities are polished to generate and display the final answer text corresponding to the question description text.

[0088] In one embodiment, when the processor 1001 generates a relational database, it performs the following operations: Obtain information sheets about traditional villages from the website of the Digital Museum of Traditional Villages; By using a pre-defined large language model and a pre-defined format, the long text data of folk activities in each village in the traditional village information table is split into a data structure with folk activities as the unit, resulting in the split data of folk activities for each village. The split data of folk activities includes a first field representing the time of the folk activity, a second field representing the location of the folk activity, a third field representing the name of the folk activity, and a fourth field representing the content of the folk activity. The data on folk activities in each village are broken down and standardized, and the standardized data is stored in a relational database. The relational database contains a table structure for storing information on folk activities.

[0089] In one embodiment, when the processor 1001 generates a preset format, it specifically performs the following operations: Obtain a preliminary survey document on tourist needs; Based on the tourist demand document, an application scenario analysis was conducted to obtain the time, location, name, and content of the folk activities. Construct a ternary data structure based on the time, location, name, and content of folk activities; The triplet data structure is used as the default format.

[0090] In one embodiment, the processor 1001 also performs the following operations: Obtain test question description text and standard answers for system testing; According to the method of claim 1, generate test answer text corresponding to the test question description text; Semantic similarity analysis was performed on the test response text and the standard answer using the embedding vector method to obtain semantic similarity. The similarity level is determined based on semantic similarity and a preset semantic similarity range; A warning message is generated when the text of the similarity level indicator test response differs from the standard answer; The warning information will be sent to the warning client for display.

[0091] In one embodiment, when the processor 1001 performs the following operations to extract key information in JSON format from the problem description text by using a preset large language model according to time, location, name of folk activity, and content of folk activity: Obtain the first prompt keyword for extracting key information about village folk activities. Key information about village folk activities includes time, location, name of folk activity, and content of folk activity. Input the problem description text and the first prompt word into the preset large language model to extract information from the problem description text based on the first prompt word; Output the key information in JSON format corresponding to the problem description text.

[0092] In one embodiment, when the processor 1001 performs information extraction from the problem description text based on the first prompt word, it specifically performs the following operations: Intent pattern recognition is performed on the problem description text to identify the target intent pattern implied in the problem description text. The target intent pattern includes at least one of exact match, fuzzy query, comparison query or combined condition query. Based on the target intent pattern, automatically adapt to the specific task instruction of the first prompt word; Create multiple types of key information identifiers based on specific task instructions; Extract the attribute information of each type of key information identifier from the problem description text to obtain the key information in JSON format corresponding to the problem description text.

[0093] In one embodiment, when the processor 1001 executes an SQL query statement constructed and executed based on key information in JSON format, it specifically performs the following operations: Parse the key information in the JSON format to obtain time information representing the time of the folk activity, location information representing the location of the folk activity, name information representing the name of the folk activity, and content information representing the content of the folk activity; By using a pre-defined semantic-data mapping rule base, time information, location information, name information, and content information are converted into standardized query elements that can be directly used for database field comparison. The standardized query elements are populated into the preset SQL query template to obtain the SQL query statement; Execute the SQL query statement.

[0094] In one embodiment, when the processor 1001 refines the records of folk activities using a preset large language model to generate and display the final answer text corresponding to the question description text, it specifically performs the following operations: Obtain secondary clues for refining the copy; The records of folk activities and the second prompt words are input into a preset large language model to refine the records of folk activities based on the second prompt words; Output the final answer text corresponding to the question description text; Display the final answer text.

[0095] In one embodiment, when processor 1001 performs polishing of folk activity records based on a second prompt word, it specifically performs the following operations: Input the folk activity record and structure verification command into the first polishing submodule to restructure the folk activity record and generate a basic polished text containing clear time, place, activity name, core content and cultural meaning; Input the basic polished text, style instructions, and user profile information into the second polishing submodule to rewrite the basic polished text in a stylized manner that conforms to the target context, and generate a stylized intermediate text. Input the stylized intermediate copy and logic optimization instructions into the third polishing submodule to optimize the paragraph logic, causal or temporal relationships between sentences, opening and closing remarks of the stylized intermediate copy, and adjust the sentence complexity and length to obtain the optimized copy. By using keyword / entity matching and preset rules, the records of folk activities and the optimized copy are automatically compared to check whether any statements that are inconsistent with the facts of the folk activities records have been introduced during the process of style adaptation and logic optimization, and the verification results are obtained. When the verification results indicate that the optimized text does not include any statements that are inconsistent with the facts of the folk activity records, the final answer text corresponding to the problem description text will be generated.

[0096] In this embodiment, on the one hand, information is extracted from the question description text using a pre-defined large language model, and the extracted results are converted into key information in JSON format. Then, the server constructs and executes an SQL query to retrieve folk activity records that meet the conditions from a relational database. This process avoids directly relying on the probabilistic model of the large language model for retrieval, but instead utilizes the structured query capabilities of the relational database, ensuring the accuracy and stability of the answers. On the other hand, a dedicated relational database is constructed by intelligently splitting and structuring the folk activity information of traditional villages using a pre-defined large language model. When answering user questions, the system relies only on reliable data in this database, avoiding the use of unreliable internet data. This effectively avoids AI illusions and ensures that the generated answers are based on real and reliable data, thereby significantly improving the accuracy and credibility of the information.

[0097] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program for answering questions about village folk activities combining a large model and SQL queries can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The storage medium for the program for answering questions about village folk activities combining a large model and SQL queries can be a magnetic disk, optical disk, read-only memory, or random access memory, etc.

[0098] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A question-and-answer method for village folk activities that combines large-scale models and SQL queries, characterized in that, Applied to a client, the method includes: Receive a user input client request for questions and answers about village folk activities, wherein the request carries a question description text; Using a pre-defined large language model, information is extracted from the problem description text according to time, location, name of folk activity, and content of folk activity to obtain key information in JSON format; The POST service is invoked to send the key information in JSON format to the server; so that the server constructs and executes an SQL query statement based on the key information in JSON format to retrieve folk activity records that meet the conditions from a relational database, which stores folk activity information of traditional villages and supports querying via SQL query statements; Using the preset large language model, the folk activity records are polished to generate and display the final answer text corresponding to the question description text.

2. The method according to claim 1, characterized in that, To generate a relational database, follow these steps: Obtain information sheets about traditional villages from the website of the Digital Museum of Traditional Villages; By using a pre-defined large language model and a pre-defined format, the long text data of folk activities for each village in the traditional village information table is split into a data structure with folk activities as the unit, resulting in the split data of folk activities for each village; the split data of folk activities includes a first field representing the time of the folk activity, a second field representing the location of the folk activity, a third field representing the name of the folk activity, and a fourth field representing the content of the folk activity; The data of folk activities in each village are standardized and stored in a relational database, which contains a table structure for storing information on folk activities.

3. The method according to claim 2, characterized in that, To generate a preset format, follow these steps: Obtain a preliminary survey document on tourist needs; Based on the tourist demand document, an application scenario analysis was conducted to obtain the time, location, and name of the folk activities. Construct a ternary data structure based on the time, location, and name of the folk activity; The data structure of the triple is used as a preset format.

4. The method according to claim 1, characterized in that, The method further includes: Obtain test question description text and standard answers for system testing; According to the method described in claim 1, generate test answer text corresponding to the test question description text; Semantic similarity analysis was performed on the test response text and the standard answer using the embedding vector method to obtain semantic similarity. Based on the semantic similarity and the preset semantic similarity range, the similarity level is determined; When the similarity level indicates that the test response text and the standard answer are different, a warning message is generated; The warning information is sent to the warning client for display.

5. The method according to claim 1, characterized in that, The process utilizes a pre-defined large language model to extract information from the problem description text based on time, location, name of the folk activity, and content of the folk activity, obtaining key information in JSON format, including: Obtain the first prompt word used to extract key information about village folk activities, wherein the key information about village folk activities includes time, location, name of folk activity, and content of folk activity; The problem description text and the first prompt word are input into the preset large language model to extract information from the problem description text based on the first prompt word; Output the key information in JSON format corresponding to the problem description text.

6. The method according to claim 5, characterized in that, The step of extracting information from the problem description text based on the first prompt word includes: Intent pattern recognition is performed on the problem description text to identify the target intent pattern implied in the problem description text. The target intent pattern includes at least one of exact match, fuzzy query, comparison query, or combined condition query. Based on the target intent pattern, automatically adapt to the specific task instruction of the first prompt word; Based on the specific task instructions, create multiple types of key information identifiers; From the problem description text, extract the attribute information of each type of key information identifier to obtain the key information in JSON format corresponding to the problem description text.

7. The method according to claim 1, characterized in that, The process of constructing and executing an SQL query statement based on the key information in the JSON format includes: Parse the key information in the JSON format to obtain time information representing the time of the folk activity, location information representing the location of the folk activity, name information representing the name of the folk activity, and content information representing the content of the folk activity; By using a pre-defined semantic-data mapping rule base, the time information, location information, name information, and content information are converted into standardized query elements that can be directly used for database field comparison; The standardized query elements are filled into a preset SQL query template to obtain an SQL query statement; Execute the SQL query statement.

8. The method according to claim 1, characterized in that, The process of using the preset large language model to refine the folk activity records and generate and display the final answer text corresponding to the question description text includes: Obtain secondary clues for refining the copy; The folk activity record and the second prompt word are input into the preset large language model to polish the folk activity record based on the second prompt word; Output the final answer text corresponding to the question description text; Display the final answer text.

9. The method according to claim 8, characterized in that, The preset large language model includes a first polishing submodule, a second polishing submodule, and a third polishing submodule; the second prompt word includes a structure verification instruction, a style instruction, and a logic optimization instruction; The polishing of the folk activity record based on the second prompt word includes: The folk activity record and the structure verification instruction are input into the first polishing submodule to restructure the folk activity record and generate a basic polished text containing clear time, place, activity name, core content and cultural meaning. The basic polished text, the style instructions, and the user's user profile information are input into the second polishing submodule to rewrite the basic polished text in a stylized manner that conforms to the target context, generating a stylized intermediate text. The stylized intermediate text and the logic optimization instructions are input into the third polishing submodule to optimize the paragraph logic, causal or temporal relationships between sentences, opening and closing remarks of the stylized intermediate text, and adjust the sentence complexity and length to obtain the optimized text. By using keyword / entity matching and preset rules, the records of folk activities are automatically compared with the optimized copy to check whether any statements that are inconsistent with the facts of the records of folk activities have been introduced during the process of style adaptation and logic optimization, and to obtain the verification results. When the verification results indicate that the optimized text does not contain any statements that are inconsistent with the facts of the folk activity record, the final answer text corresponding to the question description text is generated.

10. A question-and-answer device for village folk activities that combines large-scale models and SQL queries, characterized in that, The device includes: The request receiving module is used to receive a question and answer request for village folk activities input by the user from the client, wherein the question and answer request for village folk activities carries a question description text; The JSON format key information output module is used to extract information from the problem description text according to time, location, folk activity name, and folk activity content using a preset large language model, and obtain key information in JSON format. The SQL query module is used to call the POST service to send the key information in JSON format to the server; so that the server can construct and execute an SQL query statement based on the key information in JSON format to retrieve folk activity records that meet the conditions from the relational database. The relational database stores folk activity information of traditional villages and supports querying through SQL query statements. The answer text display module is used to refine the folk activity records using the preset large language model, and generate and display the final answer text corresponding to the question description text.