Skip to content

Commit

Permalink
Updating
Browse files Browse the repository at this point in the history
  • Loading branch information
wildercb committed Apr 16, 2024
1 parent 4ac7b24 commit 95f937c
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 2 deletions.
4 changes: 4 additions & 0 deletions data/updated_json_format.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
],
"annotations": [
[
<<<<<<< HEAD
<<<<<<< HEAD
"Cellulose is an organic compound with the formula (C6H10O5)n, a polysaccharide consisting of a linear chain of several hundred to many thousands of linked D-glucose units.\r",
=======
"Cellulose is an organic compound with the formula (C6H10O5)n, a polysaccharide consisting of \n a linear chain of several hundred to many thousands of linked D-glucose units.\r",
>>>>>>> 4046a2a (Updating import/export)
=======
"Cellulose is an organic compound with the formula (C6H10O5)n, a polysaccharide consisting of \n a linear chain of several hundred to many thousands of linked D-glucose units.\r",
>>>>>>> a33118b (Updating)
{
"entities": [
[
Expand Down
9 changes: 8 additions & 1 deletion src/components/AnnotationPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,16 @@
const annotationHistory = this.annotationHistory;
if (annotationHistory && annotationHistory.length > 0) {
annotationHistory.forEach((annotation) => {
<<<<<<< HEAD
<<<<<<< HEAD
const [labelName, start, end, , name] = annotation;
=======
const [labelName, start, end, , name,, ogNLP] = annotation;
>>>>>>> a33118b (Updating)
const humanOpinion = name !== "nlp";
const initiallyNLP = name === "nlp";
const _class = this.classes.find(cls => cls.name === labelName);
if (_class) {
<<<<<<< HEAD
this.tm.addNewBlock(start, end, _class, humanOpinion, initiallyNLP, true, name, status);
=======
const [labelName, start, end, , name,, ogNLP] = annotation;
Expand All @@ -186,6 +190,9 @@
if (_class) {
this.tm.addNewBlock(start, end, _class, humanOpinion, ogNLP, true, name, status);
>>>>>>> 4046a2a (Updating import/export)
=======
this.tm.addNewBlock(start, end, _class, humanOpinion, ogNLP, true, name, status);
>>>>>>> a33118b (Updating)
} else {
console.warn(`Label "${labelName}" not found in classes.`);
}
Expand Down
7 changes: 7 additions & 0 deletions src/components/ReviewPage.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<<<<<<< HEAD
<div>

<classes-block />
<div class="q-pa-lg" style="height:60vh; overflow-y:scroll;">
<component
Expand Down Expand Up @@ -168,20 +169,26 @@ export default {
},
<<<<<<< HEAD
undo() {
<<<<<<< HEAD
console.log("Undo Stack:", this.addedTokensStack);
=======
handleSymbolUpdate(tokenStart, newSymbolState) {
this.tm.updateSymbolState(tokenStart, newSymbolState);
},
undo() {
=======
>>>>>>> a33118b (Updating)
if (this.addedTokensStack.length > 0) {
const lastAddedTokenStart = this.addedTokensStack.pop();
this.onRemoveBlock(lastAddedTokenStart);
console.log("Undo operation: Removed last added token", lastAddedTokenStart);
} else {
console.log("Undo Stack is empty");
}
<<<<<<< HEAD
>>>>>>> 4046a2a (Updating import/export)
=======
>>>>>>> a33118b (Updating)
},
/*
// Load history of annotations from input file
Expand Down
5 changes: 5 additions & 0 deletions src/components/TokenBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default {
},
methods: {
toggleSymbol() {
const previousState = this.isSymbolActive;
if (this.token.initiallyNLP && !this.userHasToggled) {
// If initially set by NLP and user hasn't toggled yet, allow toggle to false
this.isSymbolActive = false;
Expand All @@ -124,6 +125,10 @@ export default {
this.isSymbolActive = !this.isSymbolActive;
}
this.userHasToggled = true;
this.$emit('toggle-symbol', {
tokenStart: this.token.start,
previousState: previousState,
});
},
toggleReviewed() {
this.isReviewed = !this.isReviewed;
Expand Down
6 changes: 5 additions & 1 deletion src/components/menubar/ExportAnnotations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,16 @@ export default {
entities: annotation.entities.map(entity => {
console.log("ENTITY to transform:" ,entity);
// Copy the existing history
<<<<<<< HEAD
<<<<<<< HEAD
let history = [...entity[9]]; // Assuming entity[11] is the full history list
=======
let history = [entity[9]]; // Assuming entity[11] is the full history list
>>>>>>> a33118b (Updating)
console.log("ENTITY 8=",entity[8]);
console.log("ENTITY 9 =",entity[9]);
// Check if userHasToggles is true and add a new history entry if so
if (entity[6]) {
if (entity[7]) {
const newHistoryEntry = [
entity[8], // Status from entity[9]
=======
Expand Down
11 changes: 11 additions & 0 deletions src/components/token-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ class TokenManager {
var entityName = currentAnnotation.entities[i][3];
console.log("ENTITYNAME: ",entityName, currentAnnotation.entities[i]);
var entityClass = this.classes.find(c => c.name.toUpperCase() === entityName.toUpperCase());
<<<<<<< HEAD
<<<<<<< HEAD
entityClass = entityClass.name;
=======
>>>>>>> 4046a2a (Updating import/export)
=======
>>>>>>> a33118b (Updating)
console.log("SETTOKENENTITYCLSAS: ",entityClass);
if (!entityClass) {
entityClass = {"name": entityName};
Expand All @@ -55,11 +58,15 @@ class TokenManager {
* @param {Boolean} isHumanOpinion Seperate nlp vs human made annotation
*/
<<<<<<< HEAD
<<<<<<< HEAD
addNewBlock(_start, _end, _class, humanOpinion, initiallyNLP = false, isLoaded, name="name", status ="suggested", annotationHistory) {
=======
addNewBlock(_start, _end, _class, humanOpinion, initiallyNLP = false, isLoaded, name="name", status ="suggested", annotationHistory, userHasToggled = false,isSymbolActive = 0) {
>>>>>>> 4046a2a (Updating import/export)
=======
addNewBlock(_start, _end, _class, humanOpinion, initiallyNLP = false, isLoaded, name="name", status ="suggested", annotationHistory, userHasToggled = false,) {
>>>>>>> a33118b (Updating)
// Directly apply humanOpinion to the block structure
let block = {
type: "token-block",
Expand All @@ -70,8 +77,12 @@ class TokenManager {
label: _class.name,
humanOpinion: humanOpinion,
initiallyNLP: initiallyNLP,
<<<<<<< HEAD
<<<<<<< HEAD
userHasToggled: false, // Ensure it's set for the new block
=======
userHasToggled: userHasToggled, // Ensure it's set for the new block
>>>>>>> a33118b (Updating)
isSymbolActive: false, // Ensure it's set for the new block
=======
userHasToggled: userHasToggled, // Ensure it's set for the new block
Expand Down
15 changes: 15 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,27 @@ const niceColors = [
"orange-11",
];

<<<<<<< HEAD
<<<<<<< HEAD
=======


>>>>>>> 4046a2a (Updating import/export)
=======


>>>>>>> a33118b (Updating)
export const mutations = {
setCurrentPage(state, page) {
// console.log("From index.js, changing currentpage to", page)
state.currentPage = page;
// console.log("From index.js, current page is now", state.currentPage)
},
<<<<<<< HEAD
<<<<<<< HEAD
=======
=======
>>>>>>> a33118b (Updating)
addToUndoStack(state, { undoAction, actionDescription }) {
state.undoStack.push({ undoAction, actionDescription });
},
Expand All @@ -59,7 +67,10 @@ export const mutations = {
clearUndoStack(state) {
state.undoStack = [];
},
<<<<<<< HEAD
>>>>>>> 4046a2a (Updating import/export)
=======
>>>>>>> a33118b (Updating)

loadClasses(state, payload) {
if (!Array.isArray(payload)) {
Expand Down Expand Up @@ -333,9 +344,13 @@ export default {
annotations: [],
annotationHistory: [],
<<<<<<< HEAD
<<<<<<< HEAD
=======
undoStack: [],
>>>>>>> 4046a2a (Updating import/export)
=======
undoStack: [],
>>>>>>> a33118b (Updating)
classes: tags || [],
inputSentences: [],
originalText: "",
Expand Down

0 comments on commit 95f937c

Please sign in to comment.