Ignore:
Timestamp:
Apr 27, 2012, 10:54:45 PM (7 years ago)
Author:
ksherdy
Message:

Updated div2 pablo logic to mark both length i and i+1 at common marker
positions to allow symbol distinction on precense/absence of a
delimeter.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/symbol_table/div2_group_strms.py

    r2056 r2059  
    1717def Gen_lgth_groups(groups):
    1818
    19         cursor = groups.starts
    20         shift_or_ends = groups.ends | pablo.Advance(groups.ends)
    21         temp = groups.ends
     19        shift_or_ends = (groups.ends | pablo.Advance(groups.ends))
     20        ends = groups.ends
    2221
    23         # Group symbols of length 1 and length 2
    24         cursor = pablo.Advance(pablo.Advance(cursor))
    25         groups.ends_2 = cursor & shift_or_ends
    26         temp = temp &~ groups.ends_2
     22        # Group symbols of length 1 and length 2
     23        cursor = pablo.Advance(pablo.Advance(groups.starts))
     24        groups.ends_2 = cursor & (shift_or_ends)
     25
     26        mask = pablo.Advance(groups.starts) | pablo.Advance(pablo.Advance(groups.starts))
     27        ends = ends &~ mask
    2728
    2829        # Group symbols of length 3 and length 4
    2930        cursor = pablo.Advance(pablo.Advance(cursor &~ shift_or_ends))
    30         groups.ends_4 = cursor & shift_or_ends
    31         temp = temp &~ groups.ends_4
     31        groups.ends_4 = cursor & (shift_or_ends)
    3232
    33         # Group symbols of length 5 and length 6
     33        mask = pablo.Advance(pablo.Advance(mask))
     34        ends = ends &~ mask
     35
     36        ## Group symbols of length 5 and length 6
    3437        cursor = pablo.Advance(pablo.Advance(cursor &~ shift_or_ends))
    35         groups.ends_6 = cursor & shift_or_ends
    36         temp = temp &~ groups.ends_6
     38        groups.ends_6 = cursor & (shift_or_ends)
    3739
    38         # Group symbols of length 7 and length 8
     40        mask = pablo.Advance(pablo.Advance(mask))
     41        ends = ends &~ mask
     42
     43        ## Group symbols of length 7 and length 8
    3944        cursor = pablo.Advance(pablo.Advance(cursor &~ shift_or_ends))
    40         groups.ends_8 = cursor & shift_or_ends
    41         temp = temp &~ groups.ends_8
     45        groups.ends_8 = cursor & (shift_or_ends)
    4246
    43         # Group symbols of length 9 and length 10
     47        mask = pablo.Advance(pablo.Advance(mask))
     48        ends = ends &~ mask
     49
     50        ## Group symbols of length 9 and length 10
    4451        cursor = pablo.Advance(pablo.Advance(cursor &~ shift_or_ends))
    45         groups.ends_10 = cursor & shift_or_ends
    46         temp = temp &~ groups.ends_10
     52        groups.ends_10 = cursor & (shift_or_ends)
    4753
    48         # Group symbols of length 11 and length 12
     54        mask = pablo.Advance(pablo.Advance(mask))
     55        ends = ends &~ mask
     56
     57        ## Group symbols of length 11 and length 12
    4958        cursor = pablo.Advance(pablo.Advance(cursor &~ shift_or_ends))
    50         groups.ends_12 = cursor & shift_or_ends
    51         temp = temp &~ groups.ends_12
     59        groups.ends_12 = cursor & (shift_or_ends)
    5260
    53         # Group symbols of length 13 and length 14
     61        mask = pablo.Advance(pablo.Advance(mask))
     62        ends = ends &~ mask
     63
     64        ## Group symbols of length 13 and length 14
    5465        cursor = pablo.Advance(pablo.Advance(cursor &~ shift_or_ends))
    55         groups.ends_14 = cursor & shift_or_ends
    56         temp = temp &~ groups.ends_14
     66        groups.ends_14 = cursor & (shift_or_ends)
    5767
    58         # Group symbols of length 15 and length 16
     68        mask = pablo.Advance(pablo.Advance(mask))
     69        ends = ends &~ mask
     70
     71        ## Group symbols of length 15 and length 16
    5972        cursor = pablo.Advance(pablo.Advance(cursor &~ shift_or_ends))
    60         groups.ends_16 = cursor & shift_or_ends
    61         temp = temp &~ groups.ends_16
     73        groups.ends_16 = cursor & (shift_or_ends)
    6274
    63         # Group symbols of length greater than equal to 17
    64         groups.ends_gte_17 = temp
     75        mask = pablo.Advance(pablo.Advance(mask))
     76        ends = ends &~ mask
     77
     78        ## Group symbols of length greater than equal to 17
     79        groups.ends_gte_17 = ends
    6580
    6681def Main(groups):
Note: See TracChangeset for help on using the changeset viewer.