Spam mail filtering method and device, equipment, storage medium and program product
By preprocessing email content and extracting text features, and using an email classification model to filter spam, the problem of low accuracy in existing technologies is solved, achieving efficient spam interception and reducing maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-19
- Publication Date
- 2026-04-10
AI Technical Summary
Existing spam filtering methods have low accuracy and are difficult to achieve efficient interception.
By preprocessing the email content, extracting the email text feature vector, and using a trained email classification model to determine the email classification information, the email is rejected if it is classified as spam.
It improved the accuracy of spam filtering, reduced maintenance costs, and maintained high interception efficiency.
Smart Images

Figure CN121836650A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of financial technology, and in particular to a method, apparatus, device, storage medium, and program product for filtering spam. Background Technology
[0002] In the financial industry, email has become a core tool for information exchange between individuals, businesses, and institutions. Its convenience, low cost, and immediacy make it a fundamental infrastructure of modern communication. With the explosive growth of internet users, the spam problem has become increasingly serious. Spam not only consumes server storage space and network bandwidth but can also lead to user privacy leaks and financial losses for businesses. To improve the security of received emails, spam filtering can be implemented.
[0003] Current technologies filter spam emails using preset whitelists or blacklists. However, these methods are not very accurate and struggle to effectively block spam. Summary of the Invention
[0004] This application provides methods, apparatus, devices, storage media, and program products for filtering spam, in order to improve the accuracy of spam filtering.
[0005] In a first aspect, embodiments of this application provide a method for filtering spam emails, including:
[0006] Preprocess the email content to obtain email text information related to email classification;
[0007] Text features are extracted from email text information to generate text feature vectors corresponding to the email text information. The text feature vectors include the weight values of each word segment in the email text information. The weight values are used to indicate the probability that the word segment belongs to spam content.
[0008] The email classification model is called based on the text feature vector to determine the email classification information corresponding to the email; the email classification model is trained based on the text feature vectors of multiple historical emails.
[0009] If the email is classified as a normal email, the email will be accepted; if it is classified as spam, the email will be rejected.
[0010] In one possible implementation, the email content is preprocessed to obtain email text information related to email classification, including: performing data cleaning on the email content to remove redundant information and obtain cleaned email content; and performing word segmentation on the cleaned email content to obtain email text information related to email classification.
[0011] In one possible implementation, text feature extraction is performed on the email text information to generate a text feature vector corresponding to the email text information. This includes: extracting text features from multiple word segments in the email text information and obtaining the term frequency inverse document frequency (TFD) corresponding to each word segment; and generating a text feature vector corresponding to the email text information based on the TFD corresponding to each word segment.
[0012] In one possible implementation, the method further includes: preprocessing the email content of multiple historical emails to obtain the historical email text information corresponding to each of the multiple historical emails; extracting text features from the historical email text information to generate historical text feature vectors corresponding to the historical email text information; training the historical text feature vectors using multiple machine learning models; and selecting the model with the highest classification accuracy as the trained email classification model.
[0013] In one possible implementation, multiple machine learning models are used to train the historical text feature vectors, including: dividing the text feature vectors corresponding to multiple historical emails into a training sample set and a test sample set according to a preset ratio; training the machine learning model using the training sample set for each machine learning model; and determining the classification accuracy of the machine learning model using the test sample set.
[0014] In one possible implementation, the method further includes: obtaining user feedback information, which includes the actual email type; if the email classification information obtained based on the email classification model is different from the actual email type, then adjusting the model parameters of the email classification model to improve the classification accuracy of the email classification model.
[0015] Secondly, embodiments of this application provide a spam filtering device, comprising:
[0016] The acquisition module is used to preprocess the email content and acquire email text information related to email classification.
[0017] The feature extraction module is used to extract text features from email text information and generate text feature vectors corresponding to the email text information. The text feature vectors include the weight values of each word segment in the email text information. The weight values are used to indicate the probability that the word segment belongs to spam content.
[0018] The determination module is used to call the trained email classification model based on the text feature vector to determine the email classification information corresponding to the email; the email classification model is trained based on the text feature vectors of multiple historical emails.
[0019] The filtering module is used to accept emails if the email classification information indicates they are normal emails, and to reject emails if the email classification information indicates they are spam.
[0020] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;
[0021] The memory stores instructions that the computer executes;
[0022] The processor executes computer execution instructions stored in memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0023] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0024] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0025] This application provides a spam filtering method, apparatus, device, storage medium, and program product. The method includes: preprocessing the email content to obtain email text information related to email classification; extracting text features from the email text information to generate a text feature vector corresponding to the email text information, wherein the text feature vector includes weight values corresponding to multiple words in the email text information, and the weight values are used to indicate the probability that the word belongs to spam content; calling a trained email classification model based on the text feature vector to determine the email classification information corresponding to the email; the email classification model is trained based on the text feature vectors of multiple historical emails; if the email classification information is a normal email type, the email is accepted; if the email classification information is a spam type, the email is rejected. In this embodiment, because the input text data is first standardized through preprocessing, providing a high-quality data foundation for subsequent feature extraction; then, the key attributes of the email content are dynamically captured through text feature extraction; and finally, the email classification information corresponding to the email is determined through the email classification model, manual intervention is reduced, maintenance costs are lowered, and high interception efficiency is maintained even in complex attack scenarios, thus improving the accuracy of spam filtering. Attached Figure Description
[0026] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0027] Figure 1 A schematic diagram illustrating a scenario for the spam filtering method provided in this application;
[0028] Figure 2 A flowchart illustrating the spam filtering method provided in this application embodiment;
[0029] Figure 3 A schematic diagram of the structure of the spam filtering device provided in the embodiments of this application;
[0030] Figure 4 A schematic diagram of the structure of the electronic device provided in this application.
[0031] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0032] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0033] In the financial industry, email has become a core tool for information exchange between individuals, businesses, and institutions. Its convenience, low cost, and immediacy make it a fundamental infrastructure of modern communication. With the explosive growth of internet users, the spam problem has become increasingly serious. Spam not only consumes server storage space and network bandwidth but can also lead to user privacy leaks and financial losses for businesses. To improve the security of received emails, spam filtering can be implemented.
[0034] Current technologies filter spam emails using preset whitelists or blacklists. However, whitelist / blacklist-based filtering requires manual addition by the user, which is inefficient. Whitelists are created in the same way as blacklists, and the sender email addresses they contain should not be blocked.
[0035] However, with in-depth research into spam technology, the techniques for creating and spreading spam are also constantly improving. For example, forging new mail server addresses makes it easy to circumvent blacklist and whitelist filters, making it difficult to achieve efficient interception of spam.
[0036] To address the aforementioned technical problems, the inventors propose the following technical concept: by performing text analysis on email content, extracting email content features, and then using email content features and machine learning models, determining email classification information.
[0037] The specific steps may include: preprocessing the email content to obtain email text information related to email classification; extracting text features from the email text information to generate a text feature vector corresponding to the email text information, wherein the text feature vector includes the weight values corresponding to each of the multiple words in the email text information, and the weight values are used to indicate the probability that the word belongs to spam content; calling a trained email classification model based on the text feature vector to determine the email classification information corresponding to the email; the email classification model is trained based on the text feature vectors of multiple historical emails; if the email classification information is a normal email type, the email is accepted; if the email classification information is a spam type, the email is rejected.
[0038] In this embodiment, the standardization of the input text data is first ensured through preprocessing, providing a high-quality data foundation for subsequent feature extraction; then, key attributes of the email content are dynamically captured through text feature extraction; finally, the email classification information corresponding to the email is determined through an email classification model. This reduces manual intervention, lowers maintenance costs, and maintains high interception efficiency even in complex attack scenarios, thus improving the accuracy of spam filtering.
[0039] The collection, storage, use, processing, transmission, provision, and disclosure of financial data or user data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0040] It should be noted that in the embodiments of this application, certain software, components, models and other existing solutions in the industry may be mentioned. These should be regarded as exemplary and are only intended to illustrate the feasibility of implementing the technical solution of this application. However, they do not mean that the applicant has used or necessarily used the solution.
[0041] Figure 1 A schematic diagram illustrating a scenario for the spam filtering method provided in this application. For example... Figure 1 In this scenario, there are: terminal 101 and server 102.
[0042] In the specific implementation process, server 102 and terminal 101 can be implemented using a cluster of one or more servers with more powerful processing capabilities and higher security. Where possible, computers or laptops with strong computing power can also be used as alternatives.
[0043] The connection between server 102 and terminal 101 can be either wired or wireless. When terminal 101 receives a new email, it can send a spam filtering request to server 102. Server 102 receives the spam filtering request from terminal 101 and filters the spam using the spam filtering method provided in this application.
[0044] It is understood that the scenarios illustrated in the embodiments of this application do not constitute a specific limitation on the spam filtering method. In other feasible embodiments of this application, the above scenarios may include more or fewer components than illustrated, or combine some components, or split some components, or arrange different components, which can be determined according to the actual application scenario and are not limited here. Figure 1 The scenario shown can be implemented by hardware, software, or a combination of both.
[0045] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0046] Figure 2 This is a flowchart illustrating the spam filtering method provided in this application embodiment. The execution entity of this application embodiment can be... Figure 1 The server 102 in this embodiment can also be a computer and / or a mobile phone, etc., and this embodiment does not impose any special restrictions on it. Figure 2 As shown, the method includes:
[0047] S201. Preprocess the email content to obtain email text information related to email classification.
[0048] In this embodiment of the disclosure, the email content is preprocessed to generate standardized email text information, thereby achieving standardization of email content.
[0049] In some embodiments, preprocessing includes data cleaning and word segmentation. Accordingly, this step may include: performing data cleaning on the email content to remove redundant information and obtain cleaned email content; and performing word segmentation on the cleaned email content to obtain email text information related to email classification.
[0050] Optionally, redundant information may include non-Chinese characters, spaces, and other non-text information, as well as information unrelated to email category, such as sender's email address, recipient's email address, and email sending time.
[0051] For example, the email content is "Dear customer, you have won a prize. Please click the link to claim your prize." After removing non-Chinese characters and performing word segmentation, the resulting email text is "Dear / customer / win / click / link / claim / prize".
[0052] S202. Extract text features from the email text information and generate a text feature vector corresponding to the email text information. The text feature vector includes the weight values corresponding to each of the multiple words in the email text information. The weight values are used to indicate the probability that the word belongs to spam content.
[0053] In this embodiment of the disclosure, TF-IDF (Term Frequency-Inverse Document Frequency), a trained neural network model, or a bag-of-words model can be used to extract text features from email text information and generate text feature vectors corresponding to the email text information.
[0054] Neural network models learn the contextual information of words in text, representing each word as a real-valued vector. The bag-of-words model is a simple text representation method that treats text as an unordered collection of words, ignoring word order and grammatical structure, focusing only on word frequency. In the bag-of-words model, each word is considered a feature, and the text is represented as a vector. Each dimension of the vector corresponds to a word, and the value of the dimension indicates the number of times that word appears in the text or whether it appears at all.
[0055] In some embodiments, text features are extracted from email text information using term frequency inverse document frequency (TFD) to generate a text feature vector corresponding to the email text information. Accordingly, this step may include: extracting text features from multiple word segments in the email text information to obtain the term frequency inverse document frequency (TFD) corresponding to each word segment; and generating a text feature vector corresponding to the email text information based on the term frequency inverse document frequency (TFD) corresponding to each word segment.
[0056] Optionally, text feature extraction is performed on multiple word segments in the email text information to obtain the term frequency inverse document frequency (TFD) corresponding to each word segment. This includes: extracting text features from multiple word segments in the email text information and determining the term frequency inverse document frequency (TFD) corresponding to each word segment using the following formula:
[0057] Formula 1:
[0058] Where TF-IDF represents the term frequency inverse document frequency of the word segment, W represents the number of times the word appears in the email, N represents the total number of words in the email, Y represents the total number of emails, Yw represents the number of emails containing the word, and adding 1 is to avoid the case where the denominator is 0.
[0059] In some embodiments, when the text feature vector has a high dimensionality, singular value decomposition can be performed on the text feature vector to reduce the dimensionality of the feature space. Optionally, the top 20 most frequent feature words in the email can be selected to generate the feature matrix.
[0060] For example, the weight values (i.e., word frequency inverse document frequency) of keywords such as "winning", "click", and "link" can be used to form a text feature vector.
[0061] It should be noted that during the generation of text feature vectors, sparse vectors may occur, leading to some feature words having a probability of 0 during calculation, resulting in a significant local bias in the final result. Therefore, to prevent probability distortion due to insufficient feature samples, a semaphore (i.e., a smoothing factor) can be added when extracting text features from email text information to address this issue. The default value for the semaphore can be set to 1. Correspondingly, the inverse document frequency (IVF) can be expressed as:
[0062]
[0063] Where x represents the text length; L1 and L2 represent adjustment factors, which can be set to 1000 and 10000 respectively; B1 and B2 represent smoothing factors, with a default value of 1.
[0064] S203. Based on the text feature vector, call the trained email classification model to determine the email classification information corresponding to the email; the email classification model is trained based on the text feature vectors of multiple historical emails.
[0065] In this embodiment of the disclosure, the email classification model can be any machine learning model.
[0066] In some embodiments, the training process of the email classification model includes: preprocessing the email content of multiple historical emails to obtain the historical email text information corresponding to each of the multiple historical emails; extracting text features from the historical email text information to generate historical text feature vectors corresponding to the historical email text information; training the historical text feature vectors using multiple machine learning models; and selecting the model with the highest classification accuracy as the trained email classification model.
[0067] For example, different machine learning algorithms are used to model the data, the test dataset is transformed and tested to obtain the training results of each model, and then the parameters of each algorithm model are tuned. The model with the highest recall rate is selected as the email classification model.
[0068] Optionally, multiple machine learning models are used to train the historical text feature vectors, including: dividing the text feature vectors corresponding to multiple historical emails into a training sample set and a test sample set according to a preset ratio; training the machine learning model using the training sample set for each machine learning model; and determining the classification accuracy of the machine learning model using the test sample set.
[0069] In this disclosure, the value of the preset ratio is not specifically limited. For example, the preset ratio can be 7:3.
[0070] S204. If the email classification information is normal email, accept the email; if the email classification information is spam, reject the email.
[0071] In some embodiments, the machine learning model can be updated periodically based on user feedback and new spam samples to improve the accuracy of spam filtering. Accordingly, the method further includes: obtaining user feedback information, including the actual email type; and adjusting the model parameters of the email classification model if the email classification information obtained based on the email classification model differs from the actual email type, in order to improve the classification accuracy of the email classification model.
[0072] The spam filtering method provided in this application includes: preprocessing the email content to obtain email text information related to email classification; extracting text features from the email text information to generate a text feature vector corresponding to the email text information, where the text feature vector includes the weight values corresponding to multiple words in the email text information, and the weight values indicate the probability that a word belongs to spam content; calling a trained email classification model based on the text feature vector to determine the email classification information corresponding to the email; the email classification model is trained based on the text feature vectors of multiple historical emails; if the email classification information is a normal email type, the email is accepted; if the email classification information is spam, the email is rejected. In this embodiment, because the input text data is first standardized through preprocessing, providing a high-quality data foundation for subsequent feature extraction; then, the key attributes of the email content are dynamically captured through text feature extraction; and finally, the email classification information corresponding to the email is determined through the email classification model, manual intervention is reduced, maintenance costs are lowered, and high interception efficiency is maintained even in complex attack scenarios, thus improving the accuracy of spam filtering.
[0073] Figure 3 This is a schematic diagram of the structure of a spam filtering device provided in an embodiment of this application. Figure 3 As shown, the spam filtering device includes:
[0074] The acquisition module 301 is used to preprocess the email content and acquire email text information related to email classification.
[0075] The feature extraction module 302 is used to extract text features from email text information and generate a text feature vector corresponding to the email text information. The text feature vector includes the weight values corresponding to each of the multiple words in the email text information. The weight values are used to indicate the probability that the word belongs to spam content.
[0076] The determination module 303 is used to call the trained email classification model based on the text feature vector to determine the email classification information corresponding to the email; the email classification model is trained based on the text feature vectors of multiple historical emails.
[0077] The filtering module 304 is used to accept emails if the email classification information is normal, and to reject emails if the email classification information is spam.
[0078] In one possible implementation, the feature extraction module 302 preprocesses the email content to obtain email text information related to email classification, including: performing data cleaning on the email content, deleting redundant information in the email content to obtain cleaned email content; and performing word segmentation on the cleaned email content to obtain email text information related to email classification.
[0079] In one possible implementation, the feature extraction module 302 performs text feature extraction on the email text information to generate a text feature vector corresponding to the email text information, including: extracting text features from multiple word segments in the email text information and obtaining the inverse document frequency (IVF) of each word segment; and generating a text feature vector corresponding to the email text information based on the IVF of each word segment.
[0080] In one possible implementation, the device further includes: a model training module; the model training module is used to preprocess the email content of multiple historical emails to obtain the historical email text information corresponding to each of the multiple historical emails; extract text features from the historical email text information to generate historical text feature vectors corresponding to the historical email text information; train the historical text feature vectors using multiple machine learning models; and select the model with the highest classification accuracy as the trained email classification model.
[0081] In one possible implementation, the model training module uses multiple machine learning models to train the historical text feature vectors, including: dividing the text feature vectors corresponding to multiple historical emails into a training sample set and a test sample set according to a preset ratio; training the machine learning model using the training sample set for each machine learning model; and determining the classification accuracy of the machine learning model using the test sample set.
[0082] In one possible implementation, the device further includes: a model adjustment module; the model adjustment module is used to obtain user feedback information, including the actual email type; if the email classification information obtained based on the email classification model is different from the actual email type, the model parameters of the email classification model are adjusted to improve the classification accuracy of the email classification model.
[0083] The spam filtering device provided in this application first ensures the standardization of input text data through preprocessing, providing a high-quality data foundation for subsequent feature extraction; then, it dynamically captures key attributes of email content through text feature extraction; and finally, it determines the corresponding email classification information through an email classification model. This reduces manual intervention, lowers maintenance costs, and maintains high interception efficiency even in complex attack scenarios, thus improving the accuracy of spam filtering.
[0084] The spam filtering device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.
[0085] Figure 4 A schematic diagram of the structure of the electronic device provided in this application. Figure 4 As shown, the electronic device 40 provided in this embodiment includes at least one processor 401 and a memory 402. Optionally, the electronic device 40 further includes a communication component 403. The processor 401, memory 402, and communication component 403 are connected via a bus.
[0086] In a specific implementation, at least one processor 401 executes computer execution instructions stored in memory 402, causing at least one processor 401 to perform the above-described method.
[0087] The specific implementation process of processor 401 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0088] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.
[0089] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0090] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0091] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.
[0092] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.
[0093] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.
[0094] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.
[0095] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0096] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0097] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0098] If a function is implemented as 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 this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0099] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.
[0100] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A method for filtering spam emails, characterized in that, include: Preprocess the email content to obtain email text information related to email classification; Text features are extracted from the email text information to generate a text feature vector corresponding to the email text information. The text feature vector includes the weight values corresponding to each of the multiple words in the email text information. The weight values are used to indicate the probability that the word belongs to spam content. The trained email classification model is invoked based on the text feature vector to determine the email classification information corresponding to the email. The email classification model is trained based on the text feature vectors of multiple historical emails. If the email classification information indicates that it is a normal email, then the email will be accepted; if the email classification information indicates that it is a spam email, then the email will be rejected.
2. The method according to claim 1, characterized in that, The preprocessing of email content to obtain email text information related to email classification includes: The email content is cleaned by removing redundant information to obtain cleaned email content. The cleaned email content is segmented to obtain email text information related to email classification.
3. The method according to claim 1, characterized in that, The step of extracting text features from the email text information to generate a text feature vector corresponding to the email text information includes: Text features are extracted from multiple word segments in the email text information to obtain the inverse document frequency (IVF) of each word segment; Based on the inverse document frequency of each word segment, a text feature vector corresponding to the email text information is generated.
4. The method according to claim 1, characterized in that, The method further includes: Preprocess the content of multiple historical emails to obtain the corresponding historical email text information for each of the multiple historical emails; Text features are extracted from the historical email text information to generate historical text feature vectors corresponding to the historical email text information. Multiple machine learning models were used to train the historical text feature vectors, and the model with the highest classification accuracy was selected as the trained email classification model.
5. The method according to claim 4, characterized in that, The historical text feature vectors are trained using multiple machine learning models, including: The text feature vectors corresponding to multiple historical emails are divided into a training sample set and a test sample set according to a preset ratio. For each machine learning model, the machine learning model is trained using a set of training samples. The classification accuracy of the machine learning model is determined by testing a set of samples.
6. The method according to claim 1, characterized in that, The method further includes: Obtain user feedback information, including the actual email type; If the email classification information obtained based on the email classification model is different from the actual email type, the model parameters of the email classification model are adjusted to improve the classification accuracy of the email classification model.
7. A spam filtering device, characterized in that, include: The acquisition module is used to preprocess the email content and acquire email text information related to email classification. The feature extraction module is used to extract text features from the email text information and generate a text feature vector corresponding to the email text information. The text feature vector includes the weight values corresponding to each of the multiple words in the email text information. The weight values are used to indicate the probability that the word belongs to spam content. The determination module is used to call a trained email classification model based on the text feature vector to determine the email classification information corresponding to the email. The email classification model is trained based on the text feature vectors of multiple historical emails. The filtering module is used to accept the email if the email classification information is normal, and to reject the email if the email classification information is spam.
8. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 6.
10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1 to 6.