CN109858026A - Text emotion analysis method, device, computer equipment and storage medium - Google Patents

Text emotion analysis method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN109858026A
CN109858026A CN201910043351.3A CN201910043351A CN109858026A CN 109858026 A CN109858026 A CN 109858026A CN 201910043351 A CN201910043351 A CN 201910043351A CN 109858026 A CN109858026 A CN 109858026A
Authority
CN
China
Prior art keywords
text
analyzed
paragraph
unit
phrase
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910043351.3A
Other languages
Chinese (zh)
Inventor
刘顺
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201910043351.3A priority Critical patent/CN109858026A/en
Publication of CN109858026A publication Critical patent/CN109858026A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the invention discloses a kind of text emotion analysis method, device, computer equipment and storage mediums.The present invention applies in the disaggregated model field in intelligent decision.This method comprises: obtaining text to be analyzed by the way of web crawlers and judging the type of the text to be analyzed according to the content of the text to be analyzed;If the type of the text to be analyzed is long text, the long text is subjected to the first pretreatment and obtains the phrase to be analyzed as unit of paragraph;It is matched according to default sentiment dictionary with the phrase to be analyzed with the emotional value of the determination paragraph;The emotional value of the paragraph in the long text is subjected to sum-average arithmetic and obtains the emotional value of the long text;The Sentiment orientation of the long text is determined according to the emotional value of the long text.Method by implementing the embodiment of the present invention can control the emotional value of long text in reasonable section, efficiently avoid the defect that the emotional value of long text is amplified, improve the accuracy of sentiment analysis.

Description

