or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

classification.mddistance.mdindex.mdngrams-tfidf.mdphonetics.mdpos-tagging.mdsentiment.mdtext-processing.mdtransliterators.mdutilities.mdwordnet.md

transliterators.mddocs/

0

# Text Transliteration

1

2

Japanese text transliteration functionality for converting Hiragana and Katakana characters to romanized text using the modified Hepburn system. Essential for processing Japanese text in applications that need ASCII representation.

3

4

## Capabilities

5

6

### Japanese Transliteration

7

8

Converts Japanese Hiragana and Katakana text to romanized characters using the modified Hepburn system with comprehensive rules for accurate transliteration.

9

10

```javascript { .api }

11

/**

12

* Japanese text transliteration using modified Hepburn system

13

* Converts Hiragana and Katakana to roman characters

14

* Based on CLDR transform rule set with fixes for missing characters and edge cases

15

*/

16

class TransliterateJa {

17

/** Transliterate Japanese text to romanized form */

18

static transliterate(text: string): string;

19

}

20

```

21

22

**Features:**

23

- Supports both Hiragana and Katakana character sets

24

- Handles long vowel marks (ー) correctly

25

- Processes small tsu (っ/ッ) for consonant doubling

26

- Manages complex character combinations and diphthongs

27

- Includes support for katakana middle dot (・)

28

- Handles final small tsu and iteration marks

29

- Supports modern extensions like small vowels and special combinations

30

31

**Usage Examples:**

32

33

```javascript

34

const natural = require('natural');

35

36

// Basic transliteration

37

const result1 = natural.TransliterateJa.transliterate('こんにちは');

38

console.log(result1); // 'konnichiwa'

39

40

const result2 = natural.TransliterateJa.transliterate('カタカナ');

41

console.log(result2); // 'katakana'

42

43

// Complex examples with long vowels

44

const result3 = natural.TransliterateJa.transliterate('おとうさん');

45

console.log(result3); // 'otōsan'

46

47

const result4 = natural.TransliterateJa.transliterate('きょう');

48

console.log(result4); // 'kyō'

49

50

// Small tsu handling

51

const result5 = natural.TransliterateJa.transliterate('がっこう');

52

console.log(result5); // 'gakkō'

53

54

// Mixed Hiragana and Katakana

55

const result6 = natural.TransliterateJa.transliterate('ひらがなとカタカナ');

56

console.log(result6); // 'hiragana to katakana'

57

58

// Modern extensions

59

const result7 = natural.TransliterateJa.transliterate('ファイル・システム');

60

console.log(result7); // 'fairu shisutemu'

61

```

62

63

**Transliteration Rules:**

64

65

The system follows the modified Hepburn romanization with these key features:

66

67

- **Long vowels**: Marked with macrons (ā, ī, ū, ē, ō)

68

- **Double consonants**: Small tsu creates doubled consonants (kk, ss, tt, etc.)

69

- **N handling**: Special rules for 'n' before vowels and certain consonants

70

- **Voiced marks**: Properly handles dakuten (゛) and handakuten (゜)

71

- **Modern sounds**: Supports katakana extensions for foreign words

72

73

**Character Support:**

74

75

- All standard Hiragana characters (あ-ん)

76

- All standard Katakana characters (ア-ン)

77

- Small characters (ぁぃぅぇぉ, ァィゥェォ, etc.)

78

- Combination characters (きゃ, キャ, etc.)

79

- Long vowel mark (ー)

80

- Katakana middle dot (・)

81

- Iteration marks and special symbols