From 5cdc41b1e45fb00b636a55dbcf7d87ff90d1a9df Mon Sep 17 00:00:00 2001 From: Steffen Slavetinsky Date: Fri, 27 Oct 2023 10:36:18 +0200 Subject: [PATCH 1/4] add types to the lense and move d.ts file to types --- src/lenses/RougeScoreLens.tsx | 9 ++++----- src/{ => types}/rougeScore.d.ts | 0 2 files changed, 4 insertions(+), 5 deletions(-) rename src/{ => types}/rougeScore.d.ts (100%) diff --git a/src/lenses/RougeScoreLens.tsx b/src/lenses/RougeScoreLens.tsx index 9ee86dbf..5c0431de 100644 --- a/src/lenses/RougeScoreLens.tsx +++ b/src/lenses/RougeScoreLens.tsx @@ -3,7 +3,7 @@ import 'twin.macro'; import rouge from 'rouge'; import { formatNumber } from '../dataformat'; -const RougeScoreLens: Lens = ({ values }) => { +const RougeScoreLens: Lens = ({ values }) => { const rouge1 = rouge.n(values[0], values[1], 1); const rouge2 = rouge.n(values[0], values[1], 2); return ( @@ -25,6 +25,7 @@ RougeScoreLens.minHeight = 50; RougeScoreLens.maxHeight = 100; RougeScoreLens.multi = true; RougeScoreLens.displayName = 'ROUGE Score'; + RougeScoreLens.filterAllowedColumns = (allColumns, selectedColumns) => { if (selectedColumns.length === 2) return []; const selectedKeys = selectedColumns.map((selectedCol) => selectedCol.key); @@ -32,8 +33,6 @@ RougeScoreLens.filterAllowedColumns = (allColumns, selectedColumns) => { return type.kind === 'str' && !selectedKeys.includes(key); }); }; -RougeScoreLens.isSatisfied = (columns) => { - if (columns.length === 2) return true; - return false; -}; +RougeScoreLens.isSatisfied = (columns) => columns.length === 2; + export default RougeScoreLens; diff --git a/src/rougeScore.d.ts b/src/types/rougeScore.d.ts similarity index 100% rename from src/rougeScore.d.ts rename to src/types/rougeScore.d.ts From 7c6dd716592964745045a45b6557d2c6f99d6e15 Mon Sep 17 00:00:00 2001 From: Steffen Slavetinsky Date: Fri, 27 Oct 2023 10:41:24 +0200 Subject: [PATCH 2/4] remove typing from generic Lens as we cannot cope with it as of now --- src/lenses/RougeScoreLens.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lenses/RougeScoreLens.tsx b/src/lenses/RougeScoreLens.tsx index 5c0431de..92c70047 100644 --- a/src/lenses/RougeScoreLens.tsx +++ b/src/lenses/RougeScoreLens.tsx @@ -3,7 +3,7 @@ import 'twin.macro'; import rouge from 'rouge'; import { formatNumber } from '../dataformat'; -const RougeScoreLens: Lens = ({ values }) => { +const RougeScoreLens: Lens = ({ values }) => { const rouge1 = rouge.n(values[0], values[1], 1); const rouge2 = rouge.n(values[0], values[1], 2); return ( From ed705e7135685725b2278995f70c5ba2b886c7f9 Mon Sep 17 00:00:00 2001 From: Steffen Slavetinsky Date: Fri, 27 Oct 2023 10:44:52 +0200 Subject: [PATCH 3/4] add reougeScore.d.ts to global types --- {src/types => types}/rougeScore.d.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {src/types => types}/rougeScore.d.ts (100%) diff --git a/src/types/rougeScore.d.ts b/types/rougeScore.d.ts similarity index 100% rename from src/types/rougeScore.d.ts rename to types/rougeScore.d.ts From 843418af5f5f41ba8b0db399d58e9333b67aa16c Mon Sep 17 00:00:00 2001 From: Steffen Slavetinsky Date: Fri, 27 Oct 2023 15:40:25 +0200 Subject: [PATCH 4/4] type lense --- src/lenses/RougeScoreLens.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lenses/RougeScoreLens.tsx b/src/lenses/RougeScoreLens.tsx index 92c70047..5c0431de 100644 --- a/src/lenses/RougeScoreLens.tsx +++ b/src/lenses/RougeScoreLens.tsx @@ -3,7 +3,7 @@ import 'twin.macro'; import rouge from 'rouge'; import { formatNumber } from '../dataformat'; -const RougeScoreLens: Lens = ({ values }) => { +const RougeScoreLens: Lens = ({ values }) => { const rouge1 = rouge.n(values[0], values[1], 1); const rouge2 = rouge.n(values[0], values[1], 2); return (