Fix ranking issues

This commit is contained in:
Reinhard Pointner 2016-03-12 18:15:07 +00:00
parent eccace4f51
commit 18e97cf677
1 changed files with 3 additions and 8 deletions

View File

@ -88,16 +88,11 @@ def getNamePermutations(names) {
def out = names*.trim().unique().collectMany{ original -> def out = names*.trim().unique().collectMany{ original ->
def s = original.trim() def s = original.trim()
s = s.replaceAll(/([,]\s(The|A)$)/, '').trim() s = s.replaceAll(/([,]\s(The|A)$)/, '')
s = s.replaceAll(/\s&\s/, ' and ') s = s.replaceAll(/\s&\s/, ' and ')
s = s.replaceAll(/\s\([^\)]*\)$/, '').trim() s = s.replaceAll(/\s\([^\)]*\)$/, '').trim()
s = s.replaceAll(/^(?i:The|A)\s/, '').trim()
// e.g. The Walking Dead => Walking Dead, The Voice => The Voice return [original, s]
def sn = s.replaceAll(/^(?i:The|A)\s/, '').trim()
if (sn ==~ /\w+/) {
return [original, s]
}
return [original, sn]
}.unique{ normalize(it) }.findAll{ it.length() > 0 } }.unique{ normalize(it) }.findAll{ it.length() > 0 }
out = out.findAll{ it.length() >= 2 && !(it ==~ /[1][0-9][1-9]/) && !(it =~ /^[a-z]/) && it =~ /^[@.\p{L}\p{Digit}]/ } // MUST START WITH UNICODE LETTER out = out.findAll{ it.length() >= 2 && !(it ==~ /[1][0-9][1-9]/) && !(it =~ /^[a-z]/) && it =~ /^[@.\p{L}\p{Digit}]/ } // MUST START WITH UNICODE LETTER