Text emotion analysis method, device, computer equipment and storage medium
Technical field
The present invention relates to field of artificial intelligence more particularly to a kind of text emotion analysis method, device, computer to set Standby and storage medium.
Background technique
With science and technology and expanding economy, the information of flood tide is generated in people's lives daily, in information of today Generation, the value ever more important of information also more pay attention to the analysis of information.Sentiment analysis carries out emotion as a kind of pair of information Method for analyzing tendentiousness is widely applied in public sentiment monitoring, box office receipts prediction and shares changing tendency prediction field.However, Existing text emotion analysis method tends not to unification for the sentiment analysis of long text and short text, holds in long text analysis Easily there is the phenomenon that sentiment analysis result is amplified.
Summary of the invention
The embodiment of the invention provides a kind of text emotion analysis method, device, computer equipment and storage mediums, it is intended to Solve the problems, such as that the sentiment analysis result of long text is easy to be amplified.
In a first aspect, the embodiment of the invention provides a kind of text emotion analysis methods comprising: using web crawlers Mode obtains text to be analyzed and judges the type of the text to be analyzed according to the content of the text to be analyzed;If it is described to The type for analyzing text is long text, and the long text is carried out the first pretreatment and obtains the word to be analyzed as unit of paragraph Group;It is matched according to default sentiment dictionary with the phrase to be analyzed with the emotional value of the determination paragraph;By the long article The emotional value of the paragraph in this carries out sum-average arithmetic and obtains the emotional value of the long text;According to the emotion of the long text Value determines the Sentiment orientation of the long text.
Second aspect, the embodiment of the invention also provides a kind of text emotion analytical equipments comprising: judging unit is used In obtaining text to be analyzed by the way of web crawlers and judge the text to be analyzed according to the content of the text to be analyzed This type;It is pre- to be carried out first if the type for the text to be analyzed is long text by pretreatment unit for the long text Processing obtains the phrase to be analyzed as unit of paragraph;Matching unit, for according to default sentiment dictionary and the word to be analyzed Group is matched with the emotional value of the determination paragraph;Sum-average arithmetic unit, for by the paragraph in the long text Emotional value carries out sum-average arithmetic and obtains the emotional value of the long text;Determination unit, for the emotional value according to the long text Determine the Sentiment orientation of the long text.
The third aspect, the embodiment of the invention also provides a kind of computer equipments comprising memory and processor, it is described Computer program is stored on memory, the processor realizes the above method when executing the computer program.
Fourth aspect, the embodiment of the invention also provides a kind of computer readable storage medium, the storage medium storage There is computer program, the computer program can realize the above method when being executed by a processor.
The embodiment of the invention provides a kind of text emotion analysis method, device, computer equipment and storage mediums.Its In, which comprises text to be analyzed is obtained by the way of web crawlers and is sentenced according to the content of the text to be analyzed Break the type of the text to be analyzed;If the type of the text to be analyzed is long text, it is pre- that the long text is carried out first Processing obtains the phrase to be analyzed as unit of paragraph;It is matched according to default sentiment dictionary with the phrase to be analyzed with true The emotional value of the fixed paragraph;The emotional value of the paragraph in the long text is subjected to sum-average arithmetic and obtains the long text Emotional value;The Sentiment orientation of the long text is determined according to the emotional value of the long text.The embodiment of the present invention passes through default Sentiment dictionary determines the emotional value of paragraph in long text, and the emotional value of paragraph in long text is carried out sum-average arithmetic and obtains long article This emotional value efficiently avoids the emotion of long text, it can be achieved that by the emotional value control of long text in reasonable section The defect that value is amplified improves the accuracy of sentiment analysis.
Detailed description of the invention
Technical solution in order to illustrate the embodiments of the present invention more clearly, below will be to needed in embodiment description Attached drawing is briefly described, it should be apparent that, drawings in the following description are some embodiments of the invention, general for this field For logical technical staff, without creative efforts, it is also possible to obtain other drawings based on these drawings.
Fig. 1 is the application scenarios schematic diagram of text emotion analysis method provided in an embodiment of the present invention;
Fig. 2 is the flow diagram of text emotion analysis method provided in an embodiment of the present invention;
Fig. 3 is the sub-process schematic diagram of text emotion analysis method provided in an embodiment of the present invention;
Fig. 4 is the sub-process schematic diagram of text emotion analysis method provided in an embodiment of the present invention;
Fig. 5 is the sub-process schematic diagram of text emotion analysis method provided in an embodiment of the present invention;
Fig. 6 be another embodiment of the present invention provides text emotion analysis method flow diagram;
Fig. 7 is the schematic block diagram of text emotion analytical equipment provided in an embodiment of the present invention;
Fig. 8 is the schematic block diagram of the specific unit of text emotion analytical equipment provided in an embodiment of the present invention;And
Fig. 9 is the schematic block diagram of computer equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair Embodiment in bright, every other implementation obtained by those of ordinary skill in the art without making creative efforts Example, shall fall within the protection scope of the present invention.
It should be appreciated that ought use in this specification and in the appended claims, term " includes " and "comprising" instruction Described feature, entirety, step, operation, the presence of element and/or component, but one or more of the other feature, whole is not precluded Body, step, operation, the presence or addition of element, component and/or its set.
It is also understood that mesh of the term used in this description of the invention merely for the sake of description specific embodiment And be not intended to limit the present invention.As description of the invention and it is used in the attached claims, unless on Other situations are hereafter clearly indicated, otherwise " one " of singular, "one" and "the" are intended to include plural form.
It will be further appreciated that the term "and/or" used in description of the invention and the appended claims is Refer to any combination and all possible combinations of one or more of associated item listed, and including these combinations.
Fig. 1 and Fig. 2 are please referred to, Fig. 1 is that the application scenarios of text emotion analysis method provided in an embodiment of the present invention are illustrated Figure.Fig. 2 is the schematic flow chart of text emotion analysis method provided in an embodiment of the present invention.Text sentiment analysis method tool Body is applied in terminal 10, by interacting realization between terminal 10 and server 20.
Fig. 2 is the flow diagram of text emotion analysis method provided in an embodiment of the present invention.As shown, this method packet Include following steps S110-S150.
S110, text to be analyzed is obtained by the way of web crawlers and institute is judged according to the content of the text to be analyzed State the type of text to be analyzed.
In one embodiment, obtain text to be analyzed by the way of web crawlers, web crawlers refer to it is a kind of according to Certain rule automatically grabs the program of web message in server.Specifically, specific webpage is chosen first as just Beginning page selects microblogging, Sina and Tencent etc. as initial page for example, monitoring field in public sentiment, or leads in Prediction of Stock Index Domain selects east wealth, straight flush and huge damp net as initial page, or predicts field in box office receipts, selection opal, Bean cotyledon and Meituan etc. are used as initial page;Then it is crawled since initial page, other chained addresses is grabbed in initial page, then Next webpage is found by these chained addresses again, repeats the above process and is finished until crawling the content of all websites, most Accessed web page contents are subjected to data cleansing afterwards, the filtering of the extraneous datas such as link, picture in web page contents is final To text to be analyzed.Need further to judge the type of the text to be analyzed after obtaining text to be analyzed comprising long text And short text two types, the content by scanning text to be analyzed is judged, if text to be analyzed has paragraph, is sentenced The fixed text to be analyzed is long text;If text to be analyzed does not have paragraph, determine that the text to be analyzed is short text.
If the type of S120, the text to be analyzed be long text, by the long text carry out first pretreatment obtain with Paragraph is the phrase to be analyzed of unit.
In one embodiment, as shown in figure 3, the step S120 may include step S121-S123.
S121, the long text is segmented to obtain multiple paragraphs according to default chopping rule.
S122, the sentence as unit of paragraph is obtained to paragraph progress subordinate sentence according to default punctuation mark.
S123, according to participle tool to the sentence as unit of paragraph segmented to obtain as unit of paragraph to Analyze phrase.
In one embodiment, it is the content of text with paragraph that long text is specified, for example, news and article etc..First Pretreatment refers to for long text being segmented, subordinate sentence and participle, is segmented long text to obtain multiple paragraphs first, In to preset chopping rule include: that can be segmented according to every row sentence-initial with the presence or absence of space, or carried out according to subhead Segmentation, or be segmented according to blank line, for example, including tri- titles of A, B and C in text, according to tri- titles of ABC It is divided into three paragraphs.Then each paragraph progress subordinate sentence is obtained into multiple sentences, wherein default punctuation mark includes fullstop, asks Number and exclamation mark, specifically, using fullstop, question mark and exclamation mark as the ending of each sentence carry out subordinate sentence, for example, " what For bomb? bomb is a kind of weapon filled with explosive substance, has great risk.Therefore, it please be sure to remote From!" wherein, " what is bomb? " it is to be divided into one with question mark ending;" bomb is a kind of weapon filled with explosive substance, With great risk." it is to be divided into one with fullstop ending;" therefore, ask everybody separate!" it is to be ended up with exclamation mark Be divided into one.Finally each sentence is segmented again, participle is referred to continuous word sequence according to certain specification weight Combination nova is specifically segmented by participle tool at the process of word sequence, for example, jieba, SnowNLP and NLPIR Equal participles tool, participle tool is used to a chinese character sequence being cut into individual word one by one, for example, " today, weather was true Well ", " today/weather/very good " is obtained after participle.It should be noted that above-mentioned subordinate sentence is carried out according to as unit of paragraph Subordinate sentence, participle is also to be segmented according to as unit of paragraph, for example, including tri- paragraphs of X, Y, Z in text, to X, Y, Z tri- A paragraph carries out subordinate sentence and obtains the sentence of tri- paragraphs of X, Y, Z, then is segmented to obtain X, Y, Z tri- to tri- paragraphs of X, Y, Z The phrase to be analyzed of paragraph.
S130, it is matched according to default sentiment dictionary with the phrase to be analyzed with the emotional value of the determination paragraph.
In one embodiment, as shown in figure 4, the step S130 may include step S131-S133.
S131, it is carried out matching point for obtaining the phrase to be analyzed with the phrase to be analyzed according to default sentiment dictionary Value.
S132, the emotional value that the sentence as unit of paragraph is determined according to the score value of the phrase to be analyzed.
S133, the emotional value that the paragraph is determined according to the emotional value of the sentence as unit of paragraph.
In one embodiment, default sentiment dictionary refers to the dictionary that classification marking is carried out to emotion word, presets emotion word Word is divided into three classes in allusion quotation, including emotion word, degree adverb and negative word, wherein emotion word include positive emotion word and Negative Affect word, it is poor for example, like, like and happiness etc. is positive emotion word, dislike and rotten etc. for Negative Affect word;Journey Degree adverbial word is used to indicate the degree of strength of emotion, for example, very, very and extremely etc.;Negative word indicates the reversion of emotion, example Such as, it is not, absolutely not and is difficult to.Default sentiment dictionary is built in advance, by calling connecing for default sentiment dictionary It mouthful uses.In default sentiment dictionary, each emotion word has a corresponding weight score value distributed, and each degree adverb has pair The degree score value that should be distributed, phrase to be analyzed is by match obtaining phrase to be analyzed default with default sentiment dictionary Weight score value or degree score value in sentiment dictionary.Specifically, it is traversed and is searched in default sentiment dictionary according to phrase to be analyzed To same phrase, power of the phrase to be analyzed in default sentiment dictionary is obtained if the phrase to be analyzed is emotion word Weight score value obtains degree score value of the phrase to be analyzed in default sentiment dictionary if the phrase to be analyzed is degree adverb, Polarity inverts if the phrase to be analyzed is negative word.After the score value for getting phrase to be analyzed, start to be calculated, it is first First as unit of paragraph, the emotional value of each sentence in paragraph is calculated, according to the following formula:
Score=W*P* (± 1)
Wherein, Score refers to the emotional value of sentence, and W refers to that the weight score value of emotion word, P refer to degree adverb Degree score value, ± 1 indicates negative word, occurs negative word in sentence and is then multiplied by once (- 1).For example, " I/be not/very/ Happily ", wherein including emotion word " happy ", degree adverb " very " and negative word "no", the weight score value of " happy " is 0.6, the degree score value of " very " is 1.5, then being -0.9 by the emotional value that the sentence is calculated in formula.Continue to calculate the section The emotional value of all sentences of the emotional value of other sentences in falling until obtaining the paragraph, then again by all sentences of the paragraph The emotional value of son carries out summation and is averaged to obtain the emotional value of the paragraph.For example, in the paragraph include sentence 1, sentence 2 and Sentence 3, the emotional value of sentence 1, sentence 2 and sentence 3 are respectively -0.9,8.5 and 3.6, then to sentence 1, sentence 2 with And sentence 3 summed after to be averaged to obtain the emotional value of the paragraph be 3.73.
S140, the emotional value progress sum-average arithmetic of the paragraph in the long text is obtained into the emotion of the long text Value.
In one embodiment, in obtaining long text after the emotional value of each paragraph, by the feelings of paragraphs all in long text Inductance value carries out summation and is averaged to obtain the emotional value of long text.For example, including paragraph 1, paragraph 2 and paragraph in the long text 3, the emotional value of paragraph 1, paragraph 2 and paragraph 3 is respectively -3.5,12 and 5.2, then to paragraph 1, paragraph 2 and paragraph 3 Emotional value summed after to be averaged to obtain the emotional value of the long text be 13.7.
S150, the Sentiment orientation that the long text is determined according to the emotional value of the long text.
In one embodiment, as shown in figure 5, the step S150 may include step S151-S153.
S151, judge whether the emotional value of the long text is greater than zero.
If the emotional value of S152, the long text is greater than zero, determine that the Sentiment orientation of the long text is actively to be inclined to.
If the emotional value of S153, the long text less than zero, determines the Sentiment orientation of the long text for passiveness tendency.
In one embodiment, based on the judgement of emotional value, emotional value is bigger, and the emotion intensity for illustrating the text is higher, The smaller emotion intensity for illustrating the text of emotional value is lower.The judgment rule of Sentiment orientation is by the emotional value of text and zero Be compared, when emotional value is greater than zero, illustrate the Sentiment orientation of the text be it is positive, when emotional value is minus, say The Sentiment orientation of the bright text is passive.
In another embodiment, as shown in fig. 6, further comprising the steps of: S160-S190 after the step S110.
If the type of S160, the text to be analyzed be short text, by the short text carry out second pretreatment obtain with Sentence is the phrase to be analyzed of unit.
In one embodiment, short text refers to the content of text without paragraph, for example, microblogging and comment etc..The Two pretreatments refer to short text carrying out subordinate sentence and participle, because paragraph is not present in short text, with the first pretreatment Compared to the step of having lacked segmentation, other steps are identical as the first pretreatment.Subordinate sentence is carried out to short text first and obtains multiple sentences Son, wherein default punctuation mark includes fullstop, question mark and exclamation mark, specifically, using fullstop, question mark and exclamation mark as The ending of each sentence carries out subordinate sentence, for example, " my mood today is very bad.Can you comfort me once? prithee!", Wherein, " my mood today is very bad." be with fullstop ending be divided into one, " you can comfort me once? " it is with question mark Ending is divided into one, " prithee!" it is to be divided into one with exclamation mark ending.Then each sentence is segmented again, It is also segmented by participle tool, for example, " my mood today is very bad.", obtained after segmenting " I/today/heart Feelings/very/bad ".It should be noted that above-mentioned participle is segmented according to as unit of sentence, for example, wrapping in short text Tri- sentences of U, W, Y are included, tri- sentences of U, W, Y are segmented to obtain the phrase to be analyzed of tri- sentences of U, W, Y.
S170, it is matched according to default sentiment dictionary with the phrase to be analyzed with the emotional value of the determination sentence.
In one embodiment, it is analysed to phrase first to be matched with default sentiment dictionary, is existed according to phrase to be analyzed Traversal finds same phrase in default sentiment dictionary, obtains the word to be analyzed if the phrase to be analyzed is emotion word Weight score value of the group in default sentiment dictionary obtains the phrase to be analyzed default if the phrase to be analyzed is degree adverb Degree score value in sentiment dictionary, polarity inverts if the word is negative word.After the score value for getting phrase to be analyzed, with Sentence is unit, and the emotional value of each sentence is calculated according to the formula in above-mentioned steps S133, for example, " I/it is not to open/very much/ The heart ", wherein including emotion word " happy ", degree adverb " very " and negative word "no", the weight score value of " happy " are 0.6, " very " degree score value is 1.5, then being -0.9 by the emotional value that the sentence is calculated in formula.
S180, the emotional value progress sum-average arithmetic of the sentence in the short text is obtained into the emotion of the short text Value.
In one embodiment, in obtaining short text after the emotional value of each sentence, by the feelings of sentences all in short text Inductance value carries out summation and is averaged to obtain the emotional value of short text.For example, in short text include sentence 1, sentence 2 and sentence 3, The emotional value of sentence 1, sentence 2 and sentence 3 is respectively 6, -5 and 8.3, then carrying out to sentence 1, sentence 2 and sentence 3 The emotional value for being averaged to obtain the paragraph after summation is 3.1.
S190, the Sentiment orientation that the short text is determined according to the emotional value of the short text.
In one embodiment, based on the judgement of emotional value, emotional value is bigger, and the emotion intensity for illustrating the text is higher, The smaller emotion intensity for illustrating the text of emotional value is lower.The judgment rule of Sentiment orientation is by the emotional value of text and zero Be compared, when emotional value is greater than zero, illustrate the Sentiment orientation of the text be it is positive, when emotional value is minus, say The Sentiment orientation of the bright text is passive.
The embodiment of the present invention illustrates a kind of text emotion analysis method, obtains by using the mode of web crawlers wait divide Analysis text and the type that the text to be analyzed is judged according to the content of the text to be analyzed;If the class of the text to be analyzed Type is long text, and the long text is carried out the first pretreatment and obtains the phrase to be analyzed as unit of paragraph;According to default feelings Sense dictionary is matched with the phrase to be analyzed with the emotional value of the determination paragraph;By the paragraph in the long text Emotional value carry out sum-average arithmetic obtain the emotional value of the long text;The long article is determined according to the emotional value of the long text The emotional value of long text can be controlled in reasonable section, efficiently avoid the emotional value of long text by this Sentiment orientation The defect being amplified improves the accuracy of sentiment analysis.
Fig. 7 is a kind of schematic block diagram of text emotion analytical equipment 200 provided in an embodiment of the present invention.As shown in fig. 7, Corresponding to the above text emotion analysis method, the present invention also provides a kind of text emotion analytical equipments 200.Text sentiment analysis Device 200 includes the unit for executing above-mentioned text emotion analysis method, which can be configured in desktop computer, plate Computer, laptop computer, etc. in terminals.Specifically, referring to Fig. 7, text sentiment analysis device 200 include judging unit 210, Pretreatment unit 220, matching unit 230, sum-average arithmetic unit 240 and determination unit 250.
Judging unit 210, for obtaining text to be analyzed by the way of web crawlers and according to the text to be analyzed Content judge the type of the text to be analyzed.
The long text is carried out first if the type for the text to be analyzed is long text by pretreatment unit 220 Pretreatment obtains the phrase to be analyzed as unit of paragraph.
In one embodiment, as shown in figure 8, the pretreatment unit 220 includes subelement: segmenting unit 221, subordinate sentence list Member 222 and participle unit 223.
Segmenting unit 221, for being segmented to obtain multiple paragraphs to the long text according to default chopping rule.
Clause unit 222 obtains as unit of paragraph for carrying out subordinate sentence to the paragraph according to default punctuation mark Sentence.
Participle unit 223, for being segmented to obtain with section to the sentence as unit of paragraph according to participle tool Fall the phrase to be analyzed for unit.
Matching unit 230, for being matched according to default sentiment dictionary with the phrase to be analyzed with described section of determination The emotional value fallen.
In one embodiment, as shown in figure 8, the matching unit 230 includes subelement: acquiring unit 231, first determines Subelement 232 and the second determining subelement 233.
Acquiring unit 231, for match described in acquisition wait divide with the phrase to be analyzed according to default sentiment dictionary Analyse the score value of phrase.
First determines subelement 232, described as unit of paragraph for being determined according to the score value of the phrase to be analyzed The emotional value of sentence.
Second determines subelement 233, for determining the paragraph according to the emotional value of the sentence as unit of paragraph Emotional value.
Sum-average arithmetic unit 240 is obtained for the emotional value of the paragraph in the long text to be carried out sum-average arithmetic The emotional value of the long text.
Determination unit 250, for determining the Sentiment orientation of the long text according to the emotional value of the long text.
In one embodiment, as shown in figure 8, the determination unit 250 includes subelement: judgment sub-unit 251, first are sentenced Order member 252 and the second judging unit 253.
Judgment sub-unit 251, for judging whether the emotional value of the long text is greater than zero;
First judging unit 252 determines that the emotion of the long text is inclined if the emotional value for the long text is greater than zero It is inclined to to be positive;
Second judging unit 253, if the emotional value for the long text less than zero, determines that the emotion of the long text is inclined It is inclined to for passiveness.
It should be noted that it is apparent to those skilled in the art that, above-mentioned text emotion analytical equipment 200 and each unit specific implementation process, can with reference to the corresponding description in preceding method embodiment, for convenience of description and Succinctly, details are not described herein.
Above-mentioned text emotion analytical equipment can be implemented as a kind of form of computer program, which can be It is run in computer equipment as shown in Figure 9.
Referring to Fig. 9, Fig. 9 is a kind of schematic block diagram of computer equipment provided by the embodiments of the present application.The computer Equipment 500 can be terminal, wherein terminal can be smart phone, tablet computer, laptop, desktop computer, a number Word assistant and wearable device etc. have the electronic equipment of communication function.
Refering to Fig. 9, which includes processor 502, memory and the net connected by system bus 501 Network interface 505, wherein memory may include non-volatile memory medium 503 and built-in storage 504.
The non-volatile memory medium 503 can storage program area 5031 and computer program 5032.The computer program 5032 include program instruction, which is performed, and processor 502 may make to execute a kind of text emotion analysis method.
The processor 502 is for providing calculating and control ability, to support the operation of entire computer equipment 500.
The built-in storage 504 provides environment for the operation of the computer program 5032 in non-volatile memory medium 503, should When computer program 5032 is executed by processor 502, processor 502 may make to execute a kind of text emotion analysis method.
The network interface 505 is used to carry out network communication with other equipment.It will be understood by those skilled in the art that in Fig. 9 The structure shown, only the block diagram of part-structure relevant to application scheme, does not constitute and is applied to application scheme The restriction of computer equipment 500 thereon, specific computer equipment 500 may include more more or fewer than as shown in the figure Component perhaps combines certain components or with different component layouts.
Wherein, the processor 502 is for running computer program 5032 stored in memory, to realize following step It is rapid: to obtain text to be analyzed by the way of web crawlers and the text to be analyzed is judged according to the content of the text to be analyzed This type;If the type of the text to be analyzed is long text, the long text is subjected to the first pretreatment and is obtained with paragraph For the phrase to be analyzed of unit;It is matched according to default sentiment dictionary with the phrase to be analyzed with the feelings of the determination paragraph Inductance value;The emotional value of the paragraph in the long text is subjected to sum-average arithmetic and obtains the emotional value of the long text;According to The emotional value of the long text determines the Sentiment orientation of the long text.
In one embodiment, processor 502 is obtained in described pre-process long text progress first of realization with paragraph For unit phrase step to be analyzed when, be implemented as follows step: the long text being divided according to default chopping rule Section obtains multiple paragraphs;Subordinate sentence is carried out to the paragraph according to default punctuation mark and obtains the sentence as unit of paragraph;According to Participle tool is segmented to obtain the phrase to be analyzed as unit of paragraph to the sentence as unit of paragraph.
In one embodiment, processor 502 is realizing that the basis presets sentiment dictionary and the phrase to be analyzed carries out When matching the emotional value step with the determination paragraph, it is implemented as follows step: according to default sentiment dictionary with described wait divide Analysis phrase carries out the score value that matching obtains the phrase to be analyzed;It is determined according to the score value of the phrase to be analyzed described with paragraph For the emotional value of the sentence of unit;The emotional value of the paragraph is determined according to the emotional value of the sentence as unit of paragraph.
In one embodiment, processor 502 determines the long text in the realization emotional value according to the long text Sentiment orientation step when, be implemented as follows step: judging whether the emotional value of the long text is greater than zero;If the long article This emotional value is greater than zero, determines that the Sentiment orientation of the long text is actively to be inclined to;If the emotional value of the long text is less than Zero, determine the Sentiment orientation of the long text for passiveness tendency.
In one embodiment, processor 502 is realizing text to be analyzed and the root of obtaining by the way of web crawlers After the type step for judging the text to be analyzed according to the content of the text to be analyzed, following steps are also realized: if described The type of text to be analyzed is short text, and the short text is carried out the second pretreatment and obtains the word to be analyzed as unit of sentence Group;It is matched according to default sentiment dictionary with the phrase to be analyzed with the emotional value of the determination sentence;By the short essay The emotional value of the sentence in this carries out sum-average arithmetic and obtains the emotional value of the short text;According to the emotion of the short text Value determines the Sentiment orientation of the short text.
It should be appreciated that in the embodiment of the present application, processor 502 can be central processing unit (Central Processing Unit, CPU), which can also be other general processors, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic Device, discrete gate or transistor logic, discrete hardware components etc..Wherein, general processor can be microprocessor or Person's processor is also possible to any conventional processor etc..
Those of ordinary skill in the art will appreciate that be realize above-described embodiment method in all or part of the process, It is that relevant hardware can be instructed to complete by computer program.The computer program includes program instruction, computer journey Sequence can be stored in a storage medium, which is computer readable storage medium.The program instruction is by the department of computer science At least one processor in system executes, to realize the process step of the embodiment of the above method.
Therefore, the present invention also provides a kind of storage mediums.The storage medium can be computer readable storage medium.This is deposited Storage media is stored with computer program, and wherein computer program includes program instruction.The program instruction makes when being executed by processor Processor executes following steps: text to be analyzed is obtained by the way of web crawlers and according to the content of the text to be analyzed Judge the type of the text to be analyzed;If the type of the text to be analyzed is long text, the long text is carried out first Pretreatment obtains the phrase to be analyzed as unit of paragraph;Matched according to default sentiment dictionary with the phrase to be analyzed with Determine the emotional value of the paragraph;The emotional value of the paragraph in the long text is subjected to sum-average arithmetic and obtains the long article This emotional value;
The Sentiment orientation of the long text is determined according to the emotional value of the long text.
In one embodiment, the processor is realized and described the long text is carried out the executing described program instruction When one pretreatment obtains the phrase step to be analyzed as unit of paragraph, it is implemented as follows step: according to default chopping rule The long text is segmented to obtain multiple paragraphs;Subordinate sentence is carried out to the paragraph according to default punctuation mark to obtain with paragraph For the sentence of unit;According to participle tool to the sentence as unit of paragraph segmented to obtain as unit of paragraph to Analyze phrase.
In one embodiment, the processor execute described program instruction and realize the basis preset sentiment dictionary with When the phrase to be analyzed is matched with the emotional value step of the determination paragraph, it is implemented as follows step: according to default Sentiment dictionary carries out matching the score value for obtaining the phrase to be analyzed with the phrase to be analyzed;According to the phrase to be analyzed Score value determines the emotional value of the sentence as unit of paragraph;It is determined according to the emotional value of the sentence as unit of paragraph The emotional value of the paragraph.
In one embodiment, the processor realizes the feelings according to the long text executing described program instruction When inductance value determines the Sentiment orientation step of the long text, be implemented as follows step: judging the emotional value of the long text is It is no to be greater than zero;If the emotional value of the long text is greater than zero, determine that the Sentiment orientation of the long text is actively to be inclined to;If described The emotional value of long text determines the Sentiment orientation of the long text for passiveness tendency less than zero.
In one embodiment, the processor is realized described by the way of web crawlers in the instruction of execution described program It is also real after obtaining text to be analyzed and judging the type step of the text to be analyzed according to the content of the text to be analyzed Existing following steps: if the type of the text to be analyzed is short text, the short text is subjected to the second pretreatment and is obtained with sentence Son is the phrase to be analyzed of unit;It is matched according to default sentiment dictionary with the phrase to be analyzed with the determination sentence Emotional value;The emotional value of the sentence in the short text is subjected to sum-average arithmetic and obtains the emotional value of the short text;Root The Sentiment orientation of the short text is determined according to the emotional value of the short text.
The storage medium can be USB flash disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), magnetic disk Or the various computer readable storage mediums that can store program code such as CD.
Those of ordinary skill in the art may be aware that list described in conjunction with the examples disclosed in the embodiments of the present disclosure Member and algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware With the interchangeability of software, each exemplary composition and step are generally described according to function in the above description.This A little functions are implemented in hardware or software actually, the specific application and design constraint depending on technical solution.Specially Industry technical staff can use different methods to achieve the described function each specific application, but this realization is not It is considered as beyond the scope of this invention.
In several embodiments provided by the present invention, it should be understood that disclosed device and method can pass through it Its mode is realized.For example, the apparatus embodiments described above are merely exemplary.For example, the division of each unit, only Only a kind of logical function partition, there may be another division manner in actual implementation.Such as multiple units or components can be tied Another system is closed or is desirably integrated into, or some features can be ignored or not executed.
The steps in the embodiment of the present invention can be sequentially adjusted, merged and deleted according to actual needs.This hair Unit in bright embodiment device can be combined, divided and deleted according to actual needs.In addition, in each implementation of the present invention Each functional unit in example can integrate in one processing unit, is also possible to each unit and physically exists alone, can also be with It is that two or more units are integrated in one unit.
If the integrated unit is realized in the form of SFU software functional unit and when sold or used as an independent product, It can store in one storage medium.Based on this understanding, technical solution of the present invention is substantially in other words to existing skill The all or part of part or the technical solution that art contributes can be embodied in the form of software products, the meter Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a People's computer, terminal or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, can readily occur in various equivalent modifications or replace It changes, these modifications or substitutions should be covered by the protection scope of the present invention.Therefore, protection scope of the present invention should be with right It is required that protection scope subject to.

