A method and system for locating traffic accident locations based on natural language processing
Through natural language processing and geocoding technology, combined with road retrieval and projection calculation, it solves the difficulty of accurately locating traffic accident locations on the road, improves processing efficiency and accuracy, and is suitable for various accident location information.
Patent Information
- Application Number
- CN202310961238.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-02
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2043-08-02
AI Technical Summary
The existing technology is difficult to accurately locate the location on the road when locating traffic accident locations. In particular, the processing of non-standardized accident location information in historical data is inefficient and error-prone.
Using a method based on natural language processing to analyze accident location information through stop words and regular expressions, combined with road retrieval and geocoding technology, road projection calculations are performed to determine the final positioning point, which is suitable for the expansion and accurate positioning of sparse road data. .
It realizes the accurate positioning of traffic accident locations on the road, improves the efficiency and accuracy of historical data processing, and is suitable for locating accident locations under various circumstances.
Smart Images

Figure CN116992858B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent traffic control, and in particular to a method and system for locating a traffic accident site based on natural language processing. Background Art
[0002] The location of traffic accidents has always been a key issue that has plagued the improvement of traffic management methods. At present, many Internet platforms provide open map interfaces with rich interfaces, which can obtain positioning information according to actual needs. However, when applied to the location of accidents, it is difficult to locate on the road in most cases. Most of the relevant technical personnel use geocoding methods based on existing platforms to obtain accident location information more accurately, providing a more refined data source for traffic management departments.
[0003] Chinese patent document CN 112052908 A provides a traffic accident location clustering method, which first converts the accident location data recorded in the traffic accident information collection table into longitude and latitude coordinate points; secondly, converts the longitude and latitude coordinate points in the original coordinate system into longitude and latitude coordinate points in the target coordinate system; then, according to the longitude and latitude coordinate points in the converted target coordinate system, calculates the distance between the longitude and latitude coordinate points; and according to the spatial distribution characteristics of the accident location, clusters the accidents with the same spatial distribution characteristics. This method focuses on processing the location positioning data after positioning, and does not fully consider the accuracy of the positioning points.
[0004] Chinese patent document CN 108320515 B provides a method for automatically matching and verifying the road network of a traffic accident site, including obtaining traffic accident attribute information; matching road names according to national highway naming standards to obtain a mapping relationship table between traffic control road codes and national highway numbers and names; obtaining the longitude and latitude coordinates of the accident that match the pile number; verifying the spatial relationship between the longitude and latitude coordinates of the accident and the administrative division to obtain the first longitude and latitude coordinate point of the accident that passes the verification; verifying whether the first longitude and latitude coordinate point of the accident is consistent with the description text of the accident site to obtain the second longitude and latitude coordinate point of the accident that passes the verification; and generating a geographic data set for traffic accident analysis. This patent focuses on road network matching for highways, which can accurately solve the location of traffic accidents on highways with mileage pile numbers, but cannot accurately locate urban roads with more accidents.
[0005] Chinese patent document CN 103631776 B provides a method for automatically recording and locating semantic information of traffic accident sites, including calling the accident site entry and automatic location control when the accident data integrated management system receives the input accident data; the accident site entry and automatic location control requests the road name data and the topological structure of the road network from the road name dictionary server; the accident site entry and automatic location control receives the accident site information input by the user, and realizes automatic location according to the user input information; judges whether the location is correct, and submits if it is correct; otherwise, the user manually drags the accident site icon to realize manual location, and then submits; the accident site entry and automatic location control transmits the accident site and location information entered by the user back to the accident data integrated management system. This patent provides a method for customizing the text information of the accident site, which is only suitable for the location location that has been entered into the accident system according to its rules, and is not suitable for the hundreds of millions of non-standardized accident site information in the current accident system.
[0006] Chinese patent document CN107270922B provides a traffic accident spatial positioning method based on POI index, which is characterized by comprising the following steps: the first step: screening POI location information and extracting the GPS coordinates of specific traffic locations; the second step: performing map matching on the GPS coordinates of specific traffic locations to obtain a set of road links within 30m of the GPS coordinates; the third step: obtaining the road grade according to the map file and calculating the traffic direction of the road; the fourth step: searching the traffic direction and road grade corresponding to each road link number in the road link set in the third step according to the traffic location and road link set obtained in the second step, and constructing a POI index table containing four fields: traffic location, road link number, road grade and traffic direction; the fifth step: extracting traffic accident information according to the accident broadcast information; the sixth step: matching the traffic location and traffic direction in the POI index table constructed in the fourth step through the traffic accident information obtained in the fifth step; and finally obtaining the final spatial positioning according to the road grade screening results. This method does not consider the specific road where the accident occurred, but obtains a set of road links within 30m, and cannot accurately locate the accident on the road.
[0007] The above four patent documents all involve the location of traffic accident sites. However, there is a large amount of traffic accident information entered in the past in the traffic database. Because traffic police mostly use natural language to describe the location of traffic accidents when entering past data, and the expression method of the entered traffic accident location information is not uniform and standardized, it has been difficult to accurately locate the accident site in historical data using the technical means in the prior art and to achieve automatic identification based on a unified method. When it is necessary to use past information data, it can only be counted manually, which is not only inefficient but also prone to errors. Summary of the invention
[0008] In order to solve the problem that the location positioning method based on the existing technology of the traffic accident location is not accurate enough and cannot fully handle the location positioning of the traffic accident location in the past historical data, the present application provides a traffic accident location positioning method based on natural language processing, which is applicable to the location positioning of various situations including the accident location in the past historical data, ensuring that the location can be finally positioned on the road. At the same time, the present application also provides a traffic accident location positioning system based on natural language processing.
[0009] The technical solution of the present invention is as follows: a method for locating a traffic accident site based on natural language processing, which comprises the following steps:
[0010] S1: Obtain information data of the location of the traffic accident to be processed based on natural language expression, recorded as: data to be processed;
[0011] It is characterized in that it also includes the following steps:
[0012] S2: Create a stop word list for traffic accident location information analysis and a regular expression for word segmentation;
[0013] S3: Analyze the data to be processed based on the stop word list and the regular expression to obtain corresponding accident location information;
[0014] The accident location information includes: the city, road, street and location where the accident occurred;
[0015] S4: Based on the road retrieval technology, the digital road information data based on the longitude and latitude description corresponding to the road where the accident occurred is obtained, and the longitude and latitude data set describing the road where the accident occurred is obtained, which is recorded as: the initial road longitude and latitude data set;
[0016] S5: Based on the data in the initial road longitude and latitude data set, determine whether the road where the accident occurred is an information-sparse road;
[0017] If yes, execute step S6;
[0018] Otherwise, the initial road longitude and latitude data set is recorded as the road longitude and latitude data set R to be processed, and step S7 is executed;
[0019] R=[R1, R2, ..., Rn], where n is the number of longitude and latitude points included in the data set, and is a positive integer;
[0020] S6: performing an expansion point density operation on the initial road longitude and latitude data set to expand the number of data in the data set to obtain a digital road set, which is recorded as: a road longitude and latitude data set R to be processed;
[0021] S7: using geocoding technology, the text information of the accident location in the accident location information is converted into latitude and longitude digital information location, recorded as: original accident location P;
[0022] If the original accident location P can be found, execute step S8;
[0023] Otherwise, point P cannot be found, the original data is judged to be incorrect, an error message is returned, and the calculation ends;
[0024] S8: Performing road projection calculation on the original accident location P and the road latitude and longitude data set R to be processed, and determining the final positioning point corresponding to the data to be processed;
[0025] The road projection calculation specifically includes the following steps:
[0026] a1: Calculate the spatial distance between point P and all points in the road longitude and latitude data set R to be processed, and find the three points Ri, Rj, Rk closest to P in R;
[0027] a2: Determine the positional relationship between points Ri, Rj and Rk. If Ri, Rj and Rk are on the same straight line, execute step a3;
[0028] Otherwise, the three points are not collinear, and step a4 is executed;
[0029] a3: Determine whether P and points Ri, Rj and Rk are on the same straight line. If so, determine that point P is the final positioning point corresponding to the data to be processed;
[0030] Otherwise, execute step a5;
[0031] a4: Draw a triangle with points Ri, Rj and Rk as endpoints, denoted as: positioning area;
[0032] Determine whether point P is within the positioning area;
[0033] If yes, then point P is determined to be the final positioning point corresponding to the data to be processed;
[0034] Otherwise, execute step a5;
[0035] a5: Find the point in R that is closest to P, recorded as: the closest point Rm;
[0036] The distance between Rm and P is recorded as: Dm;
[0037] a6: Compare Dm with the preset positioning threshold;
[0038] If Dm<positioning threshold, then point Rm is determined to be the final positioning point corresponding to the data to be processed;
[0039] Otherwise, it is determined that the final positioning point corresponding to the data to be processed cannot be found.
[0040] It is further characterized by:
[0041] Based on longitude and latitude, the method for calculating the spatial distance between two points is:
[0042] Assume: the points involved in the calculation are x and y, lon x Represents the longitude information of point x, lat x Represents the latitude information of point x, lon y Represents the longitude information of point y, lat y Represents the latitude information of point y; then, the calculation process of the distance dist from point x to point y is:
[0043] lat x = lat x × π / 180;
[0044] lon x = lon x × π / 180;
[0045] lat y = lat y × π / 180;
[0046] lon y = lon y × π / 180;
[0047] ∆lat = lat y –lat x ;
[0048] △lon = lon y –lon x ;
[0049] a = sin(△lat / 2)^2 + cos(lat y ) * cos(lat x ) * sin(△lon / 2)^2;
[0050] c = 2 * arcsin(sqrt(a));
[0051] dist = 6371 * c * 1000;
[0052] In step S5, the method for determining the information-sparse road is:
[0053] b1: Calculate the spatial distances between all adjacent points in the road longitude and latitude data set to be processed;
[0054] b2: Calculate the average of all distances to get the average distance between adjacent points;
[0055] b3: Compare the average distance between adjacent points with a preset distance threshold;
[0056] In step S6, the expansion point density operation includes the following steps:
[0057] c1: confirm all adjacent points in the initial road longitude and latitude dataset;
[0058] c2: Calculate the number of interpolation points that need to be inserted, and then use mean filling to interpolate between all adjacent points to obtain: the intermediate data set Rt;
[0059] inset_num = ceil(mean_dist / distance threshold)
[0060] Among them, inset_num is the number of points to be inserted, ceil is the rounding up algorithm, mean_dist is the average distance between all adjacent points; the distance threshold is the preset ideal distance between adjacent points;
[0061] c3: record the intermediate data set Rt as the longitude and latitude data set R of the road to be processed;
[0062] In step S7, the method for locating the original accident location P comprises the following steps:
[0063] d1: Determine to use an online geocoding service interface of an online map, transcode the parsed city, road and accident location information and write them into the online geocoding service interface;
[0064] d2: Access the online geocoding service interface to obtain the returned json data;
[0065] d3: Parse the JSON data, extract the longitude and latitude coordinates therein, and obtain the original accident location P;
[0066] P=[ lon P , lat P ], where lon represents the longitude coordinate and lat represents the latitude coordinate;
[0067] In step a6, when it is determined that the final positioning point corresponding to the data to be processed cannot be found, the positioning area with points Ri, Rj and Rk as endpoints is fed back to the user as a reference area of the accident location.
[0068] A traffic accident location positioning system based on natural language processing, characterized in that it includes: an accident location analysis module, a road retrieval module, a road encryption module, a geocoding module and a projection positioning module;
[0069] After the data to be processed is sent to the accident location analysis module, the accident location analysis module analyzes the data to be processed based on the stop word list and the regular expression used for word segmentation to obtain the accident location information corresponding to the data to be processed; the accident location information includes: the city, road, street and location where the accident occurred; and the accident location information is sent to the road retrieval module and the geocoding module;
[0070] The road retrieval module retrieves road information of the road where the accident occurred based on the offline map interface, obtains corresponding digitized road information data based on longitude and latitude description, and obtains an initial road longitude and latitude data set; and sends the initial road longitude and latitude data set to the road encryption module;
[0071] In the road encryption module, it is determined whether the road where the accident occurred is an information-sparse road; if so, the sparse initial road longitude and latitude data set is subjected to a point density expansion operation, and the overly sparse digital road array is expanded into a relatively dense array to obtain a road longitude and latitude data set R to be processed, where R=[R1, R2, ..., Rn]; otherwise, if the longitude and latitude points of the road where the accident occurred are sufficient, the initial road longitude and latitude data set is directly recorded as: road longitude and latitude data set R to be processed; and the road longitude and latitude data set R to be processed is sent to the projection positioning module;
[0072] In the geocoding module, the accident location information transmitted by the accident location analysis module is converted into corresponding longitude and latitude coordinate points using the geocoding interface, which are recorded as: original accident location P; and the original accident location P is sent to the projection positioning module;
[0073] The projection positioning module performs road projection calculation based on the received original accident location P and the road latitude and longitude data set R to be processed, and determines the final positioning point corresponding to the data to be processed.
[0074] It is further characterized by:
[0075] The stop word list includes: location adverbs, intersection, road, road section and place;
[0076] After the accident location analysis module extracts the accident location information, the text of the accident location information is standardized to unify the data format of the accident location information into: XX Road XX Street XX District XX City;
[0077] The geocoding module also includes a credibility analysis operation. When the geocoding interface returns the longitude and latitude coordinate points corresponding to the accident location information, the returned data is recorded as: data to be determined; the geocoding module performs a credibility analysis on the data to be determined, and calculates the confidence of the data to be determined. If the confidence is greater than 60, the coding result is considered reliable, and the longitude and latitude are set as the original accident location P; if not, the text information of the accident location is refined and re-sent to the geocoding interface until the confidence of the data to be determined is greater than 60;
[0078] The operation of refining the text information of the accident location includes: obtaining the text of the accident location information of the last geocoding interface, adding preset high-frequency address words one by one to the fields corresponding to streets, roads and places, and sending the text to the geocoding interface for relocation after adding a high-frequency address word each time;
[0079] The high-frequency address words include: bus stop, community, neighborhood, alley, lane, lane, place, fork, fork, street, and road.
[0080] The present application provides a method for locating the location of a traffic accident based on natural language processing, which fully considers the problem of inaccurate spatial location positioning based on traffic accident information inputted in natural language, and obtains standardized accident location text information by combining a text parsing method using a stop word list and regular expressions for word segmentation, and obtains accident location information; uses road retrieval technology to obtain a digital road information dataset R based on longitude and latitude description corresponding to the road where the accident occurred, and uses geocoding technology to resolve the text information of the accident location in the accident location information into a digital information location of longitude and latitude, and obtains the original accident location P; then uses a road projection calculation method to project point P on the digital road information dataset R, even if the accident location inputted by the case handler is not on the accident road represented by the digital road information dataset R, the mapping point of point P can be found on the road represented by the digital road information dataset R, and then the final positioning point corresponding to the data to be processed can be accurately found on the accident road. This method is applicable to the location of accident locations including various situations in past historical data, ensuring that the location can be finally located on the accident road. BRIEF DESCRIPTION OF THE DRAWINGS
[0081] Figure 1 A flow chart of the steps of the method for locating the location of a traffic accident provided by the present invention;
[0082] Figure 2 A schematic diagram of the structure of the traffic accident location positioning system provided by the present invention;
[0083] Figure 3The incident road search and encryption flow chart provided by the present invention;
[0084] Figure 4 A flow chart of the geographical coding of the accident site provided by the present invention;
[0085] Figure 5 The accident site projection mapping positioning flow chart provided by the present invention;
[0086] Figure 6 This is an example of a schematic diagram of an accident location. DETAILED DESCRIPTION
[0087] like Figure 6 In the embodiment shown in the schematic diagram of the accident location shown, the Ring Road is built around the lake in the middle, there is an island in the lake, there are lake center buildings A and lake center building B on the island, and there are branches 1 to 3 on the Ring Road. If a traffic accident occurs on the Ring Road, located between branch 1 and branch 3, in actual work, or in historical data, in order to accurately describe the location of the accident, accident handlers sometimes use methods such as: opposite to the lake center building A on the Ring Road to locate the accident location. However, the actual address of the lake center building A is not on the Ring Road. Therefore, if "Ring Road" and "Lake Center Building A" are directly extracted for retrieval, the accurate accident location cannot be obtained. This method can locate the accident location to the actual accident location on the Ring Road based on the input of the accident handler.
[0088] In order to accurately analyze the accident address based on natural language expression, this application provides a traffic accident location positioning method based on natural language processing, such as Figure 1 As shown, it includes the following steps.
[0089] S1: Obtain information data of the location of the pending traffic accident expressed based on natural language, recorded as: pending data.
[0090] In this embodiment, examples of data to be processed based on natural language expression are as follows:
[0091] Case details: At about X:X on X / X / 2023, Zhang XX was driving vehicle No. Su B XXXXX from XX Community in Binhu District to XX Building of the company in Wuxi City. When the vehicle was driving opposite Building A in the center of the lake on Huanhu Road, a traffic accident occurred with an electric bicycle driven by Wang X, resulting in personal injury and vehicle damage.
[0092] Accident location: Opposite to Building A in the center of the lake, Huanhu Road, Binhu District.
[0093] S2: Create a stop word list for traffic accident location information analysis and a regular expression for word segmentation;
[0094] The word segmentation content using regular expressions includes: case details, accident address and basic facts.
[0095] Stop words refer to certain words or phrases that are automatically filtered out before or after processing natural language data (or text) in order to save storage space and improve search efficiency in information retrieval. These words or phrases are called Stop Words. These stop words are all manually input. In this application, a stop word list is specifically prepared based on the historical data of traffic accidents, and a targeted stop word list can be obtained. For example, the stop word list includes: location adverbs, intersections, roads, sections, and places.
[0096] Location adverbs include: in, located, driven to, to, etc. In practical applications, based on historical data statistics, we can obtain common location adverbs used in describing traffic accident information.
[0097] The data to be processed in this application is information based on natural language description. Regular expressions are important technical components in natural language processing, such as commonly used technical means in the fields of speech recognition and translation software. This application can be implemented using existing technologies, and will not be expanded here.
[0098] S3: Based on the stop word list and the regular expression for word segmentation, the word segmentation algorithm in the prior art is used to analyze the data to be processed to obtain corresponding accident location information;
[0099] The accident location information includes: the city, road, street and location where the accident occurred.
[0100] S4: Based on the road retrieval technology, the digital road information data based on the longitude and latitude description corresponding to the road where the accident occurred is obtained, and the longitude and latitude dataset describing the road where the accident occurred is obtained, which is recorded as: the initial road longitude and latitude dataset.
[0101] In this application, offline map road retrieval technology is used, such as the road retrieval interface in the API provided by Baidu offline map, to retrieve the description information of the road where the accident occurred. Using the city name and road name as input, the digital information of the road where the accident occurred is retrieved, and the information includes multiple longitude and latitude points. These longitude and latitude points constitute the initial road longitude and latitude data set. However, different roads or different retrieval interfaces return different numbers of longitude and latitude points. Some roads have a sufficient number of longitude and latitude points, but some roads, such as some remote country roads, have very sparse numbers of longitude and latitude points in their corresponding digital information. In order to accurately locate the location of the accident, it is necessary to ensure that the road information is rich enough. Therefore, this method needs to judge whether the road is an information-sparse road based on the number of data in the initial road longitude and latitude data set.
[0102] S5: Based on the data in the initial road latitude and longitude dataset, determine whether the road where the accident occurred is an information sparse road;
[0103] If yes, execute step S6;
[0104] Otherwise, the initial road longitude and latitude data set is recorded as the road longitude and latitude data set R to be processed, and step S7 is executed;
[0105] R=[R1, R2, …, Rn], where n is the number of longitude and latitude points included in the data set, and is a positive integer.
[0106] In step S5, the method for determining the information-sparse road is:
[0107] b1: Based on longitude and latitude, calculate the spatial distance between all adjacent points in the longitude and latitude dataset of the road to be processed;
[0108] Spatial distance is the actual distance between two longitude and latitude points. This method determines whether the road needs to be encrypted by calculating the average distance between all adjacent points. It can also be determined by the distance between each two adjacent points, but the amount of calculation is large. This method determines the road information density by the average distance between all adjacent points on the road where the accident occurred. It can reduce the amount of calculation and improve the overall calculation efficiency while ensuring the accuracy of the judgment result.
[0109] The specific calculation method is as follows:
[0110] lat j = lat j × π / 180;
[0111] lon j = lon j × π / 180;
[0112] lat i = lat i × π / 180;
[0113] lon i = lon i × π / 180;
[0114] ∆lat = lat i – lat j ;
[0115] △lon = lon i – lon j ;
[0116] a = sin(△lat / 2)^2 + cos(lat i ) * cos(lat j ) * sin(△lon / 2)^2;
[0117] c = 2 * arcsin(sqrt(a));
[0118] dist ij = 6371 * c * 1000;
[0119] Among them, lat represents the latitude coordinate, lon represents the longitude coordinate, and dist ij Represents the distance between adjacent points i and j;
[0120] b2: Calculate the average of all distances to get the average distance between adjacent points;
[0121] b3: Compare the average distance between adjacent points with the preset distance threshold;
[0122] S6: Performing a point density expansion operation on the sparse initial road longitude and latitude data set to expand the number of data in the data set, thereby obtaining a digitized road set, which is recorded as the road longitude and latitude data set R to be processed.
[0123] In step S6, the operation of expanding the point density includes the following steps:
[0124] c1: confirm all adjacent points in the initial road longitude and latitude dataset;
[0125] c2: First calculate the number of interpolation points that need to be inserted, and then use the mean filling method to interpolate between all adjacent points. The original longitude and latitude points in R and the inserted points constitute the intermediate data set Rt;
[0126] inset_num = ceil(mean_dist / distance threshold)
[0127] Among them, inset_num is the number of points to be inserted, ceil is the rounding up algorithm, mean_dist is the average distance between all adjacent points; the distance threshold is the preset ideal distance between adjacent points.
[0128] In this embodiment, the distance threshold is set to 20m, that is, when the distance between adjacent longitude and latitude points in the road longitude and latitude data set R to be processed is less than or equal to 20m, the point density of the longitude and latitude points required for calculation can be met, ensuring that the accident location can be accurately located;
[0129] The mean filling method in this method is: take two adjacent points as the starting point and the end point, calculate the value of inset_num, and then evenly add inset_num points between the starting point and the end point.
[0130] After adding, the distance between the two adjacent points between the starting point and the end point is the same. For example, the distance between two adjacent points A and B is 60m, and the mean_dist of this section is 40, then:
[0131] inset_num = ceil(40 / 20)=2;
[0132] Then, take A as the starting point and B as the end point, and add 2 points evenly in the middle: c1 and c2;
[0133] Then the AB section becomes: three equally spaced sections Ac1, c1c2, and c2B, each of which is 20m long.
[0134] c3: record the intermediate data set Rt as the longitude and latitude data set R of the road to be processed;
[0135] R = [R1, R2, ..., Rn], where Ri = [ lat i , lon i ](i=1, 2, 3, …, n), that is, each point contains longitude and latitude information.
[0136] S7: Use geocoding technology to convert the text information of the accident location in the accident location information into a latitude and longitude digital information location, recorded as: the original accident location P. If point P cannot be found, it means that the original data is wrong, and an error message is returned to end this calculation.
[0137] In step S7, the method for locating the original accident location P includes the following steps:
[0138] d1: Determine to use the geocoding interface of the online map, such as the geocoding interface provided by Baidu Offline Map API, transcode the parsed city, road and accident location information and write it into the online geocoding service interface, and parse the structured address (province / city / district / street / house number) into the corresponding location coordinates;
[0139] d2: Access the online geocoding service interface and obtain the returned json data;
[0140] d3: Parse the json data, extract the longitude and latitude coordinates, and obtain the original accident location P;
[0141] P=[ lon P , latP ], where lon represents the longitude coordinate and lat represents the latitude coordinate.
[0142] S8: Perform road projection calculation on the original accident location P and the road latitude and longitude dataset R to be processed to determine the final positioning point corresponding to the data to be processed.
[0143] The road projection calculation includes the following steps:
[0144] a1: Based on longitude and latitude, calculate the spatial distance between point P and all points in the longitude and latitude dataset R of the road to be processed. The specific calculation method is as follows:
[0145] lat P = lat P × π / 180;
[0146] lon P = lon P × π / 180;
[0147] lat i = lat i × π / 180;
[0148] lon i = lon i × π / 180;
[0149] ∆lat = lat i – lat P ;
[0150] △lon = lon P – lon P ;
[0151] a = sin(△lat / 2)^2 + cos(lat i ) * cos(lat P ) * sin(△lon / 2)^2;
[0152] c = 2 * arcsin(sqrt(a));
[0153] dist i = 6371 * c * 1000;
[0154] Among them, lon P and lat P Respectively represent the latitude and longitude information of point P, lon i and lat i Respectively represent the longitude and latitude information of the i-th point in the set R, dist iRepresents the distance from point P to point Ri, and finally obtains the distance set D=[dist1, dist2, dist3, …, distn];
[0155] Find the three points Ri, Rj, Rk closest to P in R, that is, find the longitude and latitude points corresponding to the three smallest values in the set D, Ri, Rj and Rk∈R;
[0156] a2: Determine the positional relationship between points Ri, Rj and Rk. If Ri, Rj and Rk are on the same straight line, execute step a3;
[0157] Otherwise, the three points are not collinear, and step a4 is executed;
[0158] a3: Determine whether P and points Ri, Rj and Rk are on the same straight line. If so, determine that point P is the final positioning point corresponding to the data to be processed;
[0159] Otherwise, execute step a5;
[0160] If P is on the same straight line as Ri, Rj and Rk, then P must be on the same road as the three points, so point P is the final location point of the accident;
[0161] a4: Draw a triangle with points Ri, Rj and Rk as endpoints, denoted as: positioning area;
[0162] Determine whether point P is within the positioning area;
[0163] If yes, point P is determined to be the final positioning point corresponding to the data to be processed;
[0164] Otherwise, execute step a5;
[0165] Point P is within the triangle area enclosed by Ri, Rj and Rk, so P must be on the same road as the three points, so point P is the final location point of the accident;
[0166] a5: Find the point in R that is closest to P, recorded as: the closest point Rm;
[0167] The distance between Rm and P is recorded as: Dm;
[0168] Point P is not within the triangular area enclosed by Ri, Rj, and Rk, nor is it on the same straight line as the three points, which means that point P is not on the same road as the three points. This means that the accident handling personnel may have used nearby buildings or landmarks for positioning when entering the accident location.
[0169] a6: Compare Dm with the preset positioning threshold;
[0170] If Dm<positioning threshold, then point Rm is determined to be the final positioning point corresponding to the data to be processed;
[0171] Otherwise, it is determined that the final positioning point corresponding to the data to be processed cannot be found.
[0172] The positioning threshold is a preset distance value in meters. Usually, the positioning threshold is set to the average width of the road and the buildings beside the road. The specific value of the positioning threshold may be different according to different urban areas. Or an empirical value can be estimated based on historical data. In this embodiment, the positioning threshold is set to 10m.
[0173] Find the point Rm closest to point P (the accident location input by the accident handling personnel) on the road where the accident occurred, and compare the distance Dm between Rm and P with the positioning threshold. If Dm is less than the positioning threshold, it means that point Rm can be regarded as the actual location where the accident occurred on the road;
[0174] Otherwise, if Dm is greater than or equal to the positioning threshold, it means that the distance between Rm and point P is too far, that is, point P is too far from the road input by the accident handler, and the accident on the road input by the accident handler cannot be located through point P, which means that the final positioning point corresponding to the data to be processed cannot be found.
[0175] like Figure 6 In the illustrated embodiment, point P is the lake center building A. Assume that, after calculation in step a1, three points closest to the lake center building A are found on the set R corresponding to the ring road: reference point 1, the accident site, and reference point 2.
[0176] Reference point 1, the accident site and reference point 2 are not in a straight line, and building A in the center of the lake is not in the triangular area surrounded by the three points. It is obvious that the accident handling personnel chose a point outside the ring road around the lake as a reference for locating the accident site.
[0177] The possible situations are as follows:
[0178] Case 1: Assuming that the accident site is closest to Building A in the center of the lake, and the distance between the two is less than 10m, the accident site can be accurately located;
[0179] Case 2: Assuming that the accident site is closest to the lake center building A, and the distance between the two is greater than or equal to 10m, then the judgment point P is too far from the road input by the accident handling personnel, and the final positioning point corresponding to the data to be processed cannot be found;
[0180] Case 3: Assuming that reference point 1 is closest to building A in the center of the lake, and the distance between the two is less than 10m, reference point 1 is located as the final location point corresponding to the data to be processed. At this time, although reference point 1 and the accident site are not the same point, because the average distance between the longitude and latitude points on the ring road around the lake after the point density expansion operation is less than 20m, and the two points are relatively close to building A in the center of the lake, even if reference point 1 is determined as the final location point corresponding to the data to be processed, in practical applications, if used as statistical data, this distance error is acceptable.
[0181] In specific applications, if more accurate calculation results are required, the accuracy of the final calculation results can be controlled by adjusting the values of the positioning threshold and the distance threshold. In this method, if point P cannot be found, it means that the original data is wrong, and an accurate prompt can be given in step S7; on the basis of the real existence of point P, the result obtained by this method is "the final positioning point corresponding to the data to be processed cannot be found", so it can be judged that the reference point when the accident handling personnel input the data is too far away from the actual accident point, and the triangular area surrounded by Ri, Rj and Rk can be fed back to the user as a possible accident area. This method can locate the real location on the road where the accident occurred. Even if an abnormal result occurs, the scope of the accident location can be narrowed. Compared with other positioning methods in existing calculations, it effectively improves the accuracy of locating the accident location in accident information described based on natural language.
[0182] A traffic accident location positioning system based on natural language processing, such as Figure 2 As shown, it includes: an accident location analysis module 10, a road retrieval module 20, a road encryption module 30, a geocoding module 40 and a projection positioning module 50.
[0183] After the data to be processed is sent to the accident location analysis module 10, the accident location analysis module 10 parses the data to be processed based on the stop word list and the regular expression used for word segmentation to obtain the accident location information corresponding to the data; the accident location information includes: the city, road, street and location where the accident occurred; and the accident location information is sent to the road retrieval module 20 and the geocoding module 40.
[0184] After the accident location analysis module 10 extracts the accident location information, it standardizes the text of the accident location information and unifies the data format of the accident location information into standardized location information: XX Road XX Street XX District (County or County-level City) XX City.
[0185] The road retrieval module 20 is based on an offline map interface and takes the city and road name as input. It uses the retrieval interface to retrieve road information on the road where the accident occurred, obtains the corresponding digitized road information data based on longitude and latitude descriptions, and obtains an initial road longitude and latitude data set; and sends the initial road longitude and latitude data set to the road encryption module 30.
[0186] In the road encryption module 30, it is determined whether the road where the accident occurred is an information-sparse road; if so, the sparse initial road longitude and latitude data set is expanded with a point density operation, and the overly sparse digital road array is expanded into a denser array to obtain the longitude and latitude data set R of the road to be processed, R=[R1, R2,..., Rn]; otherwise, if the longitude and latitude points of the road where the accident occurred are sufficient, the initial road longitude and latitude data set is directly recorded as: the longitude and latitude data set R of the road to be processed; and the longitude and latitude data set R of the road to be processed is sent to the projection positioning module 50.
[0187] In the geocoding module 40 , the accident location information in the form of standardized location information transmitted by the accident location analysis module 10 is converted into corresponding longitude and latitude coordinate points using a geocoding interface, recorded as: the original accident location P; and the original accident location P is sent to the projection positioning module 50 .
[0188] The geocoding module 40 also includes a credibility analysis operation. When the geocoding interface returns the longitude and latitude coordinate points corresponding to the accident location information, the returned data is recorded as: data to be judged; the geocoding module 40 performs a credibility analysis on the data to be judged, and calculates the confidence of the data to be judged. If the confidence is greater than 60, the coding result is considered reliable, and the longitude and latitude are set as the original accident location P; if not, the text information of the accident location is refined and re-sent to the geocoding interface until the confidence of the data to be judged is greater than 60.
[0189] In actual application, credibility analysis can be implemented based on credibility analysis technology in the existing technology. For example, the longitude and latitude coordinates returned by the geocoding interface provided by the Web service API will also give the confidence corresponding to the coordinates. When the calculation accuracy requirement is not high, this confidence can be used directly.
[0190] The operation of refining the text information of the accident location includes: obtaining the text of the accident location information of the last geocoding interface, adding preset high-frequency address words one by one to the fields corresponding to streets, roads and places, and inputting the geocoding interface to relocate after adding a high-frequency address word each time;
[0191] High-frequency address words include: bus stop, community, neighborhood, alley, lane, lane, place, fork, fork, street, and road.
[0192] The operation of refining the text information of the accident location is specifically implemented as follows: the standardized location information sent by the accident location analysis module 10 to the geocoding module 40 is: City A, District B, Street C, Road D; the corresponding confidence level of the data to be judged in the latitude and longitude coordinate point format converted in the geocoding module 40 is 40, then, the standardized location information is refined in the geocoding module 40 to become: City A, District B, Street C, Road D bus stop, and the coordinate point conversion is performed again through the geocoding interface, and the obtained data with judgment is subjected to credibility analysis; until the confidence level is greater than or equal to 60, the accuracy of subsequent calculations is ensured.
[0193] The projection positioning module performs road projection calculation based on the received original accident location P and the longitude and latitude data set R of the road to be processed whose longitude and latitude point density meets the calculation requirements, calculates the position relationship between the point P and the road represented by the longitude and latitude data set R of the road to be processed, and then determines the final positioning point corresponding to the data to be processed.
[0194] In this method, the location of the traffic accident needs to be accurately located on the road, which requires accurate road data. At present, the relevant electronic map supply units provide road retrieval solutions for offline maps, but there is a problem of sparse road density. In this application, the road retrieval module 20 and the road encryption module 30 are used as modules for obtaining electronic data of the road where the accident occurred, such as Figure 3 As shown, the specific implementation process is as follows:
[0195] The number of data after encryption is fixed, so the method is based on a temporary storage container for data processing using a stack, which is easy to implement and has a simple calculation process.
[0196] 1.1: Import accident data;
[0197] 1.2: All accident data are pushed into the stack;
[0198] 1.3: Take out the accident data at the top of the stack;
[0199] 1.4: Create a stop word list. In addition to the commonly used Baidu stop words, the stop word list also includes the road, place, exit, etc. that often appear in traffic accident information. Write a regular expression for word segmentation to perform Chinese word segmentation on the brief case, accident location, basic facts, etc. in the accident information;
[0200] 1.5: Based on the word segmentation results, extract the city, district, county, street, road and accident location information from the text information;
[0201] 1.6: Input the acquired city and road information into the road retrieval interface of the offline electronic map to obtain the longitude and latitude dataset R of the road where the accident occurred, thus completing the road retrieval function;
[0202] 1.7: Based on the spatial point distance algorithm, calculate the spatial distance between adjacent points in the road longitude and latitude dataset R;
[0203] 1.8: Calculate the average value dist of the distances between all adjacent points, that is, the average distance between adjacent points. If the distance value is greater than the distance threshold of 20m, then increase it to 1.9; if not, then increase it directly to 1.10;
[0204] 1.9: First calculate the number of longitude and latitude coordinate points to be inserted, inset_num, and then interpolate the road data. The interpolation method uses mean filling;
[0205] The calculation method for the number of interpolation between adjacent points is as follows:
[0206] inset_num = ceil(mean_dist / 20)
[0207] Among them, inset_num is the number of points to be inserted, ceil is the rounding up algorithm, and mean_dist is the average distance between all adjacent points;
[0208] After interpolating the road data, we get the new encrypted road data points R=[R1, R2, …, Rn], where Ri=[ lat i , lon i ](i=1,2,3,…,n).
[0209] 1.10: Determine whether the data in the accident data stack is empty. If not, repeat S1.3-S1.8;
[0210] If so, the algorithm ends, all roads where the accident locations are located have been obtained and the roads have met the conditions.
[0211] In this application, the accident location geocoding module 40 can convert the standardized location text information into longitude and latitude coordinate points, such as Figure 4 As shown, the specific implementation process is as follows;
[0212] 2.1: Import the standardized traffic accident location dataset and stack it;
[0213] 2.2: Take out the top location data of the stack;
[0214] 2.3: Input the data into the geocoding interface address and initiate a network request;
[0215] 2.4: Check whether the returned result is abnormal. If it is abnormal, set the final result to null value. Otherwise, proceed to the next step.
[0216] 2.5: Calculate the confidence of the returned result;
[0217] 2.6: If the confidence level is greater than 60, the coding result is considered reliable and the longitude and latitude are set as the result. If not, the text information of the accident location is refined and 2.3 to 2.6 are executed again;
[0218] 2.7: Stack the encoded data into the result stack;
[0219] 2.8: The accident location data is popped out;
[0220] 2.9: Determine whether the accident location data stack is empty. If not, re-execute 2.2~2.9. If yes, end.
[0221] In the accident location projection positioning module 50, a location mapping method based on distance projection is adopted, which can project the longitude and latitude of the traffic accident location whose geocoding result is not on the road onto the road, and obtain the final longitude and latitude coordinates. The specific algorithm is described as follows:
[0222] 3.1: stacking the longitude and latitude point set calculated by the accident location geocoding module 40;
[0223] 3.2: Take out the top data point P from the stack;
[0224] 3.3: Based on the standardized accident location data parsed by the traffic accident location parsing module 10, the road where the accident location is located is obtained, and the road data coordinate set R processed by the road retrieval module 20 and the road encryption module 30 is taken out;
[0225] 3.4: Calculate the distance between point P and all points in set R. The calculation method is as follows:
[0226] 3.5: According to D, take out the three points Ri, Rj, Rk closest to P in R;
[0227] 3.6: If Ri, Rj, and Rk are on the same straight line, execute 3.7;
[0228] Otherwise, execute 3.8;
[0229] 3.7: Determine whether P and points Ri, Rj and Rk are on the same straight line. If so, determine that point P is the final positioning point corresponding to the data to be processed;
[0230] Otherwise, execute 3.9;
[0231] 3.8: Determine whether P is within the triangular area enclosed by the three points Ri, Rj, and Rk. If so, P is the final positioning point and jump directly to 3.9. If not, go to the next step 3.9;
[0232] 3.9: According to D, take out the point Rm in R that is closest to P, and get the distance dist between P and Rm from D;
[0233] 3.10: If dist<10m, Rm is the final positioning point. If not, point P cannot obtain an accurate positioning point.
[0234] 3.11: Data is stacked into a new positioning stack, and point P is popped out of the stack;
[0235] 3.12: Determine whether the original positioning point stack is empty. If it is not empty, re-execute steps 3.2~3.11. If it is empty, the algorithm ends.
[0236] After using the technical solution of this application, from the perspective of locating the location of the traffic accident, considering the difficulty of obtaining the road and accurately locating the location of the traffic accident, on the basis of parsing the accident text information, a road latitude and longitude data set is obtained based on the electronic map, and a projection mapping method for accurately locating the accident location is proposed, which can ensure that the positioning point can fall on the road where the accident occurred. Whether it is real-time processing of traffic accident information or processing of traffic accident information in historical data, it can be processed based on the method of this application. The text parsing method provided by this application can also provide a reference for natural language processing in other machine learning.
Claims
1. A method for locating a traffic accident location based on natural language processing, comprising the following steps: S1: Obtain information data of the location of the traffic accident to be processed based on natural language expression, recorded as: data to be processed; It is characterized in that it also includes the following steps: S2: Create a stop word list for traffic accident location information analysis and a regular expression for word segmentation; S3: Analyze the data to be processed based on the stop word list and the regular expression to obtain corresponding accident location information; The accident location information includes: the city, road, street and location where the accident occurred; S4: Based on the road retrieval technology, the digital road information data based on the longitude and latitude description corresponding to the road where the accident occurred is obtained, and the longitude and latitude data set describing the road where the accident occurred is obtained, which is recorded as: the initial road longitude and latitude data set; S5: Based on the data in the initial road longitude and latitude data set, determine whether the road where the accident occurred is an information-sparse road; If yes, execute step S6; Otherwise, the initial road longitude and latitude data set is recorded as the road longitude and latitude data set R to be processed, and step S7 is executed; R=[R1, R2, ..., Rn], where n is the number of longitude and latitude points included in the data set, and is a positive integer; S6: performing an expansion point density operation on the initial road longitude and latitude data set to expand the number of data in the data set to obtain a digital road set, which is recorded as: a road longitude and latitude data set R to be processed; S7: using geocoding technology, the text information of the accident location in the accident location information is converted into latitude and longitude digital information location, recorded as: original accident location P; If the original accident location P can be found, execute step S8; Otherwise, point P cannot be found, the original data is judged to be incorrect, an error message is returned, and the calculation ends; S8: Performing road projection calculation on the original accident location P and the road latitude and longitude data set R to be processed, and determining the final positioning point corresponding to the data to be processed; The road projection calculation specifically includes the following steps: a1: Calculate the spatial distance between point P and all points in the road longitude and latitude data set R to be processed, and find the three points Ri, Rj, Rk closest to P in R; a2: Determine the positional relationship between points Ri, Rj and Rk. If Ri, Rj and Rk are on the same straight line, execute step a3; Otherwise, the three points are not collinear, and step a4 is executed; a3: Determine whether P and points Ri, Rj and Rk are on the same straight line. If so, determine that point P is the final positioning point corresponding to the data to be processed; Otherwise, execute step a5; a4: Draw a triangle with points Ri, Rj and Rk as endpoints, denoted as: positioning area; Determine whether point P is within the positioning area; If yes, then point P is determined to be the final positioning point corresponding to the data to be processed; Otherwise, execute step a5; a5: Find the point in R that is closest to P, recorded as: the closest point Rm; The distance between Rm and P is recorded as: Dm; a6: Compare Dm with the preset positioning threshold; If Dm<positioning threshold, then point Rm is determined to be the final positioning point corresponding to the data to be processed; Otherwise, it is determined that the final positioning point corresponding to the data to be processed cannot be found; In step S6, the expansion point density operation includes the following steps: c1: confirm all adjacent points in the initial road longitude and latitude dataset; c2: Calculate the number of interpolation points that need to be inserted, and then use mean filling to interpolate between all adjacent points to obtain: the intermediate data set Rt; inset_num = ceil(mean_dist / distance threshold), Among them, inset_num is the number of points to be inserted, ceil is the rounding up algorithm, mean_dist is the average distance between all adjacent points; the distance threshold is the preset ideal distance between adjacent points; c3: record the intermediate data set Rt as the longitude and latitude data set R of the road to be processed; In step S7, the method for locating the original accident location P comprises the following steps: d1: Determine to use an online geocoding service interface of an online map, transcode the parsed city, road and accident location information and write them into the online geocoding service interface; d2: Access the online geocoding service interface to obtain the returned json data; d3: Parse the JSON data, extract the longitude and latitude coordinates therein, and obtain the original accident location P; P=[ lon P , lat P ], where lon represents the longitude coordinate and lat represents the latitude coordinate.
2. The method for locating a traffic accident site based on natural language processing according to claim 1, characterized in that: Based on longitude and latitude, the method for calculating the spatial distance between two points is: set up: The points involved in the calculation are x and y, lon x Represents the longitude information of point x, lat x Represents the latitude information of point x, lon y Represents the longitude information of point y, lat y Represents the latitude information of point y; then, the calculation process of the distance dist from point x to point y is: years x = years x ×π / 180; lon x = lon x × π / 180; years y = years y ×π / 180; lon y = lon y × π / 180; △years = years y -years x ; △lon = lon y –lon x ; a = sin(△lat / 2)^2 + cos(lat y ) * cos(lat x ) * sin(△lon / 2)^2; c = 2 * arcsin(sqrt(a)); dist = 6371 * c * 1000.
3. The method for locating a traffic accident location based on natural language processing according to claim 1, characterized in that: In step S5, the method for determining the information-sparse road is: b1: Calculate the spatial distances between all adjacent points in the road longitude and latitude data set to be processed; b2: Calculate the average of all distances to get the average distance between adjacent points; b3: Compare the average distance between adjacent points with a preset distance threshold.
4. The method for locating a traffic accident location based on natural language processing according to claim 1, characterized in that: In step a6, when it is determined that the final positioning point corresponding to the data to be processed cannot be found, the positioning area with points Ri, Rj and Rk as endpoints is fed back to the user as a reference area of the accident location.
5. A traffic accident location positioning system based on natural language processing, used to implement the traffic accident location positioning method according to claim 1, characterized in that: It includes: accident location analysis module, road retrieval module, road encryption module, geocoding module and projection positioning module; After the data to be processed is sent to the accident location analysis module, the accident location analysis module analyzes the data to be processed based on the stop word list and the regular expression for word segmentation to obtain the accident location information corresponding to the data to be processed; the accident location information includes: the city, road, street and location where the accident occurred; and the accident location information is sent to the road retrieval module and the geocoding module; The road retrieval module retrieves road information of the road where the accident occurred based on the offline map interface, obtains corresponding digitized road information data based on longitude and latitude description, and obtains an initial road longitude and latitude data set; and sends the initial road longitude and latitude data set to the road encryption module; In the road encryption module, it is determined whether the road where the accident occurred is an information-sparse road; if so, the sparse initial road longitude and latitude data set is subjected to a point density expansion operation, and the overly sparse digital road array is expanded into a relatively dense array to obtain a road longitude and latitude data set R to be processed, where R=[R1, R2, ..., Rn]; otherwise, if the longitude and latitude points of the road where the accident occurred are sufficient, the initial road longitude and latitude data set is directly recorded as: road longitude and latitude data set R to be processed; and the road longitude and latitude data set R to be processed is sent to the projection positioning module; In the geocoding module, the accident location information transmitted by the accident location analysis module is converted into corresponding longitude and latitude coordinate points using the geocoding interface, which are recorded as: original accident location P; and the original accident location P is sent to the projection positioning module; The projection positioning module performs road projection calculation based on the received original accident location P and the road latitude and longitude data set R to be processed, and determines the final positioning point corresponding to the data to be processed.
6. The traffic accident location positioning system based on natural language processing according to claim 5, characterized in that: The stop word list includes: location adverbs, intersection, road, section and place.
7. The traffic accident location positioning system based on natural language processing according to claim 5, characterized in that: After the accident location analysis module extracts the accident location information, it performs standardization processing on the text of the accident location information.
8. The traffic accident location positioning system based on natural language processing according to claim 5, characterized in that: The geocoding module also includes a credibility analysis operation. When the geocoding interface returns the longitude and latitude coordinates corresponding to the accident location information, the returned data is recorded as the data to be determined. The geocoding module performs a credibility analysis on the data to be determined and calculates the confidence of the data to be determined. If the confidence is greater than 60, the coding result is considered reliable, and the longitude and latitude are set as the original accident location P. If not, the text information of the accident location is refined and re-sent to the geocoding interface until the confidence of the data to be judged is greater than 60; The operation of refining the text information of the accident location includes: obtaining the text of the accident location information of the last geocoding interface, adding preset high-frequency address words to the fields corresponding to streets, roads and places respectively, and sending it to the geocoding interface for re-location after adding one high-frequency address word each time.
Citation Information
Patent Citations
Automatic Recording and Location Method for Semantic Expression Information of Traffic Accident Locations
CN103631776B
A Spatial Localization Method for Traffic Accidents Based on POI Index
CN107270922B
A method and system for automatic matching and verification of traffic accident locations on the road network
CN108320515B
Traffic accident site clustering method and system
CN112052908A
Method for obtaining positioning information in calling police for help in traffic accident
CN109377739A
