Hi.
I am passing different kind of text file and calling same function.. Can any one know how to avoid these repeated code.
public static void main(String[] args) throws IOException,NullPointerException
{
MultipleLinearRegrssionModel fex = new MultipleLinearRegrssionModel();
//Calls Read From File
//First ocument
docsum=1;
fex.readFromFile("f:/project/document/training/1.txt");
//Calls compare training corpus and manual summary
doccom=1;
fex.strCompare();
//Calls Stop Words Removing
fex.stoprem();
//Term Frequency Calculating
fex.termFreq();
//Calls Feature F1
fex.fOne();
//Calls Feature F2
fex.fTwo();
//Calls Feature F2
fex.fThree();
//Calls Feature F4
fex.fFour();
//Calls Feature F5
fex.fFive();
//Calls Feature F6
fex.fSix();
//Calls Feature F7
fex.fSeven();
//Calls Feature F8
fex.fEight();
//Calls Feature F9
fex.fNine();
//calls Feature F10
fex.fTen();
//sum of indepentant variable
fex.indepentant();
//weight calculation
//initialize
fex.intiaddweight();
// System.out.println("addtoweight");
fex.addtotweight();
//Calls Write To File
fex.writeToFile("f:/project/out.txt");
//calls empty
fex.empty();
//Second document
docsum=2;
fex.readFromFile("f:/project/document/training/2.txt");
//compare
doccom=2;
fex.strCompare();
//Calls Stop Words Removing
fex.stoprem();
//Term Frequency Calculating
fex.termFreq();
//Calls Feature F1
fex.fOne();
//Calls Feature F2
fex.fTwo();
//Calls Feature F2
fex.fThree();
//Calls Feature F4
fex.fFour();
//Calls Feature F5
fex.fFive();
//Calls Feature F6
fex.fSix();
//Calls Feature F7
fex.fSeven();
//Calls Feature F8
fex.fEight();
//Calls Feature F9
fex.fNine();
//calls Feature F10
fex.fTen();
//indepentant();
fex.indepentant();
//addtoweight
fex.addtotweight();
//Calls Write To File
fex.writeToFile("f:/project/out1.txt");
//calls empty
fex.empty();
//Third document
docsum=3;
fex.readFromFile("f:/project/document/training/3.txt");
//compare
doccom=3;
fex.strCompare();
//Calls Stop Words Removing
fex.stoprem();
//Term Frequency Calculating
fex.termFreq();
//Calls Feature F1
fex.fOne();
//Calls Feature F2
fex.fTwo();
//Calls Feature F2
fex.fThree();
//Calls Feature F4
fex.fFour();
//Calls Feature F5
fex.fFive();
//Calls Feature F6
fex.fSix();
//Calls Feature F7
fex.fSeven();
//Calls Feature F8
fex.fEight();
//Calls Feature F9
fex.fNine();
//calls Feature F10
fex.fTen();
//indepentant();
fex.indepentant();
//addtoweight
fex.addtotweight();
//Calls Write To File
fex.writeToFile("f:/project/out1.txt");
//avgweight
fex.avgweight();
//calls empty
fex.empty();
//Fourth document
fex.readFromFile1("f:/project/document/training/3.txt");
//Calls Stop Words Removing
fex.stoprem();
//Term Frequency Calculating
fex.termFreq();
//Calls Feature F1
fex.fOne();
//Calls Feature F2
fex.fTwo();
//Calls Feature F2
fex.fThree();
//Calls Feature F4
fex.fFour();
//Calls Feature F5
fex.fFive();
//Calls Feature F6
fex.fSix();
//Calls Feature F7
fex.fSeven();
//Calls Feature F8
fex.fEight();
//Calls Feature F9
fex.fNine();
//calls Feature F10
fex.fTen();
//calling Testing
fex.testing();
fex.writeToFile1("f:/project/out2.txt");
fex.manVsMachine();
fex.testFinalwrite("f:/project/out2final.txt");
}
}
So the above different document calling same function. I am calling one document and for that document some set of function is called.
Next time i am calling different document for the same function.
So my code become very lengthy... can any one suggest to avoid the repeated code. How to call the same function for using different kind document by writing the code only once....