Claims (10)

1. a kind of text emotion analysis method characterized by comprising
Text to be analyzed is obtained by the way of web crawlers and is judged according to the content of the text to be analyzed described to be analyzed The type of text;
If the type of the text to be analyzed is long text, the long text is subjected to the first pretreatment and is obtained as unit of paragraph Phrase to be analyzed;
It is matched according to default sentiment dictionary with the phrase to be analyzed with the emotional value of the determination paragraph;
The emotional value of the paragraph in the long text is subjected to sum-average arithmetic and obtains the emotional value of the long text;
The Sentiment orientation of the long text is determined according to the emotional value of the long text.
2. text emotion analysis method according to claim 1, which is characterized in that described that the long text is carried out first Pretreatment obtains the phrase to be analyzed as unit of paragraph, comprising:
The long text is segmented according to default chopping rule to obtain multiple paragraphs;
Subordinate sentence is carried out to the paragraph according to default punctuation mark and obtains the sentence as unit of paragraph;
Segmented to obtain the phrase to be analyzed as unit of paragraph to the sentence as unit of paragraph according to participle tool.
3. text emotion analysis method according to claim 2, which is characterized in that the basis presets sentiment dictionary and institute Phrase to be analyzed is stated to be matched with the emotional value of the determination paragraph, comprising:
It is carried out matching the score value for obtaining the phrase to be analyzed with the phrase to be analyzed according to default sentiment dictionary;
The emotional value of the sentence as unit of paragraph is determined according to the score value of the phrase to be analyzed;
The emotional value of the paragraph is determined according to the emotional value of the sentence as unit of paragraph.
4. text emotion analysis method according to claim 1, which is characterized in that the emotion according to the long text Value determines the Sentiment orientation of the long text, comprising:
Judge whether the emotional value of the long text is greater than zero;
If the emotional value of the long text is greater than zero, determine that the Sentiment orientation of the long text is actively to be inclined to;
If the emotional value of the long text less than zero, determines the Sentiment orientation of the long text for passiveness tendency.
5. text emotion analysis method according to claim 1, which is characterized in that described to be obtained by the way of web crawlers After taking text to be analyzed and judging the type of the text to be analyzed according to the content of the text to be analyzed, further includes:
If the type of the text to be analyzed is short text, the short text is subjected to the second pretreatment and is obtained as unit of sentence Phrase to be analyzed;
It is matched according to default sentiment dictionary with the phrase to be analyzed with the emotional value of the determination sentence;
The emotional value of the sentence in the short text is subjected to sum-average arithmetic and obtains the emotional value of the short text;
The Sentiment orientation of the short text is determined according to the emotional value of the short text.
6. a kind of text emotion analytical equipment characterized by comprising
Judging unit, for obtaining text to be analyzed by the way of web crawlers and being sentenced according to the content of the text to be analyzed Break the type of the text to be analyzed;
The long text is carried out the first pretreatment if the type for the text to be analyzed is long text by pretreatment unit Obtain the phrase to be analyzed as unit of paragraph;
Matching unit, for being matched according to default sentiment dictionary with the phrase to be analyzed with the emotion of the determination paragraph Value;
Sum-average arithmetic unit obtains the long article for the emotional value of the paragraph in the long text to be carried out sum-average arithmetic This emotional value;
Determination unit, for determining the Sentiment orientation of the long text according to the emotional value of the long text.
7. text emotion analytical equipment according to claim 1 characterized by comprising
Segmenting unit, for being segmented to obtain multiple paragraphs to the long text according to default chopping rule;
Clause unit obtains the sentence as unit of paragraph for carrying out subordinate sentence to the paragraph according to default punctuation mark;
Participle unit, for being segmented to obtain as unit of paragraph to the sentence as unit of paragraph according to participle tool Phrase to be analyzed.
8. text emotion analytical equipment according to claim 1 characterized by comprising
Acquiring unit obtains the phrase to be analyzed for match with the phrase to be analyzed according to default sentiment dictionary Score value;
First determines subelement, for determining the feelings of the sentence as unit of paragraph according to the score value of the phrase to be analyzed Inductance value;
Second determines subelement, for determining the emotion of the paragraph according to the emotional value of the sentence as unit of paragraph Value.
9. a kind of computer equipment, which is characterized in that the computer equipment includes memory and processor, on the memory It is stored with computer program, the processor is realized as described in any one of claim 1-5 when executing the computer program Method.
10. a kind of storage medium, which is characterized in that the storage medium is stored with computer program, and the computer program is worked as Method according to any one of claims 1 to 5 can be realized when being executed by processor.
CN201910043351.3A 2019-01-17 2019-01-17 Text emotion analysis method, device, computer equipment and storage medium Pending CN109858026A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910043351.3A CN109858026A (en) 2019-01-17 2019-01-17 Text emotion analysis method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910043351.3A CN109858026A (en) 2019-01-17 2019-01-17 Text emotion analysis method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN109858026A true CN109858026A (en) 2019-06-07

