@ -627,6 +627,7 @@ class Language(str, Enum):
LATEX = " latex "
LATEX = " latex "
HTML = " html "
HTML = " html "
SOL = " sol "
SOL = " sol "
CSHARP = " csharp "
class RecursiveCharacterTextSplitter ( TextSplitter ) :
class RecursiveCharacterTextSplitter ( TextSplitter ) :
@ -1002,6 +1003,43 @@ class RecursiveCharacterTextSplitter(TextSplitter):
" <title " ,
" <title " ,
" " ,
" " ,
]
]
elif language == Language . CSHARP :
return [
" \n interface " ,
" \n enum " ,
" \n implements " ,
" \n delegate " ,
" \n event " ,
# Split along class definitions
" \n class " ,
" \n abstract " ,
# Split along method definitions
" \n public " ,
" \n protected " ,
" \n private " ,
" \n static " ,
" \n return " ,
# Split along control flow statements
" \n if " ,
" \n continue " ,
" \n for " ,
" \n foreach " ,
" \n while " ,
" \n switch " ,
" \n break " ,
" \n case " ,
" \n else " ,
# Split by exceptions
" \n try " ,
" \n throw " ,
" \n finally " ,
" \n catch " ,
# Split by the normal type of lines
" \n \n " ,
" \n " ,
" " ,
" " ,
]
elif language == Language . SOL :
elif language == Language . SOL :
return [
return [
# Split along compiler information definitions
# Split along compiler information definitions
@ -1032,6 +1070,7 @@ class RecursiveCharacterTextSplitter(TextSplitter):
" " ,
" " ,
" " ,
" " ,
]
]
else :
else :
raise ValueError (
raise ValueError (
f " Language { language } is not supported! "
f " Language { language } is not supported! "