def to_html(doc, output="<STR_LIT>", style="<STR_LIT>"):
<EOL>file_name = "<STR_LIT:->".join([w.text for w in doc[:<NUM_LIT:6>] if not w.is_punct]) + "<STR_LIT>"<EOL>html = displacy.render(doc, style=style, page=True)  <EOL>if output is not None:<EOL><INDENT>output_path = Path(output)<EOL>if not output_path.exists():<EOL><INDENT>output_path.mkdir()<EOL><DEDENT>output_file = Path(output) / file_name<EOL>output_file.open("<STR_LIT:w>", encoding="<STR_LIT:utf-8>").write(html)  <EOL>print("<STR_LIT>".format(output_file))<EOL><DEDENT>else:<EOL><INDENT>print(html)<EOL><DEDENT>
Doc method extension for saving the current state as a displaCy
    visualization.