From efff208771c2e0513ba4823468318bb65f373d8a Mon Sep 17 00:00:00 2001 From: Kevin F Date: Tue, 14 Nov 2023 11:34:58 +0100 Subject: [PATCH] Add simple predictor for empty column cells #244 --- src/ISA/ISA/ArcTypes/CompositeColumn.fs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/ISA/ISA/ArcTypes/CompositeColumn.fs b/src/ISA/ISA/ArcTypes/CompositeColumn.fs index 4cf17e56..280ed691 100644 --- a/src/ISA/ISA/ArcTypes/CompositeColumn.fs +++ b/src/ISA/ISA/ArcTypes/CompositeColumn.fs @@ -48,4 +48,21 @@ type CompositeColumn = { let _, unit = cell.AsUnitized unit |] - if Array.isEmpty arr then None else Some arr \ No newline at end of file + if Array.isEmpty arr then None else Some arr + + /// + /// Simple predictor for empty default cells. + /// + 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 \ No newline at end of file