Exemple #1
0
def dostuff(inputFilename, outFilename, format):
   global document
   process.preprocessDocument( document )
   predict.predictDocument( document )
   if format == 'arff':
      io.applyHandcheck( inputFilename, document )
   io.renderDocument( makeFormatter(outFilename, format), document )
Exemple #2
0
      msg( "Unknown format %s." % format )
      sys.exit(1)

   # make sure it exists
   if not os.path.exists( inputFilename ):
      msg( "Can't find (or access) file '%s'" % inputFilename )
      sys.exit(1)

   if len(sys.argv) == 4:
      outFilename = sys.argv[3]
   else:
      outFilename = misc.MakeFilename(inputFilename, '.'+format)
   
   return format,inputFilename,outFilename


if __name__ == '__main__':
   setPrescriptDir()
   (format,inputFilename,outFilename) = checkParams(sys.argv)
   
   # Real work begins
   frags = io.readFragments(inputFilename)
   document = process.assembleDocument( frags )
   
   #   del frags # Uncomment this if you are low on memory
   process.preprocessDocument( document )
   predict.predictDocument( document )
   if format == 'arff': 
      io.applyHandcheck( inputFilename, document )
   io.renderDocument( makeFormatter(outFilename, format), document )