Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)

            @staticmethod
    def process(input_dir, output_dir, function):
        """
        Apply function to all files in input_dir and save the resulting ouput
        files in output_dir.

        """
        if not os.path.exists(output_dir):
            os.makedirs(output_dir)
        logger = log.get_global_console_logger()
        logger.info("Processing files in {}.".format(input_dir))
        input_file_names = os.listdir(input_dir)
        for input_file_name in input_file_names:
            logger.info("Processing {}.".format(input_file_name))
            input_file = os.path.join(input_dir, input_file_name)
            with codecs.open(input_file, "r", encoding="UTF-8") as f:
                input_string = f.read()
            output_string = function(input_string)
            output_file = os.path.join(output_dir, input_file_name)
            with codecs.open(output_file, "w", encoding="UTF-8") as f:
                f.write(output_string)
        logger.info("Saved processed files to {}.".format(output_dir))
        


src/p/y/pyrouge-0.1.2/pyrouge/utils/sentence_splitter.py   pyrouge(Download)
    def split_files(input_dir, output_dir, lang="en", punkt_data_path=None):
        ss = PunktSentenceSplitter(lang, punkt_data_path)
        DirectoryProcessor.process(input_dir, output_dir, ss.split)
 
if __name__ == '__main__':

src/p/y/pyrouge-0.1.2/pyrouge/Rouge155.py   pyrouge(Download)
        """
        DirectoryProcessor.process(
            input_dir, output_dir, Rouge155.convert_text_to_rouge_format)
 
    @staticmethod