Skip to content

Commit

Permalink
Merge pull request #1056 from AI4Bharat/noise-tags-master
Browse files Browse the repository at this point in the history
change noise tag enclosing to <> and added validation for input text …
  • Loading branch information
ishvindersethi22 authored Jun 26, 2024
2 parents 3289c7e + cec3620 commit 4d211f6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const TagsSuggestionList = React.forwardRef((props, ref) => {
const dispatch = useDispatch();
const classes = AudioTranscriptionLandingStyle();
const handleTagClick = (suggestion) => {
const modifiedText = `${textWithoutTripleDollar}[${suggestion}]${textAfterTripleDollar}`;
const modifiedText = `${textWithoutTripleDollar}<${suggestion}>${textAfterTripleDollar}`;

const sub = onSubtitleChange(modifiedText, index, tagSuggestionsAcoustic);
dispatch(setSubtitles(sub, C.SUBTITLES));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
assignSpeakerId,
// getTagsList,
} from "../../../../utils/SubTitlesUtils";
import { langDict } from "./langDict";

//Styles
// import "../../../styles/scrollbarStyle.css";
Expand Down Expand Up @@ -312,6 +313,26 @@ const TranscriptionRightPanel = ({
currentTarget,
} = event;

let langDictSet = new Set(langDict[targetlang]);
let langDictSetEn = new Set(langDict["en"]);

let splitText = value.split(" ");
let invalidCharFlag = 0;
splitText.forEach((e, i) => {
// splitText[i] = [...e].map(char => (langDictSet.has(char) || langDictSetEn.has(char)) ? char : '').join('');
if(([...e].map(char => (langDictSet.has(char) || langDictSetEn.has(char)) ? 1 : 0).join('')).search(0) !== -1){
invalidCharFlag = 1;
}
});

if(invalidCharFlag){
setSnackbarInfo({
open: true,
message: "Characters belonging to other language are used",
variant: "error",
});
}

const containsTripleDollar = value.includes("$$$");

// setEnableTransliterationSuggestion(true);
Expand Down
25 changes: 25 additions & 0 deletions src/ui/pages/container/CL-Transcription/langDict.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/utils/SubTitlesUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ export const onSubtitleChange = (text, index, updateAcoustic, populateAcoustic)
const copySub = [...subtitles];
const sub = copySub[index];


// text = splitText.join(" ");

if (updateAcoustic)
sub.acoustic_normalised_text = text;
else if (populateAcoustic) {
Expand Down

0 comments on commit 4d211f6

Please sign in to comment.