MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / read_slice_text

Function read_slice_text

graphify/file_slice.py:289–296  ·  view source on GitHub ↗

Read just this slice's characters from its parent file. Goes through :func:`unit_source_text`, so a PDF slice indexes the extracted text rather than the container's bytes — the offsets `expand_oversized_files` computed and the string the prompt carries are then the same string (#2906).

(fs: FileSlice)

Source from the content-addressed store, hash-verified

287
288
289def read_slice_text(fs: FileSlice) -> str:
290 """Read just this slice's characters from its parent file.
291
292 Goes through :func:`unit_source_text`, so a PDF slice indexes the extracted
293 text rather than the container's bytes — the offsets `expand_oversized_files`
294 computed and the string the prompt carries are then the same string (#2906).
295 """
296 return unit_source_text(fs.path)[fs.start:fs.end]
297
298
299def bisect_slice(fs: FileSlice) -> tuple[FileSlice, FileSlice] | None:

Calls 1

unit_source_textFunction · 0.85