fix(robot): make a dot between two handle words rare, prefer underscore
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 15s
CI / ui (pull_request) Has been skipped
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m10s
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Successful in 9s
CI / integration (pull_request) Successful in 15s
CI / ui (pull_request) Has been skipped
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m10s
A handle joining two meaningful words with a dot ("Тихий.Воин", "Hidden.Hunter")
reads as machine-generated — people use "_" there, a dot only rarely. assembleHandle
now picks "_" about nine times in ten and "." only about one in ten for the
separator-joined form; the camelCase and bare-noun forms are unchanged.
This commit is contained in:
@@ -140,20 +140,23 @@ func cyrillicNick() string {
|
||||
return assembleHandle(form, noun.word)
|
||||
}
|
||||
|
||||
// assembleHandle joins an adjective and noun into a handle: a bare noun, the two joined
|
||||
// by "_" or "." or camel-cased, optionally followed by a trailing number. It keeps at
|
||||
// most one separator so the result, the number aside, reads like a name a human could pick.
|
||||
// assembleHandle joins an adjective and noun into a handle: a bare noun, the two
|
||||
// camel-cased ("DarkWolf"), or joined by a separator. Between two meaningful words a human
|
||||
// almost always uses "_" — a "." there is a rare tell — so the separator is an underscore
|
||||
// far more often than a dot. An optional trailing number may follow.
|
||||
func assembleHandle(adj, noun string) string {
|
||||
var base string
|
||||
switch rand.IntN(4) {
|
||||
case 0:
|
||||
base = noun
|
||||
base = noun // a bare noun
|
||||
case 1:
|
||||
base = adj + "_" + noun
|
||||
case 2:
|
||||
base = adj + "." + noun
|
||||
base = adj + noun // camel-cased
|
||||
default:
|
||||
base = adj + noun
|
||||
sep := "_"
|
||||
if rand.IntN(10) == 0 {
|
||||
sep = "." // a dot between two words is rare
|
||||
}
|
||||
base = adj + sep + noun
|
||||
}
|
||||
if rand.IntN(2) == 0 {
|
||||
base += nickNumber()
|
||||
|
||||
Reference in New Issue
Block a user