I have a list of email subjects like
<XYZ> commented on <ABC> Weekly review for <Company> Your account is ready
And I want to find patterns in them so I can group them.
Is there a well known algorithm I can use?
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.Sign up to join this community
You'll probably have to experiment a bit with different approaches. Let me outline two different kinds of approaches you could try.
You could try applying unsupervised topic modelling to your subject lines. LDA is probably the most widely used method.
Topic modelling tries to find a limited number of "topics", and assigns each subject line to one or more "topics" based on the words in the subject line.
You could try using clustering. Broadly, you would find some way map each subject line to a feature vector, and then apply some unsupervised clustering method. There are many options for each of those two steps. To get feature vectors, you might try any of the existing word embeddings; e.g., you might try word2vec. For clustering, there are many, many clustering algorithms; e.g., you might try k-means. I recommend you do a little reading on these topics and then experiment with them a bit.
A warning. Don't set your expectations too high. Subject lines are typically very short, and that will make it hard for these techniques to find clusterings. In other words, you are operating in a regime that's known to be hard for existing NLP and ML techniques.
If you can find any other features that might assist with clustering similar emails (e.g., the identify of the sender? the mailing list it was sent on, if any?), including that information might improve the quality of the clusters.