Skip to content

Commit

Permalink
some fixes for sentence segmentation function
Browse files Browse the repository at this point in the history
  • Loading branch information
khansadaoudi committed Dec 3, 2024
1 parent 1e0188a commit 0b85cca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/sentence/SentenceSegmentation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ export default defineComponent({
const sentIdIndex = this.sortedSentIds.indexOf(this.sentId)
const secondSentId = this.segmentationOption === 'MERGE_BEFORE' ? sentIdIndex - 1 : sentIdIndex + 1;
const secondSentenceConlls = this.filteredTrees[secondSentId].conlls;
this.mergedSentId = this.sortedSentIds[secondSentId]
for (const [userId, reactiveSentence] of Object.entries(this.reactiveSentencesObj)) {
if (Object.keys(secondSentenceConlls).includes(userId)) {
Expand Down
18 changes: 12 additions & 6 deletions src/components/sentence/SentenceToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,15 @@
</q-item-label>
</q-item-section>
</q-item>

<q-item v-if="isValidator && canChangeSegmentation" v-close-popup clickable @click="chooseSegmentationOption('MERGE_BEFORE')">
<q-item v-if="canChangeSegmentation && !isFirstSentence" v-close-popup clickable @click="chooseSegmentationOption('MERGE_BEFORE')">
<q-item-section avatar>
<q-avatar icon="arrow_back" color="primary" text-color="white" />
</q-item-section>
<q-item-section>
<q-item-label> Merge before </q-item-label>
</q-item-section>
</q-item>

<q-item v-if="isValidator && canChangeSegmentation" v-close-popup clickable @click="chooseSegmentationOption('MERGE_AFTER')">
<q-item v-if="canChangeSegmentation && !isLastSentence" v-close-popup clickable @click="chooseSegmentationOption('MERGE_AFTER')">
<q-item-section avatar>
<q-avatar icon="arrow_forward" color="primary" text-color="white" />
</q-item-section>
Expand All @@ -139,7 +137,7 @@
</q-item-section>
</q-item>

<q-item v-if="isValidator && canChangeSegmentation" v-close-popup clickable @click="chooseSegmentationOption('SPLIT')">
<q-item v-if="canChangeSegmentation" v-close-popup clickable @click="chooseSegmentationOption('SPLIT')">
<q-item-section avatar>
<q-avatar icon="content_cut" color="primary" text-color="white" />
</q-item-section>
Expand Down Expand Up @@ -217,6 +215,7 @@ import { defineComponent, PropType } from 'vue';
import TagsMenu from './TagsMenu.vue';
import SentenceSegmentation from './SentenceSegmentation.vue';
import { notifyMessage } from 'src/utils/notify';
import { useTreesStore } from 'src/pinia/modules/trees';
export default defineComponent({
name: 'sentenceToolBar',
Expand Down Expand Up @@ -281,6 +280,7 @@ export default defineComponent({
'collaborativeMode'
]),
...mapState(useUserStore, ['username', 'isLoggedIn']),
...mapState(useTreesStore, ['sortedSentIds']),
isBernardCaron() {
return this.username === 'bernard.l.caron' || this.username === 'kirianguiller';
},
Expand All @@ -296,7 +296,13 @@ export default defineComponent({
}
},
canChangeSegmentation() {
return this.$route.params.samplename !== undefined // sentence segmentation option is available only in the sample view
return this.isValidator && this.$route.params.samplename !== undefined // sentence segmentation option is available only in the sample view and only for validator
},
isFirstSentence() {
return this.sortedSentIds[0] === this.sentenceData.sent_id;
},
isLastSentence() {
return this.sortedSentIds[this.sortedSentIds.length - 1] === this.sentenceData.sent_id;
}
},
methods: {
Expand Down

0 comments on commit 0b85cca

Please sign in to comment.