sentence-counter-tool / sentence_counter.py
Chris4K's picture
Rename word_counter.py to sentence_counter.py
ef73330
raw
history blame
No virus
361 Bytes
from transformers import AutoTokenizer
from transformers import Tool
class SentenceCounterTool(Tool):
name = "sentence_counter"
description = "This is a tool for counting sentences of an input."
inputs = ["text"]
outputs = ["text"]
def __call__(self, prompt: str):
sentences = str.split(". ")
return len(sentences)