You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
final class RecursiveCharacterTextSplitterTests: XCTestCase {
override func setUp() async throws {
try await super.setUp()
await initializePython()
}
func test_split_text() async throws {
let splitter = RecursiveCharacterTextSplitter(
separators: ["\n\n", "\n", " ", ""],
chunkSize: 100,
chunkOverlap: 20
)
let text = """
Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans.
"""
let result = try await splitter.split(text: text)
XCTAssertEqual(result, [
"Madam Speaker, Madam Vice President, our First Lady and Second Gentleman. Members of Congress and",
"of Congress and the Cabinet. Justices of the Supreme Court. My fellow Americans."