Skip to content

Commit

Permalink
Merge pull request #1066 from AI4Bharat/test-validation-3
Browse files Browse the repository at this point in the history
  • Loading branch information
ishvindersethi22 authored Jul 1, 2024
2 parents 4eb5624 + e85a702 commit 550a012
Showing 1 changed file with 57 additions and 57 deletions.
114 changes: 57 additions & 57 deletions src/ui/pages/container/CL-Transcription/TranscriptionRightPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,63 +206,63 @@ const TranscriptionRightPanel = ({
?.scrollIntoView(true, { block: "start" });
}

if (currentIndex > startIndex) {
const copySub = [...subtitles];
let sub = copySub[currentIndex - 1]
let replacedValue = sub.text.replace(/\[[a-zA-Z_-]+\]/g, '');
let splitText = replacedValue.split(" ");
let invalidCharFlag = 0;
let invalidWords = [];
splitText.forEach((e) => {
if (RegExp("\<[a-zA-Z\s,_-]+\>").test(e)) {
if (e.length > 2) {
if (!TabsSuggestionData.includes(e.slice(1, -1))) {
invalidCharFlag = 1;
invalidWords.push(e);
}
} else {
invalidCharFlag = 1;
invalidWords.push(e);
}
}else{
let wordSet = new Set(e);
if (([...wordSet].every(char => langDictSet.has(char))) === false) {
invalidCharFlag = 1;
invalidWords.push(e);
}
}
});
if(sub.acoustic_normalised_text.length > 0){
let replacedANValue = sub.acoustic_normalised_text.replace(/\[[a-zA-Z_-]+\]/g, '');
let splitANText = replacedANValue.split(" ");
splitANText.forEach((e) => {
if (RegExp("\<[a-zA-Z\s,_-]+\>").test(e)) {
if (e.length > 2) {
if (!TabsSuggestionData.includes(e.slice(1, -1))) {
invalidCharFlag = 1;
invalidWords.push(e);
}
} else {
invalidCharFlag = 1;
invalidWords.push(e);
}
} else {
let wordSet = new Set(e);
if (([...wordSet].every(char => langDictSet.has(char))) === false) {
invalidCharFlag = 1;
invalidWords.push(e);
}
}
});
}
if (invalidCharFlag) {
setSnackbarInfo({
open: true,
message: "Characters belonging to other language are used: "+invalidWords.join(", "),
variant: "error",
});
}
}
// if (currentIndex > startIndex) {
// const copySub = [...subtitles];
// let sub = copySub[currentIndex - 1]
// let replacedValue = sub.text.replace(/\[[a-zA-Z_-]+\]/g, '');
// let splitText = replacedValue.split(" ");
// let invalidCharFlag = 0;
// let invalidWords = [];
// splitText.forEach((e) => {
// if (RegExp("\<[a-zA-Z\s,_-]+\>").test(e)) {
// if (e.length > 2) {
// if (!TabsSuggestionData.includes(e.slice(1, -1))) {
// invalidCharFlag = 1;
// invalidWords.push(e);
// }
// } else {
// invalidCharFlag = 1;
// invalidWords.push(e);
// }
// }else{
// let wordSet = new Set(e);
// if (([...wordSet].every(char => langDictSet.has(char))) === false) {
// invalidCharFlag = 1;
// invalidWords.push(e);
// }
// }
// });
// if(sub.acoustic_normalised_text.length > 0){
// let replacedANValue = sub.acoustic_normalised_text.replace(/\[[a-zA-Z]\]/g, '');
// let splitANText = replacedANValue.split(" ");
// splitANText.forEach((e) => {
// if (RegExp("\<[a-zA-Z\s,_-]+\>").test(e)) {
// if (e.length > 2) {
// if (!TabsSuggestionData.includes(e.slice(1, -1))) {
// invalidCharFlag = 1;
// invalidWords.push(e);
// }
// } else {
// invalidCharFlag = 1;
// invalidWords.push(e);
// }
// } else {
// let wordSet = new Set(e);
// if (([...wordSet].every(char => langDictSet.has(char))) === false) {
// invalidCharFlag = 1;
// invalidWords.push(e);
// }
// }
// });
// }
// if (invalidCharFlag) {
// setSnackbarInfo({
// open: true,
// message: "Characters belonging to other language are used: "+invalidWords.join(", "),
// variant: "error",
// });
// }
// }
}, [currentIndex]);

useEffect(() => {
Expand Down

0 comments on commit 550a012

Please sign in to comment.