Methods, apparatuses, devices, and media for generating word packs
By preprocessing user corpus data and representing it with word vectors, and generating word packages through unsupervised training, the reliance on user tag values in existing technologies is resolved, expanding the scope and scenarios of applications and improving the privacy protection of data processing.
Patent Information
- Application Number
- CN202111265740.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-28
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2041-10-28
AI Technical Summary
Existing technologies require user tag values to generate word packages, which limits their practical application and makes it difficult to obtain user privacy data.
By preprocessing and representing user corpus data with word vectors, unsupervised clustering of user corpus data based on word vectors is performed to generate word packages, avoiding dependence on label values.
It enables the generation of word packages without user tag values, expanding the scope and scenarios of applications and improving the privacy protection of data processing.
Smart Images

Figure CN114004291B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the field of artificial intelligence, in particular to the fields of machine learning and text recognition, and more particularly to a method and apparatus for generating a word bag, an electronic device, a computer readable storage medium and a computer program product. BACKGROUND
[0002] Artificial intelligence is a discipline that studies enabling computers to simulate some thinking processes and intelligent behaviors of human beings (such as learning, reasoning, thinking, planning, etc.), which has both hardware and software technologies. Artificial intelligence hardware technology generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing, etc. Artificial intelligence software technology mainly includes computer vision technology, speech recognition technology, natural language processing technology, and machine learning / deep learning, big data processing technology, knowledge graph technology, etc.
[0003] With the development of artificial intelligence and machine learning technology, the method of machine learning can be applied to the clustering of text, and corpus data with the same or similar semantics are segmented and clustered to obtain a word bag with a specific meaning.
[0004] The methods described in this section can not necessarily be the methods previously conceived or adopted. Unless otherwise indicated, nothing in this section should be assumed to be prior art merely because it is included in this section. Similarly, unless otherwise indicated, nothing in this section should be assumed to have been admitted in any prior art. SUMMARY
[0005] The present disclosure provides a method and apparatus for generating a word bag, an electronic device, a computer readable storage medium and a computer program product.
[0006] According to an aspect of the present disclosure, a method for generating a word bag is provided, comprising: obtaining corpus data and pre-processing the corpus data to obtain a first segmented word set; combining a preset word set with the first segmented word set to obtain a second segmented word set, wherein the preset word set contains words related to a preset application scenario; obtaining a word vector corresponding to each segmented word in the second segmented word set; and clustering the segmented words in the second segmented word set based on the word vectors to generate at least one word bag.
[0007] According to another aspect of the present disclosure, there is provided an apparatus for generating a word bag, comprising: a preprocessing module configured to obtain corpus data and pre-process the corpus data to obtain a first set of segmented words; a merging module configured to merge a preset word set with the first set of segmented words to obtain a second set of segmented words, wherein the preset word set contains words related to a preset application scenario; an obtaining module configured to obtain a word vector corresponding to each segmented word in the second set of segmented words; and a clustering module configured to cluster the segmented words in the second set of segmented words based on the word vectors to generate at least one word bag.
[0008] According to another aspect of the present disclosure, there is provided an electronic 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 to enable the at least one processor to perform a method for generating a word bag.
[0009] According to another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause a computer to perform a method for generating a word bag.
[0010] According to another aspect of the present disclosure, there is provided a computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements a method for generating a word bag.
[0011] According to one or more embodiments of the present disclosure, a method for clustering corpus data based on word vectors to obtain a word bag can be provided.
[0012] It should be understood that the contents described in this section are not intended to identify key or important features of the embodiments of the present disclosure, nor are they used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent through the following description. BRIEF DESCRIPTION OF DRAWINGS
[0013] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain exemplary implementations of the application. The illustrated embodiments are merely examples and do not limit the scope of the claims. In all the drawings, like reference numerals refer to like elements throughout the accompanying drawings.
[0014] Figure 1 A flowchart of a method for generating a word bag according to an embodiment of the present disclosure is shown;
[0015] Figure 2 A flowchart of a method for generating a first set of segmented words according to an embodiment of the present disclosure is shown;
[0016] Figure 3 A structural block diagram of an apparatus for generating a word bag according to an embodiment of the present disclosure is shown;
[0017] Figure 4 A structural block diagram of a preprocessing module according to an embodiment of the present disclosure is shown; and
[0018] Figure 5 A structural block diagram of an exemplary electronic device that can be used to implement an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0019] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, in which various details of embodiments of the present disclosure are set forth to facilitate an understanding. It should be understood that various changes and modifications can be made to the embodiments described herein, and in which the present disclosure will be understood to include, without limitation, these and any future changes and modifications in the scope of the disclosure. Also, descriptions of well-known functions and constructions can be omitted for clarity and conciseness.
[0020] In the present disclosure, the terms "first", "second", and the like are used to describe various elements only for the purpose of distinguishing one element from another, and the terms are not intended to limit the positions, sequence, or importance of the elements. In some examples, a first element and a second element can refer to the same instance of the element, and in some cases, they can refer to different instances of the element based on the context of the description.
[0021] The terms used in the description of various described examples in the present disclosure are only for the purpose of describing particular examples and are not intended to be limiting. Unless specifically defined otherwise, an element that is a singular can be plural and vice versa. Also, the term "and / or" used in the present disclosure encompasses any and all possible combinations of the listed items.
[0022] In the prior technical solutions, the basic idea of clustering text is to extract corpus data of a user group with a label value, and to generate a word bag by statistically analyzing the corpus. This method needs to know the label value of the user representing a specific feature in advance, for example, whether a user who has purchased insurance has had an accident in the past year. After statistically analyzing the corpus data of a certain scale of user groups with label values, the words related to the specific feature can be obtained, and these words can form the corresponding word bag. However, such a supervised learning method needs to master the label value of the user, and the label value is generally difficult to obtain due to the privacy of the user, so it is also limited in actual application.
[0023] To solve the above problems, the present disclosure generates a word bag by preprocessing and word vector representation of user corpus data, and clustering the corpus data of the user based on the word vector, without the user having a label value, which can have a wider application range and application scenario.
[0024] Embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0025] Figure 1 A flowchart of a method for generating a word bag according to an embodiment of the present disclosure is shown. As shown in Figure 1 The method for generating a word bag 100 includes: step S101, obtaining corpus data and preprocessing the corpus data to obtain a first tokenization set; step S102, combining a preset word set with the first tokenization set to obtain a second tokenization set, wherein the preset word set contains words related to a preset application scenario; step S103, obtaining a word vector corresponding to each token in the second tokenization set; and step S104, clustering the tokens in the second tokenization set based on the word vector to generate at least one word bag.
[0026] Thus, by preprocessing and word vector representation of user corpus data, and clustering the corpus data of the user based on the word vector to generate a word bag through unsupervised training, without obtaining data with label values for supervised training, the method has a wider application range and application scenario compared to supervised training.
[0027] Step S101 of the method is used to generate a first tokenization set, as shown in Figure 2 The method for generating a first tokenization set includes: step S201, obtaining corpus data of a plurality of users; step S202, generating a to-be-filtered word set based on the corpus data of the plurality of users; step S203, for the corpus data of each user in the plurality of users, tokenizing the corpus data to obtain a third tokenization set; step S204, filtering the tokens in the third tokenization set based on the to-be-filtered word set to obtain a fourth tokenization set; and step S205, sorting the tokens in the fourth tokenization set based on the generation time of the corpus data to obtain the first tokenization set.
[0028] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved all comply with the relevant legal regulations and do not violate public order and good customs.
[0029] According to some embodiments, step S202 includes: determining high-frequency words with a frequency higher than a first threshold value and low-frequency words with a frequency lower than a second threshold value based on the corpus data of the plurality of users; and generating the to-be-filtered word set based on the high-frequency words and the low-frequency words.
[0030] In one example, based on the corpus data of multiple users, high-frequency words in the corpus data, such as little-semantic-impact auxiliary words, etc., can be filtered; low-frequency words with low occurrence frequency, such as English and other language words, and low-frequency words with semantic impact and classification effect impact, etc., can also be filtered, so that the semantic features of effective words are learned in the subsequent word embedding algorithm learning of the second segmented word set, to obtain better effective word vector representation effect.
[0031] For example, in step S203, the corpus data of each user can be segmented by using the tool package jieba 0.42.1 of python 3.8.1, or other applicable tools or algorithms can also be used for segmentation, and the present disclosure does not limit the tools or algorithms used for segmentation.
[0032] In step S205, based on the generation time of the corpus data, each segmented word in the fourth segmented word set is sorted, which helps the word embedding algorithm to learn the context association of the corpus data, to obtain a better word vector representation effect.
[0033] According to some embodiments, step S103 comprises: based on the learning of the word embedding algorithm on the second segmented word set, obtaining the word vector corresponding to each segmented word in the second segmented word set. Thus, through the learning of the word embedding algorithm on the second segmented word set containing the preprocessed corpus data and the preset word set, the semantic features of each segmented word in the second segmented word set are learned and the word vector corresponding to each segmented word is obtained, and the similarity between the segmented words is calculated based on the word vector and the segmented words are clustered through the similarity of the segmented words. Wherein, the preset word set contains words related to the preset application scenario, and the words related to the preset application scenario can be common words in a specific field or topic, which helps to cluster the word bag applied to a specific application scenario.
[0034] According to some embodiments, the word embedding algorithm can be a fasttext algorithm. Other applicable algorithms can also be used to learn the semantic features of the second segmented word set to obtain the corresponding word vector, such as word2cev algorithm, etc., and the present disclosure does not limit the selection of the algorithm used in the word vector representation.
[0035] According to some embodiments, step S104 comprises: based on the word vector, using an unsupervised training model to cluster the segmented words in the second segmented word set to generate at least one word bag. Before clustering the segmented words using the unsupervised training model, the number of categories for classification can be set to cluster the segmented words in the second segmented word set into a specific number of word bags.
[0036] According to some embodiments, the unsupervised training model is a Gaussian mixture model. Other applicable unsupervised training models can also be used to cluster the segmented words to generate the at least one word bag, and the present disclosure does not limit the selection of the unsupervised training model.
[0037] According to some embodiments, the method further comprises: calculating a similarity between each of the at least one word bag and the preset word set; and based on the similarity, screening out a word bag associated with the preset application scenario from the at least one word bag. For example, for the calculation of the similarity, the cosine similarity between the word vector corresponding to each vocabulary in a word bag and the word vector corresponding to each vocabulary in the preset word set is calculated, and the average of the calculated cosine similarities is taken to determine the similarity between the word bag and the preset word set, and the word bag associated with the preset application scenario is screened out based on the similarity.
[0038] In one example, the generated at least one word bag can be screened to extract a word bag associated with a target domain or topic. The type of the screened word bag can be labeled to use the word bag to generate a feature vector of a user.
[0039] According to another aspect of the present disclosure, there is provided an apparatus for generating a word bag, comprising: Figure 3 As shown, the apparatus 300 for generating a word bag comprises: a preprocessing module 301 configured to obtain corpus data and preprocess the corpus data to obtain a first segmented word set; a merging module 302 configured to merge a preset word set with the first segmented word set to obtain a second segmented word set, wherein the preset word set comprises vocabulary associated with a preset application scenario; an obtaining module 303 configured to obtain a word vector corresponding to each segmented word in the second segmented word set; and a clustering module 304 configured to cluster the segmented words in the second segmented word set based on the word vectors to generate at least one word bag.
[0040] Thus, by preprocessing the corpus data of a user by the preprocessing module 301 and obtaining the word vector representation of each segmented word by the obtaining module 303, and by clustering the corpus data of the user based on the word vectors by the clustering module 304 to generate a word bag by unsupervised training, there is no need to obtain data with label values for supervised training, and the unsupervised training has a wider range of applications and application scenarios compared to the supervised training.
[0041] As shown in Figure 4As shown, the preprocessing module 301 includes: an acquisition unit 401 configured to acquire corpus data of a plurality of users; a generation unit 402 configured to generate a set of to-be-filtered words based on the corpus data of the plurality of users; a word segmentation unit 403 configured to perform word segmentation on corpus data of each of the plurality of users to obtain a third word segmentation set; a filtering unit 404 configured to filter words in the third word segmentation set based on the set of to-be-filtered words to obtain a fourth word segmentation set; and a sorting unit 405 configured to sort each word in the fourth word segmentation set based on a generation time of the corpus data to obtain the first word segmentation set.
[0042] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved in the technical solution comply with relevant laws and regulations and do not violate public order and good customs.
[0043] According to some embodiments, the generation unit 402 includes: a sub-unit configured to determine high-frequency words with a frequency higher than a first threshold and low-frequency words with a frequency lower than a second threshold based on the corpus data of the plurality of users; and a sub-unit configured to generate the set of to-be-filtered words based on the high-frequency words and the low-frequency words.
[0044] In one example, the generation unit 402 can generate a set of to-be-filtered words composed of high-frequency words and low-frequency words based on the corpus data of the plurality of users, where the high-frequency words in the corpus data may, for example, be auxiliary words that have less impact on semantics, and the low-frequency words may, for example, be words in other languages such as English, and code text that have less impact on semantics and classification effect. The filtering unit 404 filters the words in the third word segmentation set based on the set of to-be-filtered words generated by the generation unit, so that the word embedding algorithm learns the semantic features of effective words in subsequent learning of the second word segmentation set, to obtain better word vector representation effect of effective words.
[0045] For example, the word segmentation unit 403 can use the tool package jieba 0.42.1 of python 3.8.1 to perform word segmentation on the corpus data of each user, and other applicable tools or algorithms can also be used for word segmentation, and the present disclosure does not limit the tools or algorithms used for word segmentation.
[0046] The sorting unit 405 can sort each word in the fourth word segmentation set based on the generation time of the corpus data, which helps the word embedding algorithm to learn the context association of the corpus data, to obtain a better word vector representation.
[0047] According to some embodiments, the obtaining module 303 is further configured to: based on learning of the word embedding algorithm on the second set of segmented words, obtain a word vector corresponding to each segmented word in the second set of segmented words. In this way, by learning of the word embedding algorithm on the second set of segmented words containing preprocessed corpus data and a preset word set, semantic features of each segmented word in the second set of segmented words are learned, and the word vector corresponding to each segmented word in the second set of segmented words is obtained by the obtaining module 303, so as to calculate the similarity between segmented words based on the word vector and cluster the segmented words by the similarity between the segmented words. The preset word set contains words related to a preset application scenario, and the words related to the preset application scenario can be common words in a specific field or topic, which are helpful to cluster word bags applied to the specific application scenario.
[0048] According to some embodiments, the word embedding algorithm is a fasttext algorithm.
[0049] According to some embodiments, the clustering module 304 is further configured to: based on the word vector, cluster the segmented words in the second set of segmented words by using an unsupervised training model to generate at least one word bag. Before the clustering module 304 clusters the segmented words by using the unsupervised training model, the number of categories of classification can be set to cluster the segmented words in the second set of segmented words into a specific number of word bags.
[0050] According to some embodiments, the unsupervised training model is a Gaussian mixture model. The clustering module 304 can also cluster the segmented words by using other applicable unsupervised training models to generate at least one word bag, and the selection of the unsupervised training model used by the present disclosure is not limited.
[0051] According to some embodiments, the apparatus further includes: a calculating module configured to calculate the similarity between each word bag in the at least one word bag and the preset word set; and a screening module configured to screen out, based on the similarity, a word bag associated with the preset application scenario from the at least one word bag.
[0052] According to an embodiment of the present disclosure, an electronic device, a readable storage medium and a computer program product are also provided.
[0053] Reference Figure 5The present invention describes a structural block diagram of an electronic device 500 that can serve as a server or client of the present disclosure, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0054] like Figure 5 As shown, the electronic device 500 includes a computing unit 501, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 502 or a computer program loaded from a storage unit 508 into a random access memory (RAM) 503. The RAM 503 may also store various programs and data required for the operation of the electronic device 500. The computing unit 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0055] Multiple components in electronic device 500 are connected to I / O interface 505, including: input unit 506, output unit 507, storage unit 508, and communication unit 509. Input unit 506 can be any type of device capable of inputting information to electronic device 500. Input unit 506 can receive input digital or character information and generate key signal inputs related to user settings and / or function control of electronic device, and may include, but is not limited to, a mouse, keyboard, touchscreen, trackpad, trackball, joystick, microphone, and / or remote control. Output unit 507 can be any type of device capable of presenting information, and may include, but is not limited to, a monitor, speaker, video / audio output terminal, vibrator, and / or printer. Storage unit 508 may include, but is not limited to, disk and optical disk. Communication unit 509 allows electronic device 500 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers, and / or chipsets, such as Bluetooth™ devices, 802.11 devices, WiFi devices, WiMax devices, cellular communication devices, and / or the like.
[0056] The computing unit 501 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 501 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 501 performs various methods and processes described above, such as the method for generating word bags. For example, in some embodiments, the method for generating word bags can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 508. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 500 via the ROM 502 and / or the communication unit 509. When the computer program is loaded onto the RAM 503 and executed by the computing unit 501, one or more steps of the method for generating word bags described above can be performed. Alternatively, in other embodiments, the computing unit 501 can be configured to perform the method for generating word bags by any other appropriate means, such as by means of firmware.
[0057] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a complex programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0058] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces a means for implementing the functions / acts specified in the flowcharts and / or block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0059] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0060] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0061] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0062] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0063] It should be understood that the various forms of flow illustrated above can be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technology disclosed in the present disclosure can be achieved, which is not limited herein.
[0064] While embodiments or examples of the present disclosure have been described with reference to the drawings, it should be understood that the above-described methods, systems, and devices are merely exemplary embodiments or examples, and the scope of the present disclosure is not limited by these embodiments or examples, but is only limited by the claims and their equivalents. Various elements in the embodiments or examples can be omitted or replaced by equivalent elements thereof. In addition, each step can be performed in an order different from that described in the present disclosure. Further, various elements in the embodiments or examples can be combined in various ways. It is important that many of the elements described herein can be replaced by equivalent elements that appear after the present disclosure as technology evolves.
Claims
1. A method for generating a word bag, comprising: obtaining corpus data and pre-processing the corpus data to obtain a first segmented word set; merging a preset word set with the first segmented word set to obtain a second segmented word set, wherein the preset word set contains words related to a preset application scenario; obtaining a word vector corresponding to each segmented word in the second segmented word set; clustering the segmented words in the second segmented word set based on the word vectors to generate at least one word bag; calculating a similarity between each word bag in the at least one word bag and the preset word set; and based on the similarity, screening out a word bag in the at least one word bag that is associated with the preset application scenario.
2. The method of claim 1, wherein, Obtaining corpus data and pre-processing the corpus data to obtain a first segmented word set comprises: obtaining corpus data of a plurality of users; generating a to-be-filtered word set based on the corpus data of the plurality of users; segmenting the corpus data of each user in the plurality of users to obtain a third segmented word set; filtering the segmented words in the third segmented word set based on the to-be-filtered word set to obtain a fourth segmented word set; and sorting the segmented words in the fourth segmented word set based on the generation time of the corpus data to obtain the first segmented word set.
3. The method of claim 1, wherein, Obtaining a word vector corresponding to each segmented word in the second segmented word set comprises: obtaining a word vector corresponding to each segmented word in the second segmented word set based on learning of the second segmented word set by a word embedding algorithm.
4. The method of claim 1, wherein, Clustering the segmented words in the second segmented word set based on the word vectors to generate at least one word bag comprises: clustering the segmented words in the second segmented word set based on the word vectors using an unsupervised training model to generate at least one word bag.
5. The method of claim 2, wherein, Generating a to-be-filtered word set based on the corpus data of the plurality of users comprises: determining high-frequency words with a frequency higher than a first threshold and low-frequency words with a frequency lower than a second threshold based on the corpus data of the plurality of users; generating the to-be-filtered word set based on the high-frequency words and the low-frequency words.
6. An apparatus for generating a word bag, comprising: a pre-processing module configured to obtain corpus data and pre-process the corpus data to obtain a first segmented word set; a merging module configured to merge a preset word set with the first segmented word set to obtain a second segmented word set, wherein the preset word set contains words related to a preset application scenario; an obtaining module configured to obtain a word vector corresponding to each segmented word in the second segmented word set; a clustering module configured to cluster the segmented words in the second segmented word set based on the word vectors to generate at least one word bag; a calculating module configured to calculate a similarity between each word bag in the at least one word bag and the preset word set; and a screening module configured to screen out a word bag in the at least one word bag that is associated with the preset application scenario based on the similarity.
7. The apparatus of claim 6, wherein, The pre-processing module comprises: an obtaining unit configured to obtain corpus data of a plurality of users; a generating unit configured to generate a to-be-filtered word set based on the corpus data of the plurality of users; The word segmentation unit is configured to segment the corpus data of each of the plurality of users to obtain a third word segmentation set; The filtering unit is configured to filter the word segmentation in the third word segmentation set based on the to-be-filtered word set to obtain a fourth word segmentation set; and The sorting unit is configured to sort each word segmentation in the fourth word segmentation set based on the generation time of the corpus data to obtain the first word segmentation set.
8. The apparatus of claim 6, wherein, The obtaining module is further configured to: obtain a word vector corresponding to each word segmentation in the second word segmentation set based on learning of the second word segmentation set by a word embedding algorithm.
9. The apparatus of claim 6, wherein, The clustering module is further configured to: cluster the word segmentation in the second word segmentation set based on the word vector by using an unsupervised training model to generate at least one word bag.
10. The apparatus of claim 7, wherein, The generating unit includes: a subunit configured to determine a high-frequency word with a frequency higher than a first threshold and a low-frequency word with a frequency lower than a second threshold based on the corpus data of the plurality of users; a subunit configured to generate the to-be-filtered word set based on the high-frequency word and the low-frequency word.
11. An electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method according to any one of claims 1-5.
13. A computer program product comprising a computer program, wherein, The computer program, when executed by a processor, implements the method of any one of claims 1-5. The computer program, when executed by a processor, implements the method of any one of claims 1-5.
Citation Information
Patent Citations
Text clustering method and device
CN112036176A