Cut a note into sections

Sentences

A long note is easier to search after it is cut into short sections. Each section should keep one idea.

Chunking cuts the note. sentence keeps each idea together. The result prints three sections.

Example

from praisonai import Chunking

note = (
    "Apples grow on trees in the orchard. "
    "The secret colour of the boat is blue. "
    "Tickets for the ferry cost four pounds."
)
for piece in Chunking(chunker_type="sentence", chunk_size=40).chunk(note):
    print(piece.text)
    print()

Try it Yourself

Example explained

  • Chunking — The cutter. It does not answer the question.
  • sentence — Split on sentences, so a fact is not cut in half.

Reference: documentation