New word recognition method and terminal device based on machine learning
Through the new word recognition method based on machine learning, using the deep neural network word segmentation model and stop vocabulary filtering, the problem of low accuracy of new word recognition is solved, more efficient new word recognition is achieved, and Chinese natural language processing and Accuracy of public opinion analysis.
Patent Information
- Application Number
- CN201811198025.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-10-15
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2038-10-15
AI Technical Summary
Existing new word recognition technology has low accuracy for new word recognition, which affects the accuracy of Chinese natural language processing and the effect of public opinion analysis.
Using a new word recognition method based on machine learning, the text to be processed is segmented through a deep neural network word segmentation model, and combined with the preset stop lexicon to filter, determine whether the string is a new word, and include it in the new word lexicon, which improves the efficiency Accuracy of novel word recognition.
Through the deep neural network word segmentation model and stop thesaurus comparison, new words are quickly and accurately obtained, which improves the accuracy of new word recognition, enhances the accuracy of Chinese information processing and the reliability of public opinion analysis.
Smart Images

Figure CN109472022B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular relates to a new word recognition method and terminal device based on machine learning. Background Art
[0002] In natural language processing or computer language, new words refer to words that have never appeared before or are not included in the dictionary. With the continuous development of Internet technology, many new words have emerged in various industries, especially the emergence of web2.0 applications, which allow users to create web content themselves, resulting in the emergence of a large number of new words.
[0003] In the field of Chinese information processing, Chinese is not like Western languages such as English, which have fixed separators between words, so Chinese word segmentation is an important basic technology. The emergence of new words greatly affects the accuracy of automatic word segmentation tools. In addition, the emergence of new words truly reflects people's lives and is an important basis for public opinion analysis. Therefore, the recognition and storage of new words is an important research content in the field of Chinese natural language processing.
[0004] However, the existing new word recognition technology has a low accuracy rate for new word recognition. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a new word recognition method and terminal device based on machine learning to solve the problem of low accuracy of new word recognition in the prior art.
[0006] A first aspect of an embodiment of the present invention provides a new word recognition method based on machine learning, comprising:
[0007] Through the deep neural network word segmentation model, the text to be processed is segmented to obtain multiple strings;
[0008] Screening the multiple character strings to obtain character strings whose lengths are within a preset length range as candidate character strings;
[0009] For any character string in the candidate character strings, the character string is compared with the front stop words, the back stop words and the broad stop words in the preset stop word library, wherein the front stop words refer to words that appear at the end of a word but not at the beginning of a word, the back stop words refer to words that appear at the beginning of a word but not at the end of a word, and the broad stop words are preset known words;
[0010] If the character string does not belong to the general stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, the character string is determined to be a new word and the character string is included in the new word database.
[0011] A second aspect of an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the following steps are implemented:
[0012] Through the deep neural network word segmentation model, the text to be processed is segmented to obtain multiple strings;
[0013] Screening the multiple character strings to obtain character strings whose lengths are within a preset length range as candidate character strings;
[0014] For any character string in the candidate character strings, the character string is compared with the front stop words, the back stop words and the broad stop words in the preset stop word library, wherein the front stop words refer to words that appear at the end of a word but not at the beginning of a word, the back stop words refer to words that appear at the beginning of a word but not at the end of a word, and the broad stop words are preset known words;
[0015] If the character string does not belong to the general stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, the character string is determined to be a new word and the character string is included in the new word database.
[0016] A third aspect of an embodiment of the present invention provides a terminal device, including a memory, a processor, and a computer-readable instruction stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer-readable instruction:
[0017] Through the deep neural network word segmentation model, the text to be processed is segmented to obtain multiple strings;
[0018] Screening the multiple character strings to obtain character strings whose lengths are within a preset length range as candidate character strings;
[0019] For any character string in the candidate character strings, the character string is compared with the front stop words, the back stop words and the broad stop words in the preset stop word library, wherein the front stop words refer to words that appear at the end of a word but not at the beginning of a word, the back stop words refer to words that appear at the beginning of a word but not at the end of a word, and the broad stop words are preset known words;
[0020] If the character string does not belong to the general stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, the character string is determined to be a new word and the character string is included in the new word database.
[0021] The present invention provides a new word recognition method and terminal device based on machine learning, which segments the text to be processed through a deep neural network word segmentation model, reduces the amount of calculation by screening the length of the character string, and compares the character string with a preset stop word library to quickly and accurately obtain new words. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0023] Figure 1 A flowchart of a new word recognition method based on machine learning provided by an embodiment of the present invention;
[0024] Figure 2 A flowchart of another new word recognition method based on machine learning provided by an embodiment of the present invention;
[0025] Figure 3 A flowchart of another new word recognition method based on machine learning provided by an embodiment of the present invention;
[0026] Figure 4 A flowchart of another new word recognition method based on machine learning provided in an embodiment of the present invention;
[0027] Figure 5 A structural block diagram of a new word recognition device based on machine learning provided by an embodiment of the present invention;
[0028] Figure 6 A schematic diagram of a terminal device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0029] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present invention. However, it should be clear to those skilled in the art that the present invention may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present invention.
[0030] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.
[0031] The embodiment of the present invention provides a new word recognition method based on machine learning. Figure 1 , the method comprising:
[0032] S101, Tokenize the text to be processed using a deep neural network tokenization model to obtain multiple strings.
[0033] Optionally, an embodiment of the present invention provides a deep neural network tokenization model, which includes 4 layers, namely an input layer, a first hidden layer, a second hidden layer, and an output layer. The input of the input layer is the feature vector of the characters in the training set text. The first hidden layer includes a first preset number of nodes, such as 100 nodes. The second hidden layer includes a second preset number of nodes, such as 200 nodes. The activation functions of the first hidden layer and the second hidden layer are relu functions. The output layer is the tokenization result, and the activation function of the output layer is the logistics function.
[0034] Of course, in this step, the text to be processed can also be tokenized using other deep neural network tokenization models, and the embodiments of the present invention do not limit this.
[0035] S102, Screen the multiple strings to obtain the strings with lengths within a preset length range as candidate strings.
[0036] The tokenization result of step S101 is strings of different lengths. For example, some characters form a single-word string by themselves, and their strings are of the size of a single character, while some words are composed of multiple characters, and their strings are the strings corresponding to multiple characters. For example, the length of general new words is between 2 and 5 characters. Therefore, the preliminary screening of new words can be achieved through this step.
[0037] S103, For any string in the candidate strings, compare the string with the pre-stop words, post-stop words, and general stop words in the preset stop word library, where the pre-stop words are the words that appear at the end of the word but not at the beginning, the post-stop words are the words that appear at the beginning of the word but not at the end, and the general stop words are the preset known words.
[0038] The stop words in the preset stop word library are the characters determined according to Chinese language rules and will definitely not form a meaningful word when they appear at specific positions in the word string. The stop words are divided into pre-stop words, post-stop words, and general stop words. Pre-stop words generally appear at the end of the word and rarely appear at the beginning, such as "儿 (ér), 子 (zǐ), 然 (rán), 于 (yú), 边 (biān), 么 (me), 们 (men), 呼 (hū)". Post-stop words are the opposite of pre-stop words and rarely appear at the end of the word, such as "阿 (ā), 老 (lǎo)", etc. General stop words can be set as existing words or preset words to be deleted according to needs, such as the words in a general dictionary or a professional dictionary. These pre-stop words, post-stop words, and general stop words constitute the stop word database. By screening the words in the screening result of step S102 using the preset stop word library, new words can be obtained.
[0039] S104: if the character string does not belong to the generalized stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, the character string is determined to be a new word, and the character string is included in a new word database.
[0040] The screening principle for determining whether a character string does not belong to a character string in a preset stop word library is: the character string does not belong to the generalized stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word.
[0041] The embodiment of the present invention provides a new word recognition method based on machine learning, which obtains new words by segmenting a text to be processed using a deep neural network segmentation model, filtering the segmentation results by string length, and re-screening through a preset stop word library.
[0042] Combination Figure 2 The embodiment of the present invention also provides a new word recognition method based on machine learning, which is used to improve the word segmentation accuracy of a deep neural network word segmentation model. The method includes:
[0043] S201, obtaining a first preset training set, where the first preset training set is a text set with manually annotated text category information.
[0044] S202: Training a text classification model according to the first preset training set.
[0045] Step S201 and step S202 are the process of training the text classification model, and the specific implementation process can be achieved through various implementation methods, which will not be described in detail in the embodiment of the present invention.
[0046] S203: Determine the type of the text to be processed according to the text classification model.
[0047] With the development of the Internet, a large amount of electronic text data usually involves various fields. Take Weibo or forums as an example. These platforms contain a large amount of user information and real-time hot topics in various aspects. The information covered by different topics is also very different. For example, the network information with themes such as food and gourmet food and the network information with the theme of electronic technology have almost no intersection in their content. In the prior art, network data from different sources are usually processed into a unified text, and a training set is constructed through manual word segmentation. The word segmentation model is trained through the training set. The word segmentation results of this word segmentation model are less accurate.
[0048] To solve this problem and improve the accuracy of word segmentation, in an embodiment of the present invention, the type of the text to be processed is determined by a trained text classification model. For example, a text to be processed, i.e., a text to be segmented, can be segmented by multiple segmentation models. By obtaining the type of the text in this step, the text can be segmented by a segmentation model corresponding to the type, thereby improving the accuracy of word segmentation.
[0049] S204: According to the type of the text to be processed, a second preset training set corresponding to the type of the text to be processed is obtained, and for any text in the second training set, the type of the text is the same as the type of the text to be processed.
[0050] For example, if it is determined through step S203 that the text to be processed is a financial text, then the financial corpus is manually segmented to obtain a first preset training set.
[0051] Of course, the order of the steps is not limited in the embodiments of the present invention. Optionally, the text type can be preset, such as dividing the data with high frequency and large data volume in the network into preset categories, such as finance, education, entertainment, etc. For each category, a training set corresponding to the category is established. For example, for the financial category, the texts in the training set established are all financial texts, and for the entertainment category, the texts in the training set established are all entertainment texts. The word segmentation model is trained separately by training sets of different categories to obtain the word segmentation model corresponding to the category. When a text needs to be segmented, it is only necessary to determine the category of the text and obtain the word segmentation model corresponding to the category through the category of the text, thereby improving the accuracy of the word segmentation of the text to be processed. Accurate word segmentation is the premise and basis for new word recognition, so this method can improve the accuracy of new word recognition.
[0052] S205: Training the deep neural network word segmentation model using the second preset training set.
[0053] Since the texts in the second preset training set are all of the same type and are of the same type as the text to be processed, the deep neural network word segmentation model trained by the second preset training set is a model specifically used to segment the text to be processed that is of the same type as the text in the second preset training set, and can improve the accuracy of word segmentation of this type of text.
[0054] An embodiment of the present invention provides a new word recognition method based on machine learning. By performing type judgment on a text to be processed, a word segmentation model is trained using a first preset training set corresponding to the type of the text to be processed. At this time, the type of text in the first preset training set is the same as the text type of the text to be processed. Through this method, the word segmentation accuracy can be improved, thereby improving the accuracy of new word recognition.
[0055] Further, combined with Figure 3 The embodiment of the present invention also provides a new word recognition method based on machine learning, the implementation of which is based on Figure 1 The method provided by the corresponding embodiment, after Figure 1 After the new word recognition method provided by the corresponding embodiment, or Figure 1 In the process of new word recognition provided by the corresponding embodiment, the method includes:
[0056] S301, obtaining first web page data within a first preset time period, and preprocessing the first web page data to obtain the text to be processed.
[0057] S302, obtaining second web page data within a second preset time period, and preprocessing the second web page data to obtain new text to be processed, wherein the second preset time period is a time period after the first preset time period.
[0058] If the character string does not belong to the generalized stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, then execute this step.
[0059] In the embodiment of the present invention, the first web data and the second web page data are obtained by a focused crawler with the same crawling strategy. A focused crawler is a program that automatically downloads web pages. It selectively accesses web pages and related links on the World Wide Web according to a predetermined crawling target to obtain the required information. Unlike a general crawler, a focused crawler does not pursue a large coverage, but sets the goal of crawling web pages related to a specific subject content to prepare data resources for subject-oriented user queries.
[0060] Therefore, in this step, by focusing the crawler with the same crawling strategy, the first web page data and the second web page data captured are data of the same subject, which can also be called the same type of data.
[0061] S303: Perform word segmentation processing on the new text to be processed through the deep neural network word segmentation model.
[0062] The deep neural network word segmentation model in this step is the same as the deep neural network word segmentation model in step S101. Further, the model is a deep neural network word segmentation model corresponding to the type of text to be processed.
[0063] S304: Obtain a first word frequency and a second word frequency of the character string.
[0064] Among them, the first word frequency is the ratio of the number of times the character string appears in the text to be processed to the total number of character strings in the text to be processed, and the second word frequency is the ratio of the number of times the character string appears in the new text to be processed to the total number of character strings in the new text to be processed.
[0065] S305: Determine whether the character string is a new word according to the first word frequency and the second word frequency.
[0066] For a new word, it should appear many times within a period of time. If it only appears a few times or only appears in a very short period of time, it means that the word does not meet the conditions for being called a new word. For example, if the word is a word created by one person, only the person who created the word has used the word, or the word only appears in a very short period of time, such as one day, and then it no longer appears, it means that the word is not a new word. Figure 1 The new words obtained by the method of the corresponding embodiment may still have certain errors. In this case, the accuracy of new word recognition can be further improved by the method provided by the embodiment of the present invention.
[0067] Optionally, two methods may be used to determine whether the character string is a new word based on the first word frequency and the second word frequency.
[0068] The first method is: if the first word frequency is greater than a first preset value, and the second word frequency is greater than a second preset value, then the character string is determined to be a new word, wherein the second preset value is greater than the first preset value. That is, for a word X, if Figure 1 The new word recognition method provided in the corresponding embodiment determines that the word is a new word, and further, it is necessary to determine the first word frequency and the second word frequency of word X.
[0069] For example, the frequency of word X appearing in the first preset time period, that is, the first word frequency of word X is greater than the first preset value, and word X also appears in the second preset time period, and its frequency of appearance, that is, its second word frequency is greater than the second preset value. At this time, it can be judged that the word appears continuously and at a certain frequency, thereby further proving the possibility that the word is a new word. Since network data has a strong timeliness, especially for new words, the closer the appearance time of network data is to the current time, the higher its credibility is. For example, data from a week ago is more credible than data from a year ago. Therefore, in this method, the second preset value is set to be greater than the first preset value.
[0070] The second method is: calculating the credibility of the string according to a formula, the formula is:
[0071] S=af1+bf2
[0072] Wherein, S is the credibility of the character string, f1 is the first word frequency, f2 is the second word frequency, a+b=1, and a≤b;
[0073] If the credibility of the character string is greater than a third preset value, the character string is determined to be a new word.
[0074] The second method is also based on the timeliness of network data. The weight of the second word frequency is set to be greater than or equal to the weight of the first word frequency. Through the second method, the credibility of a word being a new word can be judged. The larger the calculated value, the greater the possibility that the word is a new word.
[0075] The embodiment of the present invention provides a new word recognition method based on machine learning. In this method, a focus crawler crawls web page data of two time periods with the same topic. Figure 1 After the method of the corresponding embodiment preliminarily determines that a word is a new word, it further determines the possibility that the word is a new word based on the first word frequency of the word in the first preset time period and the second word frequency of the second preset time period, and only selects words with high possibility as new words, further improving the accuracy of new word recognition.
[0076] Combination Figure 4 The embodiment of the present invention further provides a new word recognition method based on machine learning. After the method is applied to the above embodiments, the method includes:
[0077] S401, obtaining a seed word set, wherein the seed word set includes a word vector of each word, the word vector of each word has the same dimension, and each dimension of the word vector is used to represent a semantic feature or a grammatical feature of the word.
[0078] Through the word vector space model, the word in the corpus is subjected to semantic and grammatical analysis to obtain the word vector of the word. For example, when new word recognition is performed based on Weibo corpus, word segmentation can be performed based on a large amount of Weibo data to obtain a seed word set, and the word vector of each word in the seed word set can be obtained through semantic and grammatical analysis. The word vector contains the part-of-speech information, position information, context information, and sentiment tendency information of a word and other words in the sentence in which it is located. The dimension of the word vector of each word in the seed word set is the same.
[0079] S402, performing grammatical analysis on the sentence containing the new word to obtain a word vector of the new word.
[0080] The same method is used to construct the word vectors of new words and the word vectors in the seed word set.
[0081] S403, according to the word vector of each word in the seed word set and the word vector of the new word, matching the word with the highest similarity to the new word in the seed word set as a synonym of the new word.
[0082] After the words are vectorized, the cosine similarity can be used to calculate the similarity between the words. Specifically, the similarity between the new word w1 and a word w2 in the seed word set can be calculated using the following formula:
[0083]
[0084] Among them, Cosine(w1,w2) is used to represent the similarity between w1 and w2. The word vector of each word contains n dimensions, w 1i With w 2i They represent the value of the word vector of w1 in the i-th dimension and the value of w2 in the i-th dimension respectively.
[0085] Through this step, the similarity between the new word and each word in the seed word set is calculated in turn, and the word with the highest similarity is used as the synonym of the new word.
[0086] S404: in the new word database, marking the new word by its synonyms.
[0087] An embodiment of the present invention provides a new word recognition method based on machine learning. The method obtains synonyms of new words based on word vector analysis, and marks the new words with synonyms, thereby giving specific meanings to the new words.
[0088] Combination Figure 5 , an embodiment of the present invention provides a schematic diagram of a new word recognition device based on machine learning, the device comprising: a word segmentation unit 51, a screening unit 52, a comparison unit 53 and a judgment unit 54;
[0089] A word segmentation unit 51 is used to perform word segmentation processing on the text to be processed through a deep neural network word segmentation model to obtain multiple character strings;
[0090] A screening unit 52, configured to screen the plurality of character strings and obtain character strings whose lengths are within a preset length range as candidate character strings;
[0091] a comparison unit 53, for comparing any character string in the candidate character string with a front stop word, a back stop word, and a broad stop word in a preset stop word library, wherein the front stop word refers to a word that appears at the end of a word but not at the beginning of a word, the back stop word refers to a word that appears at the beginning of a word but not at the end of a word, and the broad stop word is a preset known word;
[0092] The judging unit 54 is configured to judge that the character string is a new word and add the character string to a new word database if the character string does not belong to the generalized stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word.
[0093] Optionally, the device further includes a first acquisition unit 55 and a training unit 56;
[0094] A first acquisition unit 55 is used to acquire a first preset training set, where the first preset training set is a text set with text category information manually annotated;
[0095] A training unit 56, used to determine the type of the text to be processed according to the text classification model;
[0096] The first acquisition unit 55 is further configured to acquire, according to the type of the text to be processed, a second preset training set corresponding to the type of the text to be processed, wherein for any text in the second training set, the type of the text is the same as the type of the text to be processed;
[0097] The training unit 56 is also used to train the deep neural network analysis model through the second preset training set.
[0098] Optionally, the device further includes a second acquisition unit 57 and a third acquisition unit 58, which are used to pre-process the first web page data acquired within the first preset time period to obtain the text to be processed, and if the character string does not belong to the generalized stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, the second acquisition unit 57 is further used to acquire second web page data within a second preset time period, and pre-process the second web page data to obtain a new text to be processed, wherein the second preset time period is a time period after the first preset time period;
[0099] The word segmentation unit 51 is further used to perform word segmentation processing on the new text to be processed through the deep neural network word segmentation model;
[0100] A third acquisition unit 58 is used to acquire a first word frequency and a second word frequency of the character string, wherein the first word frequency is a ratio of the number of times the character string appears in the to-be-processed text to the total number of character strings in the to-be-processed text, and the second word frequency is a ratio of the number of times the character string appears in the new to-be-processed text to the total number of character strings in the new to-be-processed text;
[0101] The judging unit 54 is further configured to judge whether the character string is a new word according to the first word frequency and the second word frequency.
[0102] Optionally, the judgment unit 54 is specifically configured to judge that the character string is a new word if the first word frequency is greater than a first preset value and the second word frequency is greater than a second preset value, wherein the second preset value is greater than the first preset value.
[0103] Or, optionally, the judgment unit 54 is specifically used to: calculate the credibility of the character string according to a formula, and the formula is:
[0104] S=af1+bf2
[0105] Wherein, S is the credibility of the string, f1 is the first word frequency, f2 is the second word frequency, a+b=1, and a≤b; if the credibility of the string is greater than a third preset value, the string is determined to be a new word.
[0106] Optionally, the second acquisition unit 57 is specifically configured to acquire the first web page data and the second web page data by using a focused crawler and a same crawling strategy.
[0107] Optionally, the device further includes a fourth acquisition unit 59, a fifth acquisition unit 510, a matching unit 511 and a labeling unit 512;
[0108] A fourth acquisition unit 59 is used to acquire a seed word set, wherein the seed word set includes all known Chinese words, and the seed word set includes a word vector of each Chinese word, wherein the word vector of each Chinese word has the same dimension, and each dimension of the word vector is used to represent a semantic feature or a grammatical feature of the Chinese word;
[0109] A fifth acquisition unit 510 is used to perform grammatical analysis on the sentence where the new word is located to obtain a word vector of the new word;
[0110] A matching unit 511 is used to match the Chinese word with the highest similarity to the new word in the seed word set as a synonym of the new word according to the word vector of each Chinese word in the seed word set and the word vector of the new word;
[0111] The marking unit 512 is used to mark the new word in the new word database by its synonyms.
[0112] An embodiment of the present invention provides a new word recognition device based on machine learning, which segments a text to be processed using a deep neural network segmentation model, screens the segmentation results for string length, and screens again using a preset stop word library to acquire new words.
[0113] Figure 6 Schematic diagram of a terminal device provided by an embodiment of the present invention. Figure 6 As shown, the terminal device 6 of this embodiment includes: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60, such as a new word recognition program. When the processor 60 executes the computer program 62, the steps in the above-mentioned new word recognition method embodiments are implemented, such as Figure 1Steps 101 to 104 shown, or Figure 2 Steps 201 to 205 shown, or Figure 3 301 to 305 as shown, or Figure 4 Alternatively, when the processor 60 executes the computer program 62, the functions of each module / unit in the above-mentioned device embodiments are realized, for example Figure 5 Functions of modules 51 to 512 are shown.
[0114] Exemplarily, the computer program 62 may be divided into one or more modules / units, which are stored in the memory 61 and executed by the processor 60 to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program 62 in the terminal device 6.
[0115] The terminal device 6 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will appreciate that Figure 6 It is only an example of the terminal device 6 and does not constitute a limitation on the terminal device 6. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.
[0116] The processor 60 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0117] The memory 61 may be an internal storage unit of the terminal device 6, such as a hard disk or memory of the terminal device 6. The memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the terminal device 6. The memory 61 is used to store the computer program and other programs and data required by the terminal device. The memory 61 may also be used to temporarily store data that has been output or is to be output.
[0118] An embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the new word recognition method described in any of the above embodiments are implemented.
[0119] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0120] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0121] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A new word recognition method based on machine learning, characterized in that: The method includes: Through the deep neural network word segmentation model, the text to be processed is segmented to obtain multiple strings; Screening the multiple character strings to obtain character strings whose lengths are within a preset length range as candidate character strings; For any character string in the candidate character strings, the character string is compared with the front stop words, the back stop words and the broad stop words in the preset stop word library, wherein the front stop words refer to words that appear at the end of a word but not at the beginning of a word, the back stop words refer to words that appear at the beginning of a word but not at the end of a word, and the broad stop words are preset known words; If the character string does not belong to the generalized stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, the character string is determined to be a new word, and the character string is included in the new word database; The to-be-processed text is obtained by preprocessing first webpage data acquired within a first preset time period, and if the character string does not belong to the generalized stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, the method further includes: Acquire second webpage data within a second preset time period, and pre-process the second webpage data to obtain new text to be processed, wherein the second preset time period is a time period after the first preset time period; Performing word segmentation processing on the new text to be processed by using the deep neural network word segmentation model; Obtaining a first word frequency and a second word frequency of the string, wherein the first word frequency is a ratio of the number of times the string appears in the text to be processed to the total number of strings in the text to be processed, and the second word frequency is a ratio of the number of times the string appears in the new text to be processed to the total number of strings in the new text to be processed; Determining whether the character string is a new word according to the first word frequency and the second word frequency; The determining, based on the first word frequency and the second word frequency, whether the character string is a new word comprises: The credibility of the string is calculated according to a formula, which is: Wherein, S is the credibility of the string, is the first word frequency, is the second word frequency, a+b=1, and a≤b; If the credibility of the character string is greater than a third preset value, the character string is determined to be a new word.
2. The new word recognition method according to claim 1, characterized in that: The method further includes: Obtaining a first preset training set, where the first preset training set is a text set with text category information manually annotated; Training a text classification model according to the first preset training set; Determining the type of the text to be processed according to the text classification model; According to the type of the text to be processed, a second preset training set corresponding to the type of the text to be processed is obtained, and for any text in the second preset training set, the type of the text is the same as the type of the text to be processed; The deep neural network analysis model is trained using the second preset training set.
3. The new word recognition method according to claim 1, characterized in that: The determining, based on the first word frequency and the second word frequency, whether the character string is a new word comprises: If the first word frequency is greater than a first preset value and the second word frequency is greater than a second preset value, the character string is determined to be a new word, wherein the second preset value is greater than the first preset value.
4. The new word recognition method according to claim 1, characterized in that: The method further includes: By focusing the crawler, the first web page data and the second web page data are acquired with the same crawling strategy.
5. The new word recognition method according to any one of claims 1 to 4, characterized in that: After determining that the character string is a new word, the method further includes: Obtain a seed word set, wherein the seed word set includes all known Chinese words, and the seed word set includes a word vector of each Chinese word, wherein the word vector of each Chinese word has the same dimension, and each dimension of the word vector is used to represent a semantic feature or a grammatical feature of the Chinese word; Performing grammatical analysis on the sentence containing the new word to obtain a word vector of the new word; According to the word vector of each Chinese word in the seed word set and the word vector of the new word, a Chinese word with the highest similarity to the new word is matched in the seed word set as a synonym of the new word; In the new word database, the new words are marked by their synonyms.
6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
7. A terminal device, characterized in that: The terminal device includes a memory and a processor, the memory stores a computer program that can be run on the processor, and the processor implements the following steps when executing the computer program: Through the deep neural network word segmentation model, the text to be processed is segmented to obtain multiple strings; Screening the multiple character strings to obtain character strings whose lengths are within a preset length range as candidate character strings; For any character string in the candidate character strings, the character string is compared with the front stop words, the back stop words and the broad stop words in the preset stop word library, wherein the front stop words refer to words that appear at the end of a word but not at the beginning of a word, the back stop words refer to words that appear at the beginning of a word but not at the end of a word, and the broad stop words are preset known words; If the character string does not belong to the generalized stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, the character string is determined to be a new word, and the character string is included in the new word database; The to-be-processed text is obtained by preprocessing first webpage data acquired within a first preset time period, and if the character string does not belong to the generalized stop word, the first character of the character string does not belong to the front stop word, and the last character of the character string does not belong to the back stop word, further comprising: Acquire second webpage data within a second preset time period, and pre-process the second webpage data to obtain new text to be processed, wherein the second preset time period is a time period after the first preset time period; Performing word segmentation processing on the new text to be processed by using the deep neural network word segmentation model; Obtaining a first word frequency and a second word frequency of the string, wherein the first word frequency is a ratio of the number of times the string appears in the text to be processed to the total number of strings in the text to be processed, and the second word frequency is a ratio of the number of times the string appears in the new text to be processed to the total number of strings in the new text to be processed; Determining whether the character string is a new word according to the first word frequency and the second word frequency; The determining, based on the first word frequency and the second word frequency, whether the character string is a new word comprises: The credibility of the string is calculated according to a formula, which is: Wherein, S is the credibility of the string, is the first word frequency, is the second word frequency, a+b=1, and a≤b; If the credibility of the character string is greater than a third preset value, the character string is determined to be a new word.
8. The terminal device according to claim 7, characterized in that: The processor executes the computer program to further implement: Obtaining a first preset training set, where the first preset training set is a text set with text category information manually annotated; Training a text classification model according to the first preset training set; Determining the type of the text to be processed according to the text classification model; According to the type of the text to be processed, a second preset training set corresponding to the type of the text to be processed is obtained, and for any text in the second preset training set, the type of the text is the same as the type of the text to be processed; The deep neural network analysis model is trained using the second preset training set.
Citation Information
Patent Citations
Method for automatically acquiring new words from Chinese webpages
CN101706807A
Neologism discovering method and system
CN106033462A
Method for discovering investment objects by using new words, device and storage medium
CN108038119A
Text sentiment analysis method and system based on deep learning
CN108108355A
Text word-splitting method and device and instant message processing method and device
CN108334492A
