OpenCC icon

OpenCC

Get data from OpenCC API

Actions2

Overview

This node performs text conversion between different Chinese character sets using the OpenCC library. It is useful for scenarios where you need to convert text from Simplified Chinese to Traditional Chinese, Traditional Chinese to Simplified Chinese, or regional variants such as Taiwan (TW) and Mainland China (CN) forms.

Practical examples include:

  • Converting user-generated content from Simplified Chinese to Traditional Chinese for audiences in Taiwan.
  • Normalizing text data for NLP applications that require consistent character sets.
  • Translating documents or messages between regional Chinese variants.

Properties

Name Meaning
Text The input text string that you want to convert.
Conversion The type of conversion to apply. Options:
- Simplified to Traditional
- Traditional to Simplified
- TW to CN (Taiwan to Mainland China)
- CN to TW (Mainland China to Taiwan)

Output

The node outputs an array with one item per input. Each output item contains a json object with the following field:

  • result: The converted text string after applying the selected conversion.

If an error occurs during processing and the node is configured to continue on failure, the output will contain an error field with the error message.

Dependencies

  • Uses the opencc-js library for performing the Chinese character set conversions.
  • Also imports a local normalization module to further normalize the converted text based on the conversion direction.
  • No external API keys or credentials are required.
  • No special environment variables or n8n configurations needed beyond standard node setup.

Troubleshooting

  • Common issues:
    • Providing empty or invalid text input may result in no meaningful output.
    • Selecting an unsupported conversion option (not listed) would default to returning the original text unchanged.
  • Error messages:
    • Errors thrown by the underlying conversion library will be caught and can be output if "Continue On Fail" is enabled.
    • Typical errors might relate to invalid input types or unexpected characters; ensure the input is a valid string.

Links and References

Discussion