Family

ID=66894991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910043351.3A Pending CN109858026A (en) 2019-01-17 2019-01-17 Text emotion analysis method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109858026A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110334182A (en) * 2019-06-24 2019-10-15 中国南方电网有限责任公司 Online service method with speech emotion recognition
CN110399484A (en) * 2019-06-25 2019-11-01 平安科技(深圳)有限公司 Sentiment analysis method, apparatus, computer equipment and the storage medium of long text
CN110888983A (en) * 2019-11-26 2020-03-17 厦门市美亚柏科信息股份有限公司 Positive and negative emotion analysis method, terminal device and storage medium
CN111985223A (en) * 2020-08-25 2020-11-24 武汉长江通信产业集团股份有限公司 Emotion calculation method based on combination of long and short memory networks and emotion dictionaries
CN112182332A (en) * 2020-09-25 2021-01-05 科大国创云网科技有限公司 Emotion classification method and system based on crawler collection
WO2021134177A1 (en) * 2019-12-30 2021-07-08 深圳市优必选科技股份有限公司 Sentiment labeling method, apparatus and device for speaking content, and storage medium
CN113255368A (en) * 2021-06-07 2021-08-13 中国平安人寿保险股份有限公司 Method and device for emotion analysis of text data and related equipment
CN115794988A (en) * 2022-09-13 2023-03-14 广东美云智数科技有限公司 Method, apparatus, and computer storage medium for extracting viewpoint of text
CN116805147A (en) * 2023-02-27 2023-09-26 杭州城市大脑有限公司 Text labeling method and device applied to urban brain natural language processing

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110334182A (en) * 2019-06-24 2019-10-15 中国南方电网有限责任公司 Online service method with speech emotion recognition
CN110399484A (en) * 2019-06-25 2019-11-01 平安科技(深圳)有限公司 Sentiment analysis method, apparatus, computer equipment and the storage medium of long text
CN110888983A (en) * 2019-11-26 2020-03-17 厦门市美亚柏科信息股份有限公司 Positive and negative emotion analysis method, terminal device and storage medium
CN110888983B (en) * 2019-11-26 2022-07-15 厦门市美亚柏科信息股份有限公司 Positive and negative emotion analysis method, terminal equipment and storage medium
WO2021134177A1 (en) * 2019-12-30 2021-07-08 深圳市优必选科技股份有限公司 Sentiment labeling method, apparatus and device for speaking content, and storage medium
CN111985223A (en) * 2020-08-25 2020-11-24 武汉长江通信产业集团股份有限公司 Emotion calculation method based on combination of long and short memory networks and emotion dictionaries
CN112182332A (en) * 2020-09-25 2021-01-05 科大国创云网科技有限公司 Emotion classification method and system based on crawler collection
CN113255368A (en) * 2021-06-07 2021-08-13 中国平安人寿保险股份有限公司 Method and device for emotion analysis of text data and related equipment
CN115794988A (en) * 2022-09-13 2023-03-14 广东美云智数科技有限公司 Method, apparatus, and computer storage medium for extracting viewpoint of text
CN116805147A (en) * 2023-02-27 2023-09-26 杭州城市大脑有限公司 Text labeling method and device applied to urban brain natural language processing
CN116805147B (en) * 2023-02-27 2024-03-22 杭州城市大脑有限公司 Text labeling method and device applied to urban brain natural language processing

Similar Documents

Publication Publication Date Title
CN109858026A (en) Text emotion analysis method, device, computer equipment and storage medium
CN105005594B (en) Abnormal microblog users recognition methods
CN111310476B (en) Public opinion monitoring method and system using aspect-based emotion analysis method
CN106682387A (en) Method and device used for outputting information
CN113407677B (en) Method, apparatus, device and storage medium for evaluating consultation dialogue quality
Bentz Adaptive languages: An information-theoretic account of linguistic diversity
CN106844330B (en) The analysis method and device of article emotion
CN107895027A (en) Individual feelings and emotions knowledge mapping method for building up and device
CN112579733A (en) Rule matching method, rule matching device, storage medium and electronic equipment
CN112926308A (en) Method, apparatus, device, storage medium and program product for matching text
Filho et al. Gender classification of twitter data based on textual meta-attributes extraction
CN114519613B (en) Price data processing method and device, electronic equipment and storage medium
Nickels et al. Computational modelling of phonological dyslexia: How does the DRC model fare?
Xu et al. Network-based prediction of the disclosure of ideation about self-harm and suicide in online counseling sessions
US20230206007A1 (en) Method for mining conversation content and method for generating conversation content evaluation model
CN111666513A (en) Page processing method and device, electronic equipment and readable storage medium
CN115098665A (en) Method, device and equipment for expanding session data
US11748573B2 (en) System and method to quantify subject-specific sentiment
CN115827832A (en) Dialog system content relating to external events
WO2022216722A1 (en) Generating aspects from attributes identified in digital video audio tracks
CN114416941A (en) Generation method and device of dialogue knowledge point determination model fusing knowledge graph
CN116541517A (en) Text information processing method, apparatus, device, software program, and storage medium
CN108460017B (en) The extensive method, apparatus of corpus, electronic equipment and readable storage medium storing program for executing
CN112100378A (en) Text classification model training method and device, computer equipment and storage medium
CN112231444A (en) Processing method and device for corpus data combining RPA and AI and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination