Clarify confusing category stuff.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 9 Aug 2015 15:59:55 +0000 (08:59 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 9 Aug 2015 15:59:55 +0000 (08:59 -0700)
dump.c
spv-file-format.texi

diff --git a/dump.c b/dump.c
index 830a5dac1dc3714ea57c2b5429651ff560d66b67..e37202000c64f310a309f872ccbbd0ae2f46cc96 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -580,17 +580,16 @@ dump_category(int level, int *indexes, int *n_indexes, int max_indexes)
   match_byte(0);
   match_byte(0);
 
-  if (match_u32 (1))
-    match_byte (0);
-  else if (match_byte (1))
+  if (match_byte (1))
     {
-      match_byte (0);
-      if (!match_u32 (2))
-        match_u32_assert (1);
-      match_byte (0);
+      if (!match_byte (0) && !match_byte (1))
+        match_byte_assert (2);
     }
-  else if (!match_u32(2))
-    match_u32_assert (0);
+  else if (!match_byte (2))
+    match_byte_assert (0);
+  match_byte_assert (0);
+  match_byte_assert (0);
+  match_byte_assert (0);
 
   int indx = get_u32();
   int n_categories = get_u32();
@@ -629,7 +628,7 @@ dump_dim(int indx)
   printf ("<dimension index=\"%d\">\n", indx);
   dump_value (stdout, 0);
 
-  /* This byte is usually 0x02 but many other values have been spotted. */
+  /* This byte is usually 0 but many other values have been spotted. */
   pos++;
 
   if (!match_byte(0) && !match_byte(1))
index 89749de0da945e4d7097d77abef39356e441a718..e7c3f888900bcdae677436f01d42cc70e64d248a 100644 (file)
@@ -489,3 +489,34 @@ font  f1  f2     f3   f4     f5    f6  f7  f8
    7  40   0  64173  0/1      8 10/11   1   1
    8  40   0      2    3      8 10/11   1   4
 @end example
+
+@example
+dimensions := int[n-dims] dimension*[n-dims]
+dimension := value[name]
+             byte[d1]
+             (00 | 01 | 02)[d2]
+             (i0 | i2)[d3]
+             (00 | 01)[d4]
+             (00 | 01)[d5]
+             01
+             int[d6]
+             int[n-categories] category*[n-categories]
+@end example
+
+@code{name} is the name of the dimension, e.g. @code{Variables},
+@code{Statistics}, or a variable name.
+
+@code{d1} is usually 0 but many other values have been observed.
+
+@code{d3} is 2 over 99% of the time.
+
+@code{d5} is 0 over 99% of the time.
+
+@code{d6} is either -1 or the 0-based index of the dimension, e.g.@: 0
+for the first dimension, 1 for the second, and so on.  The latter is
+the case 98% of the time in the corpus.
+
+@example
+category := value i1
+            (00 | 01 (00 | 01 | 02) | 02) 00 00 00
+@end example