Natural language-driven traffic data intelligent chart generation method, system and device, medium and program product
By using a natural language-driven intelligent chart generation method for traffic data, this method automatically matches chart types using speech recognition and a multi-dimensional feature vector decision model. Combined with a data adapter to optimize query and caching mechanisms, it solves the problems of low efficiency in automatic chart type decision-making and querying in traffic data visualization, and achieves highly efficient data visualization with second-level response and multi-round interaction.
Patent Information
- Application Number
- CN202511584749.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-31
- Publication Date
- 2026-01-27
AI Technical Summary
Existing technologies for traffic data visualization suffer from problems such as difficulty in automatically deciding on chart types, low query efficiency, load caused by repetitive SQL, and inability to inherit context in voice interaction, making it difficult to meet the second-level map generation requirements of emergency command.
Employing a natural language-driven approach, the system automatically matches the optimal chart type through speech recognition, semantic parsing, and a multi-dimensional feature vector decision model. Combined with a data adapter to optimize query and caching mechanisms, it supports multi-turn interaction and dialogue state tracking, achieving a second-level response time from voice input to chart presentation.
It achieves a second-level response time from voice input to chart presentation, improving the efficiency of emergency command, supporting multi-turn interaction and contextual consistency, and meeting the needs of efficient data visualization in scenarios such as traffic emergency response, urban planning, and public transportation monitoring.
Smart Images

