I don't have the data, but I did find some other things that should help. I find this type of thing very interesting, and I have already done similar work with detecting recommendation question titles.
The Summer of Love
Given the importance that Stack Exchange puts on niceness, it makes sense that there has been interest on similar things in the past. Hans Passant alluded to this in the comments above, and I think it deserves elaboration, especially for users like me who joined after that all went down.
The "Summer of Love" was a campaign in 2012 which looked to ensure that Stack Overflow didn't turn into one of those "old" communities that complains about kids these days (aka new users) and yells at them to get off their lawn. The point was to ensure that the community stayed nice, especially to new users, which are necessary to maintain and grow the population of any site.
It makes sense that finding unfriendliness was one of the goals. Comments were submitted to Mechanical Turk to be scored on a scale of friendliness/unfriendliness. (Note: the link to the data was broken, but it's been fixed.) If you look at the data, it contains @usernames
, so you may have to do some processing.
Other options for data
While having "native" data sets is important for machine learning, I think that data from Twitter, for example, could be useful if you want more data. There may be false positives (for example, saying god doesn't work isn't blasphemy; it's actually on-topic), but it's probably not going to be significant if you are using any decent detection method.
I have found some data on crowdflower that was done on the subject of hate speech and Twitter. It's a .csv file with almost 15,000 rows.
There are a significant number of academic papers have been written on the subject too:
SEDE Query
I've also created a simple query for detecting profanity with SEDE (of course it will only find comments that are still around or recently deleted).
I'm using LIKE
statements. While my real query uses actual profanity, I have toned down the language for my answer here for the sake of politeness:
Select top 100
postid as [Post Link]
,text
from comments
where
lower(text) like '%[,.?! ]st[u*]pid[,.?! ]%'
or lower(text) like '%[,.?! ]j[e*]rk[,.?! ]%'
-- etc.
Of course, LIKE
statements are more similar to globs than regexes, which are less powerful. TSQL does not support regex matching, so it's the closest thing that can be used in SEDE queries.
Related: