An interactive web prototype for exploring the geographic origins of Japanese loanwords (外来語)
Explore the report »
Features
·
Snapshots
·
Setup
·
Structure
語旅 (Kotabi), meaning "word journey," is an interactive web prototype that makes the phenomenon of Japanese loanwords (gairaigo, 外来語) explorable and visually engaging. Built with Svelte, TypeScript, and D3.js, it renders a zoomable world map where each donor country is colored using a traditional Japanese pigment palette. Users can click any country to browse its loanwords, or switch to the AI-powered Discover mode to classify a katakana word and predict its donor language, powered by a pre-trained LinearSVC classifier served through a FastAPI backend.
This project was built for COSC 402: Current Trends and Topics in Computing (HCI Interactive Prototype).
| Technology | Purpose |
|---|---|
| Svelte + TypeScript | Frontend framework and type safety |
| Vite | Build tool and dev server |
| D3.js | Map rendering, zoom behavior, and data binding |
| TopoJSON | Geographic data (world-atlas) |
| FastAPI | Backend REST API for AI predictions |
| flagcdn.com | Country flag images |
Initial Load: World map with Japanese pigment country colors and the Explore panel idle state
Explore Mode: Country selected with flag, language tag, loanword count, search bar, and word cards
Discover Mode: Katakana input, Analyze button, disclaimer note, and example word chips
8000git clone https://github.com/krislette/gairaigo-map.git
cd gairaigo-map
npm install
npm run dev
The app will be available at http://localhost:5173. Make sure the FastAPI backend is running before using Discover mode.
npm run build
npm run preview
npm run check
gairaigo-map/
├── public/
│ ├── favicon.svg
│ └── icons.svg
├── src/
│ ├── data/
│ │ └── gairaigo_full.json # 10,378 loanword entries across 37 donor languages
│ ├── lib/
│ │ ├── components/
│ │ │ ├── WorldMap.svelte # D3 map, zoom, pan, country rendering
│ │ │ ├── ExplorePanel.svelte # Country header, search, word list
│ │ │ └── DiscoverPanel.svelte # Katakana input, AI prediction, result card
│ │ ├── stores/
│ │ │ └── mapStore.ts # Shared reactive state (activeIso2, highlights, zoom)
│ │ ├── isoMapping.ts # ISO2 ↔ numeric country code mapping
│ │ └── types.ts # TypeScript interfaces
│ ├── App.svelte # Root layout, tab bar, header, footer
│ ├── app.css # Global CSS variables and design tokens
│ └── main.ts # Entry point
├── index.html
├── vite.config.ts
├── svelte.config.js
├── tsconfig.json
├── tsconfig.app.json
└── tsconfig.node.json
This project is for academic use. Loanword data is sourced from JMdict/EDICT, distributed under the Creative Commons Attribution-ShareAlike 4.0 International License by the Electronic Dictionary Research and Development Group.