def convert_trees(self, ptb_trees, representation='basic',
                      include_punct=True, include_erased=False, universal=True,
                      debug=False):
        """Convert a list of Penn Treebank formatted trees (ptb_trees)
        into Stanford Dependencies. The dependencies are represented
        as a list of sentences, where each sentence is itself a list of
        Token objects.

        Currently supported representations are 'basic', 'collapsed',
        'CCprocessed', and 'collapsedTree' which behave the same as they
        in the CoreNLP command line tools. (note that in the online
        CoreNLP demo, 'collapsed' is called 'enhanced')

        Setting debug=True will cause debugging information (including
        the java command run to be printed."""
        self._raise_on_bad_representation(representation)
        input_file = tempfile.NamedTemporaryFile(delete=False)
        try:
            for ptb_tree in ptb_trees:
                self._raise_on_bad_input(ptb_tree)
                tree_with_line_break = ptb_tree + "\n"
                input_file.write(tree_with_line_break.encode("utf-8"))
            input_file.flush()
            input_file.close()

            command = [self.java_command,
                       '-ea',
                       '-cp', self.jar_filename,
                       JAVA_CLASS_NAME,
                       '-' + representation,
                       '-treeFile', input_file.name]
            # if we're including erased, we want to include punctuation
            # since otherwise we won't know what SD considers punctuation
            if include_punct or include_erased:
                command.append('-keepPunct')
            if not universal:
                command.append('-originalDependencies')
            if debug:
                print('Command:', ' '.join(command))
            sd_process = subprocess.Popen(command, stdout=subprocess.PIPE,
                                          stderr=subprocess.PIPE,
                                          universal_newlines=True)
            return_code = sd_process.wait()
            stderr = sd_process.stderr.read()
            stdout = sd_process.stdout.read()

            if debug:
                print("stdout: {%s}" % stdout)
                print("stderr: {%s}" % stderr)
                print('Exit code:', return_code)

            self._raise_on_bad_exit_or_output(return_code, stderr)
        finally:
            os.remove(input_file.name)

        try:
            sentences = Corpus.from_stanford_dependencies(stdout.splitlines(),
                                                          ptb_trees,
                                                          include_erased,
                                                          include_punct)
            for sentence, ptb_tree in zip(sentences, ptb_trees):
                if len(sentence) == 0:
                    raise ValueError("Invalid PTB tree: %r" % ptb_tree)
        except:
            print("Error during conversion")
            if not debug:
                print("stdout: {%s}" % stdout)
                print("stderr: {%s}" % stderr)
            raise

        assert len(sentences) == len(ptb_trees), \
            "Only got %d sentences from Stanford Dependencies when " \
            "given %d trees." % (len(sentences), len(ptb_trees))
        return sentences
Convert a list of Penn Treebank formatted trees (ptb_trees)
        into Stanford Dependencies. The dependencies are represented
        as a list of sentences, where each sentence is itself a list of
        Token objects.

        Currently supported representations are 'basic', 'collapsed',
        'CCprocessed', and 'collapsedTree' which behave the same as they
        in the CoreNLP command line tools. (note that in the online
        CoreNLP demo, 'collapsed' is called 'enhanced')

        Setting debug=True will cause debugging information (including
        the java command run to be printed.