Skip to content

sepTN/kotowaza

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Kotowaza โ€” Japanese Proverbs Dataset ๐Ÿ“š

License: MIT NPM Version NPM Downloads

Kotowaza is a structured, production-grade dataset of Japanese proverbs (ใ“ใจใ‚ใ–) with bilingual meanings, JLPT levels, example sentences, thematic tags, and cross-language equivalents.

It is designed for developers, educators, linguists, and language apps that need a clean, searchable Japanese proverb database API or JSON dataset.

โšก๏ธ Live Demo: This dataset powers the Kamus Peribahasa Jepang on Jepang.org โ€” Indonesia's comprehensive Japanese learning platform. See it running in production!

Most proverb datasets are:

  • incomplete
  • monolingual
  • unstructured
  • hard to search programmatically

Kotowaza fixes that with a normalized schema, multilingual meanings, and production-ready helper functions so you can plug proverb wisdom into apps instantly.

Features

  • ๐Ÿ“– Bilingual Meanings โ€” Each entry includes explanations in Indonesian and English
  • ๐Ÿˆ Complete Readings โ€” Hiragana (reading), romaji, and original kanji
  • ๐Ÿ“ Example Sentences โ€” Real-world usage with Japanese, romaji, and Indonesian translation
  • ๐Ÿท๏ธ Thematic Tags โ€” Categorized by theme (animals, life, money, relationships, etc.)
  • ๐Ÿ“Š JLPT Levels โ€” Entries tagged with JLPT N5โ€“N1 difficulty levels
  • ๐Ÿ”— Related Proverbs โ€” Cross-references to similar or related kotowaza
  • ๐ŸŒ Equivalent Proverbs โ€” Matching proverbs in Indonesian and English
  • โšก Zero Dependencies โ€” Pure JSON data with lightweight query helpers
  • ๐Ÿ” Built-in Search โ€” Search across all text fields instantly

Installation

npm install kotowaza

Quick Start

const kotowaza = require('kotowaza');

// Get all entries
const all = kotowaza.all();
console.log(`Loaded ${kotowaza.count()} proverbs`);

// Look up a specific proverb by ID
const entry = kotowaza.get('nanakorobi-yaoki');
console.log(entry.japanese);    // ไธƒ่ปขใณๅ…ซ่ตทใ
console.log(entry.meaning.en);  // No matter how many times you fail...

// Search across all fields (Japanese, romaji, or meaning)
kotowaza.search('็Œฟ');           // โ†’ entries containing ็Œฟ
kotowaza.search('monkey');       // โ†’ entries with "monkey" in English

// Filter by theme tag
kotowaza.byTag('motivation');    // โ†’ motivational proverbs
kotowaza.byTag('animals');       // โ†’ animal-related proverbs

// Filter by Indonesian tag
kotowaza.byTagId('motivasi');    // โ†’ same as byTag('motivation')

// Filter by JLPT level
kotowaza.byJlpt('N3');          // โ†’ proverbs suitable for N3

// Get a random proverb (great for "Quote of the Day" features!)
const daily = kotowaza.random();
console.log(`${daily.japanese} โ€” ${daily.meaning.id}`);

// Get all available tags and JLPT levels
kotowaza.tags();                 // โ†’ ['animals', 'business', 'culture', ...]
kotowaza.tagsId();               // โ†’ ['angka', 'bisnis', 'budaya', ...]
kotowaza.jlptLevels();           // โ†’ ['N2', 'N3', 'N4']

// Generate a link to the full article on Jepang.org
kotowaza.url('nanakorobi-yaoki');
// โ†’ https://jepang.org/peribahasa/nanakorobi-yaoki/

Examples

๐Ÿ“… Quote of the Day

const kotowaza = require('kotowaza');

// Deterministic "daily" proverb based on the date
function getDailyProverb() {
    const all = kotowaza.all();
    const today = new Date();
    const dayIndex = (today.getFullYear() * 366 + today.getMonth() * 31 + today.getDate()) % all.length;
    return all[dayIndex];
}

const daily = getDailyProverb();
console.log(`๐Ÿ“œ ${daily.japanese}`);
console.log(`๐Ÿ’ฌ ${daily.meaning.en}`);
// ๐Ÿ“œ ไธƒ่ปขใณๅ…ซ่ตทใ
// ๐Ÿ’ฌ No matter how many times you fail, never give up...

