Skip to content

Commit

Permalink
remove condition when parsing conll
Browse files Browse the repository at this point in the history
  • Loading branch information
khansadaoudi committed Jul 19, 2024
1 parent cde420b commit 67ca2b9
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/components/project/UploadDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ export default defineComponent({
customUserId: '',
warningMessage: '',
generateNewSentIds: false,
formatError: false,
samplesWithoutSentIds,
rtl: false,
};
Expand All @@ -186,7 +185,7 @@ export default defineComponent({
let disable = true;
if (this.samplesWithoutSentIds.length > 0) {
disable = !this.generateNewSentIds;
} else if (this.uploadSample.attachment.file.length > 0 && !this.formatError) {
} else if (this.uploadSample.attachment.file.length > 0) {
disable = false;
}
return disable;
Expand Down Expand Up @@ -224,24 +223,15 @@ export default defineComponent({
},
checkSentIdsErrors(fileContent: string, sampleName: string) {
const sentIds: any[] = [];
this.formatError = false;
const sentences = fileContent.replace(/[\r]/g, "").split(/\n\n/).filter((sentence) => sentence);
for (const sentence of sentences) {
this.checkSentFormatError(sentence, sampleName)
if (this.formatError) return;
if (sentenceConllToJson(sentence)['metaJson']['sent_id']) {
const sentId = sentenceConllToJson(sentence)['metaJson']['sent_id'];
sentIds.push(sentId);
}
}
if (sentences.length !== sentIds.length) this.samplesWithoutSentIds.push(sampleName);
},
checkSentFormatError(sentence: string, sampleName: string) {
if (/\n\s*\n\S/.test(sentence)) {
notifyError({ error: `${sampleName} contains empty line that doesn't start with a digit or # ` });
this.formatError = true;
}
},
triggerFormatErrors() {
this.samplesWithoutSentIds.forEach((sampleName) => {
this.warningMessage += `"${sampleName}" has sentences without sent_id.\n`;
Expand Down Expand Up @@ -300,7 +290,6 @@ export default defineComponent({
});
},
tokenizeSample() {
console.log(this.rtl)
const data = {
username: this.customUserId,
text: this.text.normalize('NFC'),
Expand Down

0 comments on commit 67ca2b9

Please sign in to comment.