Skip to content

Commit

Permalink
Document trivial case
Browse files Browse the repository at this point in the history
  • Loading branch information
emileferreira committed Jan 31, 2024
1 parent 7eb826b commit 250c50e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RASP_support/DrawCompFlow.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,10 @@ def __init__(self, depth, d_heads, d_ffs, add_tokens_on_ff=False):
ff_parents += ff.get_nonminor_parent_sequences()
ff_parents = list(set(ff_parents))
ff_parents = [p for p in ff_parents if not guarded_contains(d_ffs, p)]
# in the trivial case (no parents and only one ff), the ff is marked as
# constant
if not ff_parents and len(d_ffs) == 1 and d_ffs[0]._constant:
# switch the parents and ffs to label the trivial ff as 'X'
ff_parents, d_ffs = d_ffs, ff_parents
rows_by_type = {RES: d_ffs, VVAR: ff_parents}
rowtype_order = [VVAR, RES]
Expand Down
2 changes: 2 additions & 0 deletions RASP_support/analyse.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ def __init__(self, select, sequences, comp_depth):

all_ffs = self.get_full_seq_parents()
if len(all_ffs) > 1:
# filter out non-ffs in the non-trivial case
all_ffs = [m for m in all_ffs if m.from_zipmap]
else:
# mark the sequence as constant (indices / tokens) in the trivial case
for ff in all_ffs:
ff._constant = True
if remove_minors:
Expand Down

0 comments on commit 250c50e

Please sign in to comment.