๐ŸŒ Express API Endpoint

const express = require('express');
const kotowaza = require('kotowaza');
const app = express();

// GET /api/proverbs?tag=motivation&jlpt=N3
app.get('/api/proverbs', (req, res) => {
    let results = kotowaza.all();

    if (req.query.tag) {
        results = kotowaza.byTag(req.query.tag);
    }
    if (req.query.jlpt) {
        results = results.filter(e => e.jlpt === req.query.jlpt.toUpperCase());
    }
    if (req.query.q) {
        results = kotowaza.search(req.query.q);
    }

    res.json({ count: results.length, data: results });
});

// GET /api/proverbs/random
app.get('/api/proverbs/random', (req, res) => {
    res.json(kotowaza.random());
});

// GET /api/proverbs/:id
app.get('/api/proverbs/:id', (req, res) => {
    const entry = kotowaza.get(req.params.id);
    if (!entry) return res.status(404).json({ error: 'Not found' });
    res.json(entry);
});

๐ŸŽ“ JLPT Study Flashcards

const kotowaza = require('kotowaza');

// Build a study deck for a specific JLPT level
function buildStudyDeck(level) {
    return kotowaza.byJlpt(level).map(entry => ({
        front: entry.japanese,
        hint: entry.reading,
        back: entry.meaning.en,
        example: entry.examples[0]?.ja,
        url: kotowaza.url(entry.id)
    }));
}

const n3Deck = buildStudyDeck('N3');
console.log(`๐Ÿ“š ${n3Deck.length} flashcards for JLPT N3`);

// Shuffle and quiz
const card = n3Deck[Math.floor(Math.random() * n3Deck.length)];
console.log(`Q: What does "${card.front}" mean?`);
console.log(`A: ${card.back}`);

๐Ÿ”Ž Search Autocomplete

const kotowaza = require('kotowaza');

// Lightweight search for autocomplete / typeahead
function autocomplete(query) {
    if (!query || query.length < 2) return [];

    return kotowaza.search(query).slice(0, 5).map(entry => ({
        id: entry.id,
        label: `${entry.japanese} (${entry.romaji})`,
        preview: entry.meaning.en.slice(0, 60) + '...'
    }));
}

console.log(autocomplete('fall'));
// [{ id: 'nanakorobi-yaoki', label: 'ไธƒ่ปขใณๅ…ซ่ตทใ (Nanakorobi Yaoki)', preview: '...' }]

๐Ÿค– Discord / Slack Bot

const kotowaza = require('kotowaza');

// !kotowaza โ€” random proverb
function handleCommand(command, args) {
    if (command === '!kotowaza') {
        const entry = args[0] ? kotowaza.get(args[0]) : kotowaza.random();
        if (!entry) return 'โŒ Proverb not found.';

        return [
            `**${entry.japanese}** (${entry.romaji})`,
            `> _${entry.meaning.en}_`,
            entry.equivalent?.en ? `๐Ÿ”— Similar: "${entry.equivalent.en}"` : '',
            `๐Ÿ“– ${kotowaza.url(entry.id)}`
        ].filter(Boolean).join('\n');
    }

    // !kotowaza-quiz โ€” quiz mode
    if (command === '!kotowaza-quiz') {
        const entry = kotowaza.random();
        return `โ“ What does **"${entry.japanese}"** mean?\n||${entry.meaning.en}||`;
    }
}

๐Ÿ—๏ธ Static Site Generator (11ty / Hugo / Astro)

const kotowaza = require('kotowaza');

// Generate pages for each proverb (e.g. in 11ty .eleventy.js)
module.exports = function(eleventyConfig) {
    eleventyConfig.addCollection('proverbs', () => {
        return kotowaza.all().map(entry => ({
            ...entry,
            permalink: `/proverbs/${entry.id}/`,
            fullUrl: kotowaza.url(entry.id)
        }));
    });

    // Shortcode for embedding a random proverb
    eleventyConfig.addShortcode('randomProverb', () => {
        const p = kotowaza.random();
        return `<blockquote class="kotowaza">
            <p lang="ja">${p.japanese}</p>
            <footer>${p.meaning.en}</footer>
        </blockquote>`;
    });
};

