MCPcopy
hub / github.com/mindverse/Second-Me / split

Method split

lpm_kernel/file_data/chunker.py:22–51  ·  view source on GitHub ↗
(self, content: str)

Source from the content-addressed store, hash-verified

20 )
21
22 def split(self, content: str) -> List[Chunk]:
23 try:
24 if not content:
25 logger.warning("Empty content provided")
26 return []
27
28 logger.info(f"Starting to split content of length {len(content)}")
29
30 # use LangChain splitter
31 texts = self.text_splitter.split_text(content)
32
33 chunks = [
34 Chunk(
35 id=None,
36 document_id=None,
37 content=text,
38 embedding=None,
39 tags=None,
40 topic=None,
41 )
42 for text in texts
43 ]
44
45 logger.info(f"Split completed, created {len(chunks)} chunks")
46 return chunks
47
48 except Exception as e:
49 logger.error(f"Error in split method: {str(e)}")
50 logger.error(traceback.format_exc())
51 raise

Callers 15

process_all_chunksFunction · 0.95
process_chunksMethod · 0.95
select_language_descFunction · 0.80
_split_to_paragraphsMethod · 0.80
_split_to_sentencesMethod · 0.80
search_similar_chunksMethod · 0.80
apply_migrationsMethod · 0.80
_insighter_audioMethod · 0.80
insighterMethod · 0.80
get_generate_urlFunction · 0.80
create_and_prepare_modelFunction · 0.80

Calls 3

ChunkClass · 0.90
errorMethod · 0.80
split_textMethod · 0.45

Tested by

no test coverage detected