Commons talk:Suggested category scheme for playing cards

From Wikimedia Commons, the free media repository
Jump to: navigation, search

Category demotion[edit]

I've removed this:

The position is advanced that Category:Cards, being a member of Category:Games, is restricted to that family of cards loosly defined as gaming cards -- characterized by existing in complete, finite sets in which each card bears a distinctive design on one side ("front") and in which all cards of the set bear the same design on the other side ("back").

Naturally, other objects are also called cards -- business cards, greeting cards, place cards, fight cards. These are distinct from gaming cards in that they fail the above tests.

and this, formerly a comment:

Now I see this is not even true, and cat:cards is a member of cat:objects and no other, and is already populated with both gaming and non-gaming cards. As soon as I can think of a term for gaming cards (as defined here, to include both Tarot and playing cards) that is not easily confused with cat:playing cards, I'll fixit. Of course, nobody stands in your way!

I'm demoting this entire scheme to apply only to Playing cards, which is to apply to both Tarot cards and other decks of cards, such as French-suited cards.

The bone of possible contention is that Tarot is a type of playing card. I now advance that it is. Card play includes divination and gambling. — Xiongtalk* 18:00, 2005 August 28 (UTC)

Schema illustration[edit]

Having reorganized cats at the top level for Cards, the illustration -- indeed, the whole page -- is out of date. Must fix soonest. — Xiongtalk* 18:00, 2005 August 28 (UTC)

Fixed. The illustration is now current. — Xiongtalk* 13:56, 2005 August 30 (UTC)

Unruly cats[edit]

Are there ever any other kind?

My cat scheme is fighting me in a couple-three ways:

  • It seems to take a long time for a newly uploaded card to join its cats. I can live with this, but shouldn't purging the cat page refresh it entirely?
  • Problem with Spades (damn annoying):
I uploaded -- so far -- a range of cards including all the Spades; also, the Ace of Hearts. Since they are all Poker cards, I expect to see them all in Category:Poker (cards deck), and so I do. They are also all individual cards (no group images), so I expect to see them all in Category:Individual playing cards, and so I do. This particular flock of uploads are all of the Small PNG format variety (as opposed to the monster 4Mb Large or the vaporware SVG) so I expect to see them all in Category:Small PNG (card image format) -- and so I do. It seems to take a few hours for a cat to pick up all its members, but eventually, there they are.
However, with the exception of the Ace of Hearts, my uploads have all been Spades. Therefore, I expect to see them all in Category:Spades (cards suit) -- and this I do not. At this moment, the Nine, Ten, and Jack have failed to make it in!

Since I am using a template scheme to categorize uploads, I don't expect typos. That is, the exact same daughter template is used to put the Jack in Spades as is used for the Ace. Not only that, but inspection of the Jack's image page shows it as a member of Spades. Hmm.

  • Problem with sort keys (infuriating):
Each card has been uploaded with an embedded sortkey. (By use of the italic and closed spelling, I suggest the supplied template parameter specifically. I set this manually at upload time) The sortkey is used, either by itself or in combination with other elements, to form a category sort key at upload time. I have simplified this scheme since I began, so at present:

Again, Spades is the outstanding problem. Ipc, Poker, and SmPNG are sorted correctly; but Spades is a big muddle. Not only does it fail to include all members; it sorts them poorly, too.


I've chosen to make my scheme complex in order to ease the way for future uploaders. (Make the Machine do the work, not the Man.) Thus, a single template expands to create the entire image description. See Template Talk:Ct. This seems to work rather well, now that I've created many of the daughter templates. I've checked the expansion a couple of times -- by throwing the template into private Sandbox and repeatedly substituting until the markup is fully exposed. Despite the complex nature of the scheme, it seems to be working fine.

A straight transclusion is exampled at User:Xiong/Sandbox. A fully substituted example is at User:Xiong/Sandbox4. Note particularly how the various category sort keys are formed -- to my eye, completely correct.

Note that the sortkey parameter is expressed visibly on each image description page, within "Suggested filename." Thus, it's easy to check that the parameter was correctly supplied.


