微信扫码
添加专属顾问
我要投稿
文本分割器的基本工作原理:
定制文本分割器的两个主要轴向:
主要参数和功能:
def transformer_doc():# 加载待分割长文本 with open('sys_boss.txt',encoding='UTF-8') as f:state_of_the_union = f.read()text_splitter = RecursiveCharacterTextSplitter(chunk_size = 100,chunk_overlap= 20,length_function = len,add_start_index = True,)docs = text_splitter.create_documents([state_of_the_union])print(docs[0])print(docs[1])metadatas = [{"document": 1}, {"document": 2}]documents = text_splitter.create_documents([state_of_the_union, state_of_the_union], metadatas=metadatas)print(documents[0])def spit_code():print([e.value for e in Language])html_text = """<!DOCTYPE html><html><head><title>?️? LangChain</title><style>body {font-family: Arial, sans-serif;}h1 {color: darkblue;}</style></head><body><div><h1>?️? LangChain</h1><p>⚡ Building applications with LLMs through composability ⚡</p></div><div>As an open source project in a rapidly developing field, we are extremely open to contributions.</div></body></html>"""html_splitter = RecursiveCharacterTextSplitter.from_language(language=Language.HTML, chunk_size=60, chunk_overlap=0)html_docs = html_splitter.create_documents([html_text])print(html_docs)53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费POC验证,效果达标后再合作。零风险落地应用大模型,已交付160+中大型企业
2026-02-04
Agent生态碎片化终结,.agents/skills统一所有工具
2026-01-29
自建一个 Agent 很难吗?一语道破,万语难明
2026-01-28
全球首个Skills Vibe Agents,AtomStorm技术揭秘:我是怎么用Context Engineering让Agent不"变傻"的
2026-01-22
Deepagents落地场景来了:用openwork实现专属办公小管家
2026-01-05
快速上手:LangChain + AgentRun 浏览器沙箱极简集成指南
2026-01-05
为什么大模型企业都在强调可以连续工作XX小时的Agent和模型?长时运行Agent解析(Long-Running Agents)
2025-12-29
单agent落幕,双agent才能解决复杂问题!附LangGraph+Milvus实操
2025-12-28
为什么说LangGraph是企业级AI智能体的「终极答案」?
2025-12-21
2025-12-21
2025-11-25
2025-12-08
2025-11-08
2025-11-18
2025-11-07
2025-11-25
2025-11-19
2026-01-05
2025-11-03
2025-10-29
2025-07-14
2025-07-13
2025-07-05
2025-06-26
2025-06-13
2025-05-21