def _export_corpus(self):
        """
        Calls MALLET's `import-file` method.
        """
        # bin/mallet import-file --input /Users/erickpeirson/mycorpus_docs.txt
        #     --output mytopic-input.mallet --keep-sequence --remove-stopwords

        if not os.path.exists(self.mallet_bin):
            raise IOError("MALLET path invalid or non-existent.")
        self.input_path = os.path.join(self.temp, "input.mallet")

        exit = subprocess.call([
                self.mallet_bin,
                'import-file',
                '--input', self.corpus_path,
                '--output', self.input_path,
                '--keep-sequence',          # Required for LDA.
                '--remove-stopwords'])      # Probably redundant.

        if exit != 0:
            msg = "MALLET import-file failed with exit code {0}.".format(exit)
            raise RuntimeError(msg)
def _export_corpus ( self ) : if not os . path . exists ( self . mallet_bin ) : raise IOError ( "MALLET path invalid or non-existent." ) self . input_path = os . path . join ( self . temp , "input.mallet" ) exit = subprocess . call ( [ self . mallet_bin , 'import-file' , '--input' , self . corpus_path , '--output' , self . input_path , '--keep-sequence' , '--remove-stopwords' ] ) if exit != 0 : msg = "MALLET import-file failed with exit code {0}." . format ( exit ) raise RuntimeError ( msg )
Calls MALLET's `import-file` method.