Method and system for classifying word as obscene word
There is disclosed a method and system for classifying a word as an obscene word, the method comprising, at a training phrase: acquiring a first word, the first word corresponding to a given obscene word; generating a first set of misspelled words, the first set of misspelled words comprising a plurality of misspelled variations of the first word; generating a training pairs, the training pairs comprising: a set of positive training pairs comprising the first word paired with each misspelled variations of the first word; training a machine learning algorithm, the training comprising: determining, for each training pairs, a set of features representative of a property of the training pairs; generating an inferred function based on the set of features, the inferred function being configured to assign, in use, an indecency score, the decency score being indicative of a likelihood of the word being obscene.
1. A computer implemented method for classifying a word as an obscene word, the method being executable by one or more servers, the method comprising, at a training phase:
acquiring a first word, the first word corresponding to a given obscene word;
generating a first set of misspelled words, the first set of misspelled words comprising a plurality of misspelled variations of the first word;
generating training pairs, the training pairs comprising:
a set of positive training pairs comprising the first word paired with each misspelled variations of the first word;
training a machine learning algorithm (MLA), the training comprising:
determining, for each of the training pairs, a set of features representative of a property of a given one of the training pairs; and
generating an inferred function based on the set of features, the inferred function being configured to assign, in use, an indecency score, the indecency score being indicative of a likelihood of the word being obscene.
2. The method of claim 1 , wherein the method further comprises:
acquiring a second word, the second word not corresponding to any obscene word;
generating a second set of misspelled words, the second set of misspelled words comprising a plurality of misspelled variations of the second word; and
wherein the training pairs further comprise a set of negative training pairs comprising the second word paired with each misspelled variations of the second word.
3. The method of claim 2 , wherein the first set of misspelled words and the second set of misspelled words are generated by executing a misspelling algorithm.
4. The method of claim 3 , wherein the misspelling algorithm is configured to generate the plurality of misspelled variations of the first word by at least one of:
substituting a given character within the first word with a typographical symbol;
switching one or more characters within the first word;
removing, one or more characters within the first word;
substituting the given character of a first alphabet within the first word with a corresponding character of a second alphabet, the first alphabet and the second alphabet being different alphabets.
5. The method of claim 4 , wherein the misspelling algorithm is created using a set of heuristics.
6. The method of claim 1 ,
further comprising, at an in-use phase:
acquiring, from an electronic device, a text comprising a plurality of words to be published on a web resource;
inputting the text into the MLA, the MLA being configured to assign the decency indecency score to each of the words included within the plurality of words; and
in response to the indecency score of at least one word of the text being above a predetermined threshold, applying a restrictive action.
7. The method of claim 6 , wherein the restrictive action is one of:
removing the at least one word prior to publishing the text on the web resource;
preventing the text from being published on the web resource.
8. The method of claim 6 , wherein the web resource is associated with a social media application.
9. The method of claim 6 , wherein the web resource is a live-chat application on a gaming platform.
10. The method of claim 1 , wherein the MLA is a neural network.
11. A system for classifying a word as an obscene word, the system comprising a server, the server comprising at least one processor and at least one non-transitory computer-readable memory storing instructions, which, when executed by the at least one processor, at a training phase, cause the system to:
acquire, a first word, the first word corresponding to a given obscene word;
generate, a first set of misspelled words, the first set of misspelled words comprising a plurality of misspelled variations of the first word;
generate training pairs, the training pairs comprising:
a set of positive training pairs comprising the first word paired with each misspelled variations of the first word;
train a machine learning algorithm (MLA) executable by the server, the training comprising:
determine, for each of the training pairs, a set of features representative of a property of a given one of the training pairs; and
generate an inferred function based on the set of features, the inferred function being configured to assign, in use, an indecency score, the indecency score being indicative of a likelihood of the word being obscene.
12. The system of claim 11 , wherein the at least one processor further causes the system to:
acquire a second word, the second word not corresponding to any obscene word;
generate a second set of misspelled words, the second set of misspelled words comprising a plurality of misspelled variations of the second word; and
wherein the training pairs further comprise a set of negative training pairs comprising the second word paired with each misspelled variations of the second word.
13. The system of claim 12 , wherein the first set of misspelled words and the second set of misspelled words are generated by executing a misspelling algorithm.
14. The system of claim 13 , wherein the misspelling algorithm is configured to generate the plurality of misspelled variations of the first word by at least one of:
substituting a given character within the first word with a typographical symbol;
switching one or more characters within the first word;
removing, one or more characters within the first word;
substituting the given character of a first alphabet within the first word with a corresponding character of a second alphabet, the first alphabet and the second alphabet being different alphabets.
15. The system of claim 14 , wherein the misspelling algorithm is trained using a set of heuristics.
16. The system of claim 11 , wherein the system further comprises a web resource hosted by the server; and wherein the at least one processor, at an in-use phase, further causes the system to:
acquire from an electronic device, a text comprising a plurality of words to be published on the web resource;
input, the text into the MLA, the MLA being configured to assign the indecency score to each of the words included within the plurality of words; and
in response to the indecency score of at least one word of the text being above a predetermined threshold, applying a restrictive action.
17. The system of claim 16 , wherein the restrictive action is one of:
removing the at least one word prior to publishing the text on the web resource;
preventing the text from being published on the web resource.
18. The system of claim 16 , wherein the web resource is associated with a social media application.
19. The system of claim 16 , wherein the web resource is a live-chat application on a gaming platform.
20. The system of claim 11 , wherein the MLA is a neural network.