A text topic tag generation method, terminal device and storage medium
Through the text topic tag generation method, the neural network model is used to generate semantic related words as tags, which solves the problem of the lack of self-contained topic tags in Internet texts, achieves efficient organization of text content and multi-text association, and improves the quality of retrieval services.
Patent Information
- Application Number
- CN202011334632.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-25
- Publication Date
- 2025-01-21
- Estimated Expiration
- 2040-11-25
AI Technical Summary
The existing technology lacks the tags for its own topics when processing Internet text, resulting in low data collation efficiency, sparse data associations, and mechanical and lack of flexibility in the training results of machine learning methods.
A text topic label generation method is proposed. Through data cleaning, named entity recognition and neural network model training, multiple semantic related words are generated as labels to achieve topic summary of text content and topic association of multi-text content.
It achieves topic semantic association measurement for a large range of texts, improves the interpretability of the text similarity range, provides better services for retrieval, and solves the problems of low data sorting efficiency and sparse associations.
Smart Images

Figure CN112380866B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of text processing, and in particular to a method for generating text topic tags, a terminal device and a storage medium. Background Art
[0002] With the rapid expansion of network data, the demand for intelligent data search is increasing day by day. By setting relevant search conditions and keyword tags, you can obtain news, comments and other related knowledge about the things and events you are concerned about. The establishment of various big data centers also requires logical organization and labeling of raw data. Logical reasoning tags based on semantic information can help people obtain more relevant information in the data center in terms of logical semantics rather than character level, and provide convenience in building a wide range of data associations and data reasoning in the data center.
[0003] The existing technology for organizing database content is mainly divided into two directions. The first is direct organization based on online information, which mainly uses the association structure of web page links, or the Internet text itself with label attributes when searching; when the original online text does not carry similar label classification information, the data organization method often relies on manual preparation of label content and categories and then uses machine learning methods for label training. The online crawling method relies on the original content labels and Internet link relationships, which will generate a large number of default values in the data organization process, resulting in sparse data association; the machine learning method training label classification mainly has the disadvantages of large labor consumption, small label coverage, and relatively mechanical training results lacking flexibility. Summary of the invention
[0004] In order to solve the above problems, the present invention proposes a text topic tag generation method, terminal device and storage medium. In the case that Internet text lacks its own topic tags, multi-topic tagging is performed on long texts to achieve topic summarization of text content and build topic associations for multi-text content.
[0005] The specific plan is as follows:
[0006] A method for generating a text topic tag comprises the following steps:
[0007] S1: After data cleaning of the topic text to be identified, named entity recognition is performed to obtain all named entities corresponding to the topic text to be identified;
[0008] S2: Collect data and construct samples of one-to-many vocabulary combination forms to form a training set, where one word corresponds to multiple semantically associated words of the word; construct a neural network model, and train the neural network model through the training set, where in the one-to-many vocabulary combination form of the training set samples, one word is used as the input of the neural network model, and the multiple semantically associated words corresponding to the word are used as the output of the neural network model;
[0009] S3: After inputting each named entity corresponding to the topic text to be identified into the trained neural network model in turn, multiple words are obtained as output, and after cleaning and filtering the multiple words, the results of cleaning and filtering are used as labels corresponding to the named entities.
[0010] Furthermore, the data cleaning in step S1 includes the following steps:
[0011] S101: Segment the topic text to be identified into multiple sentences;
[0012] S102: Remove formatting paragraphs from all sentences;
[0013] S103: Perform word segmentation, part-of-speech recognition, stop word removal, and meaningless symbol removal on each sentence.
[0014] Furthermore, in step S1, the single-word entities in the named entity recognition result are removed and used as the named entities corresponding to the topic text to be recognized.
[0015] Furthermore, the process of extracting the semantically associated words corresponding to each word in step S2 includes the following steps:
[0016] S201: Obtain multiple vocabulary explanation entries corresponding to each word;
[0017] S202: for the explained word parts of the multiple entries, remove the entries consisting of secondary Chinese characters, and only retain the entries consisting of the three categories of words: nouns, verbs and adjectives;
[0018] S203: for the explanation part of each entry, remove the pronunciation and example sentence part, remove meaningless symbols, and perform word segmentation and part of speech recognition;
[0019] S204: According to the part of speech of the word to be explained, extract words of corresponding part of speech in the explanation language as semantically associated words corresponding to the word to be explained.
[0020] Furthermore, the network structure of the neural network model is a multi-layer perceptron network structure, in which the first three layers are fully connected networks, and the corresponding output ends of the last three layers are independent fully connected networks.
[0021] Furthermore, the loss function of the neural network model is:
[0022]
[0023] in, represents the i-th vector of the network output, w i represents the input vector corresponding to the i-th sample in the training set, and n represents the number of samples in the training set.
[0024] Furthermore, the cleaning and screening in step S3 includes: removing punctuation marks, removing long words with more than 5 characters, removing single-word words, and removing words consisting of secondary Chinese characters.
[0025] A terminal device for generating a text topic tag includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the method described above in an embodiment of the present invention are implemented.
[0026] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method described above in an embodiment of the present invention are implemented.
[0027] The present invention adopts the above technical solution, and through logical semantic label training and generation, it can measure the association of topic semantics for a large range of texts, summarize the text similarity range in an interpretable way, and provide better service for retrieval. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 Shown is a flow chart of a method according to a first embodiment of the present invention.
[0029] Figure 2 Shown is a flow chart of the data cleaning process in this embodiment.
[0030] Figure 3 Shown is a flow chart of the process of extracting semantically associated words in this embodiment. DETAILED DESCRIPTION
[0031] To further illustrate various embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, which are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementations and advantages of the present invention.
[0032] The present invention will now be further described with reference to the accompanying drawings and specific implementation methods.
[0033] Embodiment 1:
[0034] The embodiment of the present invention provides a method for generating a text topic tag. Figure 1 As shown, it is a flowchart of a method for generating a text topic tag according to an embodiment of the present invention, and the method comprises the following steps:
[0035] S1: After data cleaning of the topic text to be identified, named entity recognition is performed to obtain all named entities corresponding to the topic text to be identified.
[0036] Since the topic text to be identified is often a long sentence, and contains formatted phrases, stop words, meaningless symbols and other contents that affect named entity recognition, it is necessary to align and clean the data before named entity recognition.
[0037] like Figure 2 As shown, in this embodiment, data cleaning includes the following steps:
[0038] S101: Segment the topic text to be identified into multiple sentences.
[0039] Sentence processing can define sentence boundaries according to commas, periods, exclamation marks, question marks, and spaces in the text. Each long text can be defined into multiple single sentences.
[0040] S102: Remove formatting paragraphs from all sentences.
[0041] The formatted paragraph may specifically be an account name at the beginning of the paragraph, a forwarding sign, a system prompt, etc.
[0042] S103: Perform word segmentation, part-of-speech recognition, stop word removal, and meaningless symbol removal on each sentence.
[0043] In this embodiment, the period, comma, exclamation mark, question mark, and ellipsis commonly used in Chinese are retained as legal text, and the remaining punctuation marks are uniformly deleted.
[0044] Stop words are removed using the results of part-of-speech recognition to remove auxiliary words, numerals, conjunctions, quantifiers, prepositions, and adverbs in text sentences.
[0045] Named entity recognition can be performed using commonly known methods. In this embodiment, the open source model BERT is used to perform named entity recognition. The training set is sampled and labeled using its own data set. Each named entity annotation uses the BIESO annotation method for character-level annotation, which respectively represents B(begin)I(inside)E(end)S(single)O(other) to mark the "start character", "middle character", "end character", "single character entity" and "non-entity" of entities composed of multiple characters.
[0046] After removing the single-word entities in the named entity recognition results, the named entities corresponding to the topic text to be recognized are used.
[0047] S2: Collect data and construct samples of one-to-many vocabulary combination forms to form a training set, where the one-to-many vocabulary combination form is that one word corresponds to multiple semantically associated words of the word; construct a neural network model, and train the neural network model through the training set, where in the one-to-many vocabulary combination form of the training set samples, one word is used as the input of the neural network model, and the multiple semantically associated words corresponding to the word are used as the output of the neural network model.
[0048] like Figure 3 As shown, the process of extracting the semantically associated words corresponding to each word in this embodiment includes the following steps:
[0049] S201: Obtain multiple vocabulary explanation entries corresponding to each word.
[0050] In this embodiment, based on the vocabulary appearing in the "Modern Chinese Dictionary", after removing the vocabulary consisting of secondary Chinese characters, for each word, multiple vocabulary explanation entries are returned from the search results of the Internet encyclopedia data.
[0051] S202: For the explained word parts of the multiple entries, remove the entries consisting of secondary Chinese characters, and only keep the entries consisting of the three categories of words: nouns, verbs and adjectives.
[0052] S203: For the explanation part of each entry, remove the pronunciation and example sentence part, remove meaningless symbols, and perform word segmentation and part-of-speech recognition.
[0053] S204: According to the part of speech of each interpreted word, extract words of corresponding part of speech in the interpretation language as semantic associated words corresponding to the interpreted word.
[0054] When the explained word is a noun, the noun in the explanation is extracted; when the explained word is a verb, the verb in the explanation is extracted; when the explained word is an adjective, the adjective in the explanation is extracted.
[0055] Because it is necessary to extract a one-to-many vocabulary combination in the end, and the interpretation of a basic Chinese vocabulary in the encyclopedia data is usually determined by repeated deliberations of multiple experts in related fields, and the vocabulary explanation sentences usually use words with the same part of speech and strong semantic association to interpret. Taking nouns as an example, dictionaries usually use the hypernyms, hyponyms and nouns with direct semantic relationships with the vocabulary to characterize it, such as: "undercurrent: society, groundwater, thought, tendency, dynamics". Therefore, after extracting according to the rule that the interpreted word and the word extracted in the explanatory language have the same part of speech in this embodiment, a data form such as "domineering: fierce, powerful" will be obtained.
[0056] In order to more clearly reflect the mapping relationship, the network structure of the neural network model constructed in this embodiment is a multi-layer perceptron network structure. The first three layers are fully connected networks, and the output ends corresponding to the last three layers are fully connected networks that are independent of each other. The output ends of the last three layers of networks are independent of each other in order to avoid interference caused by repeated information when padding the length.
[0057] The output end uses cosine similarity as the loss, and the calculation formula is as follows:
[0058]
[0059] in, represents the i-th vector of the network output, w i The input vector corresponding to the i-th sample in the training set, n represents the number of samples in the training set.
[0060] It should be noted that, since words cannot be directly used as input and output of the model, in this embodiment, each word is converted into a corresponding vector in the similar word table through a similar word table, and the model is trained through the vector.
[0061] S3: After inputting each named entity corresponding to the topic text to be identified into the trained neural network model in turn, multiple words are obtained as output, and after cleaning and filtering the multiple words, the results of cleaning and filtering are used as labels corresponding to the named entities.
[0062] In this embodiment, after each named entity is input into the trained neural network model, n similarity vectors are input, and a similar word search is performed on each similarity vector in the similar word list to obtain the top t words with the greatest similarity. Therefore, n*t result words are output corresponding to each named entity.
[0063] Since these result words may contain synonyms, they need to be cleaned and screened. In this embodiment, cleaning and screening include: removing punctuation marks, removing long words with more than 5 characters, removing single-word words, and removing words composed of secondary Chinese characters. The final retained result is the vocabulary that constitutes the label. These words will be stored together with the text as the logical label of the text. If there are other texts with the same label, or the label vector similarity is above 0.8, the labels are merged.
[0064] The embodiment of the present invention uses the core explanation text in the Internet encyclopedia data as the original data, performs data cleaning, forms a one-to-many relationship of word analogies without limiting the scope of parts of speech, and performs mapping training in the static word vector space so that the neural network model has a wider range of logical reasoning capabilities for new vocabulary. The neural network model is used to generate topic tags for the paragraphs after named entity recognition. The neural network model is used to extract named entities from Internet texts and then generate topic tags, so that an automatically labeled label result is obtained for the Internet text, which can better integrate data in the database.
[0065] Embodiment 2:
[0066] The present invention also provides a text topic tag generation terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above-mentioned method embodiment of the first embodiment of the present invention when executing the computer program.
[0067] Further, as an executable solution, the text topic tag generation terminal device can be a computing device such as a desktop computer, a notebook, a PDA, and a cloud server. The text topic tag generation terminal device may include, but is not limited to, a processor and a memory. Those skilled in the art can understand that the composition structure of the above-mentioned text topic tag generation terminal device is only an example of a text topic tag generation terminal device, and does not constitute a limitation on the text topic tag generation terminal device. It may include more or less components than the above, or a combination of certain components, or different components. For example, the text topic tag generation terminal device may also include input and output devices, network access devices, buses, etc., and the embodiments of the present invention do not limit this.
[0068] Further, as an executable solution, the processor 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. The general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the text topic tag generation terminal device, and uses various interfaces and lines to connect various parts of the entire text topic tag generation terminal device.
[0069] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the text topic tag generation terminal device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required for a function; the data storage area can store data created according to the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0070] The present invention also 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 above method in the embodiment of the present invention are implemented.
[0071] If the module / unit integrated in the text topic tag generation terminal device 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 present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory) and software distribution medium, etc.
[0072] Although the present invention has been specifically shown and described in conjunction with the preferred embodiments, it should be understood by those skilled in the art that various changes may be made to the present invention in form and details without departing from the spirit and scope of the present invention as defined by the appended claims, all of which are within the scope of protection of the present invention.
Claims
1. A method for generating text topic tags, characterized in that: The following steps are involved: S1: After data cleaning of the topic text to be identified, named entity recognition is performed to obtain all named entities corresponding to the topic text to be identified; S2: Collect data and construct samples of one-to-many vocabulary combination forms to form a training set, where one word corresponds to multiple semantically associated words of the word; construct a neural network model, and train the neural network model through the training set, where in the one-to-many vocabulary combination form of the training set samples, one word is used as the input of the neural network model, and multiple semantically associated words corresponding to the word are used as the output of the neural network model; the semantically associated words corresponding to each word are extracted through the following steps: S201: Obtain multiple vocabulary explanation entries corresponding to each word; S202: for the explained word parts of the multiple entries, remove the entries consisting of secondary Chinese characters, and only retain the entries consisting of the three categories of words: nouns, verbs and adjectives; S203: for the explanation part of each entry, remove the pronunciation and example sentence part, remove meaningless symbols, and perform word segmentation and part of speech recognition; S204: extracting words of corresponding parts of speech in the explanation language according to the part of speech of the word to be explained as semantically associated words corresponding to the word to be explained; S3: After inputting each named entity corresponding to the topic text to be identified into the trained neural network model in turn, multiple words are obtained as output, and after cleaning and filtering the multiple words, the cleaning and filtering results are used as labels corresponding to the named entities; Cleaning and screening include: removing punctuation marks, removing long words with more than 5 characters, removing single-word words, and removing words consisting of secondary Chinese characters.
2. The method for generating text topic tags according to claim 1, characterized in that: The data cleaning in step S1 includes the following steps: S101: Segment the topic text to be identified into multiple sentences; S102: Remove formatting paragraphs from all sentences; S103: Perform word segmentation, part-of-speech recognition, stop word removal, and meaningless symbol removal on each sentence.
3. The method for generating text topic tags according to claim 1, characterized in that: After removing the single-word entities in the named entity recognition results, the named entities corresponding to the topic text to be recognized are used.
4. The method for generating text topic tags according to claim 1, characterized in that: The network structure of the neural network model is a multi-layer perceptron network structure, in which the first three layers are fully connected networks, and the corresponding output ends of the last three layers are independent fully connected networks.
5. The method for generating text topic tags according to claim 1, characterized in that: The loss function of the neural network model is: in, represents the i-th vector output by the network, w i represents the input vector corresponding to the i-th sample in the training set, and n represents the number of samples in the training set.
6. The method for generating text topic tags according to claim 1, characterized in that: The cleaning and screening in step S3 include: removing punctuation marks, removing long words with more than 5 characters, removing single-word words, and removing words consisting of secondary Chinese characters.
7. A terminal device for generating text topic tags, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.
8. 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 6 are implemented.
Citation Information
Patent Citations
Entity attribute information extraction method and device based on syntactic dependency
CN107957991A
Chinese punctuation mark adding method based on named entity recognition
CN111709242A