Skip to content

Commit

Permalink
Merge pull request #29 from vaibhavsTekdi/release-4.0
Browse files Browse the repository at this point in the history
Hot fix for ASR API & telemtery response
  • Loading branch information
gouravmore authored Jul 14, 2023
2 parents 7531843 + 48e9262 commit a2c53d1
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 15 deletions.
13 changes: 8 additions & 5 deletions src/views/Score/Score.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,15 @@ function Score() {
let tempvoiceText = voiceText?.toLowerCase();
tempvoiceText = replaceAll(tempvoiceText, '.', '');
tempvoiceText = replaceAll(tempvoiceText, "'", '');
tempvoiceText = replaceAll(tempvoiceText, "’", '');
tempvoiceText = replaceAll(tempvoiceText, ',', '');
tempvoiceText = replaceAll(tempvoiceText, '!', '');
tempvoiceText = replaceAll(tempvoiceText, '|', '');
tempvoiceText = replaceAll(tempvoiceText, '?', '');
let tempteacherText = teacherText?.toLowerCase();
tempteacherText = replaceAll(tempteacherText, '.', '');
tempteacherText = replaceAll(tempteacherText, "'", '');
tempteacherText = replaceAll(tempteacherText, "’", '');
tempteacherText = replaceAll(tempteacherText, ',', '');
tempteacherText = replaceAll(tempteacherText, '!', '');
tempteacherText = replaceAll(tempteacherText, '|', '');
Expand Down Expand Up @@ -165,11 +167,12 @@ function Score() {
let texttemp = voiceText.toLowerCase();
texttemp = replaceAll(texttemp, '.', '');
texttemp = replaceAll(texttemp, "'", '');
texttemp = replaceAll(texttemp, ',', '');
texttemp = replaceAll(texttemp, '!', '');
texttemp = replaceAll(texttemp, '|', '');
texttemp = replaceAll(texttemp, '?', '');
const studentTextArray = texttemp.split(' ');
texttemp = replaceAll(texttemp, "’", '');
texttemp = replaceAll(texttemp, ',', '');
texttemp = replaceAll(texttemp, '!', '');
texttemp = replaceAll(texttemp, '|', '');
texttemp = replaceAll(texttemp, '?', '');
const studentTextArray = texttemp.split(' ');
const teacherTextArray = tempteacherText.split(' ');
let student_text_result = [];
let originalwords = teacherTextArray.length;
Expand Down
6 changes: 6 additions & 0 deletions src/viewsProto2/Score/Score.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ function Score() {
}
function checkVoice(voiceText) {
let tempvoiceText = voiceText?.toLowerCase();
tempvoiceText = replaceAll(tempvoiceText, '.', '');
tempvoiceText = replaceAll(tempvoiceText, "'", '');
tempvoiceText = replaceAll(tempvoiceText, ',', '');
tempvoiceText = replaceAll(tempvoiceText, '!', '');
tempvoiceText = replaceAll(tempvoiceText, '|', '');
tempvoiceText = replaceAll(tempvoiceText, '?', '');
let tempteacherText = teacherText?.toLowerCase();
tempteacherText = replaceAll(tempteacherText, '.', '');
tempteacherText = replaceAll(tempteacherText, "'", '');
Expand Down
18 changes: 16 additions & 2 deletions src/viewsProto3/Score/Score.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function Score() {
const [ocurracy_percentage, setOcurracy_percentage] = useState('');
const [newtextresult, setnewtextresult] = useState('');
const [fluencyresult, setfluencyresult] = useState('');
const [percentages, setpercentages] = useState(0)

useEffect(() => {
if (voiceText && voiceText !== '') {
Expand All @@ -127,9 +128,18 @@ function Score() {

function checkVoice(voiceText) {
let tempvoiceText = voiceText?.toLowerCase();
tempvoiceText = replaceAll(tempvoiceText, '.', '');
tempvoiceText = replaceAll(tempvoiceText, "'", '');
tempvoiceText = replaceAll(tempvoiceText, "’", '');
tempvoiceText = replaceAll(tempvoiceText, ',', '');
tempvoiceText = replaceAll(tempvoiceText, '!', '');
tempvoiceText = replaceAll(tempvoiceText, '|', '');
tempvoiceText = replaceAll(tempvoiceText, '?', '');

let tempteacherText = teacherText?.toLowerCase();
tempteacherText = replaceAll(tempteacherText, '.', '');
tempteacherText = replaceAll(tempteacherText, "'", '');
tempteacherText = replaceAll(tempteacherText, "’", '');
tempteacherText = replaceAll(tempteacherText, ',', '');
tempteacherText = replaceAll(tempteacherText, '!', '');
tempteacherText = replaceAll(tempteacherText, '|', '');
Expand All @@ -156,7 +166,7 @@ function Score() {
);
}
//set text highlight
let texttemp = voiceText.toLowerCase();
let texttemp = tempvoiceText;
const studentTextArray = texttemp.split(' ');
const teacherTextArray = tempteacherText.split(' ');
let student_text_result = [];
Expand Down Expand Up @@ -197,10 +207,12 @@ function Score() {
result_per_words = Math.round(
Number((correct_words / originalwords) * 100)
);
setpercentages(result_per_words)
} else {
result_per_words = Math.round(
Number((correct_words / studentswords) * 100)
);
setpercentages(result_per_words)
}
set_numberOfPieces(result_per_words);
set_isStart(true);
Expand Down Expand Up @@ -262,7 +274,9 @@ function Score() {
{fluencyresult}
<br />
<br />
<div className="content_text_div_see">{voiceTextHighlight}</div>
<div className="content_text_div_see">
{percentages===100? teacherText:voiceTextHighlight}
</div>
<br />
{flag ? (
<div style={{ marginBottom: '-30px' }}>
Expand Down
34 changes: 26 additions & 8 deletions src/viewsProto4/Score/Score.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,25 @@ function Score() {
}

function checkVoice(voiceText) {
let tempvoiceText = removeForbiddenCharacters(voiceText?.toLowerCase());
//let tempvoiceText = removeForbiddenCharacters(voiceText?.toLowerCase());
let tempvoiceText = voiceText?.toLowerCase();
tempvoiceText = replaceAll(tempvoiceText, '.', '');
tempvoiceText = replaceAll(tempvoiceText, "'", '');
tempvoiceText = replaceAll(tempvoiceText, "’", '');
tempvoiceText = replaceAll(tempvoiceText, ',', '');
tempvoiceText = replaceAll(tempvoiceText, '!', '');
tempvoiceText = replaceAll(tempvoiceText, '|', '');
tempvoiceText = replaceAll(tempvoiceText, '?', '');

let tempteacherText = teacherText.toLowerCase();
// tempteacherText = replaceAll(tempteacherText, '.', '');
// tempteacherText = replaceAll(tempteacherText, "'", '');
// tempteacherText = replaceAll(tempteacherText, ',', '');
// tempteacherText = replaceAll(tempteacherText, '!', '');
tempteacherText = replaceAll(tempteacherText, '.', '');
tempteacherText = replaceAll(tempteacherText, "'", '');
tempteacherText = replaceAll(tempteacherText, "’", '');
tempteacherText = replaceAll(tempteacherText, ',', '');
tempteacherText = replaceAll(tempteacherText, '!', '');
tempteacherText = replaceAll(tempteacherText, '|', '');
tempteacherText = replaceAll(tempteacherText, '?', '');

setVoiceTextTeacher(tempteacherText);
if (findRegex(tempteacherText) === voiceText?.toLowerCase()) {
setTestResult(
Expand All @@ -171,9 +183,15 @@ function Score() {
//set text highlight

let texttemp = voiceText?.toLowerCase();
let studentTextArray;

studentTextArray = texttemp?.split(' ');
texttemp = replaceAll(texttemp, '.', '');
texttemp = replaceAll(texttemp, "'", '');
texttemp = replaceAll(texttemp, "’", '');
texttemp = replaceAll(texttemp, ',', '');
texttemp = replaceAll(texttemp, '!', '');
texttemp = replaceAll(texttemp, '|', '');
texttemp = replaceAll(texttemp, '?', '');
const studentTextArray = texttemp.split(' ');

const teacherTextArray = tempteacherText.split(' ');
let student_text_result = [];
let originalwords = teacherTextArray.length;
Expand Down

0 comments on commit a2c53d1

Please sign in to comment.