Last active
August 29, 2015 14:08
-
-
Save carlwiedemann/e17c4b1aad44a762d07d to your computer and use it in GitHub Desktop.
psuedo bin code yo
This file contains 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
START | |
id keyword | |
-------------- | |
123 acid and base | |
456 acid and bases | |
567 acids and bases | |
890 koalas | |
END | |
id keyword | |
-------------- | |
123 acid and base | |
890 koalas | |
### PSEUDO STUFF | |
shortestItems = {} | |
For each record in table: | |
parts = record.keywords.split(" ") | |
newparts = [] | |
for each part in parts | |
newparts << part.stem | |
end | |
stem = newparts.join(" ") | |
if shortestItems[stem] does not exist | |
shortestItems[stem] = record | |
else | |
if record.keywords.length < shortestItems[stem].keywords.length | |
DELETE FROM DATABASE shortestItems[stem].id | |
shortestItems[stem] = record | |
else | |
DELETE FROM DATABASE record.id | |
end | |
end | |
End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment