Skip to content

Commit

Permalink
Add readme to examples dir (#282)
Browse files Browse the repository at this point in the history
* add docs for generate.py

* add docs for generate.py

* formatting
  • Loading branch information
svlandeg authored Aug 2, 2023
1 parent 147fd1e commit 389c46e
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
## generate.py

This program takes a JSON list of strings from standard input, sends each input string to an LLM as a prompt, and returns a list of dictionaries, with a `"prompt"` and `"answer"` key for each original prompt.

To execute it, run

```bash
python generate.py
```

And then type some prompts in list form, e.g.

```bash
["What is spaCy?", "What is Rust?"]
```

followed by an EOF-marker (Ctrl-d on Linux or Mac, Ctrl-z on Windows) and an enter.
The output will look something like this:

```python
[
{"prompt": "What is spaCy?",
"answer": "spaCy is a Python library for natural language processing. It is designed to be easy to use and highly customizable, making it a great tool for developers and researchers."},
{"prompt": "What is Rust?",
"answer": "Rust is a programming language that is designed to be a safe, concurrent, and efficient replacement for C++. It is a statically-typed language that is designed to be memory-safe and thread-safe, which means that it can be used to write high-performance, low-latency applications. Rust is designed to be a modern, high-performance programming language that is designed to be easy to use and easy to learn."}
]
```

To get the full list of options and defaults for this command, run

```bash
python generate.py --help
```

## passive2active.py

This program takes a JSON list of passive sentences from standard input, and returns a list of dictionaries, with a `"passive"` and `"active"` key for each original sentence.

To execute it, run

```bash
python passive2active.py
```

And then type some prompts in list form, e.g.

```bash
["The medal was won by the Dutch speed skater.", "Anita was driven to the theatre by Carla."]
```

followed by an EOF-marker (Ctrl-d on Linux or Mac, Ctrl-z on Windows) and an enter.
The output will look something like this:

```python
[
{
"passive": "The medal was won by the Dutch speed skater.",
"active": "The Dutch speed skater won the medal."
},
{
"passive": "Anita was driven to the theatre by Carla.",
"active": "Carla drove Anita to the theatre."
}
]
```

To get the full list of options and defaults for this command, run

```bash
python passive2active.py --help
```

0 comments on commit 389c46e

Please sign in to comment.