1. I should like Somebody, if the power exist, to force all of these pages to completely update. If this test fails, then there is a flaw in my scheme (or a bug in the Engine) and Something will have to be fixed.

If the matter is simply that the Engine is slow (or stubborn) to catch up to my edits and corrections, I can live with that. I'll just finish the job and wait a week, and if necessary, call for another massive purge. The little breadcrumb purge links I've scattered everywhere do not seem to do a damn thing to correct the problem. (Why?)

2. If I am making a stupid assumption about category sort keys, please point it out to me before I stick my foot further into the toilet.

3. Naturally, I should very much like Somebody to tell me what the hell is the matter!

Xiongtalk* 14:56, 2005 August 30 (UTC)


Here are a few comments I have:

  1. Image:Poker-sm-214-Js.png wasn't showing up in Category:Spades (cards suit). I did a "null edit" of the image description page (clicked "edit", then "save page" without making any changes). Now it shows up. That's a general issue with templates: if you add a category to a template, the pages using the template won't show up until they get edited.
  2. I think most of your categories are silly. One category for each deck of cards would suffice in my opinion.
  3. I don't understand your naming convention. Why is the 2 of Spades called "Poker-sm-21D-2s.png"---what does the 21D mean? Anyway, how about the following non-arbitrary sort key: 2 of spades would be "S02", king of diamonds would be "D13", ace of clubs would be "C14". Then sorting alphabetically, you have clubs, diamonds, hearts, spades, and the ranks sorted correctly within suits.
  4. If you insist on uploading each card in multiple different sizes, I wish you'd at least upload the largest versions first.

dbenbenn | talk 06:21, 4 September 2005 (UTC)

I'm sorry if you find my documentation impenetrable. I'm glad for any help, but frankly, I think you've got to understand what I'm doing and why, in order to see what trouble I'm running into. I hope I can give you enough background in an "exec summary" to cast a little light on this.

1. It's interesting that the null edit brought the Jack into Spades. But why doesn't Purge do the same thing?

And although your null edit did bring the image into the category, it did not bring it in, in the correct sort order. I guess I'll try null edits on all the cards I've uploaded so far, and see how it works. I'd better do the null edits out of order, though; otherwise, this won't prove much.

2. I don't know how to justify categories in some definitive fashion. Do you understand that there are dozens of cards, each with radically distinct designs, which all can be thought of as the Ace of Spades? The world of playing cards is huge. I'm not talking about Star Wars decks and anime decks, either; for the most part, these are all Novelty decks, and all French-suited. There are at least three major families of Tarot card decks, and perhaps five major families of 52 (or 56) card decks. I'm not even touching Eastern decks; only Western, four-suited decks.

Let's assume that I've uploaded, say, ten different decks of cards -- about 600 distinct images, even if only in one size. Now, I'd like to compare all of the Aces. There will be roughly 40 of these. What should I do? If I haven't categorized them at upload time, I'll never be able to find them again. A rigorous categorization scheme and filenaming convention is the only way anybody will ever be able to pick them out again.

Granted that we can't, right now, predict all future uses of uploaded playing cards. I hope I don't have to do that, either. It's clear to me that the nature of playing cards is that they are highly categorizable. I hope you can work with me on this, perhaps just take it on faith, and help me to resolve the technical issues.

