Skip to content

Commit

Permalink
add types to the lense and move d.ts file to types
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen Slavetinsky committed Oct 27, 2023
1 parent d0dc505 commit 5cdc41b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lenses/RougeScoreLens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'twin.macro';
import rouge from 'rouge';
import { formatNumber } from '../dataformat';

const RougeScoreLens: Lens = ({ values }) => {
const RougeScoreLens: Lens<string> = ({ values }) => {
const rouge1 = rouge.n(values[0], values[1], 1);
const rouge2 = rouge.n(values[0], values[1], 2);
return (
Expand All @@ -25,15 +25,14 @@ 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);
return allColumns.filter(({ type, key }) => {
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;
File renamed without changes.

0 comments on commit 5cdc41b

Please sign in to comment.