Last active
January 3, 2016 05:19
-
-
Save Uko/8415386 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| | 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