https://github.com/aethiopicuschan/nocjk
Detect CJK text
https://github.com/aethiopicuschan/nocjk
Last synced: 6 months ago
JSON representation
Detect CJK text
- Host: GitHub
- URL: https://github.com/aethiopicuschan/nocjk
- Owner: aethiopicuschan
- License: mit
- Created: 2025-05-15T05:31:59.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-29T04:20:34.000Z (about 1 year ago)
- Last Synced: 2025-12-19T22:14:43.749Z (7 months ago)
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cli-apps-in-a-csv - nocjk - A simple CLI tool and library to detect CJK (Chinese, Japanese, and Korean) text. (<a name="text-search"></a>Text search (alternatives to grep))
- awesome-cli-apps - nocjk - A simple CLI tool and library to detect CJK (Chinese, Japanese, and Korean) text. (<a name="text-search"></a>Text search (alternatives to grep))
README
# nocjk
[](/LICENSE)
[](https://pkg.go.dev/github.com/aethiopicuschan/nocjk)
[](https://goreportcard.com/report/github.com/aethiopicuschan/nocjk)
[](https://github.com/aethiopicuschan/nocjk/actions/workflows/ci.yaml)
[](https://github.com/features/actions)
`nocjk` is a simple CLI tool and library to detect CJK (Chinese, Japanese, and Korean) text.
## Installation
### As a CLI tool:
```sh
go install github.com/aethiopicuschan/nocjk/cmd/nocjk@latest
nocjk .
```
When CJK text is detected, the CLI exits with error code 1.
#### Ignore
If you want to ignore the detection of a specific language, you can use the following option.
- `--ignore-chinese` to ignore Chinese text
- `--ignore-japanese` to ignore Japanese text
- `--ignore-korean` to ignore Korean text
You can also define ignore rules using a `.nocjkignore` file in your project root. The format of `.nocjkignore` is fully compatible with `.gitignore`. Files and directories matching the patterns in this file will be skipped during CJK text detection. This is especially useful when you want to exclude certain generated files or third-party code from being analyzed.
### As a library:
```sh
go get -u github.com/aethiopicuschan/nocjk/pkg/nocjk
```
`nocjk` provides `FindChineseLines`, `FindJapaneseLines`, `FindKoreanLines` and `FindCJKLines` functions to detect CJK text in a string. More information can be found in the [documentation](https://pkg.go.dev/github.com/aethiopicuschan/nocjk).
## Usage with GitHub Actions
You can easily integrate `nocjk` into your GitHub Actions workflows to automatically detect CJK text during code changes. Here is a basic example:
```yaml
jobs:
check-cjk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Detect CJK text
uses: aethiopicuschan/nocjk/actions/nocjk-action@v1.2.0
with:
ignore_chinese: false
ignore_japanese: false
ignore_korean: false
args: "."
```
See [nocjk-action on GitHub](https://github.com/aethiopicuschan/nocjk/tree/main/actions/nocjk-action) for more details.