Skip to content

Commit

Permalink
Support supervised table labeling/training/prediction with new data s…
Browse files Browse the repository at this point in the history
…chema. (microsoft#828)

* added new icons

* feat: support table tag creation

* feat: support labeling

* fix: zoomIn keyboar shortcut for macOS

* fix: appId

* fix: icons scr url (microsoft#593)

* Alex krasn/rtl refactor to functional components (microsoft#594)

* refactor to funct componenet - tableTagConfig.tsx

* tagInputItemLabel.tsx- refactor to functional component

* fix format error detected by tslint

* support dropdown options (microsoft#603)

* support dropdown options

* add format filter on cell type choice

* reset format on type change

* add default theme to dropdowns

* refactor: introduce and lift state of table body

* Alex krasn/rtl create table view styles (microsoft#620)

* styles (resize pane WIP)

* styles

* enable feature (microsoft#621)

* Alex krasn/rtl support validation of user input on config table (microsoft#611)

* -merge with changes

* feat: enable user input validation

* add strings

* fix wording

* - on save show only generic error message

* custom error message for textfield

* reset type and format of rows/columnst on save + refactor

* refactor: support interfaces and lift state for labeling

* feat: persist table labeling

* feat: enable deleting headers (microsoft#627)

* feat: table view styles (microsoft#629)

* feat: table view styles

* add styles for 'cells'

* feat: table preview (microsoft#630)

* Alex krasn/rtl eanble reordering of headers (microsoft#631)

* enable reordering

* fix checkmark and addButton styles

* pipe line test fix

* styles fix

* fix resize pane width

* fix: allow deleting and reassigning of table regions

* feat: add table label description

* fix: support selecting regions without opening table labeling

* fix: react unique keys errors

* fix: selection behaviour + refactor

* disable move btns when a selection reached list's edges

* disable delete btns when it's just one row/col

* makes inputs placeholder less visible

* support large tables in tableConfig + support resize pane (microsoft#634)

* support large tables in tableConfig + support resize pane

* cleanup

* support large tables in tableLabeling

* fix: buttons container nesting

* fix: setup initial container width, and setup min and max headers width

* add reconfigure btn to tableLabeling.tsx + some styling

* add HOW TO label the table

* add strings to tableLabeling.tsx

* disable "table" type as an option for headers type

* fix: spelling

* feat: not allow tag type change if it is tableTag

* disable tagtype and format from table tag dropdown submenu

* delete table type options for all other tags (not table)

* fix: support reconfigure button

* fix: scroll unnecessary scrollbar in tableLabeling

* refactor: rename + types

* support row dynamic table in tableTagConfig

* support table name in tableTagLabeling.tsx

* support view of row dynamic tables in tableTagLabeling.tsx table view

* add reconfig button to tag menu items

* add table tag color bar under table name in table labeling view

* add "Add row" btn for labeling row dynamic tables

* fix: wording and strings for Confirm message on reconfigure table

* fix: trim all inputted names during config validation

* fix: on resize right splitpane to width less than min allowed

* support rowDynamic table in tableLabeling table view

* fix: table labeling view styles

* add row indices for tableLabel table view

* add indices in tableConfig + support some reconfig func

* fix: dont show "Row #" for fixed tables in tableTagLabeling.tsx

* fix: restore right pane size for basic input mode

* feat: support row dynamic labeling

* fix: tableName validation erorr

* fix: show one row for rowDynmic in preview

* refactor: validateInputAndSave

* refactor: support adding rows for row dynamic tables

* refactor: support row dynamic labeling

* fix: trim rows

* merge master into RTL branch (microsoft#647)

* merge master into RTL branch

* fix an API icon

* add stings to tableConfig

* fix: typo in tableTagToAdd

* tableLabeling: refactor, styles, strings

* tableLabeling: add spanish strings

* refactor: optimize inputs validation

* fix: TableElements enum spelling

* fix: use correct table format values

* fix: spelling

* enable reconfigure button from tag menu dropdown

* refactor: remove not needed customizer

* fix: conditional Enum for headersFormatAndTypeOptions

* feat: support reconfigure table map

* feat: cross out columns when renaming

* fix: scrollbar visibilty + style adjustments

* fix: scroll issue on open

* feat: support tracking changed and deleted headers

* autofocus on last added input

* fix: delete extra colon

* fix: class name for renamed header  + forgoten variable

* enable reconfigure [cancel] button

* styles for renamed headers

* display original col/row name on reconfigure

* fix: delete autofocus on btns

* fix: revert accidentally deleted ref + whitespaces

* display table name in preview

* fix: support deleted headers and style change

* feat: support reconfig deleting fields

* feat: support deleting tables

* fix margin + and Lunk styles

* restore deleted row/col: Link => ActionButton

* fix: splitpane and labelng/config styles

* add: tag color for reconfigure

* fix: tableName color for config

* feat: support saving reconfigure

* analyze results

* fix: delete red table border

* fix reconfigure name validation and toast message

* fix on reconfigure projectAction assets update

* add higlight table results in analyze

* feat: redraw canvas with changed regions

* fix: add reconfigure support for tag name change

* handle long row/col names without spaces

* temp fix for unique column names in analyzeOutput.json

* feat: handle long col and row names in tableTagConfig

* feat: enable drawn region icon and selection marks

* feat: add progress to table reconfigure

* feat: support rowKeys and columnKeys for analysis

* feat: support tracking column and row count

* fix: reconfigure progess spinner styles

* feat: highlight table cell bounding box on mouse enter

* fix: reconfigure state on close()

* fix: commnet out testing config in predictPage

* fix: check for rowKeys in updatedAssetMetadata

* fix: on reconfigure when adding columns (rdt)

* new row/col headers icons

* fix: update asset after reconfigure

* fix: check if theres tags

* fix: update document bounding boxes after reconfigure

* fix: handle region reset after reconfigure

* refactor: hardcode to preview.3 api

* feat: support rename of table tag

* merge with master as of 11/16

* feat: enable table support for labeledTags filter

* fix: table labeling issues

* fix issue of "Trained label doesn't show as manually labeled after revisioni"

(cherry picked from commit d17e8a0)

* fix: display analyze results

* Merge branch 'stew-ro/support-table-labeling' of https://github.com/microsoft/OCR-Form-Tools into rtl_merge_with_master

* support new schema for prediction

* support highlighting of tableTag and tableCell in editor page

* display table in tag view and support highlight after schema change

* feat: support row/col header selectionMark logic

* display column header after schema change in prediction results

* handle empty rows after schema change predict

* use fieldType Object and Array for new schema

* write new schema to field.json

* fix on 'definitions' undefiened on reconfigure

* support writing to field.json and removing rowKeys and columnKey logic

* fix: remove label type when invalid

* fix: use default rows and columns if field is null

* feat: support label files for new schema

* support encoding

* fix decoding and encoding logic

* fix remove label with empy value

* update taginput toolbar

* change row dynamic starting index to zero

* support reconfigure after schema change

* support drawn region logic for table labeling

* support encoding for refactoring table

* support rename and delete tag

* support empty table for analysis

* fix: support empty tables for analysis

* Fix pipeline build failures.

Co-authored-by: alex-krasn <[email protected]>
Co-authored-by: stew-ro <[email protected]>
Co-authored-by: alex-krasn <[email protected]>
Co-authored-by: Alex Chen <[email protected]>
Co-authored-by: Starain chen <[email protected]>
Co-authored-by: Alexander Krasnorutskiy <[email protected]>
  • Loading branch information
7 people authored Jan 1, 2021
1 parent ae4ce9a commit c279a3f
Show file tree
Hide file tree
Showing 49 changed files with 4,458 additions and 990 deletions.
746 changes: 373 additions & 373 deletions CHANGELOG.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
"reactstrap": "^8.2.0",
"redux": "^4.0.4",
"redux-thunk": "^2.3.0",
"rfdc": "^1.1.4",
"rimraf": "^3.0.2",
"serialize-javascript": "^5.0.1",
"shortid": "^2.2.15",
"utif": "^3.1.0",
"vott-react": "^0.2.12"
Expand Down
24 changes: 23 additions & 1 deletion src/assets/sass/fabric-icons-inline.scss

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export const constants = {
autoLabelBatchSizeMax: 10,
autoLabelBatchSizeMin: 3,
showOriginLabelsByDefault: true,
fieldsSchema: "http://www.azure.com/schema/formrecognizer/fields.json",
labelsSchema: "http://www.azure.com/schema/formrecognizer/labels.json",

pdfjsWorkerSrc(version: string) {
return `https://fotts.azureedge.net/npm/pdfjs-dist/${version}/pdf.worker.js`;
Expand Down
50 changes: 43 additions & 7 deletions src/common/localization/en-us.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {IAppStrings} from "../strings";
import { IAppStrings } from "../strings";

/*eslint-disable no-template-curly-in-string, no-multi-str*/

Expand Down Expand Up @@ -271,7 +271,7 @@ export const english: IAppStrings = {
localFile: "Local file",
url: "URL",
},
layoutPredict:{
layoutPredict: {
layout: "Layout",
title: "Layout analyze",
inProgress: "Analysis in progress...",
Expand Down Expand Up @@ -337,7 +337,43 @@ export const english: IAppStrings = {
autoLabel: "Auto-labeled: ",
revised: "Revised: ",
},
regionTableTags: {
configureTag: {
errors: {
atLeastOneColumn: "Please assign at least one column.",
atLeastOneRow: "Please assign at least one row.",
checkFields: "Please check if you filled out all required fields correctly.",
assignTagName: "Tag name cannot be empty",
notUniqueTagName: "Tag name should be unique",
emptyTagName: "Please assign name for your table tag.",
emptyName: "Name cannot be empty",
notUniqueName: "Name should be unique",
notCompatibleTableColOrRowType: "\${kind}\ type is not compatible with this type. If you want to change type of this \${kind}\, please remove or assign all labels which using this \${kind}\ in your project.",
}
},
tableLabeling: {
title: "Label table",
tableName: "Table name",
description: {
title: "To start labeling your table:",
stepOne: "Select the words on the document you want to label",
stepTwo: "Click the table cell you want to label selected words to",
},
buttons: {
done: "Done",
reconfigureTable: "Reconfigure table",
addRow: "Add row"
},
},
confirm: {
reconfigure: {
title: "Reconfigure tag",
message: "Are you sure you want to reconfigure this tag? \n It will be reconfigured for all documents.",
}
}
},
toolbar: {
addTable: "Add new table tag",
add: "Add new tag",
onlyShowCurrentPageTags: "Only show tags used in current page",
showAllTags: "Show all tags",
Expand Down Expand Up @@ -524,7 +560,7 @@ export const english: IAppStrings = {
runOcrOnAllDocuments: "Run Layout on all documents",
runAutoLabelingCurrentDocument: "Auto-label the current document",
runAutoLabelingOnMultipleUnlabeledDocuments: "Auto-label multiple unlabeled documents",
noPredictModelOnProject: "Predict model not avaliable, please train the model first.",
noPredictModelOnProject: "Predict model not available, please train the model first.",
}
}
},
Expand Down Expand Up @@ -620,8 +656,8 @@ export const english: IAppStrings = {
description: "Select all labels for a tag on document and press 'delete' key"
},
groupSelect: {
name: "Select multiple words by drawing a bounding box around encompased words",
description: "Press and hold the shift key. Then, click and hold left mouse button. Then, drag the pointer to draw the bounding box around encompased words"
name: "Select multiple words by drawing a bounding box around encompassed words",
description: "Press and hold the shift key. Then, click and hold left mouse button. Then, drag the pointer to draw the bounding box around encompassed words"
}
},
headers: {
Expand All @@ -642,7 +678,7 @@ export const english: IAppStrings = {
},
genericRenderError: {
title: "Error Loading Application",
message: "An error occured while rendering the application. Please try again",
message: "An error occurred while rendering the application. Please try again",
},
projectInvalidSecurityToken: {
title: "Error loading project file",
Expand Down Expand Up @@ -777,7 +813,7 @@ export const english: IAppStrings = {
tokenNameExist: "Warning! You already have token with same name as in shared project. Please create a new token, and update the existing project which uses ''${sharedTokenName}'' with new token name."
},
copy: {
success: "Project token copied to clipboard and ready to share. Reciever of project token can click 'Open Cloud Project' from the Home page to use shared token.",
success: "Project token copied to clipboard and ready to share. Receiver of project token can click 'Open Cloud Project' from the Home page to use shared token.",
}
},
};
Expand Down
39 changes: 38 additions & 1 deletion src/common/localization/es-cl.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import {IAppStrings} from "../strings";
import { IAppStrings } from "../strings";

/*eslint-disable no-template-curly-in-string, no-multi-str*/

Expand Down Expand Up @@ -336,7 +336,44 @@ export const spanish: IAppStrings = {
autoLabel: "Auto-etiquetado: ",
revised: "Revisado: ",
},
regionTableTags: {
configureTag: {
errors: {
atLeastOneColumn: "Asigne al menos una columna.",
atLeastOneRow: "Asigne al menos una fila.",
checkFields: "Verifique si completó todos los campos obligatorios correctamente.",
assignTagName: "El nombre de la etiqueta no puede estar vacío.",
notUniqueTagName: "El nombre de la etiqueta debe ser único",
emptyTagName: "Asigne un nombre para la etiqueta de su mesa.",
emptyName: "El nombre no puede estar vacío",
notUniqueName: "El nombre debe ser único",
notCompatibleTableColOrRowType: "El tipo $ {kind} no es compatible con este tipo. Si desea cambiar el tipo de este $ {kind}, elimine o asigne todas las etiquetas que usan este $ {kind} en su proyecto."
}
},
tableLabeling: {
title: "Tabla de etiquetas",
tableName: "Nombre de la tabla",
description: {
title: "Para comenzar a etiquetar su mesa:",
stepOne: "Seleccione las palabras del documento que desea etiquetar",
stepTwo: "Haga clic en la celda de la tabla a la que desea etiquetar las palabras seleccionadas",
},
buttons: {
done: "Hecho",
reconfigureTable: "Reconfigurar la tabla",
addRow: "Añadir fila"
}
},
confirm: {
reconfigure: {
title: "Reconfigurar etiqueta",
message: "¿Está seguro de que desea volver a configurar esta etiqueta?\n Se volverá a configurar para todos los documentos.",
}
}

},
toolbar: {
addTable: "Agregar nueva etiqueta",
add: "Agregar nueva etiqueta",
onlyShowCurrentPageTags: "Mostrar solo las etiquetas utilizadas en la página actual",
showAllTags: "Mostrar todas las etiquetas",
Expand Down
1 change: 1 addition & 0 deletions src/common/mockFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ export default class MockFactory {
saveAssetMetadataAndCleanEmptyLabel: jest.fn(()=> Promise.resolve()),
updateProjectTag: jest.fn(() => Promise.resolve()),
deleteProjectTag: jest.fn(() => Promise.resolve()),
reconfigureTableTag: jest.fn(() => Promise.resolve()),
};
}

Expand Down
76 changes: 56 additions & 20 deletions src/common/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,22 +306,23 @@ export interface IAppStrings {
color: string,
}
toolbar: {
add: string,
onlyShowCurrentPageTags: string,
showAllTags: string,
add: string;
addTable: string;
contextualMenu: string;
delete: string;
edit: string;
format: string;
lock: string;
moveDown: string;
moveUp: string;
rename: string;
search: string;
type: string;
vertiline: string;
onlyShowCurrentPageTags:string,
showAllTags:string,
showOriginLabels: string
hideOriginLabels: string,
contextualMenu: string,
delete: string,
edit: string,
format: string,
lock: string,
moveDown: string,
moveUp: string,
rename: string,
search: string,
type: string,
vertiline: string,
}
colors: {
white: string,
Expand All @@ -346,12 +347,47 @@ export interface IAppStrings {
notCompatibleTagType: string,
checkboxPerTagLimit: string,
notCompatibleWithDrawnRegionTag: string,
replaceAllExitingLabels: string,
replaceAllExitingLabelsTitle: string,
replaceAllExitingLabels:string,
replaceAllExitingLabelsTitle:string,
},
preText: {
autoLabel: string,
revised: string,
preText:{
autoLabel:string,
revised:string,
}
regionTableTags: {
configureTag: {
errors: {
atLeastOneColumn: string,
atLeastOneRow: string,
checkFields: string,
assignTagName: string,
notUniqueTagName: string,
emptyTagName: string,
emptyName: string,
notUniqueName: string,
notCompatibleTableColOrRowType: string;
},
},
tableLabeling: {
title: string,
description: {
title: string,
stepOne: string,
stepTwo: string,
},
tableName: string,
buttons: {
done: string,
reconfigureTable: string,
addRow: string,
}
},
confirm: {
reconfigure: {
title: string,
message: string,
}
}
}
};
connections: {
Expand Down Expand Up @@ -677,7 +713,7 @@ interface IErrorMetadata {
message: string,
}

interface IStrings extends LocalizedStringsMethods, IAppStrings { }
interface IStrings extends LocalizedStringsMethods, IAppStrings {}

export const strings: IStrings = new LocalizedStrings({
en: english,
Expand Down
6 changes: 5 additions & 1 deletion src/common/themes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createTheme, IPalette} from "@fluentui/react";
import {createTheme, IPalette, DefaultPalette} from "@fluentui/react";

const rightPaneDefaultButtonPalette = {
themePrimary: "#E9ECEF",
Expand Down Expand Up @@ -306,6 +306,7 @@ const subMenuPalette = {

const rightPaneDefaultButtonTheme = createTheme({palette: rightPaneDefaultButtonPalette});
const defaultDarkTheme = createTheme({palette: DarkDefaultPalette});
const defaultTheme = createTheme({palette: DefaultPalette});
const whiteTheme = createTheme({palette: whiteButtonPalette});
const redTheme = createTheme({palette: redButtonPalette});
const greenTheme = createTheme({palette: greenButtonPalette});
Expand Down Expand Up @@ -356,6 +357,9 @@ export function getGreenWithWhiteBackgroundTheme() {
export function getDefaultDarkTheme() {
return defaultDarkTheme;
}
export function getDefaultTheme() {
return defaultTheme;
}

export function getSubMenuTheme() {
return subMenuTheme;
Expand Down
Loading

0 comments on commit c279a3f

Please sign in to comment.