Method Split
- Namespace
- LMKit.Extraction
- Assembly
- LM-Kit.NET.dll
Split(Attachment, CancellationToken)
Detects logical document boundaries synchronously within the specified attachment.
public DocumentSplittingResult Split(Attachment attachment, CancellationToken cancellationToken = default)
Parameters
attachmentAttachmentThe multi-page PDF Attachment to analyze. Cannot be
null.cancellationTokenCancellationTokenA token to monitor for cancellation requests. The default value is None.
Returns
- DocumentSplittingResult
A DocumentSplittingResult containing the detected document segments.
Examples
using LMKit.Model;
using LMKit.Extraction;
using LMKit.Data;
using System;
// Load a vision-capable model (8B or larger recommended)
LM model = LM.LoadFromModelID("qwen3-vl:8b");
// Create the splitter
var splitter = new DocumentSplitting(model);
// Analyze a multi-page PDF synchronously
DocumentSplittingResult result = splitter.Split(new Attachment("multi_doc.pdf"));
// Display results
Console.WriteLine($"Found {result.DocumentCount} document(s)");
foreach (DocumentSegment segment in result.Segments)
{
Console.WriteLine($" Pages {segment.StartPage}-{segment.EndPage}: {segment.Label}");
}
Remarks
This synchronous method blocks the calling thread. In asynchronous or UI contexts, use SplitAsync(Attachment, CancellationToken) instead.
Exceptions
- ArgumentNullException
Thrown if
attachmentisnull.