WO2019041528A1 - 新闻情感方向判断方法、电子设备及计算机可读存储介质 - Google Patents
新闻情感方向判断方法、电子设备及计算机可读存储介质 Download PDFInfo
- Publication number
- WO2019041528A1 WO2019041528A1 PCT/CN2017/108811 CN2017108811W WO2019041528A1 WO 2019041528 A1 WO2019041528 A1 WO 2019041528A1 CN 2017108811 W CN2017108811 W CN 2017108811W WO 2019041528 A1 WO2019041528 A1 WO 2019041528A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- news
- predicted
- event
- score
- file
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/30—Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
- G06F16/33—Querying
- G06F16/332—Query formulation
- G06F16/3325—Reformulation based on results of preceding query
- G06F16/3326—Reformulation based on results of preceding query using relevance feedback from the user, e.g. relevance feedback on documents, documents sets, document terms or passages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F40/00—Handling natural language data
- G06F40/30—Semantic analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Definitions
- the present application provides a news emotion direction determination method, an electronic device, and a computer readable storage medium, which are acquired by a machine learning algorithm through preset event tag hit rules (including event keywords or event regular expressions).
- the adjustment of the news sentiment scores effectively improved the accuracy of the judgment of the news sentiment direction.
- the present application provides a method for judging a news sentiment direction, which is applied to an electronic device, and the method includes:
- the emotional direction of the news to be predicted is determined according to the adjusted emotional score of the news to be predicted.
- the present application further provides an electronic device, where the electronic device includes a memory and a processor, and the memory stores a news emotion direction determining system operable on the processor, the news When the sentiment direction judging system is executed by the processor, the processor executes the steps of the news sentiment direction judging method as described above.
- the present application further provides a computer readable storage medium storing a news sentiment direction determining system, the news sentiment direction determining system being executable by at least one processor, Taking the at least one processor to perform as described above The steps of the method of judging the emotional direction of the news.
- the electronic device, the news emotion direction judging method and the computer readable storage medium proposed by the present application machine learning through preset event tag hitting rules (including event keywords or event regular expressions)
- the news sentiment scores obtained by the algorithm are adjusted.
- the result of the score calculation of this application is higher and the coverage is more accurate. Wide, customer experience is better.
- 1 is a schematic diagram of an optional hardware architecture of an electronic device of the present application
- FIG. 2 is a schematic diagram of a program module of an embodiment of a news sentiment direction determining system in an electronic device of the present application
- FIG. 3 is a schematic diagram of an implementation process of an embodiment of a method for determining a sentiment direction of a news in the present application.
- first”, “second” and the like in the present application are only used for description. The purpose is not to be construed as indicating or implying its relative importance or implicitly indicating the number of technical features indicated. Thus, features defining “first” and “second” may include at least one of the features, either explicitly or implicitly.
- the technical solutions between the various embodiments may be combined with each other, but must be based on the realization of those skilled in the art, and when the combination of the technical solutions is contradictory or impossible to implement, it should be considered that the combination of the technical solutions does not exist. Nor is it within the scope of protection required by this application.
- FIG. 1 it is a schematic diagram of an optional hardware architecture of the electronic device 2 of the present application.
- the electronic device 2 may include, but is not limited to, a memory 21, a processor 22, and a network interface 23 that can communicate with each other through a system bus. It is pointed out that FIG. 1 only shows the electronic device 2 with the components 21-23, but it should be understood that not all illustrated components are required to be implemented, and more or fewer components may be implemented instead.
- the electronic device 2 may be a computing device such as a rack server, a blade server, a tower server, or a rack server.
- the electronic device 2 may be an independent server or a server cluster composed of multiple servers. .
- the memory 21 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (eg, SD or DX memory, etc.), a random access memory (RAM), a static Random access memory (SRAM), read only memory (ROM), electrically erasable programmable read only memory (EEPROM), programmable read only memory (PROM), magnetic memory, magnetic disk, optical disk, and the like.
- the memory 21 may be an internal storage unit of the electronic device 2, such as a hard disk or memory of the electronic device 2.
- the memory 21 may also be an external storage device of the electronic device 2, such as a plug-in hard disk equipped on the electronic device 2, a smart memory card (SMC), and a secure digital device. (Secure Digital, SD) card, flash card, etc.
- the memory 21 may also include both an internal storage unit of the electronic device 2 and an external storage device thereof.
- the memory 21 is generally used to store an operating system installed in the electronic device 2 and various types of application software, such as program codes of the news emotion direction determining system 20, and the like. Further, the memory 21 can also be used to temporarily store various types of data that have been output or are to be output.
- the processor 22 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments.
- the processor 22 is typically used to control overall operations of the electronic device 2, such as executing with the electronic device 2 Perform data interaction or communication related control and processing.
- the processor 22 is configured to run program code or process data stored in the memory 21, such as running the news sentiment direction determination system 20 and the like.
- the network interface 23 may comprise a wireless network interface or a wired network interface, which is typically used to establish a communication connection between the electronic device 2 and other electronic devices.
- the network interface 23 is configured to connect the electronic device 2 to an external data platform through a network, and establish a data transmission channel and a communication connection between the electronic device 2 and an external data platform.
- the network may be an intranet, an Internet, a Global System of Mobile communication (GSM), a Wideband Code Division Multiple Access (WCDMA), a 4G network, or a 5G network.
- Wireless or wired networks such as network, Bluetooth, Wi-Fi, etc.
- the news sentiment direction determining system 20 may be divided into one or more program modules, the one or more program modules being stored in the memory 21 and being processed by one or more processors. (Processing in the present embodiment for the processor 22) to complete the application.
- the news sentiment direction determining system 20 can be divided into a scoring module 201, an adjusting module 202, and a judging module 203.
- the program module referred to in the present application refers to a series of computer program instruction segments capable of performing a specific function, and is more suitable than the program to describe the execution process of the news emotion direction judgment system 20 in the electronic device 2.
- the function of each program module 201-203 will be described in detail below.
- the scoring module 201 is configured to perform semantic scoring on the to-be-predicted news by using a predetermined machine learning algorithm to obtain an emotional score of the to-be-predicted news.
- the predetermined machine learning algorithm may adopt a random forest algorithm (such as the open source package weka), and the semantic score includes the following steps:
- the training set tuple is selected by the bagging algorithm, and each decision tree in the random forest model is trained by the Radomtree algorithm, and M times are repeated to obtain M base classifiers;
- Prediction vector conversion is performed on the title of the news to be predicted, and the predicted base classifier is used to perform prediction voting, and the category with the largest number of predictions is used as the category of the news (such as positive category and negative category), and the prediction is specified.
- the number of categories (such as category 1) divided by the total number of decision trees, ie
- the news A to be predicted is predicted by the training model (assuming that the training model has 1000 decision trees).
- the adjusting module 202 is configured to adjust an emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm according to a preset event tag-event keyword rule.
- the event tag-event keyword rule may be set as a first file (such as a first dynamic dictionary), that is, the specific content of the event tag-event keyword rule is in the form of a file (this embodiment is a first file) ) to record.
- the first file may include the following: an event tag (used to distinguish categories of events, such as development adjustments, etc.), event keywords (such as transformation, upgrade, etc.), and corresponding to each event keyword. Emotional score (score).
- the first file may be set to the format of the following file A:
- the score range corresponding to the event keyword can be set to [-1, 1].
- the score range can be further divided into sub-intervals of several files, for example, sub-intervals divided into the following four files: [-1, -0.75), [-0.75, -0.5), [-0.5, -0.04), [-0.04,1], where subinterval [-1,-0.75) and [-0.75,-0.5) represent major negative news, [-0.5,-0.04) represents general negative news, [-0.04,1] represents Positive news.
- the range of emotional scores [-1, 1] obtained by the predetermined machine learning algorithm (such as the random forest algorithm) can also be divided into sub-intervals of the above four gears.
- the adjusting the sentiment score of the to-be-predicted news obtained by the predetermined machine learning algorithm includes the following steps:
- the corresponding event score in the first file is taken as the waiting event Predicting the final score of the news, and using the event tag corresponding to the identified event keyword as the main business event of the news to be predicted;
- the emotional score of the news to be predicted obtained by the predetermined machine learning algorithm is used as the final of the news to be predicted. score.
- the adjusting the emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm further comprises the following steps:
- the event keyword in the first file is identified from the title and the body of the news to be predicted, and the recognized event keyword is in the first file corresponding to the emotional score and the predetermined machine learning If the sentiment score obtained by the algorithm is not in the same bin (ie, in the subinterval corresponding to the same bin, such as [-0.04, 1]), the corresponding sentiment score in the first file is determined by the identified event keyword. For the main weight, a weighted calculation is performed with the sentiment score obtained by the predetermined machine learning algorithm, and a weighted score is obtained as the final score of the news to be predicted.
- the weighting calculation includes: multiplying the identified event keyword in the first file by a corresponding preset score (eg, 60%), and the predetermined machine learning algorithm
- the acquired emotion score is multiplied by a second preset ratio (eg, 40%), and then the product of the two is added to obtain a weighted score as the final score of the news to be predicted.
- the first preset ratio is greater than the second preset ratio, and the sum of the first preset ratio and the second preset ratio is 1.
- the application uses the 0.2 score as the main weight to adjust the score.
- the adjustment module 202 is further configured to:
- the event tag-event regular expression rule may be set to a second file (such as a second dynamic dictionary), that is, the specific content of the event tag-event regular expression rule is in the form of a file (this embodiment is Second file) for recording.
- the second file may include the following contents: an event tag (used to distinguish the category of the event, such as performance increase, etc.), an event regular expression (set according to different business experience and related logic, the following file) B shows), and the emotional score (score) corresponding to each event regular expression.
- the second file can be set to the format of the following file B:
- the scoring range corresponding to the event regular expression can be set to [-1, 1].
- the score range can be further divided into sub-intervals of several files, for example, sub-intervals divided into the following four files: [-1, -0.75), [-0.75, -0.5), [-0.5, -0.04), [-0.04,1], where subinterval [-1,-0.75) and [-0.75,-0.5) represent major negative news, [-0.5,-0.04) represents general negative news, [-0.04,1] represents Positive news.
- the adjusting the emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm further includes the following steps:
- the corresponding emotional score of the event regular expression in the second file is taken as the waiting
- the final score of the news is predicted, and the event tag corresponding to the event regular expression is used as the main business event of the news to be predicted.
- the adjusting the emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm further includes the following steps:
- the reservation is The emotional score of the news to be predicted obtained by the machine learning algorithm is used as the final score of the news to be predicted.
- the adjusting the emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm further includes the following steps:
- the corresponding emotional score of the event regular expression in the second file is related to the predetermined
- the emotional score obtained by the machine learning algorithm is not in the same bin (ie, in the subinterval corresponding to the same bin, such as [-0.04, 1])
- the corresponding emotion in the second file is represented by the event regular expression.
- the score is the main weight, and the emotional score obtained by the predetermined machine learning algorithm is weighted, and a weighted score is obtained as the final score of the news to be predicted.
- the weighting calculation includes: multiplying the corresponding sentiment score of the event regular expression in the second file by a first preset ratio (eg, 60%), and acquiring the predetermined machine learning algorithm.
- the emotion score is multiplied by a second preset ratio (eg, 40%), and then the product of the two is added to obtain a weighted score as the final score of the news to be predicted.
- the first preset ratio is greater than the second preset ratio, and the sum of the first preset ratio and the second preset ratio is 1.
- the event regular expression has a corresponding emotional score of 0.4 in the second file (in the bin subinterval [-0.04, 1]), and the emotional score obtained by the predetermined machine learning algorithm is - 0.4 (located in the sub-range [-0.5, -0.04)), the two are obviously not in the same bin, then this application
- the 0.4 score is the main weight to adjust the score.
- the determining module 203 is configured to determine an emotional direction of the news to be predicted according to the adjusted emotional score of the news to be predicted. Specifically, if the adjusted emotional score of the news to be predicted is located in the first scoring interval (eg, [-1, -0.04)), it is determined that the sentiment direction of the news to be predicted is negative; if the adjusted predicted result is to be predicted The emotional score of the news is located in the second scoring interval (such as [-0.04, 1]), and it is determined that the emotional direction of the news to be predicted is positive.
- the first scoring interval eg, [-1, -0.04
- the first scoring interval or the second scoring interval may be further subdivided.
- the first scoring interval [-1, -0.04) may be further divided into subintervals [-1, -0.5) and [-0.5, -0.04), wherein subintervals [-1, -0.5) represent significant Negative news, sub-interval [-0.5, -0.04) represents general negative news.
- the news sentiment direction judging system 20 proposed by the present application passes a preset event tag hitting rule (including an event keyword or an event regular expression) to a machine learning algorithm (such as a random forest algorithm).
- a preset event tag hitting rule including an event keyword or an event regular expression
- a machine learning algorithm such as a random forest algorithm.
- the acquired news sentiment scores are adjusted.
- the score calculation result of the present application has higher accuracy, wider coverage and better customer experience.
- the present application also proposes a method for judging news emotion direction.
- FIG. 3 it is a schematic flowchart of an implementation process of an embodiment of the method for judging the sentiment direction of the present application.
- the order of execution of the steps in the flowchart shown in FIG. 3 may be changed according to different requirements, and some steps may be omitted.
- Step S31 Perform semantic scores on the news to be predicted by using a predetermined machine learning algorithm, and obtain an emotional score of the news to be predicted.
- the predetermined machine learning algorithm may adopt a random forest algorithm (such as the open source package weka), and the semantic score includes the following steps:
- the training set tuple is selected by the bagging algorithm, and each decision tree in the random forest model is trained by the Radomtree algorithm, and M times are repeated to obtain M base classifiers;
- Prediction vector conversion is performed on the title of the news to be predicted, and the predicted base classifier is used to perform prediction voting, and the category with the largest number of predictions is used as the category of the news (such as positive category and negative category), and the prediction is specified.
- the news A to be predicted is predicted by the training model (assuming that the training model has 1000 decision trees).
- Step S32 adjusting an emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm according to a preset event tag-event keyword rule.
- the event tag-event keyword rule may be set as a first file (such as a first dynamic dictionary), that is, the specific content of the event tag-event keyword rule is in the form of a file (this embodiment is a first file) ) to record.
- the first file may include the following: an event tag (used to distinguish categories of events, such as development adjustments, etc.), event keywords (such as transformation, upgrade, etc.), and corresponding to each event keyword. Emotional score (score).
- the first file may be set to the format of the following table file A:
- the score range corresponding to the event keyword can be set to [-1, 1].
- the score range can be further divided into sub-intervals of several files, for example, sub-intervals divided into the following four files: [-1, -0.75), [-0.75, -0.5), [-0.5, -0.04), [-0.04,1], where subinterval [-1,-0.75) and [-0.75,-0.5) represent major negative news, [-0.5,-0.04) represents general negative news, [-0.04,1] represents Positive news.
- the range of emotional scores [-1, 1] obtained by the predetermined machine learning algorithm (such as the random forest algorithm) can also be divided into sub-intervals of the above four gears.
- the adjusting the sentiment score of the to-be-predicted news obtained by the predetermined machine learning algorithm includes the following steps:
- the corresponding event score of the recognized event keyword in the first file is used as the news to be predicted. Finalizing the score, and using the event tag corresponding to the identified event keyword as the main business event of the news to be predicted;
- the emotional score of the news to be predicted obtained by the predetermined machine learning algorithm is used as the final of the news to be predicted. score.
- the adjusting the emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm further comprises the following steps:
- the event keyword in the first file is identified from the title and the body of the news to be predicted, and the recognized event keyword is in the first file corresponding to the emotional score and the predetermined machine learning If the sentiment score obtained by the algorithm is not in the same bin (ie, in the subinterval corresponding to the same bin, such as [-0.04, 1]), the corresponding sentiment score in the first file is determined by the identified event keyword. For the main weight, a weighted calculation is performed with the sentiment score obtained by the predetermined machine learning algorithm, and a weighted score is obtained as the final score of the news to be predicted.
- the weighting calculation includes: multiplying the identified event keyword in the first file by a corresponding preset score (eg, 60%), and the predetermined machine learning algorithm
- the acquired emotion score is multiplied by a second preset ratio (eg, 40%), and then the product of the two is added to obtain a weighted score as the final score of the news to be predicted.
- the first preset ratio is greater than the second preset ratio, and the sum of the first preset ratio and the second preset ratio is 1.
- the application uses the 0.2 score as the main weight to adjust the score.
- step S32 further includes the following steps:
- the event tag-event regular expression rule may be set to a second file (such as a second dynamic dictionary), that is, the specific content of the event tag-event regular expression rule is in the form of a file (this embodiment is Second file) for recording.
- the second file may include the following contents: an event tag (used to distinguish the category of the event, such as performance increase, etc.), an event regular expression (set according to different business experience and related logic, the following file) B shows), and the emotional score (score) corresponding to each event regular expression.
- the second file can be set to the format of the following form file B:
- the main business event of the news item is the corresponding event label (such as "performance pre-increased"), the news The emotional score is 0.4.
- the scoring range corresponding to the event regular expression can be set to [-1, 1].
- the score range can be further divided into sub-intervals of several files, for example, sub-intervals divided into the following four files: [-1, -0.75), [-0.75, -0.5), [-0.5, -0.04), [-0.04,1], where subinterval [-1,-0.75) and [-0.75,-0.5) represent major negative news, [-0.5,-0.04) represents general negative news, [-0.04,1] represents Positive news.
- the adjusting the emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm further includes the following steps:
- the corresponding emotional score of the event regular expression in the second file is taken as the waiting
- the final score of the news is predicted, and the event tag corresponding to the event regular expression is used as the main business event of the news to be predicted.
- the adjusting the emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm further includes the following steps:
- the reservation is The emotional score of the news to be predicted obtained by the machine learning algorithm is used as the final score of the news to be predicted.
- the adjusting the emotional score of the to-be-predicted news acquired by the predetermined machine learning algorithm further includes the following steps:
- the corresponding emotional score of the event regular expression in the second file is related to the predetermined
- the emotional score obtained by the machine learning algorithm is not in the same bin (ie, in the subinterval corresponding to the same bin, such as [-0.04, 1])
- the corresponding emotion in the second file is represented by the event regular expression.
- the score is the main weight, and the emotional score obtained by the predetermined machine learning algorithm is weighted, and a weighted score is obtained as the final score of the news to be predicted.
- the weighting calculation includes: multiplying the corresponding sentiment score of the event regular expression in the second file by a first preset ratio (eg, 60%), and acquiring the predetermined machine learning algorithm.
- the emotion score is multiplied by a second preset ratio (eg, 40%), and then the product of the two is added to obtain a weighted score as the final score of the news to be predicted.
- the first preset ratio is greater than the second preset ratio, and the sum of the first preset ratio and the second preset ratio is 1.
- the application uses the 0.4 score as the main weight to adjust the score.
- Step S33 determining the news to be predicted according to the emotional score of the to-be-predicted news obtained by the adjustment.
- the emotional direction Specifically, if the adjusted emotional score of the news to be predicted is located in the first scoring interval (eg, [-1, -0.04)), it is determined that the sentiment direction of the news to be predicted is negative; if the adjusted predicted result is to be predicted The emotional score of the news is located in the second scoring interval (such as [-0.04, 1]), and it is determined that the emotional direction of the news to be predicted is positive.
- the first scoring interval eg, [-1, -0.04
- the first scoring interval or the second scoring interval may be further subdivided.
- the first scoring interval [-1, -0.04) may be further divided into subintervals [-1, -0.5) and [-0.5, -0.04), wherein subintervals [-1, -0.5) represent significant Negative news, sub-interval [-0.5, -0.04) represents general negative news.
- the news sentiment direction judging method proposed by the present application acquires a machine learning algorithm (such as a random forest algorithm) through a preset event tag hitting rule (including an event keyword or an event regular expression).
- the news sentiment score is adjusted.
- the score calculation result of this application has higher accuracy, wider coverage and better customer experience.
- the present application further provides a computer readable storage medium (such as a ROM/RAM, a magnetic disk, an optical disk), wherein the computer readable storage medium stores a news emotion direction determining system 20, the news
- the sentiment direction determination system 20 can be executed by at least one processor 22 to cause the at least one processor 22 to perform the steps of the news sentiment direction determination method as described above.
- the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and can also be implemented by hardware, but in many cases, the former is A better implementation.
- the technical solution of the present application which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
- the optical disc includes a number of instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present application.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Mathematical Physics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Data Mining & Analysis (AREA)
- Artificial Intelligence (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Software Systems (AREA)
- Evolutionary Computation (AREA)
- Audiology, Speech & Language Pathology (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种新闻情感方向判断方法,该方法包括步骤:通过预定的机器学习算法,针对待预测新闻进行语义评分,获取该待预测新闻的情感分数(S31);根据预设的事件标签-事件关键词规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数(S32);根据调整得到的该待预测新闻的情感分数,确定该待预测新闻的情感方向(S33)。该方法可以提升新闻情感方向判断的准确率。
Description
本专利申请以2017年8月31日提交的申请号为201710775417.9,名称为“新闻情感方向判断方法、电子设备及计算机可读存储介质”的中国发明专利申请为基础,并要求其优先权。
本申请涉及计算机信息技术领域,尤其涉及一种新闻情感方向判断方法、电子设备及计算机可读存储介质。
在进行新闻语义解析的同时,往往需要关注新闻的情感方向是正面还是负面,以及正负面的程度如何。现有方法通常采用机器学习方法(比如随机森林等算法)对新闻进行分数计算,根据所得分数判断新闻的正负面,这样的结果可能准确度不高、导致不好的客户体验。故,现有技术中的新闻情感方向判断方法设计不够合理,亟需改进。
发明内容
有鉴于此,本申请提出一种新闻情感方向判断方法、电子设备及计算机可读存储介质,通过预设的事件标签命中规则(包括事件关键字或事件正则表达式),对机器学习算法获取的新闻情感分数进行调整,有效提升了新闻情感方向判断的准确率。
首先,为实现上述目的,本申请提出一种新闻情感方向判断方法,该方法应用于电子设备,所述方法包括:
通过预定的机器学习算法,针对待预测新闻进行语义评分,获取该待预测新闻的情感分数;
根据预设的事件标签-事件关键词规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数;及
根据调整得到的该待预测新闻的情感分数,确定该待预测新闻的情感方向。
此外,为实现上述目的,本申请还提供一种电子设备,所述电子设备包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的新闻情感方向判断系统,所述新闻情感方向判断系统被所述处理器执行时,所述处理器执行如上所述的新闻情感方向判断方法的步骤。
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质存储有新闻情感方向判断系统,所述新闻情感方向判断系统可被至少一个处理器执行,以使所述至少一个处理器执行如上述的
新闻情感方向判断方法的步骤。
相较于现有技术,本申请所提出的电子设备、新闻情感方向判断方法及计算机可读存储介质,通过预设的事件标签命中规则(包括事件关键字或事件正则表达式),对机器学习算法(如随机森林算法)获取的新闻情感分数进行调整,相较于传统的只采用随机森林等机器学习算法的新闻情感方向判断方法而言,本申请评分计算的结果准确度更高,覆盖面更广,客户体验更佳。
图1是本申请电子设备一可选的硬件架构的示意图;
图2是本申请电子设备中新闻情感方向判断系统一实施例的程序模块示意图;
图3为本申请新闻情感方向判断方法一实施例的实施流程示意图。
附图标记:
电子设备 | 2 |
存储器 | 21 |
处理器 | 22 |
网络接口 | 23 |
新闻情感方向判断系统 | 20 |
评分模块 | 201 |
调整模块 | 202 |
判断模块 | 203 |
流程步骤 | S31-S33 |
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述
目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。
进一步需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
首先,本申请提出一种电子设备2。
参阅图1所示,是本申请电子设备2一可选的硬件架构的示意图。本实施例中,所述电子设备2可包括,但不限于,可通过系统总线相互通信连接存储器21、处理器22、网络接口23。需要指出的是,图1仅示出了具有组件21-23的电子设备2,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。
其中,所述电子设备2可以是机架式服务器、刀片式服务器、塔式服务器或机柜式服务器等计算设备,该电子设备2可以是独立的服务器,也可以是多个服务器所组成的服务器集群。
所述存储器21至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,所述存储器21可以是所述电子设备2的内部存储单元,例如该电子设备2的硬盘或内存。在另一些实施例中,所述存储器21也可以是所述电子设备2的外部存储设备,例如该电子设备2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述存储器21还可以既包括所述电子设备2的内部存储单元也包括其外部存储设备。本实施例中,所述存储器21通常用于存储安装于所述电子设备2的操作系统和各类应用软件,例如所述新闻情感方向判断系统20的程序代码等。此外,所述存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。
所述处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制所述电子设备2的总体操作,例如执行与所述电子设备2
进行数据交互或者通信相关的控制和处理等。本实施例中,所述处理器22用于运行所述存储器21中存储的程序代码或者处理数据,例如运行所述的新闻情感方向判断系统20等。
所述网络接口23可包括无线网络接口或有线网络接口,该网络接口23通常用于在所述电子设备2与其他电子设备之间建立通信连接。例如,所述网络接口23用于通过网络将所述电子设备2与外部数据平台相连,在所述电子设备2与外部数据平台之间的建立数据传输通道和通信连接。所述网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi等无线或有线网络。
至此,己经详细介绍了本申请各个实施例的应用环境和相关设备的硬件结构和功能。下面,将基于上述应用环境和相关设备,提出本申请的各个实施例。
参阅图2所示,是本申请电子设备2中新闻情感方向判断系统20一实施例的程序模块图。本实施例中,所述的新闻情感方向判断系统20可以被分割成一个或多个程序模块,所述一个或者多个程序模块被存储于所述存储器21中,并由一个或多个处理器(本实施例中为所述处理器22)所执行,以完成本申请。例如,在图2中,所述的新闻情感方向判断系统20可以被分割成评分模块201、调整模块202、以及判断模块203。本申请所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序更适合于描述所述新闻情感方向判断系统20在所述电子设备2中的执行过程。以下将就各程序模块201-203的功能进行详细描述。
所述评分模块201,用于通过预定的机器学习算法,针对待预测新闻进行语义评分,获取该待预测新闻的情感分数。
优选地,在本实施例中,所述预定的机器学习算法可以采用随机森林算法(如开源包weka),其语义评分包括如下步骤:
(1)先人工选择随机森林模型训练集,其中,正面、负面新闻数据内容为每篇新闻的标题;
(2)获取训练集(训练模型)所需中文词向量库(向量库语料可以是开源的维基新闻内容),通过对训练集中的训练样本进行HanLP分词,并用词向量代替分词,对每条训练集数据进行标准化处理;
(3)通过bagging算法选取训练集元组,并经过Radomtree算法训练随机森林模型中的每棵决策树,重复M次,得到M个基分类器;
(4)预测:对于待预测新闻的标题进行向量转换,用上述训练好的基分类器进行预测投票,预测数量最多的类别作为该新闻的类别(如正面类别和负面类别),将预测的指定类别(如类别1)的数量除以决策树的总数量,即
为判断的该指定类别(如类别1)的概率p,其中,概率p的取值范围为[0,1],用公式p=2*p-1换算成取值范围为[-1,1],换算后的数值作为该待预测新闻的情感分数。
举例而言,假设待预测新闻A,经过训练模型(假设训练模型有1000棵决策树)预测。
若其中520棵树预测为类别0(代表负面类别),480棵树预测为类别1(代表正面类别),则此种情形下该待预测新闻A的类别是0,对应的情感分数为score=2*(480/1000)-1=-0.04;
若其中520棵树预测为类别1,480棵树预测为类别0,则此种情形下该待预测新闻A的类别是1,对应的情感分数为score=2*(520/1000)-1=0.04。
所述调整模块202,用于根据预设的事件标签-事件关键词规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数。其中,所述事件标签-事件关键词规则可以设置为第一文件(如第一动态词典),即将所述事件标签-事件关键词规则的具体内容用文件的形式(本实施例为第一文件)进行记录。在本实施例中,该第一文件可以包括如下内容:事件标签(用于区分事件的类别,如发展调整等)、事件关键词(如转型、升级等)、及每个事件关键词对应的情感分数(评分)。
举例而言,所述第一文件可以设置为如下文件A的格式:
在上述文件A中,若从新闻标题中识别到第一行任意一个事件关键词(如“转型”),则该篇新闻的主要经营事件为对应的事件标签(“发展调整”),该篇新闻的情感分数为0.2。
优选地,在本实施例中,可以将事件关键词对应的评分范围设置为[-1,1]。进一步地,可以将该评分范围继续分成若干档的子区间,例如,分成如下四档的子区间:[-1,-0.75),[-0.75,-0.5),[-0.5,-0.04),[-0.04,1],其中,子区间[-1,-0.75)和[-0.75,-0.5)代表重大负面新闻,[-0.5,-0.04)代表一般负面新闻,[-0.04,1]代表正面新闻。同理,所述预定的机器学习算法(如随机森林算法)获取的情感分数范围[-1,1]也可以分成上述四档的子区间。
具体而言,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数包括如下步骤:
遍历该待预测新闻的标题和正文;
若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键词,则将该识别出的事件关键词在所述第一文件中对应的情感分数作为该待
预测新闻的最终评分,并将该识别出的事件关键词对应的事件标签作为该待预测新闻的主要经营事件;
若从该待预测新闻的标题和正文中没有识别出所述第一文件中的事件关键词,则将所述预定的机器学习算法获取的该待预测新闻的情感分数作为该待预测新闻的最终评分。
优选地,在其它实施例中,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括如下步骤:
若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键词,且该识别出的事件关键词在所述第一文件中对应的情感分数与所述预定的机器学习算法获取的情感分数不在同一分档内(即同一分档对应的子区间内,如[-0.04,1]),则以该识别出的事件关键词在所述第一文件中对应的情感分数为主要权重,与所述预定的机器学习算法获取的情感分数进行加权计算,得到一个加权分数作为该待预测新闻的最终评分。
具体而言,所述加权计算包括:将该识别出的事件关键词在所述第一文件中对应的情感分数乘以第一预设比例(如60%),将所述预定的机器学习算法获取的情感分数乘以第二预设比例(如40%),然后将两者的乘积相加得到一个加权分数作为该待预测新闻的最终评分。其中,所述第一预设比例大于第二预设比例,且所述第一预设比例与第二预设比例之和为1。
举例而言,若该识别出的事件关键词在所述第一文件中对应的情感分数为0.2(位于分档子区间[-0.04,1]),而所述预定的机器学习算法获取的情感分数为-0.2(位于分档子区间[-0.5,-0.04)),两者显然不在同一分档内,则本申请以0.2评分为主要权重去调整评分。
优选地,在其它实施例中,所述调整模块202还用于:
根据预设的事件标签-事件正则表达式规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数。其中,所述事件标签-事件正则表达式规则可以设置为第二文件(如第二动态词典),即将所述事件标签-事件正则表达式规则的具体内容用文件的形式(本实施例为第二文件)进行记录。在本实施例中,该第二文件可以包括如下内容:事件标签(用于区分事件的类别,如业绩预增等)、事件正则表达式(根据不同业务经验和相关逻辑进行设定,如下文件B所示)、及每个事件正则表达式对应的情感分数(评分)。
举例而言,所述第二文件可以设置为如下文件B的格式:
在上述文件B中,若从新闻标题中识别出与第一行事件正则表达式符合
的内容,则该篇新闻的主要经营事件为对应的事件标签(如“业绩预增”),该篇新闻的情感分数为0.4。
优选地,可以将事件正则表达式对应的评分范围设置为[-1,1]。进一步地,可以将该评分范围继续分成若干档的子区间,例如,分成如下四档的子区间:[-1,-0.75),[-0.75,-0.5),[-0.5,-0.04),[-0.04,1],其中,子区间[-1,-0.75)和[-0.75,-0.5)代表重大负面新闻,[-0.5,-0.04)代表一般负面新闻,[-0.04,1]代表正面新闻。
进一步地,此种情形下,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括如下步骤:
若从该待预测新闻的标题和正文中识别出与所述第二文件中的事件正则表达式符合的内容,则将该事件正则表达式在所述第二文件中对应的情感分数作为该待预测新闻的最终评分,并将该事件正则表达式对应的事件标签作为该待预测新闻的主要经营事件。
进一步地,此种情形下,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括如下步骤:
若从该待预测新闻的标题和正文中没有识别出所述第一文件中的事件关键词,且没有识别出与所述第二文件中的事件正则表达式符合的内容,则将所述预定的机器学习算法获取的该待预测新闻的情感分数作为该待预测新闻的最终评分。
进一步地,此种情形下,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括如下步骤:
若从该待预测新闻的标题和正文中识别出与所述第二文件中的事件正则表达式符合的内容,且该事件正则表达式在所述第二文件中对应的情感分数与所述预定的机器学习算法获取的情感分数不在同一分档内(即同一分档对应的子区间内,如[-0.04,1]),则以该事件正则表达式在所述第二文件中对应的情感分数为主要权重,与所述预定的机器学习算法获取的情感分数进行加权计算,得到一个加权分数作为该待预测新闻的最终评分。
具体而言,所述加权计算包括:将该事件正则表达式在所述第二文件中对应的情感分数乘以第一预设比例(如60%),将所述预定的机器学习算法获取的情感分数乘以第二预设比例(如40%),然后将两者的乘积相加得到一个加权分数作为该待预测新闻的最终评分。其中,所述第一预设比例大于第二预设比例,且所述第一预设比例与第二预设比例之和为1。
举例而言,若该事件正则表达式在所述第二文件中对应的情感分数为0.4(位于分档子区间[-0.04,1]),而所述预定的机器学习算法获取的情感分数为-0.4(位于分档子区间[-0.5,-0.04)),两者显然不在同一分档内,则本申请以
0.4评分为主要权重去调整评分。
所述判断模块203,用于根据调整得到的该待预测新闻的情感分数,确定该待预测新闻的情感方向。具体而言,若调整得到的该待预测新闻的情感分数位于第一评分区间(如[-1,-0.04)),则确定该待预测新闻的情感方向为负面;若调整得到的该待预测新闻的情感分数位于第二评分区间(如[-0.04,1]),则确定该待预测新闻的情感方向为正面。
需要说明的是,在其它实施例中,还可以进一步对上述第一评分区间或第二评分区间进行细分。例如,可以将所述第一评分区间[-1,-0.04)进一步划分成子区间[-1,-0.5)和[-0.5,-0.04),其中,子区间[-1,-0.5)代表重大负面新闻,子区间[-0.5,-0.04)代表一般负面新闻。
通过上述程序模块201-203,本申请所提出的新闻情感方向判断系统20,通过预设的事件标签命中规则(包括事件关键字或事件正则表达式),对机器学习算法(如随机森林算法)获取的新闻情感分数进行调整,相较于传统的只采用随机森林等机器学习算法的新闻情感方向判断方法而言,本申请评分计算的结果准确度更高,覆盖面更广,客户体验更佳。
此外,本申请还提出一种新闻情感方向判断方法。
参阅图3所示,是本申请新闻情感方向判断方法一实施例的实施流程示意图。在本实施例中,根据不同的需求,图3所示的流程图中的步骤的执行顺序可以改变,某些步骤可以省略。
步骤S31,通过预定的机器学习算法,针对待预测新闻进行语义评分,获取该待预测新闻的情感分数。
优选地,在本实施例中,所述预定的机器学习算法可以采用随机森林算法(如开源包weka),其语义评分包括如下步骤:
(1)先人工选择随机森林模型训练集,其中,正面、负面新闻数据内容为每篇新闻的标题;
(2)获取训练集(训练模型)所需中文词向量库(向量库语料可以是开源的维基新闻内容),通过对训练集中的训练样本进行HanLP分词,并用词向量代替分词,对每条训练集数据进行标准化处理;
(3)通过bagging算法选取训练集元组,并经过Radomtree算法训练随机森林模型中的每棵决策树,重复M次,得到M个基分类器;
(4)预测:对于待预测新闻的标题进行向量转换,用上述训练好的基分类器进行预测投票,预测数量最多的类别作为该新闻的类别(如正面类别和负面类别),将预测的指定类别(如类别1)的数量除以决策树的总数量,即为判断的该指定类别(如类别1)的概率p,其中,概率p的取值范围为[0,1],用公式p=2*p-1换算成取值范围为[-1,1],换算后的数值作为该待预测新闻的
情感分数。
举例而言,假设待预测新闻A,经过训练模型(假设训练模型有1000棵决策树)预测。
若其中520棵树预测为类别0(代表负面类别),480棵树预测为类别1(代表正面类别),则此种情形下该待预测新闻A的类别是0,对应的情感分数为score=2*(480/1000)-1=-0.04;
若其中520棵树预测为类别1,480棵树预测为类别0,则此种情形下该待预测新闻A的类别是1,对应的情感分数为score=2*(520/1000)-1=0.04。
步骤S32,根据预设的事件标签-事件关键词规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数。其中,所述事件标签-事件关键词规则可以设置为第一文件(如第一动态词典),即将所述事件标签-事件关键词规则的具体内容用文件的形式(本实施例为第一文件)进行记录。在本实施例中,该第一文件可以包括如下内容:事件标签(用于区分事件的类别,如发展调整等)、事件关键词(如转型、升级等)、及每个事件关键词对应的情感分数(评分)。
举例而言,所述第一文件可以设置为如下表格文件A的格式:
在上述文件A中,若从新闻标题中识别到第一行任意一个事件关键词(如“转型”),则该篇新闻的主要经营事件为对应的事件标签(“发展调整”),该篇新闻的情感分数为0.2。
优选地,在本实施例中,可以将事件关键词对应的评分范围设置为[-1,1]。进一步地,可以将该评分范围继续分成若干档的子区间,例如,分成如下四档的子区间:[-1,-0.75),[-0.75,-0.5),[-0.5,-0.04),[-0.04,1],其中,子区间[-1,-0.75)和[-0.75,-0.5)代表重大负面新闻,[-0.5,-0.04)代表一般负面新闻,[-0.04,1]代表正面新闻。同理,所述预定的机器学习算法(如随机森林算法)获取的情感分数范围[-1,1]也可以分成上述四档的子区间。
具体而言,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数包括如下步骤:
遍历该待预测新闻的标题和正文;
若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键词,则将该识别出的事件关键词在所述第一文件中对应的情感分数作为该待预测新闻的最终评分,并将该识别出的事件关键词对应的事件标签作为该待预测新闻的主要经营事件;
若从该待预测新闻的标题和正文中没有识别出所述第一文件中的事件关键词,则将所述预定的机器学习算法获取的该待预测新闻的情感分数作为该待预测新闻的最终评分。
优选地,在其它实施例中,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括如下步骤:
若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键词,且该识别出的事件关键词在所述第一文件中对应的情感分数与所述预定的机器学习算法获取的情感分数不在同一分档内(即同一分档对应的子区间内,如[-0.04,1]),则以该识别出的事件关键词在所述第一文件中对应的情感分数为主要权重,与所述预定的机器学习算法获取的情感分数进行加权计算,得到一个加权分数作为该待预测新闻的最终评分。
具体而言,所述加权计算包括:将该识别出的事件关键词在所述第一文件中对应的情感分数乘以第一预设比例(如60%),将所述预定的机器学习算法获取的情感分数乘以第二预设比例(如40%),然后将两者的乘积相加得到一个加权分数作为该待预测新闻的最终评分。其中,所述第一预设比例大于第二预设比例,且所述第一预设比例与第二预设比例之和为1。
举例而言,若该识别出的事件关键词在所述第一文件中对应的情感分数为0.2(位于分档子区间[-0.04,1]),而所述预定的机器学习算法获取的情感分数为-0.2(位于分档子区间[-0.5,-0.04)),两者显然不在同一分档内,则本申请以0.2评分为主要权重去调整评分。
优选地,在其它实施例中,步骤S32还包括如下步骤:
根据预设的事件标签-事件正则表达式规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数。其中,所述事件标签-事件正则表达式规则可以设置为第二文件(如第二动态词典),即将所述事件标签-事件正则表达式规则的具体内容用文件的形式(本实施例为第二文件)进行记录。在本实施例中,该第二文件可以包括如下内容:事件标签(用于区分事件的类别,如业绩预增等)、事件正则表达式(根据不同业务经验和相关逻辑进行设定,如下文件B所示)、及每个事件正则表达式对应的情感分数(评分)。
举例而言,所述第二文件可以设置为如下表格文件B的格式:
在上述文件B中,若从新闻标题中识别出与第一行事件正则表达式符合的内容,则该篇新闻的主要经营事件为对应的事件标签(如“业绩预增”),该篇新闻的情感分数为0.4。
优选地,可以将事件正则表达式对应的评分范围设置为[-1,1]。进一步地,可以将该评分范围继续分成若干档的子区间,例如,分成如下四档的子区间:[-1,-0.75),[-0.75,-0.5),[-0.5,-0.04),[-0.04,1],其中,子区间[-1,-0.75)和[-0.75,-0.5)代表重大负面新闻,[-0.5,-0.04)代表一般负面新闻,[-0.04,1]代表正面新闻。
进一步地,此种情形下,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括如下步骤:
若从该待预测新闻的标题和正文中识别出与所述第二文件中的事件正则表达式符合的内容,则将该事件正则表达式在所述第二文件中对应的情感分数作为该待预测新闻的最终评分,并将该事件正则表达式对应的事件标签作为该待预测新闻的主要经营事件。
进一步地,此种情形下,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括如下步骤:
若从该待预测新闻的标题和正文中没有识别出所述第一文件中的事件关键词,且没有识别出与所述第二文件中的事件正则表达式符合的内容,则将所述预定的机器学习算法获取的该待预测新闻的情感分数作为该待预测新闻的最终评分。
进一步地,此种情形下,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括如下步骤:
若从该待预测新闻的标题和正文中识别出与所述第二文件中的事件正则表达式符合的内容,且该事件正则表达式在所述第二文件中对应的情感分数与所述预定的机器学习算法获取的情感分数不在同一分档内(即同一分档对应的子区间内,如[-0.04,1]),则以该事件正则表达式在所述第二文件中对应的情感分数为主要权重,与所述预定的机器学习算法获取的情感分数进行加权计算,得到一个加权分数作为该待预测新闻的最终评分。
具体而言,所述加权计算包括:将该事件正则表达式在所述第二文件中对应的情感分数乘以第一预设比例(如60%),将所述预定的机器学习算法获取的情感分数乘以第二预设比例(如40%),然后将两者的乘积相加得到一个加权分数作为该待预测新闻的最终评分。其中,所述第一预设比例大于第二预设比例,且所述第一预设比例与第二预设比例之和为1。
举例而言,若该事件正则表达式在所述第二文件中对应的情感分数为0.4(位于分档子区间[-0.04,1]),而所述预定的机器学习算法获取的情感分数为-0.4(位于分档子区间[-0.5,-0.04)),两者显然不在同一分档内,则本申请以0.4评分为主要权重去调整评分。
步骤S33,根据调整得到的该待预测新闻的情感分数,确定该待预测新闻
的情感方向。具体而言,若调整得到的该待预测新闻的情感分数位于第一评分区间(如[-1,-0.04)),则确定该待预测新闻的情感方向为负面;若调整得到的该待预测新闻的情感分数位于第二评分区间(如[-0.04,1]),则确定该待预测新闻的情感方向为正面。
需要说明的是,在其它实施例中,还可以进一步对上述第一评分区间或第二评分区间进行细分。例如,可以将所述第一评分区间[-1,-0.04)进一步划分成子区间[-1,-0.5)和[-0.5,-0.04),其中,子区间[-1,-0.5)代表重大负面新闻,子区间[-0.5,-0.04)代表一般负面新闻。
通过上述步骤S31-S33,本申请所提出的新闻情感方向判断方法,通过预设的事件标签命中规则(包括事件关键字或事件正则表达式),对机器学习算法(如随机森林算法)获取的新闻情感分数进行调整,相较于传统的只采用随机森林等机器学习算法的新闻情感方向判断方法而言,本申请评分计算的结果准确度更高,覆盖面更广,客户体验更佳。
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质(如ROM/RAM、磁碟、光盘),所述计算机可读存储介质存储有新闻情感方向判断系统20,所述新闻情感方向判断系统20可被至少一个处理器22执行,以使所述至少一个处理器22执行如上所述的新闻情感方向判断方法的步骤。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件来实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。
以上参照附图说明了本申请的优选实施例,并非因此局限本申请的权利范围。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。另外,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
本领域技术人员不脱离本申请的范围和实质,可以有多种变型方案实现本申请,比如作为一个实施例的特征可用于另一实施例而得到又一实施例。凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。
Claims (20)
- 一种新闻情感方向判断方法,应用于电子设备,其特征在于,所述方法包括:通过预定的机器学习算法,针对待预测新闻进行语义评分,获取该待预测新闻的情感分数;根据预设的事件标签-事件关键词规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数;及根据调整得到的该待预测新闻的情感分数,确定该待预测新闻的情感方向。
- 如权利要求1所述的新闻情感方向判断方法,其特征在于,所述事件标签-事件关键词规则设置为第一文件,该第一文件包括用于区分事件类别的事件标签、事件关键词、及每个事件关键词对应的情感分数。
- 如权利要求2所述的新闻情感方向判断方法,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数包括:遍历该待预测新闻的标题和正文;若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键词,则将该识别出的事件关键词在所述第一文件中对应的情感分数作为该待预测新闻的最终评分,并将该识别出的事件关键词对应的事件标签作为该待预测新闻的主要经营事件;及若从该待预测新闻的标题和正文中没有识别出所述第一文件中的事件关键词,则将所述预定的机器学习算法获取的该待预测新闻的情感分数作为该待预测新闻的最终评分。
- 如权利要求3所述的新闻情感方向判断方法,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括:若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键词,且该识别出的事件关键词在所述第一文件中对应的情感分数与所述预定的机器学习算法获取的情感分数不在同一分档内,则以该识别出的事件关键词在所述第一文件中对应的情感分数为主要权重,与所述预定的机器学习算法获取的情感分数进行加权计算,得到一个加权分数作为该待预测新闻的最终评分。
- 如权利要求4所述的新闻情感方向判断方法,其特征在于,所述加权计算包括:将该识别出的事件关键词在所述第一文件中对应的情感分数乘以第一预设比例,将所述预定的机器学习算法获取的情感分数乘以第二预设比例;及将两者的乘积相加得到一个加权分数作为该待预测新闻的最终评分,其中,所述第一预设比例大于第二预设比例,且所述第一预设比例与第二预设比例之和为1。
- 如权利要求1或2所述的新闻情感方向判断方法,其特征在于,该方法还包括:根据预设的事件标签-事件正则表达式规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数,其中,所述事件标签-事件正则表达式规则设置为第二文件,该第二文件包括用于区分事件类别的事件标签、事件正则表达式、及每个事件正则表达式对应的情感分数。
- 如权利要求6所述的新闻情感方向判断方法,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数包括:若从该待预测新闻的标题和正文中识别出与所述第二文件中的事件正则表达式符合的内容,则将该事件正则表达式在所述第二文件中对应的情感分数作为该待预测新闻的最终评分,并将该事件正则表达式对应的事件标签作为该待预测新闻的主要经营事件;及若从该待预测新闻的标题和正文中没有识别出所述第一文件中的事件关键词,且没有识别出与所述第二文件中的事件正则表达式符合的内容,则将所述预定的机器学习算法获取的该待预测新闻的情感分数作为该待预测新闻的最终评分。
- 如权利要求7所述的新闻情感方向判断方法,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括:若从该待预测新闻的标题和正文中识别出与所述第二文件中的事件正则表达式符合的内容,且该事件正则表达式在所述第二文件中对应的情感分数与所述预定的机器学习算法获取的情感分数不在同一分档内,则以该事件正则表达式在所述第二文件中对应的情感分数为主要权重,与所述预定的机器学习算法获取的情感分数进行加权计算,得到一个加权分数作为该待预测新闻的最终评分。
- 一种电子设备,其特征在于,所述电子设备包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的新闻情感方向判断系统,所述新闻情感方向判断系统被所述处理器执行时,所述处理器执行如下步骤:通过预定的机器学习算法,针对待预测新闻进行语义评分,获取该待预测新闻的情感分数;根据预设的事件标签-事件关键词规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数;及根据调整得到的该待预测新闻的情感分数,确定该待预测新闻的情感方 向。
- 如权利要求9所述的电子设备,其特征在于,所述事件标签-事件关键词规则设置为第一文件,该第一文件包括用于区分事件类别的事件标签、事件关键词、及每个事件关键词对应的情感分数。
- 如权利要求10所述的电子设备,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数包括:遍历该待预测新闻的标题和正文;若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键词,则将该识别出的事件关键词在所述第一文件中对应的情感分数作为该待预测新闻的最终评分,并将该识别出的事件关键词对应的事件标签作为该待预测新闻的主要经营事件;及若从该待预测新闻的标题和正文中没有识别出所述第一文件中的事件关键词,则将所述预定的机器学习算法获取的该待预测新闻的情感分数作为该待预测新闻的最终评分。
- 如权利要求11所述的电子设备,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括:若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键词,且该识别出的事件关键词在所述第一文件中对应的情感分数与所述预定的机器学习算法获取的情感分数不在同一分档内,则以该识别出的事件关键词在所述第一文件中对应的情感分数为主要权重,与所述预定的机器学习算法获取的情感分数进行加权计算,得到一个加权分数作为该待预测新闻的最终评分。
- 如权利要求12所述的电子设备,其特征在于,所述加权计算包括:将该识别出的事件关键词在所述第一文件中对应的情感分数乘以第一预设比例,将所述预定的机器学习算法获取的情感分数乘以第二预设比例;及将两者的乘积相加得到一个加权分数作为该待预测新闻的最终评分,其中,所述第一预设比例大于第二预设比例,且所述第一预设比例与第二预设比例之和为1。
- 如权利要求9或10所述的电子设备,其特征在于,所述新闻情感方向判断系统被所述处理器执行时,所述处理器还执行如下步骤:根据预设的事件标签-事件正则表达式规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数,其中,所述事件标签-事件正则表达式规则设置为第二文件,该第二文件包括用于区分事件类别的事件标签、事件正则表达式、及每个事件正则表达式对应的情感分数。
- 如权利要求14所述的电子设备,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数包括:若从该待预测新闻的标题和正文中识别出与所述第二文件中的事件正则表达式符合的内容,则将该事件正则表达式在所述第二文件中对应的情感分数作为该待预测新闻的最终评分,并将该事件正则表达式对应的事件标签作为该待预测新闻的主要经营事件;及若从该待预测新闻的标题和正文中没有识别出所述第一文件中的事件关键词,且没有识别出与所述第二文件中的事件正则表达式符合的内容,则将所述预定的机器学习算法获取的该待预测新闻的情感分数作为该待预测新闻的最终评分。
- 如权利要求15所述的电子设备,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括:若从该待预测新闻的标题和正文中识别出与所述第二文件中的事件正则表达式符合的内容,且该事件正则表达式在所述第二文件中对应的情感分数与所述预定的机器学习算法获取的情感分数不在同一分档内,则以该事件正则表达式在所述第二文件中对应的情感分数为主要权重,与所述预定的机器学习算法获取的情感分数进行加权计算,得到一个加权分数作为该待预测新闻的最终评分。
- 一种计算机可读存储介质,所述计算机可读存储介质存储有新闻情感方向判断系统,所述新闻情感方向判断系统可被至少一个处理器执行,以使所述至少一个处理器执行如下步骤:通过预定的机器学习算法,针对待预测新闻进行语义评分,获取该待预测新闻的情感分数;根据预设的事件标签-事件关键词规则,调整所述预定的机器学习算法获取的该待预测新闻的情感分数;及根据调整得到的该待预测新闻的情感分数,确定该待预测新闻的情感方向。
- 如权利要求17所述的计算机可读存储介质,其特征在于,所述事件标签-事件关键词规则设置为第一文件,该第一文件包括用于区分事件类别的事件标签、事件关键词、及每个事件关键词对应的情感分数。
- 如权利要求18所述的计算机可读存储介质,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数包括:遍历该待预测新闻的标题和正文;若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键 词,则将该识别出的事件关键词在所述第一文件中对应的情感分数作为该待预测新闻的最终评分,并将该识别出的事件关键词对应的事件标签作为该待预测新闻的主要经营事件;及若从该待预测新闻的标题和正文中没有识别出所述第一文件中的事件关键词,则将所述预定的机器学习算法获取的该待预测新闻的情感分数作为该待预测新闻的最终评分。
- 如权利要求19所述的计算机可读存储介质,其特征在于,所述调整所述预定的机器学习算法获取的该待预测新闻的情感分数还包括:若从该待预测新闻的标题和正文中识别出所述第一文件中的事件关键词,且该识别出的事件关键词在所述第一文件中对应的情感分数与所述预定的机器学习算法获取的情感分数不在同一分档内,则以该识别出的事件关键词在所述第一文件中对应的情感分数为主要权重,与所述预定的机器学习算法获取的情感分数进行加权计算,得到一个加权分数作为该待预测新闻的最终评分。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710775417.9A CN107688651B (zh) | 2017-08-31 | 2017-08-31 | 新闻情感方向判断方法、电子设备及计算机可读存储介质 |
CN2017107754179 | 2017-08-31 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2019041528A1 true WO2019041528A1 (zh) | 2019-03-07 |
Family
ID=61155954
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2017/108811 WO2019041528A1 (zh) | 2017-08-31 | 2017-10-31 | 新闻情感方向判断方法、电子设备及计算机可读存储介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN107688651B (zh) |
WO (1) | WO2019041528A1 (zh) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111428118A (zh) * | 2019-11-08 | 2020-07-17 | 华东理工大学 | 一种检测事件可靠性的方法及电子设备 |
CN111858903A (zh) * | 2020-06-11 | 2020-10-30 | 创新工场(北京)企业管理股份有限公司 | 一种用于负面新闻预警的方法和装置 |
CN113704501A (zh) * | 2021-08-10 | 2021-11-26 | 上海硬通网络科技有限公司 | 应用的标签获取方法、装置、电子设备及存储介质 |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109783800B (zh) * | 2018-12-13 | 2024-04-12 | 北京百度网讯科技有限公司 | 情感关键词的获取方法、装置、设备及存储介质 |
CN114186559B (zh) * | 2021-12-09 | 2022-09-13 | 北京深维智信科技有限公司 | 一种从销售会话中确定会话主体角色标签的方法及系统 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120041953A1 (en) * | 2010-08-16 | 2012-02-16 | Microsoft Corporation | Text mining of microblogs using latent topic labels |
CN102682130A (zh) * | 2012-05-17 | 2012-09-19 | 苏州大学 | 一种文本情感分类方法及系统 |
CN103544321A (zh) * | 2013-11-06 | 2014-01-29 | 北京国双科技有限公司 | 用于微博情感信息的数据处理方法和装置 |
CN106202372A (zh) * | 2016-07-08 | 2016-12-07 | 中国电子科技网络信息安全有限公司 | 一种网络文本信息情感分类的方法 |
CN106294326A (zh) * | 2016-08-23 | 2017-01-04 | 成都科来软件有限公司 | 一种新闻报道情感倾向分析方法 |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8311973B1 (en) * | 2011-09-24 | 2012-11-13 | Zadeh Lotfi A | Methods and systems for applications for Z-numbers |
CN102831184B (zh) * | 2012-08-01 | 2016-03-02 | 中国科学院自动化研究所 | 根据对社会事件的文字描述来预测社会情感的方法及系统 |
CN102929861B (zh) * | 2012-10-22 | 2015-07-22 | 杭州东信北邮信息技术有限公司 | 一种文本情感指数计算方法和系统 |
CN103778215B (zh) * | 2014-01-17 | 2016-08-17 | 北京理工大学 | 一种基于情感分析和隐马尔科夫模型融合的股市预测方法 |
CN105740228B (zh) * | 2016-01-25 | 2019-06-04 | 云南大学 | 一种互联网舆情分析方法及系统 |
CN106897439B (zh) * | 2017-02-28 | 2020-04-14 | 百度在线网络技术(北京)有限公司 | 文本的情感识别方法、装置、服务器以及存储介质 |
-
2017
- 2017-08-31 CN CN201710775417.9A patent/CN107688651B/zh active Active
- 2017-10-31 WO PCT/CN2017/108811 patent/WO2019041528A1/zh active Application Filing
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120041953A1 (en) * | 2010-08-16 | 2012-02-16 | Microsoft Corporation | Text mining of microblogs using latent topic labels |
CN102682130A (zh) * | 2012-05-17 | 2012-09-19 | 苏州大学 | 一种文本情感分类方法及系统 |
CN103544321A (zh) * | 2013-11-06 | 2014-01-29 | 北京国双科技有限公司 | 用于微博情感信息的数据处理方法和装置 |
CN106202372A (zh) * | 2016-07-08 | 2016-12-07 | 中国电子科技网络信息安全有限公司 | 一种网络文本信息情感分类的方法 |
CN106294326A (zh) * | 2016-08-23 | 2017-01-04 | 成都科来软件有限公司 | 一种新闻报道情感倾向分析方法 |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111428118A (zh) * | 2019-11-08 | 2020-07-17 | 华东理工大学 | 一种检测事件可靠性的方法及电子设备 |
CN111428118B (zh) * | 2019-11-08 | 2023-04-11 | 华东理工大学 | 一种检测事件可靠性的方法及电子设备 |
CN111858903A (zh) * | 2020-06-11 | 2020-10-30 | 创新工场(北京)企业管理股份有限公司 | 一种用于负面新闻预警的方法和装置 |
CN113704501A (zh) * | 2021-08-10 | 2021-11-26 | 上海硬通网络科技有限公司 | 应用的标签获取方法、装置、电子设备及存储介质 |
CN113704501B (zh) * | 2021-08-10 | 2024-05-31 | 上海硬通网络科技有限公司 | 应用的标签获取方法、装置、电子设备及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN107688651B (zh) | 2021-11-16 |
CN107688651A (zh) | 2018-02-13 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021051517A1 (zh) | 基于卷积神经网络的信息检索方法、及其相关设备 | |
US10262059B2 (en) | Method, apparatus, and storage medium for text information processing | |
WO2019041528A1 (zh) | 新闻情感方向判断方法、电子设备及计算机可读存储介质 | |
WO2019061989A1 (zh) | 贷款风险控制方法、电子装置及可读存储介质 | |
WO2019184217A1 (zh) | 热点事件分类方法、装置及存储介质 | |
WO2019091026A1 (zh) | 知识库文档快速检索方法、应用服务器及计算机可读存储介质 | |
US10637826B1 (en) | Policy compliance verification using semantic distance and nearest neighbor search of labeled content | |
WO2019037258A1 (zh) | 信息推荐的装置、方法、系统及计算机可读存储介质 | |
TWI677828B (zh) | 基於資料源的業務客製裝置、方法及電腦可讀儲存介質 | |
WO2020087774A1 (zh) | 基于概念树的意图识别方法、装置及计算机设备 | |
WO2020259280A1 (zh) | 日志管理方法、装置、网络设备和可读存储介质 | |
CN109508373B (zh) | 企业舆情指数的计算方法、设备及计算机可读存储介质 | |
CN112686022A (zh) | 违规语料的检测方法、装置、计算机设备及存储介质 | |
WO2022048363A1 (zh) | 网站分类方法、装置、计算机设备及存储介质 | |
CN110083832B (zh) | 文章转载关系的识别方法、装置、设备及可读存储介质 | |
WO2023029356A1 (zh) | 基于句向量模型的句向量生成方法、装置及计算机设备 | |
CN107861948B (zh) | 一种标签提取方法、装置、设备和介质 | |
WO2019085332A1 (zh) | 金融数据分析方法、应用服务器及计算机可读存储介质 | |
CN107924398B (zh) | 用于提供以评论为中心的新闻阅读器的系统和方法 | |
CN111369148A (zh) | 对象指标的监测方法、电子装置及存储介质 | |
CN110825868A (zh) | 一种基于话题热度的文本推送方法、终端设备及存储介质 | |
CN106663123B (zh) | 以评论为中心的新闻阅读器 | |
CN109753646B (zh) | 一种文章属性识别方法以及电子设备 | |
CN111737607B (zh) | 数据处理方法、装置、电子设备以及存储介质 | |
WO2021174814A1 (zh) | 众包任务的答案验证方法、装置、计算机设备及存储介质 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 09.10.2020) |
|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 17922974 Country of ref document: EP Kind code of ref document: A1 |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 17922974 Country of ref document: EP Kind code of ref document: A1 |