mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-03 03:59:42 +00:00
text-splitters[minor]: Add lua code splitting (#20421)
- **Description:** Complete the support for Lua code in langchain.text_splitter module. - **Dependencies:** No - **Twitter handle:** @saberuster If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, hwchase17. --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
@@ -571,6 +571,23 @@ class RecursiveCharacterTextSplitter(TextSplitter):
|
||||
" ",
|
||||
"",
|
||||
]
|
||||
elif language == Language.LUA:
|
||||
return [
|
||||
# Split along variable and table definitions
|
||||
"\nlocal ",
|
||||
# Split along function definitions
|
||||
"\nfunction ",
|
||||
# Split along control flow statements
|
||||
"\nif ",
|
||||
"\nfor ",
|
||||
"\nwhile ",
|
||||
"\nrepeat ",
|
||||
# Split by the normal type of lines
|
||||
"\n\n",
|
||||
"\n",
|
||||
" ",
|
||||
"",
|
||||
]
|
||||
elif language == Language.HASKELL:
|
||||
return [
|
||||
# Split along function definitions
|
||||
|
Reference in New Issue
Block a user