Figure CN121412293A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent transportation systems and natural language processing technology, and in particular to a method, system, device, medium and program product for generating intelligent charts of traffic data driven by natural language. Background Technology
[0002] With the explosive growth of urban traffic data, how to quickly and accurately transform massive amounts of heterogeneous data into visual charts that can be used for decision-making has become one of the core challenges in the construction of Intelligent Transportation Systems (ITS). Traditional methods rely on manual dragging and dropping fields, selecting graphs, and adjusting parameters within Business Intelligence (BI) platforms, requiring an average of no less than eight steps, which is both time-consuming and requires users to have a high level of domain and tool knowledge.
[0003] In recent years, Natural Language Processing (NLP) technology has been introduced into the field of visualization, forming the sub-field of "Natural Language to Visualization" (NL2VIS). Representative solutions include Tableau's "Ask Data," Power BI's "Q&A," and Amazon QuickSight's voice query function. However, these general-purpose systems reveal significant technical shortcomings when facing specialized transportation scenarios, such as:
[0004] (1) Rigid chart adaptation: The existing tools use a fixed template matching strategy, which cannot dynamically select the optimal visualization code according to the query intent. This often results in problems such as line charts being misused for spatial distribution and pie charts being misused for time series trends.
[0005] (2) The query efficiency is low and it is impossible to generate a graph in seconds; and the disk / network amplification caused by repeated SQL in the same area and at the same time increases the CPU and I / O load of the backend database.
[0006] (3) Lack of interactive loop: The voice interface only supports single query and lacks a dialogue state tracking (DST) mechanism, which makes it impossible to achieve multi-round progressive analysis. The user experience remains at the "question and answer" level.
[0007] Within the transportation industry, although big data systems such as Alibaba Cloud's "Traffic Brain" and Baidu's Intelligent Transportation Platform provide a wealth of visualization components, business personnel still need to manually select data sources, set dimensions and indicators, and save templates, which takes an average of tens of minutes and is difficult to meet the rigid demand of emergency command for "second-level map generation".
[0008] In summary, existing technologies have not yet solved problems such as difficulties in automatically deciding on chart types, low query efficiency, load caused by repetitive SQL, and inability to inherit context in voice interaction, which restricts the efficiency and popularization of traffic data visualization in practice. Summary of the Invention
[0009] In view of this, the present invention provides a method, device, medium and program product for generating intelligent traffic data charts driven by natural language in the field of transportation, which at least partially solves the problems existing in the prior art.
[0010] To achieve the above objectives, the present invention adopts the following technical solution:
[0011] In a first aspect, the present invention provides a natural language-driven intelligent chart generation method for traffic data, the method comprising:
[0012] Receive user voice input, perform speech recognition, and generate text;
[0013] The text is semantically parsed to identify the user's query intent, extract spatiotemporal parameters and transportation-related terms, and output the semantic parsing results.
[0014] Based on the semantic parsing results, a query feature vector is constructed and input into a chart type decision model based on multi-dimensional feature vectors. The feature dimensions include: time granularity, spatial level, number of indicators, and intent type. A weighted similarity matching algorithm is used to automatically match the optimal chart type.
[0015] Obtain chart query data by querying the traffic database using the data adapter;
[0016] Generate a visual chart based on the chart query data and the optimal chart type.
[0017] Furthermore, the chart type decision model based on multidimensional feature vectors aims to select from the candidate chart set. Choose the optimal chart type , so that:
[0018]
[0019] in: : No. Each query feature includes time granularity, spatial hierarchy, number of metrics, and intent type; Feature weights, calculated based on the AHP (Analytic Hierarchy Process); The similarity function between features and chart types uses a normalized matching score.
[0020] When the intent type is regional comparison, a heatmap is used when the spatial hierarchy is ≥3, and a pie chart is used when the spatial hierarchy is <3.
[0021] When the intent type is trend analysis, a line chart with year-on-year comparison is used when the time granularity is monthly, and a line chart is used when the time granularity is daily.
[0022] When the intent type is flow analysis, a Sankey diagram is used.
[0023] Furthermore, the data adapter query includes multi-source data query;
[0024] The multi-source data query includes: parameterizing SQL, removing literals; mapping long strings to 64-bit integers using stable hashing; adding a time window; and publishing the optimized SQL to different traffic multi-source database management systems to begin data querying.
[0025] Furthermore, the data adapter query includes database cache querying using an LRU-K order heat scoring algorithm;
[0026] The LRU-K order popularity scoring algorithm includes uniformly recording the K most recent access times, and then using "average interval and frequency" as two factors to calculate the comprehensive popularity score;
[0027] The data adapter query also includes primary cache query promotion and eviction, wherein, the previous This visit is only available in The cumulative value of the zone is then the first Next When the threshold is reached, promotion is based on exponential probability; when eliminated, the minimum score is obtained.
[0028] Furthermore, the generation of visualization charts also includes visual parameter configuration and adaptive chart layout;
[0029] The visual parameter configuration includes semantic color mapping, pixel density adaptive automatic font size adjustment, and line width and dot diameter scaling.
[0030] The adaptive chart layout is achieved through constraint satisfaction problem modeling, backtracking search and conflict-oriented handling algorithms, and multi-subgraph automatic column splitting algorithm.
[0031] Furthermore, it also includes multi-turn interactive control, supporting users to perform multi-turn adjustments and drill-down analysis of charts via voice commands, and maintaining contextual consistency based on a dialogue state tracking model, including:
[0032] A hybrid dialogue state tracking model based on rules and machine learning is adopted, maintaining a dialogue state vector for each round of dialogue:
[0033]
[0034] in:
[0035] Intent: The unique hot code number of the current user's query intent; Time: The start and end timestamps of the time range after standardization; Space: Spatial region code; Chart: The selected chart type number; Drill: The drill-down depth counter;
[0036] The dialogue state vector is updated by a function after each round of dialogue. The state update function is:
[0037]
[0038] in:
[0039] : for the first The semantic parsing results of the user input are processed; the Update function inherits and overrides the state based on predefined rules and historical context.
[0040] Secondly, the present invention also provides a natural language-driven intelligent traffic data chart generation system, comprising:
[0041] The speech recognition module is configured to receive user voice input, perform speech recognition, and generate text.
[0042] The semantic parsing module is configured to perform semantic parsing on the text, identify the user's query intent, extract spatiotemporal parameters and transportation-related terms, and output the semantic parsing results.
[0043] The chart type decision engine module is configured to construct query feature vectors based on semantic parsing results, and input a chart type decision model based on multi-dimensional feature vectors. The feature dimensions include: time granularity, spatial level, number of indicators, and intent type. The optimal chart type is automatically matched using a weighted similarity matching algorithm.
[0044] The data adapter module is configured to query the traffic database through the data adapter to obtain chart query data;
[0045] The chart generation module is configured to generate visual charts based on the chart query data and the optimal chart type matched.
[0046] The multi-turn interactive control module is configured to support users in making multi-turn adjustments and drill-down analyses of charts via voice commands, and to maintain contextual consistency based on a dialogue state tracking model.
[0047] Thirdly, the present invention provides a computer device comprising: a processor and a memory; the memory for storing one or more program instructions; and the processor for executing the one or more program instructions to perform the steps of the natural language-driven intelligent traffic data chart generation method described above.
[0048] Fourthly, the present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method for generating intelligent traffic data charts driven by natural language.
[0049] Fifthly, the present invention also provides a computer program product comprising computer program instructions that, when executed by a processor, implement the steps of the above-described method for generating intelligent traffic data charts driven by natural language.
[0050] This invention addresses traffic data visualization scenarios by proposing a natural language-driven intelligent traffic data chart generation method and system that directly converts natural language speech into professional charts. It employs a chart type decision model and a Chart Decision Tree (CDT) algorithm based on feature vectors. Simultaneously, it constructs feature vectors using temporal granularity, spatial hierarchy, number of indicators, and query intent. The weighted decision tree automatically selects the optimal visualization scheme from various chart types and further dynamically configures color mapping, annotation strategies, and layout parameters. This overcomes the bottlenecks of traditional rigid templates and the need for manual configuration. The entire process, from voice input to chart presentation, is controlled within seconds. The system further maintains state vectors such as intent, spatiotemporal range, chart type, and drill-down level based on DST (Dialogue State Tracking). It supports users to continuously switch dimensions, make year-on-year comparisons, or perform five-level drill-down using voice without losing context. The parameter retention rate is no less than 85%, and the response latency is no more than 800 milliseconds. This reduces the time consumption of traditional traffic analysis from hours to seconds. The measured emergency command efficiency has been improved by three times, and it can handle millions of queries per day. It is suitable for scenarios such as traffic emergency, urban planning, and public transportation monitoring, and realizes a closed-loop interaction of "speak and get a picture" and "talk while looking at the picture". Attached Figure Description
[0051] To more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are merely exemplary, and those skilled in the art can derive other embodiments based on the provided drawings without creative effort.
[0052] Figure 1 This is an overall architecture diagram of a natural language-driven intelligent traffic data chart generation system according to an embodiment of the present invention;
[0053] Figure 2 This is a flowchart of a natural language-driven intelligent traffic data chart generation method according to an embodiment of the present invention.
[0054] Figure 3 The chart type is a decision tree structure diagram;
[0055] Figure 4 This is a multi-round interactive state transition diagram. Detailed Implementation
[0056] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0057] This invention discloses a natural language-driven intelligent chart generation method for traffic data, primarily applied to natural language-driven data visualization and decision support systems in scenarios such as traffic emergency command, urban traffic planning, and public transportation monitoring. The method takes the user's natural language speech signal as input and outputs a dynamic visualization chart that matches the user's query intent. It also supports real-time adjustment and drill-down analysis of the chart via voice commands.
[0058] The system corresponding to this natural language-driven intelligent traffic data chart generation method adopts a modular design, supports distributed deployment and edge computing integration, and possesses high concurrency processing capabilities. The overall technical architecture of the natural language-driven intelligent traffic data chart generation system is as follows: Figure 1 As shown, the overall architecture includes: a speech recognition module, a semantic parsing module, a chart type decision engine module, a data adapter module, a chart generation module, and a multi-round interactive control module. These modules exchange data through standardized interfaces, forming a complete closed-loop control chain from voice input to chart output and interactive feedback.
[0059] Figure 2 This is a flowchart of a natural language-driven intelligent traffic data chart generation method according to an embodiment of the present invention; combined with Figure 1 , 2 As shown, the natural language-driven intelligent traffic data chart generation method of this embodiment includes:
[0060] Step S100: Receive user voice input, perform voice recognition, and generate text;
[0061] Step S200: Perform semantic parsing on the text, identify the user's query intent, extract spatiotemporal parameters and transportation-related terms, and output the semantic parsing results;
[0062] Step S300: Construct a query feature vector based on the semantic parsing results, input the chart type decision model based on multi-dimensional feature vectors, the feature dimensions include: time granularity, spatial level, number of indicators, and intent type, and use a weighted similarity matching algorithm to automatically match the optimal chart type.
[0063] Chart types include: heatmaps, line charts, Sankey diagrams, bar charts, pie charts, etc., and support automatic switching between more than 12 chart types.
[0064] Specifically, in combination Figure 3 As shown, the chart type decision model based on multidimensional feature vectors aims to select from the candidate chart set. Choose the optimal chart type , so that:
[0065]
[0066] in: : No. Each query feature (such as time granularity, spatial hierarchy, number of metrics, and intent type); Feature weights, calculated based on the AHP (Analytic Hierarchy Process); The similarity function between features and chart types uses a normalized matching score.
[0067]
[0068] For example, when a user's query intent is "regional comparison" and the spatial hierarchy is greater than or equal to 3, the system prioritizes the heatmap type and enhances readability through color mapping and labeling strategies; when the spatial hierarchy is less than 3, a pie chart is used.
[0069] When the user's query intent is "trend analysis", a line chart with year-on-year comparison is used when the time granularity is monthly, and a line chart is used when the time granularity is daily.
[0070] When the user's query intent is "flow analysis", a Sankey diagram is used.
[0071] Next, proceed to step S400: Query the traffic database through the data adapter to obtain chart query data.
[0072] Specifically, the data adapter query employs a multi-source query and an LRU-K caching subsystem.
[0073] It provides a "millisecond-level data foundation" for the chart type decision engine module. Only when the underlying query return time is less than 100ms can the overall "second-level chart generation" promise be guaranteed. On the other hand, it also eliminates disk / network amplification caused by repeated SQL queries in the same region and time period, reducing the CPU and I / O load on the backend database. This embodiment designs a probabilistic LRU-K cache within the data adapter. The core idea is:
[0074] It not only records the "most recent" access time, but also maintains the most recent... The complete timestamp sequence of each visit is used to estimate the long-term arrival rate using second-order statistics, and then combined with the exponentially weighted moving average (EWMA) to form the elimination score, thereby significantly reducing the "occasional jittery elimination" problem of traditional LRU.
[0075] 1. Multi-source query
[0076] The traffic control center repeatedly issues queries for "same area + same time period" every day. If the raw SQL text is used as the key, the query will fail if the parameter order is different. It is necessary to normalize and hash the "template-administrative region-time" triple into a unique fingerprint to achieve byte-level deduplication.
[0077] The key technical points are: first, parameterize the SQL, removing literals; then, use a stable hash (MurmurHash3) to map long strings to 64-bit integers; next, add a time window, naturally supporting "sliding window" reuse (e.g., 2025-08-01 00:00→00:05 and 00:01→00:06 can share 4 minutes of data); finally, publish the optimized SQL to different multi-source database management systems for transportation to begin data querying. The specific formula is as follows:
[0078]
[0079] Where SQL_template: the parameterized SQL string; district_code: a 12-digit administrative division number (e.g., 110105); time_start / time_end: Unix timestamps (in seconds).
[0080] ;hash (·) : MurmurHash3_64, outputs a 64-bit unsigned integer.
[0081] 2. LRU-K order heat rating algorithm
[0082] Classic LRU only considers the "most recent" timestamp, which can easily lead to "batch scripts in the early morning" pushing truly hot items out of the cache. LRU-K introduces a "historical K-times access interval," which can filter out occasional fluctuations and retain long-term hot items. The key optimization points are:
[0083] Record the times of the K most recent visits uniformly, then use a two-factor weighting method of "average interval → frequency". Items with higher frequency and shorter intervals receive higher scores. Finally, apply variance penalty. Suppressing "sudden cooling" pulse flow rates. The calculation steps of the K-order heat scoring algorithm are as follows:
[0084] (1) First, calculate the average access interval.
[0085]
[0086] in: :item The latest Unix timestamp (in seconds) for the first access; : The first timestamp (seconds) within the same window; History window length, example 3 (sufficient for statistics and saves memory); unit: seconds; physical meaning: the smaller the value, the more frequent the user activity.
[0087] (2) Next, calculate the local frequencies.
[0088]
[0089] in: Instantaneous frequency, measured in Hz (times per second); and They are reciprocals of each other, but retain [the following]: At the molecular level, "dense" can be emphasized. "difference.
[0090] (3) Finally, calculate the overall popularity score.
[0091]
[0092] in: Elimination score: the higher the score, the more popular the elimination; range: 0 to +∞. Interval weight, 0.7;
[0093] : Frequency weight, 0.3; sum to 1, ➜ via Grid-Search, in 10 6 QPS has the highest hit rate on the trajectory; Short intervals and high weights ensure "continuous dense" and "continuous false clearing".
[0094] 3. Promotion and dismissal thresholds
[0095] If a previously "cold" item suddenly becomes popular, immediate promotion will pollute the main cache. Setting access frequency gating combined with probability-based promotion allows the item to "test the waters" first, ensuring stability before entering the main pool. The key optimization techniques for this step are:
[0096] forward This visit is only available in The cumulative value of the zone is then the first Next When the threshold is reached, promotion is based on exponential probability to avoid a one-time surge in popularity using "batch scripts"; when eliminating, always select the appropriate candidate. The minimum term ensures that "extremely cold" data is eliminated first. The calculation steps for the promotion and elimination threshold algorithm are as follows:
[0097] (1) Calculate the limit on the number of loops
[0098]
[0099] in: : The cumulative number of accesses (integer) for the same key; Set to 3 to filter occasional events without excessively delaying promotion.
[0100] (2) Promotion threshold algorithm
[0101]
[0102] in: :item Promotion probability, ranging from 0 to 1; Steepness coefficient, set to 2.0 (the larger the value, the steeper the threshold). Arrival rate threshold, take Its physical meaning is that only by being "faster than the network average" can it achieve this. "Those who are qualified have a high probability of being promoted."
[0103] (3) Elimination threshold algorithm
[0104]
[0105] in: Select the cache block with the smallest score; ensure that long-term cold items are evicted first, and the retention rate of hot items increases by 12.3 pp.
[0106] 4. Performance metrics and concurrency security testing
[0107] After testing, the hit rate of the experiment was improved, and the average query latency decreased. The quantitative indicators are as follows:
[0108] Formula to improve hit rate:
[0109] ΔP = - = 94.7% − 82.4% = 12.3 pp, which means that there are 12.3 more hits per 100 queries.
[0110] ΔP: Absolute increase in hit rate, measured in percentage points (pp).
[0111] The measured hit rate of the LRU-K cache in this invention is 94.7%.
[0112] The baseline hit rate of a traditional LRU-1 cache is 82.4%.
[0113] Formula for reducing average query latency:
[0114] ΔT = - = 210 ms - 23 ms = 187 ms. During continuous drilling tests, approximately 0.19 seconds are saved per step, ensuring an overall voice loop closure time of ≤ 800 ms.
[0115] ΔT: Absolute decrease in average query latency, in milliseconds (ms).
[0116] Average response time of the legacy system (LRU-1 + direct database connection): 210 ms (including network and disk connections).
[0117] The average response time of the new system (LRU-K + cache hits) is 23 ms (primarily memory hits).
[0118] In terms of concurrency safety, the number of segmented locks is The expected lock contention probability is ,in:
[0119] Physical core count (64 cores on the test machine)
[0120] Number of lock segments: 64 segments; empirical coefficient of 128 segments can balance the overhead of "lock granularity vs. memory".
[0121] Expected contention probability for each hash chain
[0122] Tests showed that the 64-core platform had a latency of 0.78%, far lower than the 100% latency of the global lock.
[0123] Next, proceed to step S500: Generate a visualization chart based on the chart query data and the optimal chart type.
[0124] After the above steps, the entire workflow of "voice → text → intent → data → cache → chart type" has been completed. This step is responsible for transforming the raw data matrix output from the cache into a semantically correct, screen-adaptive bitmap frame buffer image for display without manual dragging.
[0125] 1. Visual parameter configuration engine
[0126] The aforementioned chart decision engine only outputs "type + data". Directly calling a general rendering library will result in colors that do not match traffic semantics (e.g., green for accidents), font sizes / line widths that are unreadable on 4K large screens, and overlapping titles and legends that run out of the safe zone when there are multiple subgraphs. Therefore, this implementation adds a two-level module of "visual parameter configuration + adaptive layout" before rendering to ensure that data → pixels are completed in one step without manual dragging, and to meet the extreme physical pixel densities of 12-inch in-vehicle screens and 110-inch screens in command centers.
[0127] (1) Semantic color mapping table
[0128] Color confirmation is accomplished by adding a semantic color mapping table to the ontology library.
[0129] Table 1 Semantic Color Map
[0130]
[0131] (2) Automatic font size formula (pixel density adaptive)
[0132] The following formula can be used to automatically adjust the font size.
[0133] ,in:
[0134] (Based on 96 dpi);
[0135] Target screen pixel density (141 PPI for automotive screens, 48 PPI for large screens).
[0136] Index 0.8: Empirical power law, balancing "not too large" and "readable from a distance".
[0137] (3) Line width / dot diameter scaling
[0138] The following formula can be used to ensure that lines on a 4K large screen are not jagged and dots on a car screen are not blurred:
[0139]
[0140]
[0141] 2. Adaptive Chart Layout Algorithm
[0142] (1) Constraint Satisfaction Problem (CSP) Modeling
[0143] Assume that the position vector of each primitive on the screen is as shown in the following formula:
[0144]
[0145] The domain of screen pixel coordinates can then be set as follows:
[0146] At the same time, the following hard constraints must not be violated:
[0147] a) Readability spacing: ≥ 0.5cm (physical size) between any two text boxes
[0148] b) Safe zone: No more than 5% of the screen edge
[0149] c) Layer order: Title > Legend > Polyline > Grid
[0150] On the other hand, the following soft constraints can be satisfied as much as possible:
[0151] a) Visual center of gravity balance:
[0152] b) Aspect ratio of golden ratio:
[0153] (2) Backtracking search + conflict-oriented processing algorithm
[0154] The pseudocode is as follows:
[0155] While there are conflicting constraints:
[0156] Select the variable with the highest degree of conflict
[0157] Sort by minimum conflict value
[0158] Assign values and propagate constraints
[0159] If it fails, roll back and mark it in the taboo list.
[0160] The worst-case complexity formula is: Number of variables , Domain size It converges within 4ms.
[0161] (3) Automatic column splitting algorithm for multi-subgraph
[0162] When the number of indicators > 3, the number of columns will be automatically calculated:
[0163] The pseudocode is as follows:
[0164]
[0165] / / Minimum aspect ratio
[0166] / / Ensure that sub-images are not shrunk on a 110-inch 16:9 large screen and do not overflow on a 16:10 car screen.
[0167] 4. Rendering Performance and Actual Measurements
[0168] When the GPU is not enabled, a single CPU core (i9-10980) can complete the entire link from "data matrix" to "frame buffer bitmap" within 20ms, meeting the voice loop closure requirement of total time ≤ 800ms. See Table 2 for a detailed comparison.
[0169] Table 2 Rendering Performance Parameter Mapping Table
[0170]
[0171] Next, proceed to step S600: Employ multi-turn interactive control, allowing users to perform multi-turn adjustments and drill-down analysis on charts via voice commands, and maintain contextual consistency based on a dialogue state tracking model.
[0172] 1. Multi-turn Dialogue State Tracking Model (DST)
[0173] To achieve multi-turn voice interaction, a hybrid multi-turn dialogue state tracking model based on rules and machine learning is constructed. Each turn of the dialogue maintains a dialogue-state vector:
[0174]
[0175] Variable descriptions (column-by-column):
[0176] Intent: The one-hot encoded sequence number of the current user's query intent (integer, range 1–4).
[0177] Time: The start and end timestamps after time range standardization (can be stored as Unix seconds, double-precision floating point).
[0178] Space: Spatial area code (administrative division code or Geohash string, mapped to an integer ID)
[0179] Chart: Selected chart type number (integer, 1–12 correspond to line chart, heat map, Sankey chart, etc.)
[0180] Drill: Drilling depth counter (integer, 0–5, initial value 0)
[0181] This vector is updated by a function after each round of dialogue; the state update function is:
[0182]
[0183] in:
[0184] : for the first The `Update` function processes the semantic parsing results of the user input. It then performs state inheritance and overriding based on predefined rules and historical context.
[0185] 2. Example of state inheritance:
[0186] For example, if the user's first command is "Display accident distribution in Chaoyang District", then the initial state is: =[Regional Comparison, Current Month, Chaoyang District, Heat Map, 0]; If the next instruction is "Compare to the same period last year", then the status will be updated at this time:
[0187] =[Regional comparison, current month + same month last year, Chaoyang District, comparison heatmap, 0]; For detailed logic, please refer to [link / reference]. Figure 4 As shown.
[0188] Experiments show that this mechanism achieves a state parameter retention rate of ≥85% and a context inheritance accuracy of ≥91.3% in interactions of up to 5 rounds.
[0189] The following three application scenarios will be used as examples to illustrate:
[0190] (1) Application Scenario 1: Regional accident hotspot query and year-on-year comparison
[0191] User voice input: "Display the distribution hotspots of major accidents in Chaoyang District throughout last year."
[0192] Step 1: Speech Recognition and Text Output
[0193] The system outputs the text "Displaying the distribution hotspots of major accidents in Chaoyang District throughout last year" through speech recognition. The recognition confidence level is 0.94, which meets the system threshold requirement (≥0.9), and then proceeds to semantic analysis.
[0194] Step 2: Semantic parsing
[0195] Intent recognition: Region Comparison; Spatial parameters: Chaoyang District (code: 110105); Time parameters: Last year (January 1, 2024 to December 31, 2024); Accident type: Major accident (defined as an accident resulting in 3 or more deaths according to Article 6 of the "Regulations on the Procedures for Handling Traffic Accidents"); Keyword extraction: "Distribution hotspots" → Chart tends to be a heatmap.
[0196] Step 3: Chart Decision
[0197] The input feature vector for the decision model based on chart type is as follows: Intent = Regional comparison; Spatial hierarchy = 3 (city → district → street); Time granularity = year; Number of indicators = 1 (number of accidents); Keywords containing "hot spots" → heat map priority.
[0198] The system outputs a heatmap, with a red-yellow gradient for color mapping and a threshold segmentation for labeling (red for ≥5 incidents, orange for 3–4 incidents, and yellow for 1–2 incidents).
[0199] Step 4: Data Query and Chart Generation
[0200] The data adapter queries the traffic ontology database, and SQL generates test code; the query results are cached in the LRU-K cache system, and the chart generation response time is 0.73 seconds.
[0201] Step 5: Adjusting User Interaction
[0202] If the user continues to input via voice: "Compare with the same period of the previous year", the system will recognize this as an intention to expand the time dimension, automatically expand the time range to 2023 and 2024, generate a two-cycle heat map comparison, and add year legends and year-on-year change labels to the chart.
[0203] 2. Application Scenario 2: Switching between traffic flow trend analysis charts
[0204] User voice input: "Show the changes in average vehicle speed on main roads in Haidian District in the first quarter of 2025."
[0205] Step 1: Semantic parsing results
[0206] Intent: Trend Analysis; Location: Haidian District (110108); Time: First quarter of 2025 (January 2025 to March 2025); Indicator: Average vehicle speed (km / h); Chart type: Line Chart.
[0207] Step 2: Chart Decision Logic:
[0208] Time granularity = month; Number of indicators = 1; Intent = Trend Analysis → The system selects a line chart and automatically adds a year-on-year curve (same period in 2024). Chart generation parameters: X-axis: month (January, February, March...); Y-axis: average vehicle speed;
[0209] Step 3: User voice adjustment:
[0210] The message "Change to a monthly statistical bar chart" was identified as an intent to adjust the chart type. The chart reconstruction interface was then called to switch the line chart to a bar chart, while retaining the year-on-year data series. The response time was 0.68 seconds.
[0211] (3) Application Scenario 3: Multi-round Drill-down Analysis - From Urban Area to Intersection
[0212] User voice input: "View accident-prone road sections in Xicheng District last month"
[0213] Step 1: Semantic parsing:
[0214] Intent: Regional comparison; Space: Xicheng District (110102); Time: Last month (August 2025); Chart type: Heat map (street level); Chart generation: The system generates a street-level heat map, marking the top five streets with the most accidents.
[0215] Step 2: User's drill-down command: "Drill down to Financial Street".
[0216] The system identifies the intention to drill down into space, updates the spatial parameters to "Financial Street," and automatically switches the chart to an intersection-level heat map to display the accident distribution at each intersection under the jurisdiction of the street.
[0217] State vector update process:
[0218] (1) Initial state: [intent=regional comparison, time=2025-08, space=Xicheng District, chart=heat map, drill=0];
[0219] (2) Status after drilling: [intent=regional comparison, time=2025-08, space=Financial Street, chart=heat map, drill=1].
[0220] At this point, the user continues to drill down with the command: "Drill down to the intersection of Yuetan North Street." The system continues to drill down to the intersection level and displays a line graph showing the accident trend of the intersection over the past three months, completing the three-level drill-down analysis.
[0221] This invention provides a natural language-driven intelligent traffic data chart generation method that enables end-to-end adaptive processing from data features to visual encoding to interactive logic, overcoming the challenge of automatic chart type decision-making. It also constructs a voice interaction closed-loop system that supports multi-turn, context-aware chart exploration, meeting the urgent needs of scenarios such as traffic emergency command, urban planning, and public transportation monitoring for efficient, intelligent, and interactive data visualization.
[0222] In addition to providing a natural language-driven intelligent traffic data chart generation method and system, this embodiment also provides a computer device, the device including: a processor and a memory; the memory is used to store one or more program instructions; the processor is used to run one or more program instructions to perform the steps of the natural language-driven intelligent traffic data chart generation method described above.
[0223] In addition, this embodiment also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described natural language-driven intelligent traffic data chart generation method.
[0224] Furthermore, this embodiment also provides a computer program product, which includes computer program instructions that, when executed by a processor, implement one of the above-described methods.
[0225] The steps of a natural language-driven intelligent chart generation method for traffic data.
[0226] In this embodiment of the invention, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in this embodiment of the invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in this embodiment of the invention can be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The processor reads information from the storage medium and, in conjunction with its hardware, completes the steps of the above methods. The storage medium can be memory, for example, volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM).The storage media described in the embodiments of this invention are intended to include, but are not limited to, these and any other suitable types of memory. Those skilled in the art will recognize that the functions described in one or more of the above examples can be implemented using a combination of hardware and software. When applied software, the corresponding functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transmission of computer programs from one place to another. Storage media can be any available medium accessible to general-purpose or special-purpose computers. Although the invention has been described in detail above with general description and specific embodiments, modifications or improvements can be made to it, which will be apparent to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the invention are within the scope of protection claimed by this invention.
[0227] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications, equivalent changes, or alterations made by those skilled in the art using the disclosed technical content shall fall within the protection scope of the present invention.
Claims
1. A natural language-driven intelligent chart generation method for traffic data, characterized in that, The method includes: Receive user voice input, perform speech recognition, and generate text; The text is semantically parsed to identify the user's query intent, extract spatiotemporal parameters and transportation-related terms, and output the semantic parsing results. Based on the semantic parsing results, a query feature vector is constructed and input into a chart type decision model based on multi-dimensional feature vectors. The feature dimensions include: time granularity, spatial level, number of indicators, and intent type. A weighted similarity matching algorithm is used to automatically match the optimal chart type. Obtain chart query data by querying the traffic database using the data adapter; Generate a visual chart based on the chart query data and the optimal chart type.
2. The natural language-driven intelligent traffic data chart generation method according to claim 1, characterized in that, The chart type decision model based on multidimensional feature vectors aims to select from a set of candidate charts. Choose the optimal chart type , so that: ; in: : No. Each query feature includes time granularity, spatial hierarchy, number of metrics, and intent type; Feature weights, calculated based on the AHP (Analytic Hierarchy Process); The similarity function between features and chart types uses a normalized matching score. When the intent type is regional comparison, a heatmap is used when the spatial hierarchy is ≥3, and a pie chart is used when the spatial hierarchy is <3. When the intent type is trend analysis, a line chart with year-on-year comparison is used when the time granularity is monthly, and a line chart is used when the time granularity is daily. When the intent type is flow analysis, a Sankey diagram is used.
3. The natural language-driven intelligent traffic data chart generation method according to claim 1, characterized in that, The data adapter query includes multi-source data query; The multi-source data query includes: parameterizing SQL, removing literals; mapping long strings to 64-bit integers using stable hashing; adding a time window; and publishing the optimized SQL to different traffic multi-source database management systems to begin data querying.
4. The natural language-driven intelligent traffic data chart generation method according to claim 1, characterized in that, The data adapter query includes database cache querying using an LRU-K order heat scoring algorithm; The LRU-K order popularity scoring algorithm includes uniformly recording the K most recent access times, and then using "average interval and frequency" as two factors to calculate the comprehensive popularity score; The data adapter query also includes primary cache query promotion and eviction, wherein, the previous This visit is only available in The cumulative value of the zone is then the first Next When the threshold is reached, promotion is based on exponential probability; when eliminated, the minimum score is obtained.
5. The natural language-driven intelligent traffic data chart generation method according to claim 1, characterized in that, The generation of visual charts also includes visual parameter configuration and adaptive chart layout; The visual parameter configuration includes semantic color mapping, pixel density adaptive automatic font size adjustment, and line width and dot diameter scaling. The adaptive chart layout is achieved through constraint satisfaction problem modeling, backtracking search and conflict-oriented handling algorithms, and multi-subgraph automatic column splitting algorithm.
6. The natural language-driven intelligent traffic data chart generation method according to claim 1, characterized in that, It also includes multi-turn interactive control, supporting users to make multiple adjustments and drill-down analyses of charts via voice commands, and maintaining contextual consistency based on a dialogue state tracking model, including: A hybrid dialogue state tracking model based on rules and machine learning is adopted, maintaining a dialogue state vector for each round of dialogue: ; in: Intent: The unique hot code number of the current user's query intent; Time: The start and end timestamps of the time range after standardization; Space: Spatial region code; Chart: The selected chart type number; Drill: The drill-down depth counter; The dialogue state vector is updated by a function after each round of dialogue. The state update function is: ; in: : for the first The semantic parsing results of the user input are processed; the Update function inherits and overrides the state based on predefined rules and historical context.
7. A natural language-driven intelligent chart generation system for traffic data, characterized in that, include: The speech recognition module is configured to receive user voice input, perform speech recognition, and generate text; The semantic parsing module is configured to perform semantic parsing on the text, identify the user's query intent, extract spatiotemporal parameters and transportation-related terms, and output the semantic parsing results. The chart type decision engine module is configured to construct query feature vectors based on semantic parsing results, and input a chart type decision model based on multi-dimensional feature vectors. The feature dimensions include: time granularity, spatial level, number of indicators, and intent type. The optimal chart type is automatically matched using a weighted similarity matching algorithm. The data adapter module is configured to query the traffic database through the data adapter to obtain chart query data; The chart generation module is configured to generate visual charts based on the chart query data and the optimal chart type matched. The multi-turn interactive control module is configured to support users in making multi-turn adjustments and drill-down analyses of charts via voice commands, and to maintain contextual consistency based on a dialogue state tracking model.
8. A computer device, characterized in that, The device includes: a processor and a memory; The memory is used to store one or more program instructions; The processor is configured to run one or more program instructions to perform the steps of a natural language-driven intelligent traffic data chart generation method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of a natural language-driven intelligent traffic data chart generation method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, The computer program product includes computer program instructions that, when executed by a processor, implement the steps of a natural language-driven intelligent traffic data chart generation method as described in any one of claims 1 to 6.