Should we have auto-replace rules in titles?


(Lowell Heddings) #1

I don’t know exactly how this would work, or whether it is even a good idea. But here’s the idea:

Allow some auto-replace rules for titles, to prevent people from leaving stupid titles.

For instance:

  • Replace ??? with a single ?
  • Replace !!! with a slap in the face.
  • Replace all-caps titles with regular case letters. (SCREAMING TOPIC TITLE becomes Screaming Topic Title).
  • Capitalize first letter in the title.
  • Remove an unnecessary period at the end of the title.

I’m not sure it’s somewhere we even want to go - after all, the title of a forum post can accurately predict the intelligence of the user and whether the discussion is worth clicking on. So there’s some benefit to stupid titles as well.

I’ve been editing a lot of titles to make them less annoying, which made me think it might be worth automating some of it.

Edit: Alternatively, these rules could be tied to user trust level. If somebody leaves posts in all caps with a ton of exclamation points in the title, they clearly should not be a highly trusted user.


(Régis Hanol) #2

My $0.02

I’m not super fan of any kind of auto-replace feature. I’d rather have a warning message explaining me the rules than be surprised when the post is submitted and see that my title has changed.

That said, Discourse already does a great job at preventing people from leaving stupid titles.
There is a TextSentinel that will validate the title according to the following rules:

  1. text should not be empty or be composed of only whitespaces
  2. text should have at least min_entropy unique characters
  3. text should not only be composed of symbols (not comprehensive, but eliminates most of the noise)
  4. text should not have words longer than max_word_length
  5. text should not be all uppercase (only works for english)

Note that it already removes any leading/trailing whitespaces and interior spaces for the title.

Also, it’s worth considering non-latin languages when implementing this kind of feature.


(Stephanie Daugherty) #3

The way SE handles this is to let users above a set threshold propose another title for moderator approval, while users with very high reputation get to edit it directly and accept other user’s proposed edits (taking the load off the moderators)

This sort of functionality would be really useful here, but I think a discussion-oriented site would need to be more careful in how such things are handled. I wonder if this could be wrapped into flagging somehow. as a “The subject doesn’t describe the topic very well” option.


(Lowell Heddings) #4

I’m not a huge fan of it either… but after 5 days of fixing titles on my forum, I started thinking maybe some of it could be automated.

Or at least find a way to ding that user’s trust level for bringing youtube-level discussion over to Discourse. Because there’s no useful discussion that starts with 8 exclamation points in a title.


(Chris R) #5

I’ve been a member of some communities that have site-wide censorship as well, mostly targeted at eliminating intensely unpleasant language directed at minority members of the site. I’m not willing to pass judgement on whether that case is a good one or not, but it is a case where automatic text filtering support at the admin level may be a good idea.


(Stephanie Daugherty) #6

IMHO, Good case to make the filters smarter and more flexible… Rather than have to do blanket filtering or blanket search and replace for everything, what if one option was to warn the user up front when posting with something they can click through.:

Reminder: This forum is a place for civilized public discussion. Please carefully review your post and make sure it meets the community standards (Your message appears to be inflammatory) [Click here to dismiss[.

If it’s a false positive, or a borderline case, or even meta discussion of racist language, then the user is free to use their own judgement and post it anyway. If they decide to go forward with their post, fine, but increase their trust penalties if the post gets flagged so that the first round of flagging and hiding is basically equal to the second on a post that hadn’t gotten the initia up frontl warning.


(Jeff Atwood) #7

Auto-detection of hateful words in the body is such a different topic than the one this topic is actually about

Anyway, on the topic of auto-replace rules in title:

Replace ??? with a single ?

Seems safe to me.

Replace !!! with :facepunch: in the face

Not technically possible, sorry. But we can replace !!! with single !, seems quite safe to me.

Replace all-caps titles with regular case letters.

Safe in the case where the ENTIRE TITLE IS ALL CAPS, not safe in any other case IMO.

Capitalize first letter in the title.

I need to look at topic titles in other forums as a data corpus, but probably safe.

Remove an unnecessary period at the end of the title.

Probably safe, though I worry that I’m not thinking of some edge condition.

Another one you forgot that we hated at Stack Exchange was this:

This is my topic title !
Here is another topic title ?

e.g. the extraneous space before the end punctuation. Had to be disabled on our French site for reasons I bet @zogstrip can explain.


(Régis Hanol) #8

Ok, I’ll give a shot at the safe rules and we’ll see if that frees @geek from fixing every titles on his forum.

@codinghorror one question regarding the symbols: should we replace multiple occurences of the same symbol with only one occurence for every symbols or just for ? and !?

Regarding the space before the end ponctuation, the rule in French is actually simple: if the punctuation mark has two parts (e.g. :, !, ? or ;) then it has two spaces, one before and one after. On the other hand, if the punctuation mark has only one part (e.g. . or ,) then it only has one space, after it.

If you want more details, head over: Why is there a space before certain punctuation marks?


(Bill Ayakatubby) #9

I think a specific list of punctuation marks to replace and their “max lengths” is the way to go. Otherwise, you’d never be able to do an ellipsis (…) without using the actual ellipsis symbol, you wouldn’t be able to approximate a dash with two hyphens (--), and probably a few other cases that I’m not thinking of. In other words, define the rules, not the exceptions.


(Michael Scott Shappe) #10

Someone really needs to get on that problem…


(Luke S) #11

With this approach, you could do what some word processor programs have done… replace three periods with the ellipsis character, and two hyphens with a dash.

Not everyone knows that there is a difference, and those that do don’t always know how to type the character that they want. I know that when I type (…) I really want ellipsis.


(Jeff Atwood) #12

We already “prettify” common ASCII typography in the titles, e.g. – becomes – and “bleh” becomes “bleh”, etecetera:

http://daringfireball.net/projects/smartypants/


(Régis Hanol) #13

Let me just add that this “prettify” feature is only enabled when the title_fancy_entities? setting is (which is the default btw).


(Régis Hanol) #14

I think this pull request should make some of you happy :wink:


(Jeff Atwood) #15

Yep deployed and confirmed on try @geek this is working. Thank you @zogstrip!

(Note that all caps titles are already effectively prevented by some earlier “no nonsense titles please” checks, though, you can’t even submit an all caps topic title to the server…)


(Jeff Atwood) #16

Looks like we missed a “case”, @geek :laughing:

Where Are The Coments From HTG Articles ….

Not sure we can reliably detect that though, since Camel Case might be valid for some topics and an ellipsis ... is also valid.

The spelling error is just a bonus, I guess.


(Jack Slater) #17

Apparently the first letter of every topic title is still capitalized. This functionality is extremely frustrating when you are attempting to discuss a URL or another thing that should be lowercase.


(Sam Saffron) #18

I support a site setting to disable this behavior


(Kane York) #19

we have one

Fun fact: This (uppercase first letters) could be accomplished using CSS! I don’t recommend it though.

a.topic-link:first-letter { /* topic page */
  text-transform:uppercase;
}
a.title:first-letter { /* topic list */
  text-transform:uppercase;
}

(Jack Slater) #20

It’d be nice to disable the one thing, since I want the others.