Spaces:
Runtime error
Runtime error
File size: 423 Bytes
ef73330 44c9ddf ef73330 44c9ddf ec5ecb6 44c9ddf ec5ecb6 ef73330 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from transformers import AutoTokenizer
from transformers import Tool
class SentenceCounterTool(Tool):
name = "sentence_counter"
description = "This tool counts the sentences of a text."
inputs = ["text"]
outputs = ["text"]
def __call__(self, text: str):
print(text)
print("----")
sentences = text.split(". ")
print(len(sentences))
return len(sentences)
|