diff --git a/src/components/project/DetectedTagSetDial.vue b/src/components/project/DetectedTagSetDial.vue index dbd0ef35..686aa051 100644 --- a/src/components/project/DetectedTagSetDial.vue +++ b/src/components/project/DetectedTagSetDial.vue @@ -14,20 +14,36 @@
UPOS
- +
Features
-
- - -
+ +
+ +
misc
+
Relations
- - + +
@@ -49,21 +65,25 @@ export default defineComponent({ type: Object as PropType, required: true, }, + newMisc: { + type: Object as PropType, + required: true, + }, newPos: { type: Object as PropType, required: true, }, newRel: { - type: Object as PropType, + type: Object as PropType, required: true, } }, data() { return { selectedPos: [] as boolean[], - selectedFeats: [] as { select: boolean, option: string }[], - selectedRelations: [] as { select: boolean, option: string } [], - featsOptions: ['FEATS', 'MISC'], + selectedFeats: [] as boolean[], + selectedMisc: [] as boolean[], + selectedRelations: [] as boolean[], deprelOptions: [] as string[], currentAnnotationSchema: {} as annotationFeatures_t, } @@ -73,8 +93,9 @@ export default defineComponent({ }, mounted() { this.selectedPos = this.newPos.map(() => false); - this.selectedFeats = this.newFeats.map(() => ({ select: false, option: 'FEATS' })) - this.selectedRelations = this.newRel.map(() => ({ select: false, option: this.annotationFeatures.DEPREL[0].name })) + this.selectedFeats = this.newFeats.map(() => false); + this.selectedMisc = this.newMisc.map(() => false); + this.selectedRelations = this.newRel.map(() => false); this.deprelOptions = this.annotationFeatures.DEPREL.map((deprel) => deprel.name); }, methods: { @@ -86,19 +107,19 @@ export default defineComponent({ } } for (const feat in this.selectedFeats) { - if (this.selectedFeats[feat].select) { - if (this.selectedFeats[feat].option === 'FEATS') { - this.annotationFeatures.FEATS.push({ name: this.newFeats[feat], values: []}); - } - else { - this.annotationFeatures.MISC.push({ name: this.newFeats[feat], values: [] }); - } + if (this.selectedFeats[feat]) { + this.annotationFeatures.FEATS.push({ name: this.newFeats[feat], values: [] }); + } + } + for (const misc in this.selectedMisc) { + if (this.selectedMisc[misc]) { + this.annotationFeatures.MISC.push({ name: this.newMisc[misc], values: [] }); } } for (const deprel in this.selectedRelations) { - if (this.selectedRelations[deprel].select) { - const index = this.annotationFeatures.DEPREL.map(deprel => deprel.name).indexOf(this.selectedRelations[deprel].option) - this.annotationFeatures.DEPREL[index].values.push(this.newRel[deprel]); + if (this.selectedRelations[deprel]) { + const index = this.newRel[deprel].index; + this.annotationFeatures.DEPREL[index].values.push(this.newRel[deprel].value); } } this.updateProjectConlluSchema(this.name, this.annotationFeatures, this.currentAnnotationSchema); diff --git a/src/components/project/UploadDialog.vue b/src/components/project/UploadDialog.vue index 45bbb97a..b188cd7c 100644 --- a/src/components/project/UploadDialog.vue +++ b/src/components/project/UploadDialog.vue @@ -152,7 +152,13 @@ - + @@ -226,11 +232,13 @@ export default defineComponent({ rtl: false, userId: 'username', featsList: [] as string[], + miscList: [] as string[], posList: [] as string[], relationsList: [] as string[], newFeatsList: [] as string[], + newMiscList: [] as string[], newPosList: [] as string[], - newRelationsList: [] as string[], + newRelationsList: [] as { value: string, index: number }[], }; }, @@ -257,7 +265,7 @@ export default defineComponent({ return disable; }, hasNewFeatures() { - return this.newFeatsList.length > 0 || this.newPosList.length > 0 || this.newRelationsList.length > 0; + return this.newFeatsList.length > 0 || this.newPosList.length > 0 || this.newRelationsList.length > 0 || this.newMiscList.length > 0; } }, methods: { @@ -345,6 +353,7 @@ export default defineComponent({ this.uploadDialModel = false; this.uploadSample.submitting = false; this.featsList = response.data.data.feats; + this.miscList = response.data.data.misc; this.posList = response.data.data.pos; this.relationsList = response.data.data.relations; this.checkNewFeats(); @@ -368,13 +377,16 @@ export default defineComponent({ const splitRegex = new RegExp(`[${deprels.map(({ join }) => join).join('')}]`, 'g'); this.newPosList = this.posList.filter(pos => !annotationUpos.includes(pos)); - this.newFeatsList = this.featsList.filter(feat => !annotationFeats.includes(feat) && !annotationMisc.includes(feat)); + this.newFeatsList = this.featsList.filter(feat => !annotationFeats.includes(feat)); + this.newMiscList = this.miscList.filter(misc => !annotationMisc.includes(misc)); for (const relation of this.relationsList) { const splittedRel = relation.split(splitRegex); + let index = 0; for (const subRel of splittedRel) { const found = deprels.some(({ values, join }) => values.includes(subRel) && relation.includes(join + subRel)); - if (!found) this.newRelationsList.push(subRel); + index += 1; + if (!found) this.newRelationsList.push({ value: subRel, index: index }); } } }, @@ -420,6 +432,7 @@ export default defineComponent({ this.newFeatsList = []; this.newPosList = []; this.newRelationsList = []; + this.newMiscList = []; } }, }); diff --git a/src/components/shared/TreesTypeSelect.vue b/src/components/shared/TreesTypeSelect.vue index be94131b..20fdacae 100644 --- a/src/components/shared/TreesTypeSelect.vue +++ b/src/components/shared/TreesTypeSelect.vue @@ -107,7 +107,6 @@ export default defineComponent({ { value: 'recent', label: this.$t('grewSearch.recentTree'), icon: 'schedule' }, { value: 'user', label: this.$t('grewSearch.userTree') }, { value: 'validated', label: this.$t('grewSearch.validatedTree'), icon: 'verified' }, - { value: 'pending', label: this.$t('grewSearch.pendingTree'), icon: 'pending' }, { value: 'all', label: this.$t('grewSearch.allTree'), icon: 'groups' }, { value: 'base_tree', label: this.$t('grewSearch.baseTree'), icon: 'linear_scale' }, { value: 'others', label: this.$t('grewSearch.otherTree'), icon: 'group' }, @@ -129,7 +128,7 @@ export default defineComponent({ if (this.grewOption != 'REWRITE') { return this.treeTypes.filter((element) => this.grewTreeTypes.includes(element.value)); } else { - return this.treeTypes.filter((element) => this.grewTreeTypes.includes(element.value) && !['all', 'pending'].includes(element.value)); + return this.treeTypes.filter((element) => this.grewTreeTypes.includes(element.value) && 'all' !== element.value); } }, treesFrom() { diff --git a/src/pinia/modules/grewSearch/index.ts b/src/pinia/modules/grewSearch/index.ts index 1e2284b3..dd5469d7 100644 --- a/src/pinia/modules/grewSearch/index.ts +++ b/src/pinia/modules/grewSearch/index.ts @@ -7,7 +7,7 @@ export const useGrewSearchStore = defineStore('grewSearch', { return { reloadGrew: 0, lastQuery: null as null | { text: string; type: 'REWRITE' | 'SEARCH'; userType: string }, - treeTypes: ['user', 'user_recent', 'recent', 'validated', 'pending', 'base_tree', 'all', 'others'], + treeTypes: ['user', 'user_recent', 'recent', 'validated', 'base_tree', 'all', 'others'], }; }, getters: {