-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProfanity.cs
18 lines (16 loc) · 1.05 KB
/
Profanity.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace MessengerAnalysis
{
public static class Profanity
{
//This list is pretty arbitrary, but that's unavoidable
public static List<string> SwearWords = new List<string>() {"arsehole","arseholes","ass","asses","bitch","bitches","bullshit","bollocks","bolocks","cock","cocks","cum","cums","cumming","cuming","cunt","cunts","cunty","dick","dicks","fag","fags","faggot","faggots","fagot","fagots","fuck","fucks","fucking","fucked","fucker","jerking","jerkoff","jizz","motherfucker","motherfuckers","nigga","niggas","niggaz","nigger","niggers","niggerz","nigg","pussy","pussies","shit","shits","shitting","shitty","shity","slut","sluts","slutty","tit","tits","titties","titty","twat","twats","wank","wanks","whore","whores"};
public static int Counter(string content)
{
var words = (new Regex(@"[^\p{L}]*\p{Z}[^\p{L}]*")).Split(content.ToLower());
return words.Intersect(SwearWords).Count();
}
}
}