示例#1
0
    def run(self, args):
        assert command_exists('mvn'), 'BEwTE requires Maven to be installed'
        assert command_exists(
            'git-lfs'), 'BEwTE requires git-lfs to be installed'

        commands = [
            f'mkdir -p {DATA_ROOT}/metrics', f'cd {DATA_ROOT}/metrics',
            f'git clone https://github.com/igorbrigadir/ROUGE-BEwTE'
        ]
        command = ' && '.join(commands)

        process = Popen(command, shell=True)
        process.communicate()
        if process.returncode != 0:
            print('BEwT-E setup failure')
            return

        self._edit_pom(f'{DATA_ROOT}/metrics/ROUGE-BEwTE/pom.xml')

        commands = [f'cd {DATA_ROOT}/metrics/ROUGE-BEwTE', f'mvn package']
        command = ' && '.join(commands)

        process = Popen(command, shell=True)
        process.communicate()
        if process.returncode == 0:
            print('BEwT-E setup success')
        else:
            print('BEwT-E setup failure')
示例#2
0
    def run(self, args):
        assert command_exists('mvn'), 'BEwTE requires Maven to be installed'

        if args.force and os.path.exists(f'{DATA_ROOT}/metrics/ROUGE-BEwTE'):
            shutil.rmtree(f'{DATA_ROOT}/metrics/ROUGE-BEwTE')

        # We have to clone the ROUGE-BEwTE repository and disable git-lfs, otherwise we may cause the repo
        # to exceed the bandwidth quota, which results in a cloning failure. Afterward, the model files are downloaded
        # and put into place
        commands = [
            f'mkdir -p {DATA_ROOT}/metrics',
            f'cd {DATA_ROOT}/metrics',
            f'GIT_LFS_SKIP_SMUDGE=1 git clone https://github.com/igorbrigadir/ROUGE-BEwTE',
        ]
        command = ' && '.join(commands)

        process = Popen(command, shell=True)
        process.communicate()
        if process.returncode != 0:
            print('BEwT-E setup failure')
            return

        # Download the models, unzip, and move to the correct directory
        download_file_from_google_drive(
            '1d0DjP8sxNoro_9fXaAlhB5JgqHjWMgst',
            f'{DATA_ROOT}/metrics/ROUGE-BEwTE/models.zip')
        commands = [
            f'cd {DATA_ROOT}/metrics/ROUGE-BEwTE', f'unzip models.zip',
            f'rm models.zip', f'rm -r src/main/resources/models',
            f'mv models src/main/resources/'
        ]
        command = ' && '.join(commands)

        process = Popen(command, shell=True)
        process.communicate()
        if process.returncode != 0:
            print('BEwT-E setup failure')
            return

        self._edit_pom(f'{DATA_ROOT}/metrics/ROUGE-BEwTE/pom.xml')

        commands = [f'cd {DATA_ROOT}/metrics/ROUGE-BEwTE', f'mvn package']
        command = ' && '.join(commands)

        process = Popen(command, shell=True)
        process.communicate()
        if process.returncode == 0:
            print('BEwT-E setup success')
        else:
            print('BEwT-E setup failure')
示例#3
0
    def run(self, args):
        assert command_exists(
            'mvn'), 'AutoSummENG requires Maven to be installed'

        commands = [
            f'mkdir -p {DATA_ROOT}/metrics', f'cd {DATA_ROOT}/metrics',
            f'git clone https://github.com/danieldeutsch/AutoSummENG',
            f'cd AutoSummENG', f'mvn package'
        ]
        command = ' && '.join(commands)

        process = Popen(command, shell=True)
        process.communicate()

        if process.returncode == 0:
            print('AutoSummENG setup success')
        else:
            print('AutoSummENG setup failure')
 def test_command_exists(self):
     assert command_exists('python')
     assert not command_exists('asdfasd')