• Anti-SHOUT code already exists.

    But it works only on comments that are all shouting, rather than some % shouty.

    It's the equivalent of:

    if comment.ToUpperCase() == comment {
      comment = comment.ToLowerCase()
    }
    

    The post in question was typed out with CAPS LOCK on, but the person that typed it still shift-keyed the I at a beginning of a sentence. Thus, defeating the anti-SHOUT.

    I can make it work on a % basis, but it could still be defeated by unicode hacks, or quoting some other thing first.

    Such things are never perfect... it's more about getting the majority of all shouting comments then it is about making it precise in all cases. The exceptions can be reported (PM me) and I shall deal with them by hand.

  • You could activate the code at a percentage, or even at a percentage of a certain piece.
    What language are you using for these scripts? Maybe I can hack something neat together.

  • We use Go.

    And it needs to be unicode friendly. So you can't rely on ASCII alone, and you need to be fine with unicode runes having a concept of upper and lower.

    http://play.golang.org/p/1qwU7p3urR

    package main
    
    import (
    "fmt"
    	"strings"
    )
    
    func main() {
    	fmt.Println(ShoutToWhisper("Hello, playground"))
    	fmt.Println(ShoutToWhisper("HELLO, PLAYGROUND"))
    }
    
    func ShoutToWhisper(s string) string {
    	if strings.ToUpper(s) == s {
    		s = strings.ToLower(s)
    	}
    
    	return s
    }
    

    By default Go will do sensible things with Unicode strings, but there is also a ToUpperSpecial if the language is known (it's not in our case) as it will disambiguate which runes to consider.

About