Event context generation method, terminal device and storage medium based on news data
By filtering and sorting news events, combining key sentences and similarity analysis, the concentrated release period and correlation of news events are determined, and the problem of insufficient filtering of non-related news data in the existing technology is solved, and the accuracy of event context generation is improved.
Patent Information
- Application Number
- CN202310876811.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-17
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2043-07-17
AI Technical Summary
When generating news events, the prior art tends to retain a large amount of non-related news data, which affects the accuracy of the refinement of the context nodes, and does not fully consider the release time and overall content of the news events.
By receiving event information input by users, filtering news events in the data pool, determining the centralized release period, extracting key sentences, calculating the similarity between news events, and determining the vein node events based on the similarity and time interval.
It improves the accuracy of the relevance screening of news events, ensures that the vein node events are relevant in both time and content, thereby improving the accuracy of event vein generation.
Smart Images

Figure CN116956874B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet big data, and in particular to an event context generation method based on news data, a terminal device and a storage medium. Background Art
[0002] Most of the current methods for generating news event contexts are to obtain relevant news of the event by matching keywords or judging whether the core words contain keywords, and then generate it by similarity merging, clustering or summarization. In the prior art, as long as the keywords of the news event match or the core words contain keywords, the news event will not be screened again, thus entering the event context generation stage. For massive news data, the prior art may appear that the extracted news events are not related news events in essence, although the keywords match, that is, the correlation with the target news event screened this time is not high. The reason for these problems is that the prior art only stays on the judgment of whether the words match when screening news events, without considering the release time of the news event and the control of the overall content of the news event. If only the keyword matching is performed or only the core words of the news event are considered whether they contain keywords, it is easy to retain a large amount of non-related news data that meets the conditions, thereby affecting the accuracy of context node extraction. Summary of the invention
[0003] The present invention provides an event context generation method based on news data, a terminal device and a storage medium to solve the technical problem that the relevant news extracted by the existing method easily retains a large amount of non-relevant news data that meets the conditions, affecting the accuracy of context node extraction.
[0004] In order to solve the above technical problems, an embodiment of the present invention provides an event context generation method based on news data, comprising:
[0005] Receiving event information input by a user, the event information including keywords; screening news events in a data pool according to the event information to generate a first news set;
[0006] Determining a concentrated release period of the first news set according to the release time of each news event in the first news set, filtering out news events released within the concentrated release period from the first news set, and generating a second news set;
[0007] Extracting key sentences of each news event in the second news set, screening news events whose key sentences contain the keyword from the second news set, and generating a third news set;
[0008] Calculating the similarity between each news event in the third news set; based on the similarity, selecting a first independent news set and a plurality of similar news sets corresponding to the first independent news set from the third news set; wherein the first independent news set includes a plurality of independent news events, the similarity between each pair of independent news events is less than a first preset threshold, and the independent news events in the first independent news set are sorted by release time; each independent news event corresponds to a similar news set, and the similarity between each news event in the similar news set and its corresponding independent news event is greater than a first preset threshold;
[0009] Filtering out independent news events whose number of news events in the corresponding similar news set is greater than a second preset value from the first independent news set, and generating a second independent news set;
[0010] Calculating the time intervals between the release times of adjacent independent news events in the second independent news set one by one, and determining the context node event according to the time intervals and the similar news set;
[0011] An event context is generated according to the context node event.
[0012] As a preferred solution, the event context generation method based on news data is characterized in that the event information also includes a release time range;
[0013] The screening of news events in the data pool according to the event information includes:
[0014] The news events in the data pool are screened according to the keyword and the release time range; or the news events in the data pool are screened according to the keyword.
[0015] As a preferred solution, the event context generation method based on news data is characterized in that, according to the release time of each news event in the first news set, determining the concentrated release period of the first news set includes:
[0016] Calculate the distribution T of all news events in the first news set by release time:
[0017]
[0018] Among them, d i is the release time of the i-th news event; day j is the jth day from the earliest release time to the latest release time of the news event in the first news set; The release time is day j The number of news events;
[0019] Calculate the minimum release time day when the distribution change rate is greater than the preset value α min and the maximum release time day max :
[0020]
[0021]
[0022] According to the minimum release time day min and the maximum release time day max The concentrated release period is determined.
[0023] As a preferred solution, the event context generation method based on news data is characterized by extracting key sentences of each news event in the second news set, including:
[0024] The TextRank algorithm is used to extract key sentences corresponding to each news event in the second news set.
[0025] As a preferred solution, the event context generation method based on news data is characterized in that, before calculating the similarity between the news events in the third news set, it also includes:
[0026] Segment each news event in the third news set and remove stop words to obtain each news event doc i The segmentation results are:
[0027] Token i :{w ij |j∈1,2,3,…,n i};
[0028] Among them, Token i For news events doc i The word set obtained after word segmentation, w ij For doc i The jth participle of i For doc i The total number of participles;
[0029] Calculating News Eventsdoc i Corresponding word set Token i The word vector matrix of:
[0030] A i :{a ij |j∈1,2,3,…,n i};
[0031] Among them, a ij Yesij The corresponding word vector;
[0032] According to the word vector matrix A i , generate news event doc i The corresponding text vector v i .
[0033] As a preferred solution, the event context generation method based on news data is characterized in that the similarity between the news events in the third news set is calculated, and according to the similarity, a first independent news set and several similar news sets corresponding to the first independent news set are screened from the third news set, including:
[0034] sorting the news events in the third news set in ascending order according to release time;
[0035] Initialize the first independent news collection: E:{doc 1}; Among them, doc 1 Corresponding to an empty similar news set Ds 1 ;
[0036] Calculate the news events doc in the third news set Doc″ in sequence j (j>1) and the independent news event doc in the first independent news set E i Similarity sim ij :
[0037]
[0038] Among them, v i For news events doc i The corresponding text vector; v j For news events doc j The corresponding text vector;
[0039] If sim ij is greater than the first preset threshold β, the news event doc j Add to news event doc i The corresponding similar news set Ds i at the end of the doc j Compare the similarity with other news events in the first independent news set E in turn;
[0040] If the news event doc j If the similarity with the news events in the first independent news set E is less than or equal to the first preset threshold β, then doc j For independent news events, generate an empty set Ds j As doc jThe corresponding similar news collection, and doc j Added to the end of the first independent news collection E;
[0041] The remaining news events in the third news set Doc″ are calculated cyclically until all the news events in the third news set Doc″ have completed the similarity comparison, then the similarity comparison is terminated to obtain the first independent news set and several similar news sets corresponding to the first independent news set.
[0042] As a preferred solution, the event context generation method based on news data is characterized in that the time intervals between the release times of adjacent independent news events in the second independent news set are calculated one by one, and the context nodes are determined according to the time intervals and the similar news set, including:
[0043] Calculate the adjacent independent news events doc in the second independent news set E′ one by one i With doc i+1 The time interval between publishing events |t i -t i+1 |, where t i For doc i The release time, t i+1 For doc i+1 Release time;
[0044] If |t i -t i+1 | is less than the preset time interval t, then compare doc i The corresponding similar news set Ds i With doc i+1 The corresponding similar news set Ds i+1 The number of news events in the
[0045] If |doc i |≥|doc i+1 |, then the second independent news set E′ retains doc i , delete doc i+1 ; Otherwise, the second independent news set E′ retains doc i+1 , delete doc i ;
[0046] If |t i -t i+1 | is greater than or equal to the preset time interval t, then the second independent news set E′ retains doc i With doc i+1 ;
[0047] According to the existing independent news events in the second independent news set E′, the context node events are determined.
[0048] An embodiment of the present invention also provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the event context generation method based on news data as described in any of the above embodiments is implemented.
[0049] An embodiment of the present invention further provides a storage medium, comprising a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the event context generation method based on news data as described in any of the above embodiments.
[0050] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0051] The embodiment of the present invention provides a method for generating event context based on news data, a terminal device and a storage medium. The method determines the concentrated release events and key sentences of news events preliminarily screened out from a data pool according to event information input by a user; further screens the news events according to whether the news event release events belong to the concentrated release time; further screens the news events according to whether the key sentences contain the keywords input by the user; and then performs subsequent similarity comparison and other operations on the screened news events.
[0052] In the prior art, only the news events in the data pool are preliminarily screened through the keywords input by the user, and then subsequent operations such as similarity comparison are performed. The present invention, by introducing the above-mentioned method of calculating the concentrated release period and the key sentence topic matching, performs multiple screenings on the preliminarily screened news events step by step. Among them, the news events in the concentrated release period screened have a stronger correlation in time; the news events whose key sentences include keywords have a stronger correlation in text content. Context stage events are certain news events that are related in time and text content. Compared with the prior art, the present invention further retains event-related news, making the extraction of context node events more accurate. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 It is a flow chart of the event context generation method based on news data of the present invention. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] Embodiment 1
[0056] Please refer to Figure 1 , is a flow chart of a method for generating event context based on news data provided by an embodiment of the present invention. In an embodiment of the present invention, the method for generating event context based on news data includes the following steps:
[0057] S1, receiving event information input by a user, the event information including keywords; filtering news events in a data pool according to the event information to generate a first news set;
[0058] S2, determining a concentrated release period of the first news set according to the release time of each news event in the first news set, filtering out news events released in the concentrated release period from the first news set, and generating a second news set;
[0059] S3, extracting the key sentence of each news event in the second news set, screening out news events whose key sentences contain the keyword from the second news set, and generating a third news set;
[0060] S4, calculating the similarity between each news event in the third news set; based on the similarity, selecting a first independent news set and a plurality of similar news sets corresponding to the first independent news set from the third news set; wherein the first independent news set includes a plurality of independent news events, the similarity between each pair of independent news events is less than a first preset threshold, and the independent news events in the first independent news set are sorted by release time; each independent news event corresponds to a similar news set, and the similarity between each news event in the similar news set and its corresponding independent news event is greater than the first preset threshold;
[0061] S5, filtering out independent news events whose number of news events in the corresponding similar news set is greater than a second preset value from the first independent news set, and generating a second independent news set;
[0062] S6, calculating the time intervals between the release times of adjacent independent news events in the second independent news set one by one, and determining the context node event according to the time intervals and the similar news set;
[0063] S7: Generate an event context according to the context node event.
[0064] Regarding step S1, it should be noted that the system receives event information input by the user, extracts the keywords input by the user in the event information, filters the data according to the keywords, filters out all news events whose texts contain the keywords, and constructs the filtered news events into the first news set.
[0065] Among them, the data pool refers to the database used to store news events.
[0066] In a preferred embodiment, an event context generation method based on news data provided by an embodiment of the present invention is characterized in that the event information also includes a release time range;
[0067] The news events in the data pool are screened according to the event information, including:
[0068] The news events in the data pool are filtered according to the keyword and the release time range; or the news events in the data pool are filtered according to the keyword.
[0069] It should be noted that when the user inputs event information, the user must enter a keyword, and can choose to enter a release event range. When the system only receives event information with keywords entered by the user, it filters the news events in the data pool according to the keywords, and filters out news events whose texts contain the keywords; when the system receives event information with keywords and a release time range entered by the user, it filters the news events in the data pool according to the keywords and the release time range, and filters out news events whose texts contain the keywords and whose release time falls within the release time range. The news events filtered out by the above filtering operation constitute the first news set.
[0070] The release time range refers to a time period set by the user with an accuracy of date.
[0071] Regarding step S2, it should be noted that the system obtains the release time of each news event in the above-mentioned first news collection, calculates the release time to obtain the concentrated release time period of the first news collection, and then filters out the news events whose release time falls within the concentrated release time period from the first news collection to form the second news collection.
[0072] The concentrated release period refers to a certain time period during which news events in the first news set are concentratedly released.
[0073] In a preferred embodiment, an event context generation method based on news data provided by an embodiment of the present invention is characterized in that, according to the release time of each news event in the first news set, a concentrated release period of the first news set is determined, including:
[0074] Calculate the distribution T of all news events in the first news set by release time:
[0075]
[0076] Among them, d i is the release time of the i-th news event; day j is the jth day from the earliest release time to the latest release time of the news event in the first news set; The release time is day j The number of news events;
[0077] Calculate the minimum release time day when the distribution change rate is greater than the preset value α min and the maximum release time day max :
[0078]
[0079]
[0080] According to the minimum release time day min and the maximum release time day max Determine the concentrated release period.
[0081] It should be noted that, in this preferred embodiment, by calculating the change rate of news release, the minimum release time day with a change rate greater than the preset value α is determined. min and the maximum release time day max , and then the minimum release time day min and the maximum release time day max The time period represented by the interval is used as the concentrated release period.
[0082] It should also be noted that news events released within the release period of the first news collection are screened out from the first news collection to form a new news collection, namely, the second news collection.
[0083] Step S2 further selects news events with stronger temporal relevance based on the preliminary screening by calculating the concentrated release time periods, so that the selected news events have stronger relevance and the screening results are more accurate.
[0084] Regarding step S3, it should be noted that the system extracts key sentences from each news event in the above-mentioned second news collection to obtain the key sentences of each news event, and then filters the news events in the second news collection by determining whether the key sentences of each news event contain the keywords input by the user, and filters out the news events whose key sentences contain the keywords to form the third news collection.
[0085] The key sentence is a sentence in the text content of the news event, which best reflects the theme of the news event.
[0086] In a preferred embodiment, an event context generation method based on news data provided by an embodiment of the present invention is characterized in that the key sentence of each news event in the second news set is extracted, including:
[0087] The TextRank algorithm is used to extract key sentences corresponding to each news event in the second news set.
[0088] It should be noted that the system extracts the key sentences corresponding to each news event in the above-mentioned second news set through the TextRank method, and will filter out news events whose key sentences contain the above-mentioned keywords entered by the user from the above-mentioned second news set to form a new news set, namely the third news set.
[0089] Step S3 further screens out news events with stronger relevance in subject matter based on the previous screening by determining the key sentences of the news events, so that the screened news events are more relevant and the screening results are more accurate.
[0090] Regarding step S4, it should be noted that the system calculates the similarity between each news event in the third news set, and extracts news events whose similarities are less than a first preset threshold from the third news set as independent news events based on the similarity, to form a first independent news set; for news events that are not independent news events, the system determines whether the similarity between the news event and the independent news event is greater than or equal to the first preset threshold, and classifies the news event whose similarity is greater than or equal to the first preset threshold into the similar news set corresponding to the independent news event.
[0091] Among them, each independent news event has a corresponding similar news set; the first preset threshold refers to a preset value for determining whether news events are similar.
[0092] In a preferred embodiment, an event context generation method based on news data provided by an embodiment of the present invention is characterized in that, before calculating the similarity between the news events in the third news set, it also includes:
[0093] Segment each news event in the third news set and remove stop words to obtain each news event doc i The segmentation results are:
[0094] Token i :{w ij |j∈1,2,3,…,n i};
[0095] Among them, Token i is the set of word segments obtained after word segmentation of the news event doc i , w ij is the j-th word segment of doc i , and n i is the total number of word segments of doc i ;
[0096] Calculate the word vector matrix of the word segment set Token i corresponding to the news event doc i :
[0097] A i : {a ij | j ∈ 1, 2, 3, …, n i};
[0098] Among them, a ij is the word vector corresponding to w ij ;
[0099] According to the word vector matrix A i , generate the text vector v i corresponding to the news event doc i .
[0100] It should be noted that the above word segmentation operation is used to decompose the text of the news time into a data structure with words as units. The above word segmentation result Token i is the set of all word segments obtained after word segmentation of the news event doc i , and these word segments are represented by w ij , where w ij represents the j-th word segment of doc i . The above stop words refer to words that do not contain semantics, such as words like "of", "is", "this", and "such as". The introduction of stop words improves the quality of the text features of the news events in the above data pool, and improves the effect of the event context generation method based on news data in the present invention.
[0101] It should also be noted that this preferred embodiment uses Word2Vec to calculate the word vector matrix of the word segment set Token i corresponding to the news doc i ; uses the USIF algorithm to calculate the text vector v i corresponding to the news event doc i . This preferred embodiment uses Word2Vec and the USIF method to improve the calculation method of text vectors in the prior art, making the subsequent similarity calculation more reasonable and improving the accuracy of refining context nodes.
[0102] In a preferred embodiment, an event context generation method based on news data provided by an embodiment of the present invention is characterized in that the similarity between news events in the third news set is calculated, and according to the similarity, a first independent news set and several similar news sets corresponding to the first independent news set are screened from the third news set, including:
[0103] sorting the news events in the third news set in ascending order according to release time;
[0104] Initialize the first independent news collection: E:{doc 1}; Among them, doc 1 Corresponding to an empty similar news set Ds 1 ;
[0105] Calculate the news events doc in the third news set Doc″ in sequence j (j>1) and the independent news event doc in the first independent news set E i Similarity sim ij :
[0106]
[0107] Among them, v i For news events doc i The corresponding text vector; v j For news events doc j The corresponding text vector;
[0108] If sim ij is greater than the first preset threshold β, the news event doc j Add to news event doc i The corresponding similar news set Ds i at the end of the doc j Compare the similarity with other news events in the first independent news set E in turn;
[0109] If the news event doc j If the similarity with the news events in the first independent news set E is less than or equal to the first preset threshold β, then doc j For independent news events, generate an empty set Ds j As doc j The corresponding similar news collection, and doc j Added to the end of the first independent news collection E;
[0110] The remaining news events in the third news set Doc″ are calculated cyclically until all the news events in the third news set Doc″ have completed the similarity comparison, then the similarity comparison is terminated to obtain the first independent news set and several similar news sets corresponding to the first independent news set.
[0111] It should be noted that the first news event doc in the third news collection sorted in ascending order by release time 1 Take out to form a new news set, which is the first independent news set. When each news event is added to the first independent news set, an empty news set corresponding to the news event is generated as a similar news set of the news event, which is used to store similar news events of the news event in the subsequent similarity comparison process. Similar news events can be understood as news events whose similarity to the news event is greater than the above-mentioned first preset threshold β. After similarity calculation and comparison, a certain news event is determined to be a similar news event of the news event, and the similar news event is added to the end of the similar news set corresponding to the news event.
[0112] It should also be noted that after completing the above cycle, in the first independent news set obtained, each pair of news events is independent of each other, that is, the similarity between each pair of news events is less than or equal to the above first preset threshold β; the several similar news sets obtained correspond one-to-one to the news events in the above first independent news set, and the similarity between the news events in each similar news set and the corresponding news events in the first independent news set is greater than the above first preset threshold β.
[0113] Regarding step S5, it should be noted that the system calculates the number of news events contained in the similar news sets corresponding to each news event in the first independent news set, and determines whether the number of news events is greater than the second preset value, and screens out independent news events greater than the second preset value to form the second independent news set.
[0114] The second preset value is a standard value for determining the number of similar news events in independent news time.
[0115] Regarding step S6, it should be noted that the system calculates the time interval between the release events of adjacent news events in the second independent news set and the number of news events contained in the similar news set corresponding to each independent news event, and determines the context node event according to the above time interval and the number of news events contained in the above similar news set.
[0116] In a preferred embodiment, an event context generation method based on news data provided by an embodiment of the present invention is characterized in that the above-mentioned calculating the time intervals between the release times of adjacent independent news events in the second independent news set one by one, and determining the context nodes according to the time intervals and the similar news set, comprises:
[0117] Calculate the adjacent independent news events doc in the second independent news set E′ one by one i With doc i+1 The time interval between publishing events |t i -t i+1 |, where t i For doc i The release time, t i+1 For doc i+1 Release time;
[0118] If |t i -t i+1 | is less than the preset time interval t, then compare doc i The corresponding similar news set Ds i With doc i+1 The corresponding similar news set Ds i+1 The number of news events in the
[0119] If |doc i |≥|doc i+1 |, then the second independent news set E′ retains doc i , delete doc i+1 ; Otherwise, the second independent news set E′ retains doc i+1 , delete doc i ;
[0120] If |t i -t i+1 | is greater than or equal to the preset time interval t, then the second independent news set E′ retains doc i With doc i+1 ;
[0121] According to the existing independent news events in the second independent news set E′, the context node events are determined.
[0122] It should be noted that the system first calculates the time interval between the release events of adjacent news events in the second independent news set E′. i -t i+1 |, by judging the time interval |t i -t i+1|Whether it is greater than a preset time interval t, for adjacent news events that are less than the preset time interval t, further calculate the number of news events contained in the similar news sets corresponding to the adjacent news events, and retain the news events with a larger number of news events contained in the corresponding similar news sets in the second independent news set E′; if the numbers of news events contained in the similar news sets corresponding to the adjacent news events are the same, retain the news events that are ranked first in the set; all adjacent news events that are greater than or equal to the preset time interval t are regarded as context node events and retained in the second independent news set E′.
[0123] The preset time interval refers to a preset value used to determine the length of the time interval between adjacent news events.
[0124] It should also be noted that after the modification operation on the second independent news set, the time intervals between the releases of adjacent events in the second independent news set finally obtained are greater than or equal to the preset time interval t, and the number of similar news events of all independent news events is greater than the second preset value. The number of similar news events is the number of news events in the similar news set corresponding to the independent news event. The independent news events in the second independent news set are the context node events.
[0125] For step S7, after the context nodes are determined, an event context is generated according to the context node events.
[0126] Embodiment 2
[0127] Correspondingly, an embodiment of the present invention also provides a terminal device, characterized in that it includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, and when the processor executes the computer program, it implements the event context generation method based on news data as described in any one of the above embodiments.
[0128] It should be noted that the terminal device can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The device can include, but is not limited to, a processor and a memory. The processor can be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The processor is the control center of the device, and various interfaces and lines are used to connect the various parts of the entire device. The memory can be used to store the computer program, and the processor realizes the various functions of the device by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory may include high-speed random access memory and may also include non-volatile memory, such as a hard disk, an internal memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0129] Embodiment 3
[0130] Correspondingly, an embodiment of the present invention further provides a storage medium, comprising a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the event context generation method based on news data as described in any of the above embodiments.
[0131] It should be noted that the above storage medium is a computer-readable storage medium, and the above computer program is stored in the computer-readable storage medium. When the computer program is executed by the processor, the steps of each of the above method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the above computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0132] It should also be noted that the content contained in the above-mentioned computer-readable media can be appropriately increased or decreased according to the requirements of legislation and patent practices in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practices, computer-readable media do not include electrical carrier signals and telecommunications signals.
[0133] The above specific embodiments further describe the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for generating event context based on news data, characterized in that: include: Receiving event information input by a user, the event information including keywords; screening news events in a data pool according to the event information to generate a first news set; Determining a concentrated release period of the first news set according to the release time of each news event in the first news set, filtering out news events released within the concentrated release period from the first news set, and generating a second news set; Extracting key sentences of each news event in the second news set, screening news events whose key sentences contain the keyword from the second news set, and generating a third news set; Calculating the similarity between each news event in the third news set; based on the similarity, selecting a first independent news set and a plurality of similar news sets corresponding to the first independent news set from the third news set; wherein the first independent news set includes a plurality of independent news events, the similarity between each pair of independent news events is less than a first preset threshold, and the independent news events in the first independent news set are sorted by release time; each independent news event corresponds to a similar news set, and the similarity between each news event in the similar news set and its corresponding independent news event is greater than a first preset threshold; Filtering out independent news events whose number of news events in the corresponding similar news set is greater than a second preset value from the first independent news set, and generating a second independent news set; Calculating the time intervals between the release times of adjacent independent news events in the second independent news set one by one, determining a context node event according to the time interval and the similar news set; and generating an event context according to the context node event; The step of determining the concentrated release period of the first news set includes: Calculate the distribution T of all news events in the first news set according to release time: ; in, is the release time of the i-th news event; is the jth day from the earliest release time to the latest release time of the news event in the first news set; Release time is The number of news events; The calculated distribution change rate is greater than the preset value Minimum release time With the maximum release time : ; ; Based on minimum release time With the maximum release time The concentrated release period is determined.
2. The event context generation method based on news data as claimed in claim 1, characterized in that: The event information also includes a release time range; The screening of news events in the data pool according to the event information includes: The news events in the data pool are screened according to the keyword and the release time range; or the news events in the data pool are screened according to the keyword.
3. The event context generation method based on news data as claimed in claim 1, characterized in that: Extracting key sentences of each news event in the second news set includes: The TextRank algorithm is used to extract key sentences corresponding to each news event in the second news set.
4. The event context generation method based on news data as claimed in claim 3, characterized in that: Before calculating the similarity between the news events in the third news set, the method further includes: Segment each news event in the third news set and remove stop words to obtain each news event The segmentation results are: ; in, For news events The word set obtained after word segmentation, for The jth participle of for The total number of participles; Counting News Events Corresponding word set The word vector matrix of: ; in, yes The corresponding word vector; According to the word vector matrix , generate news events The corresponding text vector .
5. The event context generation method based on news data as claimed in claim 4, characterized in that: Calculating the similarity between the news events in the third news set, and selecting the first independent news set and a plurality of similar news sets corresponding to the first independent news set from the third news set according to the similarity, including: sorting the news events in the third news set in ascending order according to release time; Initialize the first independent news collection: ;in, Corresponding to an empty set of similar news ; Calculate the third news set in sequence middle News Events With the First Independent News Collection Independent news events in Similarity : ; in, For news events The corresponding text vector; For news events The corresponding text vector; if Greater than a first preset threshold , then the news event Add to News Event Corresponding similar news collection at the end of Sequentially with the First Independent News Collection Compare similarities with other news events in the If the news event With the First Independent News Collection The similarity of the news events in the ,but Generate an empty set for independent news events As The corresponding similar news collection Add to First Independent News Collection The end of Cyclic Computing Third News Collection All remaining news events in the third news collection When all the news events in the similarity comparison are completed, the similarity comparison is ended, and the first independent news set and several similar news sets corresponding to the first independent news set are obtained.
6. The event context generation method based on news data as claimed in claim 5, characterized in that: The step of calculating the time intervals between the release times of adjacent independent news events in the second independent news set one by one, and determining the context node according to the time intervals and the similar news set, comprises: Calculate the second independent news set one by one Adjacent independent news events and The time interval between the release times ,in, for Release time, for Release time; if Less than the preset time interval , then compare Corresponding similar news collection and Corresponding similar news collection The number of news events in the if , then the second independent news set Reserve ,delete ; otherwise a second independent news collection Reserve ,delete ; if Greater than or equal to the preset time interval , then the second independent news set Retained in the middle and ; According to the second independent news collection Identify the existing independent news events and determine the context node events.
7. A terminal device, characterized in that: The method comprises a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, the method for generating event context based on news data as described in any one of claims 1 to 6 is implemented.
8. A storage medium, characterized in that: The storage medium includes a stored computer program, wherein when the computer program is running, the device where the storage medium is located is controlled to execute the event context generation method based on news data as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Tendency analysis method of public opinion based on word2vec
CN107239439A
Event analysis method and device, computer equipment and storage medium
CN113254787A
Event context generation method and device, terminal equipment and storage medium
CN113268598A