Skip to content

Commit

Permalink
chore: updating docs to discourage multiple sentences per string
Browse files Browse the repository at this point in the history
  • Loading branch information
chanind committed May 11, 2023
1 parent 1c21345 commit e77c5a2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ result = frame_transformer.detect_frames_bulk([
])
```

**Note**: It's not recommended to pass more than a single sentence per string to `detect_frames()` or `detect_frames_bulk()`. If you have a paragraph of text to process, it's best to split the paragraph into a list of sentences and pass the sentences as a list to `detect_frames_bulk()`. Only single sentences per string were used during training, so it's not clear how the model will handle multiple sentences in the same string.

```python
# ❌ Bad, don't do this
frame_transformer.detect_frames("Fuzzy Wuzzy was a bear. Fuzzy Wuzzy had no hair.")

# 👍 Do this instead
frame_transformer.detect_frames_bulk([
"Fuzzy Wuzzy was a bear.",
"Fuzzy Wuzzy had no hair.",
])
```

### Running on GPU vs CPU

By default, `FrameSemanticTransformer` will attempt to use a GPU if one is available. If you'd like to explictly set whether to run on GPU vs CPU, you can pass the `use_gpu` param.
Expand Down Expand Up @@ -106,6 +119,7 @@ The code contained in this repo is released under a MIT license, however the pre
## Citation

If you use Frame semantic transformer in your work, please cite the following:

```bibtex
@article{chanin2023opensource,
title={Open-source Frame Semantic Parsing},
Expand Down
14 changes: 14 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,20 @@ For more efficient bulk processing of text, there's a `detect_frames_bulk` metho
"The hallway smelt of boiled cabbage and old rag mats.",
])
**Note**: It's not recommended to pass more than a single sentence per string to `detect_frames()` or `detect_frames_bulk()`. If you have a paragraph of text to process, it's best to split the paragraph into a list of sentences and pass the sentences as a list to `detect_frames_bulk()`. Only single sentences per string were used during training, so it's not clear how the model will handle multiple sentences in the same string.

.. code-block:: python
# ❌ Bad, don't do this
frame_transformer.detect_frames("Fuzzy Wuzzy was a bear. Fuzzy Wuzzy had no hair.")
# 👍 Do this instead
frame_transformer.detect_frames_bulk([
"Fuzzy Wuzzy was a bear.",
"Fuzzy Wuzzy had no hair.",
])
Running on GPU vs CPU
''''''''''''''''''''''

Expand Down

0 comments on commit e77c5a2

Please sign in to comment.