jeremydouglass / panelcode

Other
1 stars 0 forks source link

Test cases for canonical form coercion #5

Open jeremydouglass opened 7 years ago

jeremydouglass commented 7 years ago

Need to create a set of test cases to confirm that canonical forms are output -- and settings to enable coercion to canonical form(s) to be enabled / disabled and configured.


There are many ways to write the same layout in panelcode. These refer to the same composition, with variations in spacing, argument order, and implicit/explicit terms:

3_3(c2r2,1,1) 3_3(r2c2,1,1) 3_3(c2r2, 1, 1) 3_3(r2c2, 1, 1) 3_3(r2c2, 1, 1) 3_3(1r2c2, 1, 1) 3(1+1+1)_3(c2r2,1,1) 3(1+1+1)_3(r2c2,1,1) 3(1+1+1)_3(c2r2, 1, 1) 3(1+1+1)_3(r2c2, 1, 1) 3(1+1+1)_3(r2c2, 1, 1) 3(1+1+1)_3(1r2c2, 1, 1)

So all of these are valid panelcode strings that refer to the same page layout -- although some of these are very unlikely for a human to write!

If you process a large collection of panelcode -- say thousands or millions of pages -- you may want to ask how many pages have this specific composition. That is harder to anwer if the same page has been written in many slightly different ways. You may also wish to count the number of unique layouts, or create a one unique image for each layout, etc. -- again, if everything is written in slightly different ways, then you will create the same image many times.

3_3(c2r2,1,1).jpg 3_3(r2c2,1,1).jpg 3_3(c2r2, 1, 1).jpg ...etc.

So the "canonical" panelcode is the standardized one that the parser uses, parsing your slightly different handwritten codes and then replacing them with one canonical code -- like a spelling or grammar checker. So the list becomes:

3_3(1c2r2, 1, 1) 3_3(1c2r2, 1, 1) 3_3(1c2r2, 1, 1) ...etc.