3. I hate to send you down into the dungeon, but I've made a very strong effort to document the filenaming convention at Template_talk:Ct/Dungeon. That page is not all about filenames, though; it's about the file upload template {{ct}}. That template sets the suggested filename. (Obviously, by the time the file is uploaded, it's too late to change the filename to match the suggestion; I guess this is the best that can be done for now.)

Down the road, I plan to whip up a more user-friendly explanation of filenaming and upload template use; but there's not much point to that until I get the scheme itself working. So right now, I've just fixed the technical details -- and that's all in the dungeon.

In short -- very short: "poker" because it's a card from a Poker deck; "-sm" because it's a small image (by definition); "-214" the sortkey parameter (which is not always the category sort key); "J" for Jack; "s" for Spades; and "png" for PNG format. The order of these filename fragments is carefully chosen so that if you were to download every card from every deck into a single directory, they would sort in some useful fashion.

The sortkey parameter required me to think pretty hard, and I got it wrong twice before the current scheme -- so, please, in all seriousness, don't be surprised if it's not immediately clear why it ought to be that way. Template_talk:Ct/Dungeon#Sortkey explains the scheme very tersely, along with what I think it a pretty good-faith explanation of the rationale. Again, the short version:

"2", because the Jack of Spades is an ordinary card. ("1" is for Tarot Major Arcana, which need to sort ahead of the Minor Arcana; "0" is reserved in case something needs to be forced to sort to the top -- cheap to provide for the capability now, difficult to fix later.)

"1", because the card in question is a Spade. In deck order, suits are dominant over ranks -- the Deuce of Spades outranks the Ace of Diamonds.

"4", because the card in question is a Jack -- the fourth card from the beginning of the suit.

"Arbitrary", in this connection, simply means the uploader needs to create the sortkey manually; I could easily write code to generate it from inflexible rules.

There is no value to sort keys that begin with suits, or identify suits by initial letter. That would not force the deck to sort in deck order. This deck order is not an arbitrary, fanciful scheme; it is pretty much fixed and agreed upon by all who handle cards.

Card rank is context-sensitive, and depending upon the game, cards may be ordered in many different ways. In many games, there is even a circular ordering -- the Ace may sort high or low. But the basic deck ordering of French-suited cards -- be they Poker or Bridge -- is absolute: from the Ace of Spades, King of Spades...Deuce of Spades, Ace of Hearts, King of Hearts...Deuce of Clubs. This is not something you can really argue with; it's just so.

Deck ordering of Tarot cards is less well fixed -- but that is just a fraction of a point below absolute. In Tarot, Aces always sort low; so the King is always the highest rank in a suit. The Major Arcana sort order -- even the numbering of the cards themselves, as opposed to their names -- is not agreed upon from deck to deck. And worst of all, the Fool is explicitly defined not to sort. That is to say, it belongs to Tarot Major Arcana but it has no assigned position within this category! The Fool bears the number 0 (zero), but that does not represent zero in the data processing sense, like a bank balance of zero; it represents null -- an empty pointer. But even here, there is a rational approach, and though there may be minor disagreement, all who handle Tarot cards will agree on the overall deck ordering.

4. I took your earlier comment to heart, and abandoned the tiny optimized images. Now, I've defined two standard upload sizes, large and small. You are getting the small ones first, because that is what I can manage, technically. It is a royal pain in the ass to upload each one of 52 cards individually -- and the risk has been demonstrated: I uploaded all the tiny ones and now (a) we find I uploaded them all wrong and (b) we don't want them anyway.

So far, I've uploaded 14 of the new "small" cards -- and although I think I've done well, problems have surfaced. I'm not yet convinced I won't have to upload them again, using a different upload template.

I was going to say, I won't upload the "large" cards until I was sure I had the scheme working perfectly -- but I don't really think I'll ever want to do it. I just don't have the tools. It just takes far too long to shove a 4 Mb image upstream through ADSL. If I had a bulk upload tool, perhaps I could set it up to run through the whole deck and just go back to bed. But I don't, I can't, and manual upload is not a happy thought.

Once I have the scheme proven and all the bugs ironed out, then Somebody with the willingness and the tools can take the whole deck -- I'll snail a CD -- and upload it.

Right now, I'm going to go and null-edit the 14 cards I've got up now, and see if that corrects all my current troubles. I'd still like to know why "Purge" does no good here. Is there no better way? Is there no way at all to mass update categories? Can developers be prevailed upon to selectively purge and update? What is really going on? — Xiongtalk* 13:44, 2005 September 6 (UTC)

Null edit solution[edit]

I'm happy to say that null editing all uploads did solve all outstanding problems with cards not showing up in categories, or showing up out of order. Thank You! I don't see why it should be necessary, or why Purging all the image pages and all the cat pages doesn't do the trick -- but fixed is fixed.

I'll proceed to up the rest of the Poker-sm--- series now. Then, I think, I'll see if I can't populate some of the other cats, which will probably make their value a little more apparent. — Xiongtalk* 13:56, 2005 September 6 (UTC)