Character string pattern matching using machine learning
Systems, methods, apparatuses, and computer program products are disclosed herein for determining character strings that share a pattern, even though the pattern is not necessarily known. In particular, character strings of a plurality of character strings are pairwise compared to one or more other character strings of the plurality by a trained model. Each character string pair determined by the trained model to share a pattern is included in a group. After completion of the pairwise comparison, the group includes all character strings of the plurality of character strings that share the pattern.
1 . A method for determining whether a username matches a pattern, comprising:
receiving a plurality of usernames;
comparing, using a trained machine learning model, each of the plurality of usernames pairwise with others of the plurality of usernames to determine whether each pair of usernames share a pattern;
grouping, into a group, pairwise-compared usernames determined to share a pattern;
receiving an unclassified username;
determining that the unclassified username does not match the pattern associated with the group; and
responsive to determining that the unclassified username does not match the pattern associated with the group, preventing the creation of an account associated with the unclassified username.
2 . The method of claim 1 , wherein said determining that the unclassified username does not match the pattern comprises:
comparing, using the trained machine learning model, the unclassified username pairwise with each username in the group to determine whether the unclassified e username matches the pattern associated with the group.
3 . The method of claim 2 , further comprising:
providing an alert to a user or administrator.
4 . The method of claim 1 , wherein said comparing each of the plurality of usernames pairwise comprises:
for each pair of usernames from the plurality of usernames:
converting the pair of usernames to a corresponding pair of embedding vectors;
combining the pair of embedding vectors;
providing the combined pair of embedding vectors to the trained machine learning model; and
receiving a pattern match indication from the trained machine learning model that indicates whether the pair of usernames share pattern.
5 . The method of claim 4 , wherein said converting the pair of usernames to the corresponding pair of embedding vectors comprises:
mapping each character of the pair of usernames to a corresponding numeric vector using a lookup table; and
padding, when at least one of the pair of usernames is shorter than a predetermined length, the corresponding at least one of the pair of embedding vectors to the predetermined length.
6 . The method of claim 1 , wherein the trained machine learning model is based on one or more of:
a convolutional neural network (CNN);
a deep learning neural network;
a transformer neural network;
a recurrent neural network (RNN); or
a long short-term memory (LSTM) network.
7 . The method of claim 1 , wherein the trained machine learning model is trained using labeled pairs of randomly generated character strings each comprising characters from one or more of:
ASCII characters;
Unicode characters; or
UTF-8 characters.
8 . A system for determining whether a username matches a pattern, comprising:
a processor; and
a memory having computer-executable instructions stored thereon that, when executed by the processor, cause the processor to:
receive a plurality of usernames;
compare, using a trained machine learning model, each of the plurality of usernames pairwise with others of the plurality of usernames to determine whether each pair of usernames share a pattern;
group pairwise-compared serial numbers determined to share a pattern;
receive an unclassified username;
determine that the unclassified username does not match the pattern associated with the group; and
responsive to determining that the unclassified username does not match the pattern associated with the group, prevent the creation of an account associated with the unclassified username.
9 . The system of claim 8 , wherein, to determine that the unclassified username does not match the pattern, the instructions, when executed by the processor, cause the processor to:
compare, using the trained machine learning model, the unclassified username pairwise with each username in the group to determine whether the unclassified username matches the pattern associated with the group.
10 . The system of claim 9 , wherein the instructions, when executed by the processor, further cause the processor to:
provide an alert to a user or administrator.
11 . The system of claim 9 , wherein said comparing each of the plurality of usernames pairwise comprises:
for each pair of usernames from the plurality of usernames:
converting the pair of usernames to a corresponding pair of embedding vectors;
combining the pair of embedding vectors;
providing the combined pair of embedding vectors to the trained machine learning model; and
receiving a pattern match indication from the trained machine learning model that indicates whether the pair of usernames share pattern.
12 . The system of claim 11 , wherein said converting the pair of usernames to the corresponding pair of embedding vectors comprises:
mapping each character of the pair of usernames to a corresponding numeric vector using a lookup table; and
padding, when at least one of the pair of usernames is shorter than a predetermined length, the corresponding at least one of the pair of embedding vectors to the predetermined length.
13 . The system of claim 8 , wherein the trained machine learning model is based on one or more of:
a convolutional neural network (CNN);
a deep learning neural network;
a transformer neural network;
a recurrent neural network (RNN); or
a long short-term memory (LSTM) network.
14 . A computer-readable storage medium comprising computer-executable instructions stored thereon that, when executed by a processor, cause the processor to:
receive a plurality of usernames;
compare, using a trained machine learning model, each of the plurality of usernames pairwise with others of the plurality of usernames to determine whether each pair of usernames share a pattern;
group pairwise-compared serial numbers determined to share a pattern;
receive an unclassified username;
determine that the unclassified username does not match the pattern associated with the group; and
responsive to determining that the unclassified username does not match the pattern associated with the group, prevent the creation of an account associated with the unclassified username.
15 . The computer-readable storage medium of claim 14 , wherein, to determine that the unclassified username does not match the pattern, the instructions, when executed by the processor, cause the processor to:
compare, using the trained machine learning model, the unclassified username pairwise with each username in the group to determine whether the unclassified username matches the pattern associated with the group.
16 . The computer-readable storage medium of claim 15 , wherein the instructions, when executed by the processor, further cause the processor to:
provide an alert to a user or administrator.
17 . The computer-readable storage medium of claim 15 , wherein said comparing each of the plurality of usernames pairwise comprises:
for each pair of usernames from the plurality of usernames:
converting the pair of usernames to a corresponding pair of embedding vectors;
combining the pair of embedding vectors;
providing the combined pair of embedding vectors to the trained machine learning model; and
receiving a pattern match indication from the trained machine learning model that indicates whether the pair of usernames share pattern.
18 . The computer-readable storage medium of claim 17 , wherein said converting the pair of usernames to the corresponding pair of embedding vectors comprises:
mapping each character of the pair of usernames to a corresponding numeric vector using a lookup table; and
padding, when at least one of the pair of usernames is shorter than a predetermined length, the corresponding at least one of the pair of embedding vectors to the predetermined length.
19 . The computer-readable storage medium of claim 14 , wherein the trained machine learning model is based on one or more of:
a convolutional neural network (CNN);
a deep learning neural network;
a transformer neural network;
a recurrent neural network (RNN); or
a long short-term memory (LSTM) network.
20 . The computer-readable storage medium of claim 14 , wherein the trained machine learning model is trained using labeled pairs of randomly generated character strings each comprising characters from one or more of:
ASCII characters;
Unicode characters; or
UTF-8 characters.