> ## Documentation Index
> Fetch the complete documentation index at: https://www.paradedb.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Chinese Compatible

> A simple tokenizer for Chinese, Japanese, and Korean characters

The Chinese compatible tokenizer is like the [simple](https://www.paradedb.com/docs/reference/tokenizers/available-tokenizers/simple.md) tokenizer -- it lowercases non-CJK characters and splits on
any non-alphanumeric character. Additionally, it treats each CJK character as its own token.

```sql theme={null}
CREATE INDEX search_idx ON mock_items
USING paradedb (id, (description::pdb.chinese_compatible));
```

To get a feel for this tokenizer, run the following command and replace the text with your own:

```sql theme={null}
SELECT 'Hello world! 你好!'::pdb.chinese_compatible::text[];
```

```ini Expected Response theme={null}
        text
---------------------
 {hello,world,你,好}
(1 row)
```

## Convert Between Traditional and Simplified Chinese

Use `chinese_convert` to convert Traditional and Simplified Chinese to the same form
before tokenization, so queries can match documents written in either form.

```sql SQL theme={null}
CREATE INDEX search_idx ON mock_items
USING paradedb (id, (description::pdb.chinese_compatible('chinese_convert=t2s')));
```

```ts Drizzle theme={null}
import { indexing, tokenizer } from "@paradedb/drizzle-paradedb";

indexing
  .paradedbIndex("search_idx")
  .on(
    mockItems.id,
    indexing.paradedbField(
      mockItems.description,
      tokenizer.chineseCompatible({ chinese_convert: "t2s" }),
    ),
  );
```

```python Django theme={null}
from django.db import connection
from paradedb.indexes import ParadeDBIndex
from paradedb.search import Tokenizer

with connection.schema_editor() as schema_editor:
    schema_editor.add_index(
        MockItem,
        ParadeDBIndex(
            fields={'id': {}, 'description': {'tokenizer': Tokenizer.chinese_compatible(options={"chinese_convert": "t2s"})}},
            name="search_idx",
        ),
    )
```

```python SQLAlchemy theme={null}
from sqlalchemy import Index
from paradedb.sqlalchemy import indexing
from paradedb.sqlalchemy import tokenizer

idx = Index(
    "search_idx",
    indexing.ParadeDBField(MockItem.id),
    indexing.ParadeDBField(MockItem.description, tokenizer=tokenizer.chinese_compatible(options={"chinese_convert": "t2s"})),
    postgresql_using="paradedb",
)

with engine.begin() as conn:
    idx.create(conn)
```

```ruby Rails theme={null}
ActiveRecord::Base.connection.add_paradedb_index(
  :mock_items,
  fields: {
    id: {},
    description: { tokenizer: ParadeDB::Tokenizer.chinese_compatible(options: { chinese_convert: "t2s" }) },
  },
  name: :search_idx
)
```

```cs EF Core theme={null}
modelBuilder.Entity<MockItem>()
    .HasParadeDbIndex("search_idx", e => e.Id)
    .HasField(e => e.Description, Tokenizer.ChineseCompatible(new() { ["chinese_convert"] = "t2s" }));
```

The following conversion modes are supported:

| Mode | Description |
| - | - |
| `t2s` | Traditional to Simplified |
| `s2t` | Simplified to Traditional |
| `tw2s` | Traditional Taiwan to Simplified |
| `tw2sp` | Traditional Taiwan to Simplified, with idioms |
| `s2tw` | Simplified to Traditional Taiwan |
| `s2twp` | Simplified to Traditional Taiwan, with idioms |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.