Skip to main content

A Manubot plugin to revise a manuscript using GPT-3

Project description

AI Editor for Manubot

This package provides classes and functions for automated, AI-assisted revision of manuscript written using Manubot. Check out the manuscript.

Installation

pip install -U manubot-ai-editor

Example

import shutil
from pathlib import Path

from manubot.ai_editor.editor import ManuscriptEditor
from manubot.ai_editor.models import GPT3CompletionModel

# create a manuscript editor
#  here content_dir points to the "content" directory of the Manubot-based
#  manuscript, where Markdown files are (*.md).
me = ManuscriptEditor(
    content_dir="content",
)

# create a model to revise the manuscript
model = GPT3CompletionModel(
    title=me.title,
    keywords=me.keywords,
)

# first I create a temporary directory to store the revised manuscript
output_folder = (Path("tmp") / "manubot-ai-editor-output").resolve()
shutil.rmtree(output_folder, ignore_errors=True)
output_folder.mkdir(parents=True, exist_ok=True)

# then I revise the manuscript
me.revise_manuscript(output_folder, model, debug=True)

# here I move the revised manuscript back to the content folder
# CAUTION: this will overwrite the original manuscript
for f in output_folder.glob("*"):
    f.rename(me.content_dir / f.name)

# remove output folder
output_folder.rmdir()

You can also take a look at the unit tests to see how to use it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manubot-ai-editor-0.2.0.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file manubot-ai-editor-0.2.0.tar.gz.

File metadata

  • Download URL: manubot-ai-editor-0.2.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.8

File hashes

Hashes for manubot-ai-editor-0.2.0.tar.gz
Algorithm Hash digest
SHA256 398465d714044baaac750f9932415189d9b0b95beedfb16163edcd6ed905b3d4
MD5 f8e00d51082483fd510e1f6b0c2610ba
BLAKE2b-256 46c05fa560407d7d29e689e789d2838cb2ce9380a5356214593886b4b5d4de5e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page