Skip to content

Commit

Permalink
Fix TermCompTable when reference is not the sourceLayer
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsINT committed Nov 14, 2024
1 parent 854d5c3 commit 0e3833f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
9 changes: 4 additions & 5 deletions client/src/components/tables/SingleTermComparisonTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { onMounted, watch, computed, ref, Ref } from 'vue'
import stores, { JobSelectionStore } from '@/stores'
// Types & API
import { Term } from '@/types/evaluation'
import { Field, Cell } from '@/types/table'
import { Field } from '@/types/table'
// Components
import { GTable } from '@/components'
Expand Down Expand Up @@ -50,11 +50,12 @@ const columns: Ref<Field[]> = computed(() => {
return acc
}, [] as string[]).filter(i => !ignorableAnnotations.includes(i)).map(key => ({ key, label: key }))
})
// Methods
function itemEqual(data: Cell): bool {
if (data.item.layer == "sourceLayer" || data.field.key == "layer") return true // always true for source layer
if (data.item.layer == jobSelection.referenceJobId || data.field.key == "layer") return true // always true for source layer
const sourceItem = items.value.find(i => i.layer == "sourceLayer")
const sourceItem = items.value.find(i => i.layer == jobSelection.referenceJobId)
return annotationsEqual(data.value, sourceItem[data.field.key])
}
Expand All @@ -65,8 +66,6 @@ function annotationsEqual(refAnnot: string, hypoAnnot: string) {
function cleanAnnotation(term) {
return term?.toLowerCase().replace("_", "")
}
// Watches & mounts
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<GCard title="Document Layer Comparison">
<GCard title="Document View">

<template #help>
The document layer comparison show the differences between the reference and hypothesis layer on a single
The document view show the differences between the reference and hypothesis layer in a single
document. Red words indicate a difference between the layers for the selected annotation. Hover over a word
to see all annotations.
</template>
Expand Down Expand Up @@ -34,20 +34,22 @@

<!-- add newline after . -->
<br v-if="tc.refTerm.targets[0].literal == '.'" />

</template>
<Paginator v-model:first="firstRecord" :rows="rowsToDisplay" :totalRecords="termcomps.length"></Paginator>

<Paginator v-if="termcomps.length > rowsToDisplay" v-model:first="firstRecord" :rows="rowsToDisplay"
:totalRecords="termcomps.length"></Paginator>
</div>
<p v-else>Select a document and an annotation.</p>

</GCard>
</template>

<script setup lang="ts">
// Library & API
import { onMounted, watch, computed, ref } from 'vue'
import { onMounted, watch, computed, ref, Ref } from 'vue'
import * as API from '@/api/evaluation'
// Types & Stores
import { TermComparison } from '@/types/evaluation'
import { TermComparison, Term } from '@/types/evaluation'
import stores, { CorporaStore, JobsStore, ExportStore, DocumentsStore, JobSelectionStore } from "@/stores"
// Components
import { GInput, GCard } from "@/components"
Expand All @@ -62,7 +64,7 @@ const jobSelection = stores.useJobSelection() as JobSelectionStore
// Fields
const docNames = computed(() => documentsStore.available.map(doc => ({ value: doc.name, text: doc.name })))
const selectedDoc = ref(null)
const selectedAnnotation = ref(null)
const selectedAnnotation: Ref<string> = ref(null as any as string)
const annotationOptions = ref(null)
const termcomps = ref<TermComparison[]>(null)
const loading = ref(false)
Expand Down Expand Up @@ -95,7 +97,7 @@ function annotationsEqual(tc: TermComparison) {
return refAnnot == hypoAnnot
}
function cleanAnnotation(term) {
function cleanAnnotation(term: Term) {
return term.annotations[selectedAnnotation.value]?.toLowerCase().replace("_", "")
}
Expand Down

0 comments on commit 0e3833f

Please sign in to comment.