mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-03 11:47:49 +00:00
Feature/csharp text splitter doc (#10571)
- **Description:** Just docs related to csharp code splitter - **Issue:** It's related to a request made by @baskaryan in a comment on my previous PR #10350 - **Dependencies:** None - **Twitter handle:** @ather19 --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
2c11302598
commit
bfd48925e5
@ -43,7 +43,8 @@
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
"id": "283b49c9"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -71,7 +72,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "91150665"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -98,7 +100,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "15477106"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -151,7 +154,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "7abde491"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -169,7 +173,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "d42365c7"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -191,7 +196,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "0b647878"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -207,7 +213,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "d6bd0aab"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -274,7 +281,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "a5256284"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -291,7 +299,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "2526b50e"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -310,7 +319,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "52cab87e"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -327,7 +337,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "deffaba5"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -343,7 +354,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "cd9ae173"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -370,7 +382,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "7257d67a"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -389,7 +402,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "7fb717a9"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -410,7 +424,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "fba7f07e"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -431,7 +446,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "59cffcf2"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -443,7 +459,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "eebef70c"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -461,7 +478,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "b21efbfa"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -473,7 +491,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "9b42bd4d"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -487,7 +506,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "6bb272f6"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -500,7 +520,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "43818655"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -518,7 +539,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "831759f3"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -537,7 +559,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "a49aad6e"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -556,7 +579,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "d0fb0562"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -568,7 +592,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "fe607747"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -592,7 +617,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "cee245c3"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -612,7 +638,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "41a4c081"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -633,7 +660,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "bf73efc1"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -646,7 +674,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "40f48711"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -673,7 +702,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "d2e289f0"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -695,7 +725,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "958e269f"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -729,7 +760,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "56b9686c"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -745,7 +777,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "5cd721a8"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -769,7 +802,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "da631d13"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -792,7 +826,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "a333b553"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -813,7 +848,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "9ee955c8"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -827,7 +863,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "2ed1c224"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -843,7 +880,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "7981739a"
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
@ -856,7 +894,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%% md\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "24791204"
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
@ -36,7 +36,8 @@
|
||||
"pycharm": {
|
||||
"name": "#%%\n"
|
||||
}
|
||||
}
|
||||
},
|
||||
"id": "6078a74d"
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@ -50,7 +51,7 @@
|
||||
"name": "stdin",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"OpenAI API Key: ········\n"
|
||||
"OpenAI API Key: \u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
@ -31,7 +31,8 @@ from langchain.text_splitter import (
|
||||
'markdown',
|
||||
'latex',
|
||||
'html',
|
||||
'sol',]
|
||||
'sol',
|
||||
'csharp']
|
||||
```
|
||||
|
||||
</CodeOutputBlock>
|
||||
@ -342,3 +343,72 @@ sol_docs
|
||||
```
|
||||
|
||||
</CodeOutputBlock>
|
||||
|
||||
|
||||
## C#
|
||||
Here's an example using the C# text splitter:
|
||||
|
||||
```csharp
|
||||
using System;
|
||||
class Program
|
||||
{
|
||||
static void Main()
|
||||
{
|
||||
int age = 30; // Change the age value as needed
|
||||
|
||||
// Categorize the age without any console output
|
||||
if (age < 18)
|
||||
{
|
||||
// Age is under 18
|
||||
}
|
||||
else if (age >= 18 && age < 65)
|
||||
{
|
||||
// Age is an adult
|
||||
}
|
||||
else
|
||||
{
|
||||
// Age is a senior citizen
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<CodeOutputBlock lang="python">
|
||||
|
||||
```
|
||||
[Document(page_content='using System;', metadata={}),
|
||||
Document(page_content='class Program\n{', metadata={}),
|
||||
Document(page_content='static void', metadata={}),
|
||||
Document(page_content='Main()', metadata={}),
|
||||
Document(page_content='{', metadata={}),
|
||||
Document(page_content='int age', metadata={}),
|
||||
Document(page_content='= 30; // Change', metadata={}),
|
||||
Document(page_content='the age value', metadata={}),
|
||||
Document(page_content='as needed', metadata={}),
|
||||
Document(page_content='//', metadata={}),
|
||||
Document(page_content='Categorize the', metadata={}),
|
||||
Document(page_content='age without any', metadata={}),
|
||||
Document(page_content='console output', metadata={}),
|
||||
Document(page_content='if (age', metadata={}),
|
||||
Document(page_content='< 18)', metadata={}),
|
||||
Document(page_content='{', metadata={}),
|
||||
Document(page_content='//', metadata={}),
|
||||
Document(page_content='Age is under 18', metadata={}),
|
||||
Document(page_content='}', metadata={}),
|
||||
Document(page_content='else if', metadata={}),
|
||||
Document(page_content='(age >= 18 &&', metadata={}),
|
||||
Document(page_content='age < 65)', metadata={}),
|
||||
Document(page_content='{', metadata={}),
|
||||
Document(page_content='//', metadata={}),
|
||||
Document(page_content='Age is an adult', metadata={}),
|
||||
Document(page_content='}', metadata={}),
|
||||
Document(page_content='else', metadata={}),
|
||||
Document(page_content='{', metadata={}),
|
||||
Document(page_content='//', metadata={}),
|
||||
Document(page_content='Age is a senior', metadata={}),
|
||||
Document(page_content='citizen', metadata={}),
|
||||
Document(page_content='}\n }', metadata={}),
|
||||
Document(page_content='}', metadata={})]
|
||||
```
|
||||
|
||||
</CodeOutputBlock>
|
||||
|
Loading…
Reference in New Issue
Block a user