mainScript.js
/* 
    This function reads the input answer text file and if answer file is already uploaded then it calls 'findAnswer'
    function 
    */
This function reads the input answer text file and if answer file is already uploaded then it calls 'findAnswer'
function
This function reads the input answer text file and if answer file is already uploaded then it calls ' findAnswer ' function
function readAnswerUNLFile() {
        answerInput = document.getElementById('answerFileInput');
        answerInput.addEventListener('change', function (e) {
            answerFile = answerInput.files[0];
            textType = /text.*/;
            if (answerFile.type.match(textType)) {
                var answerReader = new FileReader();
                answerReader.onload = function (e) {
                    var x = answerReader.result.split("{unl}")[1].split(")");
                    var iCount = 0;
                    while (iCount < x.length - 1) {
                        answerObject.push(
                {
                    relationName: x[iCount].split("(")[0].trim(),
                    firstArgument: x[iCount].split("(")[1].split(",")[0].trim(),
                    secondArgument: x[iCount].split("(")[1].split(",")[1].trim(),
                    otherInfo: "no"
                }
		                    );
                        iCount++;
                    }
                    canFindAnswer++;
                    if (canFindAnswer > 1) { findAnswer(); }
                }
                answerReader.readAsText(answerFile);
            }
            else {
                alert("Output file cannot be read");
            }
        });
    }
function readAnswerUNLFile ( ) { answerInput = document . getElementById ( 'answerFileInput' ) ; answerInput . addEventListener ( 'change' , function ( e ) { answerFile = answerInput . files [ 0 ] ; textType = / text.* / ; if ( answerFile . type . match ( textType ) ) { var answerReader = new FileReader ( ) ; answerReader . onload = function ( e ) { var x = answerReader . result . split ( "{unl}" ) [ 1 ] . split ( ")" ) ; var iCount = 0 ; while ( iCount < x . length - 1 ) { answerObject . push ( { relationName : x [ iCount ] . split ( "(" ) [ 0 ] . trim ( ) , firstArgument : x [ iCount ] . split ( "(" ) [ 1 ] . split ( "," ) [ 0 ] . trim ( ) , secondArgument : x [ iCount ] . split ( "(" ) [ 1 ] . split ( "," ) [ 1 ] . trim ( ) , otherInfo : "no" } ) ; iCount ++ ; } canFindAnswer ++ ; if ( canFindAnswer > 1 ) { findAnswer ( ) ; } } answerReader . readAsText ( answerFile ) ; } else { alert ( "Output file cannot be read" ) ; } } ) ; }
This function reads the input answer text file and if answer file is already uploaded then it calls 'findAnswer'
function
This function reads the input answer text file and if answer file is already uploaded then it calls ' findAnswer ' function