{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "a91f3280", "metadata": {}, "outputs": [], "source": [ "# Copyright (c) 2026 Microsoft Corporation.\n", "# Licensed under the MIT License." ] }, { "cell_type": "markdown", "id": "3f76dc60", "metadata": {}, "source": [ "## Basic sentence chunking with nltk\n", "\n", "The SentenceChunker class splits text into individual sentences by identifying sentence boundaries. It takes input text and returns a list where each element is a separate sentence, making it easy to process text at the sentence level." ] }, { "cell_type": "code", "execution_count": null, "id": "4c96d3cc", "metadata": {}, "outputs": [], "source": [ "from graphrag_chunking.sentence_chunker import SentenceChunker\n", "\n", "chunker = SentenceChunker()\n", "chunks = chunker.chunk(\"This is a test. Another sentence.\")\n", "print(chunks) # [\"This is a test.\", \"Another sentence.\"]" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.9" } }, "nbformat": 4, "nbformat_minor": 5 }