public grammaticalityEstimator(Set FileNames,int iMinChar,int iMaxChar,int iCharWindow,int iMinWord,int iMaxWord,int iWordWindow){
  iMinCharNGram=iMinChar;
  iMaxCharNGram=iMaxChar;
  iMinWordNGram=iMinWord;
  iMaxWordNGram=iMaxWord;
  iWordDist=iWordWindow;
  iCharDist=iCharWindow;
  DistroDocs=new TreeMap<Integer,DistributionDocument>();
  DistroWordDocs=new TreeMap<Integer,DistributionWordDocument>();
  StringBuffer sb=new StringBuffer();
  Iterator iTexts=FileNames.iterator();
  while (iTexts.hasNext()) {
    String sFile=(String)iTexts.next();
    try {
      BufferedReader bf=new BufferedReader(new FileReader(sFile));
      String sTmp;
      while ((sTmp=bf.readLine()) != null)       sb.append(sTmp);
      bf.close();
    }
 catch (    FileNotFoundException ex) {
      ex.printStackTrace(System.err);
    }
catch (    IOException ex) {
      ex.printStackTrace(System.err);
    }
    sb.append((char)0);
  }
  FullTextDataString=sb.toString();
  for (int iCnt=iMinCharNGram; iCnt <= iMaxCharNGram; iCnt++) {
    DistroDocs.put(iCnt,new DistributionDocument(iCharDist,iCnt));
  }
  for (int iCnt=iMinWordNGram; iCnt <= iMaxWordNGram; iCnt++) {
    DistroWordDocs.put(iCnt,new DistributionWordDocument(iWordDist,iCnt));
  }
}

public grammaticalityEstimator ( Set FileNames , int iMinChar , int iMaxChar , int iCharWindow , int iMinWord , int iMaxWord , int iWordWindow ) { iMinCharNGram = iMinChar ; iMaxCharNGram = iMaxChar ; iMinWordNGram = iMinWord ; iMaxWordNGram = iMaxWord ; iWordDist = iWordWindow ; iCharDist = iCharWindow ; DistroDocs = new TreeMap < Integer , DistributionDocument > ( ) ; DistroWordDocs = new TreeMap < Integer , DistributionWordDocument > ( ) ; StringBuffer sb = new StringBuffer ( ) ; Iterator iTexts = FileNames . iterator ( ) ; while ( iTexts . hasNext ( ) ) { String sFile = ( String ) iTexts . next ( ) ; try { BufferedReader bf = new BufferedReader ( new FileReader ( sFile ) ) ; String sTmp ; while ( ( sTmp = bf . readLine ( ) ) != null ) sb . append ( sTmp ) ; bf . close ( ) ; } catch ( FileNotFoundException ex ) { ex . printStackTrace ( System . err ) ; } catch ( IOException ex ) { ex . printStackTrace ( System . err ) ; } sb . append ( ( char ) 0 ) ; } FullTextDataString = sb . toString ( ) ; for ( int iCnt = iMinCharNGram ; iCnt <= iMaxCharNGram ; iCnt ++ ) { DistroDocs . put ( iCnt , new DistributionDocument ( iCharDist , iCnt ) ) ; } for ( int iCnt = iMinWordNGram ; iCnt <= iMaxWordNGram ; iCnt ++ ) { DistroWordDocs . put ( iCnt , new DistributionWordDocument ( iWordDist , iCnt ) ) ; } }
creates a new instance of grammaticalityestimator , using a given set of documents for training .