API Reference

Method Returns Description
all() object[] Returns all kotowaza entries
get(id) object|null Get a single entry by its slug ID
search(query) object[] Search across Japanese text, romaji, and meanings
byTag(tag) object[] Filter entries by thematic tag (English)
byTagId(tag) object[] Filter entries by Indonesian tag
byJlpt(level) object[] Filter entries by JLPT level (e.g. 'N3')
random() object Returns one random entry
count() number Total number of entries
tags() string[] All unique tags in English, sorted
tagsId() string[] All unique tags in Indonesian, sorted
jlptLevels() string[] All JLPT levels present in the dataset
url(id) string Full URL to the entry on Jepang.org

Data Schema

Each entry follows this structure:

{
  "id": "nanakorobi-yaoki",        // URL slug (matches jepang.org URL)
  "japanese": "ไธƒ่ปขใณๅ…ซ่ตทใ",         // Original Japanese (kanji)
  "reading": "ใชใชใ“ใ‚ใณใ‚„ใŠใ",       // Hiragana reading
  "romaji": "Nanakorobi Yaoki",     // Romanized reading
  "literal": "Fall seven times, rise eight times", // Literal translation
  "meaning": {
    "id": "Indonesian meaning...",  // Meaning in Bahasa Indonesia
    "en": "English meaning..."      // Meaning in English
  },
  "tags": ["motivation", "numbers"],  // Thematic tags (English)
  "tags_id": ["motivasi", "angka"],   // Thematic tags (Indonesian)
  "jlpt": "N4",                     // JLPT level (or null)
  "equivalent": {
    "id": "Padanan peribahasa Indonesia...",
    "en": "Equivalent English proverb..."
  },
  "examples": [                     // Example sentences
    {
      "ja": "Japanese sentence...",
      "romaji": "Romanized sentence...",
      "id": "Indonesian translation..."
    }
  ],
  "related": ["id-1", "id-2"]      // Related kotowaza IDs
}

Use Cases

  • ๐ŸŽ“ Japanese Learning Apps โ€” Quiz, flashcard, and study apps
  • ๐Ÿ—“๏ธ "Quote of the Day" โ€” Use random() for daily proverb features
  • ๐Ÿค– Chatbots โ€” Enrich Japanese language bots with cultural wisdom
  • ๐Ÿ“ฑ Mobile Apps โ€” Offline-ready, zero-dependency JSON dataset
  • ๐Ÿ”ฌ NLP Research โ€” Bilingual proverb corpus for language analysis
  • ๐ŸŽฎ Games โ€” Cultural trivia or educational game content

Available Tags

The dataset uses the following thematic categories:

Tag Description
animals ๐Ÿพ Animals & Nature
life โš”๏ธ Life & General Wisdom
strategy ๐ŸŽฏ Strategy & Tactics
money ๐Ÿ’ฐ Money & Business
business ๐Ÿ’ผ Business
relationships โค๏ธ Relationships
motivation ๐ŸŒŸ Motivation
patience โณ Patience & Perseverance
warnings โš ๏ธ Warnings & Caution
social ๐Ÿ‘ฅ Social Dynamics
culture ๐ŸŽŒ Japanese Culture
philosophy ๐Ÿง  Philosophy
karma โ˜ฏ๏ธ Karma & Consequences
numbers ๐Ÿ”ข Numbers
efficiency โšก Efficiency
food ๐Ÿก Food & Cuisine

Contributing

Want to add more kotowaza? PRs are welcome! Each entry should follow the schema above.

You can browse the full collection of 600+ proverbs on Jepang.org Peribahasa for reference.

About

This dataset is compiled and maintained by Septian Ganendra S. K., the Lead Maintainer at Jepang.org โ€” Indonesia's comprehensive Japanese learning platform.

๐Ÿ“š If you use this package in your project, we'd appreciate a link back to Jepang.org! It helps us continue maintaining and expanding this free resource for Japanese learners worldwide.

Related Packages

License

MIT ยฉ Septian Ganendra S. K.

About

Structured JSON dataset of Japanese proverbs (kotowaza) with meanings in Indonesian & English, examples, JLPT levels, and tags.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors