A method, device and computer equipment for classifying conflicting events
The method enhances the classification of conflicting events by preprocessing and neural network-based segmentation and annotation to identify keywords, addressing the lack of accurate classification in existing technologies.
Patent Information
- Application Number
- CN202111630110.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-28
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2041-12-28
AI Technical Summary
Existing technologies lack word segmentation, part-of-speech tagging, and keyword extraction for conflicting event texts, preventing accurate classification of conflict investigation events.
A method involving feature extraction, text preprocessing, and neural network-based segmentation and annotation to identify keywords and event types using a preset keyword table.
Improves the accuracy of classifying conflicting events by obtaining feature values and using a keyword table for precise event type determination.
Smart Images

Figure CN114298034B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of text recognition, and in particular to a method, device and computer equipment for classifying conflicting events. Background Art
[0002] With the development of social modernization, people are communicating with each other more and more, and information exchange is becoming more frequent. As a result, various social hot spots and conflicts have become more prominent. Many small conflicts have gradually evolved into large-scale hot spots. Therefore, it is necessary to analyze and investigate conflicting events. Existing technologies do not have word segmentation, part-of-speech tagging, and keyword extraction for conflicting event texts, and cannot identify which type of conflict investigation event the conflicting text belongs to. Summary of the invention
[0003] Therefore, the technical problem to be solved by the present invention is to overcome the defect in the prior art that there is a lack of classification of contradictory events, which leads to the inability to further analyze contradictory events, thereby providing a contradictory event judgment method, device and computer equipment.
[0004] According to a first aspect, an embodiment of the present invention discloses a method for classifying contradictory events, comprising: acquiring target data to be classified; performing feature extraction on the target data to obtain feature values of the target data; obtaining the segmentation probability of the segmentation result of the target data based on the feature values of the target data and a preset text segmentation and annotation model; using the segmentation result with the largest segmentation probability as segmentation annotation data; obtaining keywords of the target data based on the segmentation and annotation data and a preset keyword table; and obtaining the event type of the target data based on the keywords.
[0005] Optionally, after acquiring the target data to be classified, the target data is subjected to feature extraction, and before the feature value of the target data is obtained, it is necessary to preprocess the target data to obtain preprocessed data, and feature extraction is performed based on the preprocessed data. The preprocessing process includes: removing control characters in the target data, and converting the target data without control characters into a half-width format, and converting punctuation marks into Chinese format to obtain first preprocessed data; and removing redundant text in the first preprocessed data based on a regular expression to obtain preprocessed data.
[0006] Optionally, the process of constructing the preset text segmentation and annotation model includes: obtaining segmentation sample data, the segmentation sample data including original text and part-of-speech tags for marking the original text; performing feature extraction based on the original text to obtain a first feature value; using the first feature value as input data and the part-of-speech tag as output data, training a neural network model for word segmentation and annotation, and obtaining the preset text segmentation and annotation model.
[0007] Optionally, obtaining the keywords of the target data based on the word segmentation and annotation data and a preset keyword table includes: obtaining matching rules for the target data based on the target data and the keyword table; performing matching based on the matching rules to obtain the keywords of the target data; and obtaining contradiction categories of the target data based on the keywords of the target data and a preset relationship correspondence table.
[0008] Optionally, the target data includes word meaning data and part-of-speech data, and the matching rules for the target data are obtained based on the target data and the keyword table, including: judging whether the word meaning data and part-of-speech data match the word meaning data and part-of-speech data in the keyword table, and if so, extracting the corresponding keywords; if not, concatenating the word meaning data and part-of-speech data to obtain a whole word; and retrieving based on the whole word to obtain the corresponding keywords.
[0009] Optionally, the method further includes: updating the keywords of the target data to the preset keyword table.
[0010] Optionally, the process of constructing the preset keyword table includes: obtaining keyword sample data; obtaining candidate words based on keyword extraction algorithm, word vector and part of speech; expanding based on the candidate words, preset keyword template and knowledge base to obtain the first keyword; expanding similar words based on the first keyword table to obtain the second keyword; and expanding the part of speech based on the second keyword table to obtain the keyword table.
[0011] According to the second aspect, an embodiment of the present invention further discloses a device for classifying contradictory events, comprising: a first acquisition module, used to acquire target data to be classified; a first key data module, used to perform word segmentation and part-of-speech tagging on the target data to obtain first key data; a feature value module, used to input the first key data into a neural network model to obtain a feature value of the first key data; a probability module, used to input the feature value into a natural language tool to obtain the probability of the feature value; a word segmentation and tagging data module, used to use the first key data corresponding to the maximum probability value as word segmentation and tagging data; a keyword module, used to obtain keywords of the contradictory data based on the word segmentation and tagging data and a preset keyword table; and an event type module, used to obtain the event type of the contradictory data based on the keywords.
[0012] According to the third aspect, an embodiment of the present invention also discloses a computer device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the steps of the method for classifying contradictory events as described in the first aspect or any optional embodiment of the first aspect.
[0013] According to a fourth aspect, an embodiment of the present invention further discloses a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method for classifying contradictory events as described in the first aspect or any optional embodiment of the first aspect.
[0014] The technical solution of the present invention has the following advantages:
[0015] The contradictory event classification method, device and computer equipment provided by the present invention include: obtaining target data to be classified; extracting features from the target data to obtain feature values of the target data; obtaining the segmentation probability of the segmentation result of the target data based on the feature values of the target data and a preset text segmentation and annotation model; using the segmentation result with the largest segmentation probability as segmentation and annotation data; obtaining keywords of the target data based on the segmentation and annotation data and a preset keyword table; and obtaining the event type of the target data based on the keyword. By extracting features from the target data to obtain corresponding feature values, and training the corresponding feature values to obtain the probability of feature values, the feature values of the target data can be obtained more accurately, and the event type of the target data can be judged by combining the segmentation and annotation data with the preset keyword table obtained from a large amount of data, thereby improving the accuracy of classifying the target event. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A flowchart of a specific example of a method for classifying conflicting events in an embodiment of the present invention;
[0018] Figure 2 is a principle block diagram of a specific example of a device for classifying contradictory events in an embodiment of the present invention;
[0019] Figure 3 FIG. 4 is a specific example diagram of a computer device in an embodiment of the present invention. DETAILED DESCRIPTION
[0020] The technical solution of the present invention will be described clearly and completely below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0021] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0022] In the description of the present invention, it should be noted that, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, it can also be the internal connection of two components, it can be a wireless connection, or it can be a wired connection. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0023] In addition, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0024] The embodiment of the present invention discloses a method for classifying conflicting events. Figure 1 As shown, the method comprises the following steps:
[0025] Step 101: Obtain target data to be classified. For example, the target data is text that needs to be judged for conflict events, which can be complaint website data, political and legal agency data, data reported by regional administrative personnel, etc. The embodiment of the present invention does not limit the type of target data, and those skilled in the art can determine it according to actual needs.
[0026] Step 102: Extract features from the target data to obtain feature values of the target data. For example, perform preliminary feature extraction on the target data to obtain feature values of the target data, wherein the feature values are used to represent the segmentation results obtained by preliminary annotation in the target data, namely, segmentation and part-of-speech data.
[0027] Step 103: Based on the characteristic values of the target data and the preset text segmentation and annotation model, the segmentation probability of the segmentation result of the target data is obtained. Exemplarily, the preset text annotation model is a neural network model obtained by training based on known text and text segmentation and part of speech. The characteristic values of the target data are input into the preset text segmentation and annotation model to obtain the probability size corresponding to the segmentation result of the target data, wherein the larger the probability, the higher the accuracy of the pre-annotated segmentation and part of speech data, and the smaller the probability, the lower the accuracy of the pre-annotated segmentation and part of speech data.
[0028] Step 104: The word segmentation result with the highest word segmentation probability is used as the word segmentation annotation data. Exemplarily, the word segmentation result with the highest word segmentation probability obtained by identification based on the preset text word segmentation annotation model in the above step 103 is used as the final word segmentation and part-of-speech data of the target data. The part-of-speech and word segmentation results with high accuracy can make the keywords and classification results obtained more accurate when the target data is subsequently classified and judged.
[0029] Step 105: Obtain keywords of the target data based on the word segmentation and annotation data and a preset keyword table. Exemplarily, the preset keyword table is a keyword table composed of all keyword data extracted from existing event type data. Keywords in the target data can be obtained based on the word segmentation and annotation data of the target data and the corresponding keyword types in the keyword table.
[0030] Step 106: Obtain the event type of the target data based on the keyword. Exemplarily, the event type of the target data is determined based on the keyword of the target data obtained in the above step 105. The determination method can be obtained based on a preset event table, where the events are shown in Table 1. Due to limited space, only some of the correspondences between events and keywords are listed in Table 1. The classification of events is determined based on keywords. For example, when the identified keyword is water leakage, the corresponding event classification is the conflict between residents due to water leakage between upper and lower floors.
[0031] Table 1
[0032]
[0033]
[0034] The contradictory event classification method provided by the present invention includes: obtaining target data to be classified; extracting features from the target data to obtain feature values of the target data; obtaining the segmentation probability of the segmentation result of the target data based on the feature values of the target data and a preset text segmentation and annotation model; using the segmentation result with the largest segmentation probability as segmentation and annotation data; obtaining keywords of the target data based on the segmentation and annotation data and a preset keyword table; and obtaining the event type of the target data based on the keywords. By extracting features from the target data to obtain corresponding feature values, and training the corresponding feature values to obtain the probability of feature values, the feature values of the target data can be obtained more accurately, and the event type of the target data can be judged by combining the segmentation and annotation data with the preset keyword table obtained from a large amount of data, thereby improving the accuracy of classifying the target event.
[0035] As an optional implementation of the present invention, after step 101 and before step 102, it is necessary to preprocess the target data to obtain preprocessed data, and perform feature extraction based on the preprocessed data. The preprocessing process includes: removing control characters in the target data, and converting the target data without control characters into a half-width format, and converting punctuation marks into Chinese format to obtain first preprocessed data; removing redundant text in the first preprocessed data based on a regular expression to obtain preprocessed data.
[0036] Exemplarily, since the acquired target data is of various types, including useless characters, numbers or garbled codes, etc., the target data needs to be preprocessed before the feature extraction process of the target data is performed. The specific preprocessing method can be: a. remove invisible control characters in the text; b. uniformly convert the text into a half-width format, and uniformly integrate punctuation marks into Chinese; c. because some texts contain large sections of redundant text in various forms, regular expressions are used to remove them, or there are strings similar to "(Contact Number XX, ID Card XX)" that write telephone numbers or ID card numbers in brackets, which are actually unnecessary. In order to avoid interference, regular expressions are used to remove them; d. Correct typos in the text, etc. The embodiment of the present invention does not limit the type of garbled codes and the specific method of preprocessing, and those skilled in the art can determine according to actual needs.
[0037] As an optional implementation of the present invention, in step 103, the process of constructing the preset text segmentation and annotation model includes: obtaining segmentation sample data, the segmentation sample data including original text and part-of-speech tags for marking the original text; performing feature extraction based on the original text to obtain a first feature value; using the first feature value as input data and the part-of-speech tag as output data, training a neural network model for word segmentation and annotation to obtain the preset text segmentation and annotation model.
[0038] Exemplarily, the preset text segmentation and annotation model is obtained by training the segmentation and annotation data of sample data and known sample data, the segmentation and annotation data of known sample data can be manually annotated, and after the number of annotations reaches a certain number of training sample sets, the sample data is input into the neural network model for training to obtain trained segmentation and annotation data, and the trained segmentation expression data is compared with the segmentation and annotation data annotated manually, and the neural network model is adjusted again according to the comparison result until the difference between the trained segmentation and annotation data obtained by the neural network model and the segmentation and annotation data annotated manually is less than a preset ratio. The embodiment of the present invention does not limit the specific value of the preset ratio, and those skilled in the art can determine it according to actual needs.
[0039] As an optional implementation of the present invention, step 105 includes: obtaining matching rules for the target data based on the target data and the keyword table; performing matching based on the matching rules to obtain keywords for the target data; and obtaining contradiction categories for the target data based on a correspondence table between the keywords of the target data and a preset relationship.
[0040] As an optional embodiment of the present invention, the target data includes word meaning data and part-of-speech data, and the step 105 includes: determining whether the word meaning data and part-of-speech data match the word meaning data and part-of-speech data in the keyword table, and if so, extracting the corresponding keywords; if not, concatenating the word meaning data and part-of-speech data to obtain a whole word; and retrieving based on the whole word to obtain the corresponding keyword.
[0041] Exemplarily, before performing keyword extraction on the target data, it is necessary to first find all punctuation marks, indexes, semantic information of each word (used for two hash tables for constructing semantics and mutual word queries), and part of speech of each word (used for two hash tables for constructing part of speech and mutual word queries) of the target data to facilitate rapid calculation during subsequent matching.
[0042] According to the text corresponding to the corresponding keyword in the keyword table, the parsing rule of each word in the target data is obtained. The parsing rule can be:
[0043] When multiple words are parsed out of the target data, the matching rules corresponding to the keyword table are as follows: 1) When matching the word ki in the keyword text and a word wj in the target data, if ki is a semantic original expression and the word wj in the target data is in the word set corresponding to the semantic original of ki, then wj is considered to meet the requirements and wj is extracted; 2) If ki is in the form of "(XX1<=number<=XX2)", then the part-of-speech tag of wj must be m (number), and then wj is converted into an Arabic numeral mj of the int type. If XX1<=mj<=XX2, then wj is considered to meet the requirements and w is extracted; 3) If ki is in the form of "(pronoun)", "(name)" or "(number)", as long as the part-of-speech tag of wj is of the corresponding type, then wj is considered to meet the requirements and wj is extracted.
[0044] When the target data has only one keyword k1, the matching rules are as follows: 1) If k1 is a semantic expression, and the word wi in the target data is in the word set corresponding to the semantics of k1, wi is extracted; 2) If k1 is not a semantic expression, and there is a word wi in the target data, wi==k1, then wi is extracted.
[0045] If the target data is parsed out of keywords consisting of several words, k1, k2, ..., ki, .... According to the meaning of "+" and "++" in the keyword text, the words of the target data are matched one by one, and the specific algorithm of "when the target data is parsed out of multiple words, the matching rules corresponding to the keyword table" is used. If the match is unsuccessful, these words can be spelled into one in order, and regarded as a whole word, and the text can be searched as a whole.
[0046] If the "only need to appear in the text" field value of a certain keyword is equal to "yes", then instead of considering only matching within each text segment, the full text scope is considered, and an algorithm similar to (e) is used for matching.
[0047] h. If the "whether multiple entries are consecutive" field value of a certain keyword is equal to "yes", indicating that several words in the keyword must appear consecutively in the text, then the matching of each specific word uses the algorithm in (c).
[0048] As an optional implementation manner of the present invention, in the step 105, the process of constructing the preset keyword table includes: obtaining keyword sample data; obtaining candidate words based on a keyword extraction algorithm, word vectors, and part-of-speech; expanding to obtain the first keyword based on the candidate words, a preset keyword template, and a knowledge base; expanding to obtain the second keyword based on the first keyword table for synonyms; and expanding to obtain the keyword table based on the second keyword table for part-of-speech.
[0049] Exemplarily, the keyword extraction algorithm can be algorithms such as textrank, lda, EmbedRank, SIFRank, etc., and candidate words of the sample data are obtained according to the extracted keywords and the word vectors and part-of-speech corresponding to the keywords. The preset keyword template can be a manually set keyword template. For example, "A + B" means that A and B appear in a text segment at the same time, and "A ++ B" means that A and B appear in a text segment at the same time and the position of A is before B. The knowledge base can be the semantic primitive knowledge base of HowNet (Chinese Knowledge Resource Integrated Database). Expansion is performed according to the knowledge base. For example, "{beast|走兽}", "{human|人:belong={family|家庭}, modifier={lineal|直系}{senior|长辈}}". Expansion according to synonyms can be, for example, "[垂落 - 1]", "[聚集 - 1]", and expansion directly using part-of-speech, such as "(pronoun)", "(person's name)", "(number)", etc. The specific type of the keyword extraction algorithm in the embodiments of the present invention is not limited, and those skilled in the art can determine it according to actual needs.
[0050] As an optional implementation manner of the present invention, the method further includes: updating the keywords of the target data to the preset keyword table. Exemplarily, after obtaining the keywords in the target data according to the preset keyword table, the obtained keywords are added to the keyword table again as the data in the keyword table for subsequent keyword extraction of the target data. The keyword table is enriched and expanded, and with the expansion of the keyword table, the probability of keyword extraction is improved.
[0051] The embodiments of the present invention also disclose a contradictory event classification device, as Figure 2As shown, the device comprises:
[0052] The acquisition module 201 is used to acquire target data that needs to be classified. For example, the details are shown in step 101 in the above method embodiment, which will not be repeated here.
[0053] The feature extraction module 202 is used to extract features from the target data to obtain feature values of the target data. For example, the details are shown in step 102 in the above method embodiment, which will not be described here.
[0054] The probability module 203 is used to obtain the segmentation probability of the segmentation result of the target data based on the feature value of the target data and the preset text segmentation annotation model. For example, the details are shown in step 103 in the above method embodiment, which will not be repeated here.
[0055] The word segmentation and annotation data module 204 is used to use the word segmentation result with the highest word segmentation probability as the word segmentation and annotation data. For example, the details are shown in step 104 in the above method embodiment, which will not be described here.
[0056] The keyword module 205 is used to obtain the keywords of the target data based on the word segmentation and annotation data and a preset keyword table. For example, the details are shown in step 105 in the above method embodiment, which will not be repeated here.
[0057] The event type module 206 is used to obtain the event type of the target data based on the keyword. For example, the details are shown in step 106 in the above method embodiment, which will not be repeated here.
[0058] The contradictory event classification device provided by the present invention includes: an acquisition module 201, which is used to acquire target data that needs to be classified; a feature extraction module 202, which is used to extract features from the target data to obtain feature values of the target data; a probability module 203, which is used to obtain the segmentation probability of the segmentation result of the target data based on the feature values of the target data and a preset text segmentation annotation model; a segmentation annotation data module 204, which is used to use the segmentation result with the largest segmentation probability as segmentation annotation data; a keyword module 205, which is used to obtain the keyword of the target data based on the segmentation annotation data and a preset keyword table; and an event type module 206, which is used to obtain the event type of the target data based on the keyword. By extracting features from the target data to obtain corresponding feature values, and training the corresponding feature values to obtain the probability of feature values, the feature values of the target data can be obtained more accurately, and the event type of the target data can be judged by combining the segmentation annotation data with the preset keyword table obtained from a large amount of data, thereby improving the accuracy of classifying the target event.
[0059] As an optional embodiment of the present invention, after the acquisition module 201 and before the feature extraction module 202, a preprocessing module is also included, which is used for preprocessing the target data to obtain preprocessed data, and feature extraction is performed based on the preprocessed data. The preprocessing process includes: a first preprocessing data module, which is used to remove the control characters in the target data, and convert the target data without the control characters into a half-width format, and convert the punctuation marks into a Chinese format to obtain the first preprocessed data; a preprocessing data module, which is used to remove redundant text in the first preprocessed data based on a regular expression to obtain the preprocessed data. For example, the details are shown in the above method embodiment, which will not be repeated here.
[0060] As an optional embodiment of the present invention, in the probability module 203, the process of constructing the preset text segmentation and annotation model includes: a part-of-speech tagging module, which is used to obtain segmentation sample data, wherein the segmentation sample data includes the original text and the part-of-speech tagging for marking the original text; a first feature value module, which is used to extract features based on the original text to obtain a first feature value; a text segmentation and annotation model module, which is used to train a neural network model for segmentation and annotation using the first feature value as input data and the part-of-speech tag as output data to obtain the preset text segmentation and annotation model. For example, the details are shown in step 103 in the above method embodiment, which will not be repeated here.
[0061] As an optional implementation of the present invention, the keyword module 205 includes: a matching rule module, which is used to obtain the matching rule of the target data based on the target data and the keyword table; a keyword submodule, which is used to match based on the matching rule to obtain the keyword of the target data; and a classification module, which is used to obtain the contradiction category of the target data based on the keyword of the target data and the preset relationship correspondence table. For example, the details are shown in the content of step 105 in the above method embodiment, which will not be repeated here.
[0062] As an optional embodiment of the present invention, the target data includes word meaning data and part-of-speech data, and the keyword module 205 includes: a judgment module, used to judge whether the word meaning data and part-of-speech data match the word meaning data and part-of-speech data in the keyword table, and if they match, extract the corresponding keyword; a splicing module, used to splice the word meaning data and part-of-speech data to obtain a whole word if they do not match; a retrieval module, used to retrieve the corresponding keyword based on the whole word. Exemplarily, the details are shown in the content of step 105 in the above method embodiment, which will not be repeated here.
[0063] As an optional embodiment of the present invention, in the keyword module 205, the process of constructing the preset keyword table includes: an acquisition submodule, used to obtain keyword sample data; a candidate word module, used to obtain candidate words based on keyword extraction algorithm, word vector and part of speech; a first keyword module, used to expand based on the candidate words, preset keyword templates and knowledge base to obtain the first keyword; a second keyword module, used to expand similar words based on the first keyword table to obtain the second keyword; a keyword table module, used to expand the part of speech based on the second keyword table to obtain the keyword table.
[0064] As an optional implementation manner of the present invention, the device further includes: updating the keywords of the target data to the preset keyword table.
[0065] The embodiment of the present invention also provides a computer device, such as Figure 3 As shown, the computer device may include a processor 301 and a memory 302, wherein the processor 301 and the memory 302 may be connected via a bus or other means. Figure 3 The example of connecting through bus is taken in the following.
[0066] The processor 301 may be a central processing unit (CPU). The processor 301 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or a combination of the above chips.
[0067] The memory 302 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the contradictory event classification method in the embodiment of the present invention. The processor 301 executes various functional applications and data processing of the processor by running the non-transient software programs, instructions and modules stored in the memory 302, that is, implementing the contradictory event classification method in the above method embodiment.
[0068] The memory 302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required by at least one function; the data storage area may store data created by the processor 301, etc. In addition, the memory 302 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 302 may optionally include a memory remotely arranged relative to the processor 301, and these remote memories may be connected to the processor 301 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0069] The one or more modules are stored in the memory 302, and when executed by the processor 301, the following is performed: Figure 1 The contradictory event classification method in the illustrated embodiment.
[0070] For details of the above computer equipment, please refer to Figure 1 The corresponding related descriptions and effects in the illustrated embodiments can be understood and will not be repeated here.
[0071] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above-mentioned types of memory.
[0072] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for classifying contradictory events, It is characterized in that include: Obtain target data that needs to be classified; Extracting features of the target data to obtain feature values of the target data; Based on the feature value of the target data and a preset text segmentation annotation model, obtaining the segmentation probability of the segmentation result of the target data; The word segmentation result with the highest word segmentation probability is used as word segmentation labeling data; The process of obtaining keywords of the target data based on the word segmentation and annotation data and the preset keyword table and constructing the preset keyword table includes: obtaining keyword sample data; obtaining candidate words based on the keyword extraction algorithm, word vector and part of speech; expanding the candidate words, the preset keyword template and the knowledge base to obtain a first keyword table; expanding the first keyword table by similar words to obtain a second keyword table; and expanding the second keyword table by part of speech to obtain the keyword table; The event type of the target data is obtained based on the keyword.
2. The method according to claim 1, It is characterized in that After acquiring the target data to be classified, the target data is subjected to feature extraction, and before obtaining the feature value of the target data, the target data needs to be preprocessed to obtain preprocessed data, and feature extraction is performed based on the preprocessed data. The preprocessing process includes: Removing control characters from the target data, converting the target data without the control characters into a half-width format, and converting punctuation marks into a Chinese format, to obtain first preprocessed data; Redundant text in the first preprocessed data is removed based on a regular expression to obtain preprocessed data.
3. The method according to claim 1, It is characterized in that The process of constructing the preset text segmentation and tagging model includes: Acquire word segmentation sample data, wherein the word segmentation sample data includes original text and part-of-speech tags for marking the original text; Perform feature extraction based on the original text to obtain a first feature value; The first feature value is used as input data and the part-of-speech tag is used as output data to train a neural network model for word segmentation tagging to obtain the preset text word segmentation tagging model.
4. The method according to claim 1, It is characterized in that The obtaining the keywords of the target data based on the word segmentation and annotation data and a preset keyword table includes: Based on the target data and the keyword table, obtaining a matching rule for the target data; Perform matching based on the matching rules to obtain keywords of the target data; Based on the keywords of the target data and a preset relationship correspondence table, the contradiction category of the target data is obtained.
5. The method according to claim 4, It is characterized in that The target data includes word meaning data and part-of-speech data. The matching rules of the target data are obtained based on the target data and the keyword table, including: Determine whether the word meaning data and part-of-speech data match the word meaning data and part-of-speech data in the keyword table, and if they match, extract the corresponding keyword; If there is no match, the word meaning data and the part-of-speech data are concatenated to obtain the whole word; A search is performed based on the whole word to obtain corresponding keywords.
6. The method according to claim 1, It is characterized in that The method further includes: updating the keywords of the target data to the preset keyword table.
7. A device for classifying contradictory events, It is characterized in that include: An acquisition module is used to acquire target data that needs to be classified; A feature extraction module, used to extract features from the target data to obtain feature values of the target data; A probability module, used to obtain the segmentation probability of the segmentation result of the target data based on the feature value of the target data and a preset text segmentation annotation model; A word segmentation and annotation data module, used to take the word segmentation result with the highest word segmentation probability as word segmentation and annotation data; A keyword module is used to obtain keywords of the target data based on the word segmentation and annotation data and a preset keyword table, and the process of constructing the preset keyword table includes: obtaining keyword sample data; obtaining candidate words based on a keyword extraction algorithm, a word vector and a part of speech; expanding based on the candidate words, a preset keyword template and a knowledge base to obtain a first keyword table; expanding the first keyword table by similar words to obtain a second keyword table; expanding the second keyword table by part of speech to obtain the keyword table; An event type module is used to obtain the event type of the target data based on the keyword.
8. A computer device, It is characterized in that include: at least one processor; And a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the steps of the contradictory event classification method as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the contradictory event classification method as described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Global semantic understanding method and device, computer device and storage medium
CN109325233A
Electronic medical record part-of-speech tagging method, model training method and related device
CN110457682A
Information processing method and device, storage medium and equipment
CN113536788A
Recommendation method and system based on pet feature tag, program product and medium
CN113722582A
