Skip to content

Commit

Permalink
Add simple predictor for empty column cells #244
Browse files Browse the repository at this point in the history
  • Loading branch information
Freymaurer committed Nov 14, 2023
1 parent 01e07e4 commit efff208
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/ISA/ISA/ArcTypes/CompositeColumn.fs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,21 @@ type CompositeColumn = {
let _, unit = cell.AsUnitized
unit
|]
if Array.isEmpty arr then None else Some arr
if Array.isEmpty arr then None else Some arr

/// <summary>
/// Simple predictor for empty default cells.
/// </summary>
member this.PredictNewColumnCell() =
if not this.Header.IsTermColumn then
CompositeCell.emptyFreeText
else
let unitCellCount, termCellCount =
this.Cells
|> Seq.fold (fun (units,terms) cell ->
if cell.isUnitized then (units+1,terms) else (units,terms+1)
) (0,0)
if termCellCount >= unitCellCount then
CompositeCell.emptyTerm
else
CompositeCell.emptyUnitized

0 comments on commit efff208

Please sign in to comment.