public static void addOtherFeatureToPredictDocument(MiraTemplate aTemplate,RepositoryService aRepository,AnnotationService aAnnotationService,AutomationService aAutomationService,UserDao aUserDao) throws UIMAException, ClassNotFoundException, IOException, BratAnnotationException, AutomationException {
  AnnotationFeature layerFeature=aTemplate.getTrainFeature();
  File miraDir=aAutomationService.getMiraDir(layerFeature);
  for (  SourceDocument document : aRepository.listSourceDocuments(layerFeature.getProject())) {
    List<List<String>> predictions=new ArrayList<List<String>>();
    if (!document.isProcessed() && !document.isTrainingDocument()) {
      File predFtFile=new File(miraDir,document.getId() + ".pred.ft");
      Mira mira=new Mira();
      int beamSize=0;
      boolean maxPosteriors=false;
      File predcitedFile=new File(predFtFile.getAbsolutePath() + "-pred");
      getFeatureOtherLayer(aTemplate,aRepository,aAnnotationService,aAutomationService,aUserDao,beamSize,maxPosteriors,predictions,mira,predFtFile,predcitedFile,document);
      getFeaturesTabSep(aTemplate,aRepository,aAutomationService,beamSize,maxPosteriors,layerFeature,predictions,mira,predFtFile,predcitedFile);
      File basePredFile=new File(miraDir,document.getId() + ".pred");
      if (predictions.size() == 0) {
        createTemplate(aTemplate.getTrainFeature(),getMiraTemplateFile(layerFeature,aAutomationService),0);
        FileUtils.copyFile(predFtFile,basePredFile);
      }
 else {
        createTemplate(aTemplate.getTrainFeature(),getMiraTemplateFile(layerFeature,aAutomationService),predictions.size());
        buildPredictFile(predFtFile,basePredFile,predictions,aTemplate.getTrainFeature());
      }
    }
  }
}

public static void addOtherFeatureToPredictDocument ( MiraTemplate aTemplate , RepositoryService aRepository , AnnotationService aAnnotationService , AutomationService aAutomationService , UserDao aUserDao ) throws UIMAException , ClassNotFoundException , IOException , BratAnnotationException , AutomationException { AnnotationFeature layerFeature = aTemplate . getTrainFeature ( ) ; File miraDir = aAutomationService . getMiraDir ( layerFeature ) ; for ( SourceDocument document : aRepository . listSourceDocuments ( layerFeature . getProject ( ) ) ) { List < List < String > > predictions = new ArrayList < List < String > > ( ) ; if ( ! document . isProcessed ( ) && ! document . isTrainingDocument ( ) ) { File predFtFile = new File ( miraDir , document . getId ( ) + ".pred.ft" ) ; Mira mira = new Mira ( ) ; int beamSize = 0 ; boolean maxPosteriors = false ; File predcitedFile = new File ( predFtFile . getAbsolutePath ( ) + "-pred" ) ; getFeatureOtherLayer ( aTemplate , aRepository , aAnnotationService , aAutomationService , aUserDao , beamSize , maxPosteriors , predictions , mira , predFtFile , predcitedFile , document ) ; getFeaturesTabSep ( aTemplate , aRepository , aAutomationService , beamSize , maxPosteriors , layerFeature , predictions , mira , predFtFile , predcitedFile ) ; File basePredFile = new File ( miraDir , document . getId ( ) + ".pred" ) ; if ( predictions . size ( ) == 0 ) { createTemplate ( aTemplate . getTrainFeature ( ) , getMiraTemplateFile ( layerFeature , aAutomationService ) , 0 ) ; FileUtils . copyFile ( predFtFile , basePredFile ) ; } else { createTemplate ( aTemplate . getTrainFeature ( ) , getMiraTemplateFile ( layerFeature , aAutomationService ) , predictions . size ( ) ) ; buildPredictFile ( predFtFile , basePredFile , predictions , aTemplate . getTrainFeature ( ) ) ; } } } }
based on the other layer , add features for the prediction document
