Skip to content

Instantly share code, notes, and snippets.

@Uko
Last active January 3, 2016 05:19
Show Gist options
  • Select an option

  • Save Uko/8415386 to your computer and use it in GitHub Desktop.

Select an option

Save Uko/8415386 to your computer and use it in GitHub Desktop.
| all dict reverseDict filtered |
"get data from db"
all := (MooseModel root first allAuthors collect: #name) asArray.
"get author relations data"
dict := STON fromString:
(ZnClient new get: 'https://raw2.github.com/Uko/SHubAuthors/master/SHubAuthors.ston').
"create reverse dictionary"
reverseDict := Dictionary new.
dict keysAndValuesDo: [ :key :val |
val do: [ :each |
reverseDict at: each put: key ] ].
"filter existing aliases"
filtered := all \ reverseDict keys.
"find possible aliases"
filtered
collect: [ :name | name correctAgainst: filtered ]
thenSelect: [ :suggestions | suggestions size > 1 ].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment