### Start Docker Containers Source: https://github.com/tshatrov/ichiran/blob/master/README.md Starts the Docker containers. The first time this is run, it will import the database dump and perform initializations, which may take several minutes. Warnings about pre-existing tables or vacuum tasks can be safely ignored. ```bash docker compose up ``` -------------------------------- ### Perform Partial Database Initialization Source: https://context7.com/tshatrov/ichiran/llms.txt For quicker setup, you can perform partial initialization by loading only the dictionary (`load-jmdict`) and best readings (`load-best-readings`). ```lisp ;; Partial initialization (dictionary only) (ichiran/maintenance:load-jmdict) (ichiran/maintenance:load-best-readings :reset t) ``` -------------------------------- ### Run Tests Source: https://github.com/tshatrov/ichiran/blob/master/README.md Verify the installation by running the test suite. ```Common Lisp (ichiran/test:run-all-tests) ``` -------------------------------- ### Romanization with Dictionary Info via CLI Source: https://context7.com/tshatrov/ichiran/llms.txt Use the `-i` flag with `ichiran-cli` to get romanization along with dictionary information, including kana readings and definitions. ```bash # With dictionary info (-i flag) $ ichiran-cli -i "一覧は最高だぞ" ichiran wa saikō da zo * ichiran 一覧 【いちらん】 1. [n,vs] look; glance; sight; inspection 2. [n] summary; list; table; catalog; catalogue * wa は 1. [prt] indicates sentence topic * saikō 最高 【さいこう】 1. [adj-no,adj-na,n] best; supreme; wonderful; finest ``` -------------------------------- ### Get Romaji Conversion with Regex Pattern Source: https://context7.com/tshatrov/ichiran/llms.txt The `romaji-kana` function returns both the Hiragana conversion and a regex pattern. This example demonstrates capturing both values using `multiple-value-bind`. ```lisp ;; Returns canonical form and regex pattern (multiple-value-bind (kana pattern) (ichiran:romaji-kana "toukyou") (list :kana kana :pattern pattern)) ;; => (:kana "とうきょう" :pattern "^とうきょう$") ``` -------------------------------- ### Romanize Japanese Text with Info (SBCL) Source: https://github.com/tshatrov/ichiran/blob/master/README.md Example of using the `romanize` function within the SBCL interpreter to convert Japanese text to romaji and retrieve detailed linguistic information for each word. The `:with-info t` argument enables this detailed output. ```common-lisp (romanize "一覧は最高だぞ" :with-info t) ``` -------------------------------- ### Get Formatted Word String - Lisp Source: https://context7.com/tshatrov/ichiran/llms.txt Generates a human-readable string with complete word information including readings, glosses, and conjugation details. ```lisp ;; Get formatted word info string (let ((wi (car (ichiran/dict:find-word-info "食べている")))) (ichiran/dict:word-info-str wi)) ;; => "食べている 【たべている】 ;; [ Conjugation: [v1] Continuative (~te) Affirmative Plain ;; 食べる 【たべる】 : to eat ;; [ Conjugation: [v1-s,vk] Continuative (~te) Affirmative Plain ;; いる 【いる】 : to be; to exist ]" ``` -------------------------------- ### Get JSON Gloss Data - Lisp Source: https://context7.com/tshatrov/ichiran/llms.txt Returns detailed gloss information in JSON format including conjugation chains. The output includes reading, text, kana, sequence number, conjugation chain, and sense definitions. ```lisp ;; Get JSON gloss data (let ((wi (car (ichiran/dict:find-word-info "走った")))) (ichiran/dict:word-info-gloss-json wi)) ;; Returns JSON with: ;; - reading: "走った 【はしった】" ;; - text: "走った" ;; - kana: "はしった" ;; - seq: dictionary sequence number ;; - conj: conjugation chain back to root form ;; - gloss: array of sense definitions ``` -------------------------------- ### Get Word Suggestions from Romaji Source: https://context7.com/tshatrov/ichiran/llms.txt Use `romaji-suggest` to get word suggestions for a given Romaji input. It provides options for Hiragana, Katakana, and Kanji. ```lisp ;; Get suggestions for romaji input (ichiran:romaji-suggest "neko") ;; => (:OBJ ;; ("hiragana" . ("ねこ")) ;; ("katakana" . ("ネコ")) ;; ("kanji" . ("猫" "根子" "寝こ"))) (ichiran:romaji-suggest "nihon") ;; => (:OBJ ;; ("hiragana" . ("にほん")) ;; ("katakana" . ("ニホン")) ;; ("kanji" . ("日本" "二本" "二本"))) ``` -------------------------------- ### Romanize Japanese Text with Info (Namespaced SBCL) Source: https://github.com/tshatrov/ichiran/blob/master/README.md Alternative way to call the `romanize` function using its namespace within the SBCL interpreter. This achieves the same result as the previous example, providing romaji conversion and detailed word information. ```common-lisp (ichiran:romanize "一覧は最高だぞ" :with-info t) ``` -------------------------------- ### Get Kanji Information - Lisp Source: https://context7.com/tshatrov/ichiran/llms.txt Returns comprehensive information about a kanji character including readings, meanings, stroke count, and usage statistics. Can be converted to a JSON string. ```lisp ;; Get kanji information (ichiran/kanji:kanji-info-json "日") ;; => (:OBJ ;; ("text" . "日") ;; ("rc" . 72) ; radical (classical) ;; ("rn" . 72) ; radical (nelson) ;; ("strokes" . 4) ;; ("grade" . 1) ; school grade level ;; ("freq" . 1) ; frequency rank ;; ("total" . 847) ; common words using this kanji ;; ("irr" . 156) ; irregular reading count ;; ("irr_perc" . "18.42%") ;; ("readings" . ((:OBJ ("text" . "にち") ("type" . "ja_on") ...) ;; (:OBJ ("text" . "ひ") ("type" . "ja_kun") ...))) ;; ("meanings" . ("day" "sun" "Japan" "counter for days"))) ;; Convert to JSON string (jsown:to-json (ichiran/kanji:kanji-info-json "食")) ``` -------------------------------- ### Get JSON Word Data - Lisp Source: https://context7.com/tshatrov/ichiran/llms.txt Returns word information in JSON format suitable for web APIs. Can also convert this JSON data to a JSON string. ```lisp ;; Get JSON representation of word info (ichiran/dict:find-word-info-json "猫") ;; => ((:OBJ ;; ("reading" . "猫 【ねこ】") ;; ("text" . "猫") ;; ("kana" . "ねこ") ;; ("seq" . 1467640) ;; ("gloss" . ((:OBJ ("pos" . "[n]") ;; ("gloss" . "cat (Felis catus)")))))) ``` ```lisp ;; Convert to JSON string (jsown:to-json (car (ichiran/dict:find-word-info-json "犬"))) ``` -------------------------------- ### Initialize Database Source: https://github.com/tshatrov/ichiran/blob/master/README.md Commands for initializing the database from scratch or updating existing data. ```Common Lisp (ichiran/maintenance:add-errata) ``` ```Common Lisp (ichiran/maintenance:full-init) ``` ```Common Lisp (ichiran/maintenance:load-jmdict) ``` ```Common Lisp (ichiran/maintenance:load-best-readings) ``` -------------------------------- ### Display Ichiran CLI Help Source: https://context7.com/tshatrov/ichiran/llms.txt Run `ichiran-cli --help` to display the command-line help information, listing all available options and their usage. ```bash # Help $ ichiran-cli --help ``` -------------------------------- ### Perform Complete Database Initialization Source: https://context7.com/tshatrov/ichiran/llms.txt Use `full-init` for a complete initialization of the Ichiran database from JMDict and KanjiDic source files. This process can take several hours. ```lisp ;; Complete initialization (takes several hours) (ichiran/maintenance:full-init) ;; Output: ;; Initializing ichiran/dict... ;; Calculating readings... ;; Initializing ichiran/kanji... ;; Calculating kanji stats... ``` -------------------------------- ### Build Docker Images Source: https://github.com/tshatrov/ichiran/blob/master/README.md Execute this command from the root of the repository to build the Docker images for the project. ```bash docker compose build ``` -------------------------------- ### Configure Database Connections Source: https://context7.com/tshatrov/ichiran/llms.txt Manages database connections. Connections can be configured via environment variables or programmatically. Use `load-connection-from-env` to load from environment variables, `with-db` for specific connections, and `switch-conn-vars` to switch between named connections. ```lisp ;; Set connection via environment variable ;; export ICHIRAN_CONNECTION='("jmdict" "postgres" "" "localhost" :use-ssl :yes)' ``` ```lisp ;; Load connection from environment (ichiran/conn:load-connection-from-env) ``` ```lisp ;; Use specific connection (ichiran/conn:with-db '("jmdict" "user" "pass" "host") (ichiran:romanize "テスト")) ``` ```lisp ;; Switch between named connections (ichiran/conn:switch-conn-vars :production) ``` -------------------------------- ### Run Test Suite Source: https://github.com/tshatrov/ichiran/blob/master/README.md Executes the project's test suite within the running `ichiran-main-1` container. The output shows the Common Lisp implementation version and a summary of test results. ```bash $ docker exec -it ichiran-main-1 test-suite ``` -------------------------------- ### Initialize Suffix Cache Source: https://github.com/tshatrov/ichiran/blob/master/README.md Create a suffix cache to improve the quality of word segmentation. ```Common Lisp (ichiran/dict:init-suffixes t) ``` -------------------------------- ### Enter SBCL Interpreter Source: https://github.com/tshatrov/ichiran/blob/master/README.md Connects to the `ichiran-main-1` container to enter the SBCL (Steel Bank Common Lisp) interpreter with Ichiran already initialized. This allows interactive use of Ichiran functions. ```bash $ docker exec -it ichiran-main-1 ichiran-sbcl ``` -------------------------------- ### Romanization with Different Methods Source: https://context7.com/tshatrov/ichiran/llms.txt Demonstrates converting Japanese text to romaji using various specified romanization methods like Hepburn variants and Kunrei-shiki. ```lisp ;; Using different romanization methods (ichiran:romanize "東京" :method ichiran:*hepburn-basic*) ;; => "toukyou" ``` ```lisp (ichiran:romanize "東京" :method ichiran:*hepburn-traditional*) ;; => "tōkyō" ``` ```lisp (ichiran:romanize "東京" :method ichiran:*hepburn-passport*) ;; => "tohkyoh" ``` ```lisp (ichiran:romanize "東京" :method ichiran:*kunrei-siki*) ;; => "tôkyô" ``` -------------------------------- ### Use Ichiran CLI for Romanization Source: https://github.com/tshatrov/ichiran/blob/master/README.md Demonstrates how to use the Ichiran command-line interface (CLI) to romanize Japanese text. The `-i` flag specifies the input string, and the output includes the romaji conversion along with detailed linguistic information for each word. ```bash $ docker exec -it ichiran-main-1 ichiran-cli -i "一覧は最高だぞ" ``` -------------------------------- ### Basic Romanization with Ichiran CLI Source: https://context7.com/tshatrov/ichiran/llms.txt The `ichiran-cli` tool can perform basic romanization of Japanese text directly from the command line. ```bash # Basic romanization $ ichiran-cli "一覧は最高だぞ" ichiran wa saikō da zo ``` -------------------------------- ### Initialize Suffix Cache Source: https://context7.com/tshatrov/ichiran/llms.txt Initializes the suffix cache for improved segmentation quality. This function is required before using segmentation functions. Use `init-suffixes-running-p` to check if initialization is in progress. ```lisp ;; Initialize suffix cache (required for best segmentation) (ichiran/dict:init-suffixes t) ``` ```lisp ;; Check if initialization is in progress (ichiran/dict:init-suffixes-running-p) ;; => T or NIL ``` -------------------------------- ### Full JSON Output with Ichiran CLI Source: https://context7.com/tshatrov/ichiran/llms.txt The `-f` flag with `ichiran-cli` provides detailed output in JSON format, useful for programmatic processing of segmentation results. ```bash # Full JSON output (-f flag) $ ichiran-cli -f "猫が好き" [{"type":"word","text":"猫","kana":"ねこ","seq":1467640,...}] ``` -------------------------------- ### Limit Segmentation Alternatives via CLI Source: https://context7.com/tshatrov/ichiran/llms.txt Use the `-l` flag with `ichiran-cli` to limit the number of alternative segmentations shown in the output, useful for cleaner results. ```bash # Limit segmentation alternatives $ ichiran-cli -f -l 5 "日本語" ``` -------------------------------- ### Evaluate Lisp Expressions with Ichiran CLI Source: https://context7.com/tshatrov/ichiran/llms.txt The `-e` flag allows you to evaluate arbitrary Lisp expressions directly using the Ichiran library from the command line. ```bash # Evaluate arbitrary Lisp expression $ ichiran-cli -e "(ichiran:romanize-word \"ありがとう\")" "arigatō" ``` -------------------------------- ### Convert Arabic Numerals to Kanji Source: https://context7.com/tshatrov/ichiran/llms.txt Use `number-to-kanji` to convert standard Arabic numerals into their Japanese Kanji number representations. Supports basic and large numbers. ```lisp ;; Basic conversion (ichiran/numbers:number-to-kanji 42) ;; => "四十二" (ichiran/numbers:number-to-kanji 1234) ;; => "千二百三十四" (ichiran/numbers:number-to-kanji 10000) ;; => "一万" ;; Large numbers (ichiran/numbers:number-to-kanji 123456789) ;; => "一億二千三百四十五万六千七百八十九" ``` -------------------------------- ### Basic Word Segmentation Source: https://context7.com/tshatrov/ichiran/llms.txt Segments Japanese text into individual words, returning a list of word-info objects for the most likely interpretation. ```lisp ;; Segment a sentence into words (ichiran/dict:simple-segment "私は日本語を勉強しています") ;; Returns list of word-info objects: ;; (# ;; # ;; # ;; # ;; # ;; # ; conjugated form ;; ...) ``` -------------------------------- ### Detailed Romanization with Metadata Source: https://context7.com/tshatrov/ichiran/llms.txt Provides detailed segmentation metadata along with romanized text. The :limit parameter controls the number of alternative segmentations returned. ```lisp ;; Get detailed segmentation with multiple interpretations (ichiran:romanize* "食べる" :limit 3) ;; Returns a list of (split-type . split-data) pairs ;; where split-data contains scored word-info objects with: ;; - romanized text ;; - word-info object with seq, kana, conjugations ;; - optional properties ``` ```lisp ;; Limit controls maximum alternative segmentations (ichiran:romanize* "日本語を勉強する" :limit 5 :wordprop-fn (lambda (rom wi) (list :score (ichiran/dict:word-info-score wi)))) ``` -------------------------------- ### Database Maintenance Source: https://context7.com/tshatrov/ichiran/llms.txt Functions for initializing and maintaining the Ichiran database. ```APIDOC ## full-init ### Description Initializes the entire Ichiran database from JMDict and KanjiDic source files. ### Method Lisp Function ``` -------------------------------- ### Find Detailed Word Information - Lisp Source: https://context7.com/tshatrov/ichiran/llms.txt Finds all matching dictionary entries for a word with full gloss information. Can filter by specific reading or request root forms only. ```lisp ;; Find word information (ichiran/dict:find-word-info "走る") ;; Returns list of word-info objects with different readings/senses ``` ```lisp ;; With specific reading (ichiran/dict:find-word-info "行く" :reading "いく") ;; Filters to entries matching the specified reading ``` ```lisp ;; Root forms only (no conjugated variants) (ichiran/dict:find-word-info "食べ" :root-only t) ``` -------------------------------- ### Lookup Single Word Info - Lisp Source: https://context7.com/tshatrov/ichiran/llms.txt Creates a word-info object for a single word, useful for dictionary lookups. Access properties like text, kana, sequence, and score. ```lisp ;; Look up a single word (ichiran/dict:word-info-from-text "食べる") ;; => # ``` ```lisp ;; Access word-info properties (let ((wi (ichiran/dict:word-info-from-text "学生"))) (list :text (ichiran/dict:word-info-text wi) :kana (ichiran/dict:word-info-kana wi) :seq (ichiran/dict:word-info-seq wi) :score (ichiran/dict:word-info-score wi))) ;; => (:text "学生" :kana "がくせい" :seq 1253750 :score 245) ``` -------------------------------- ### Convert Mixed Kana Text Source: https://context7.com/tshatrov/ichiran/llms.txt The `as-hiragana` and `as-katakana` functions handle mixed text by converting each character individually. ```lisp ;; Mixed text is converted character by character (ichiran/characters:as-hiragana "カタカナとひらがな") ;; => "かたかなとひらがな" ``` -------------------------------- ### normalize - Text Normalization Source: https://context7.com/tshatrov/ichiran/llms.txt Normalizes Japanese text by converting full-width characters, joining dakuten marks, and processing punctuation. ```APIDOC ## normalize ### Description Normalizes Japanese text by converting full-width characters, joining dakuten marks, and processing punctuation. ### Method Lisp Function ### Parameters - **text** (string) - Required - The text to normalize. - **context** (keyword) - Optional - Contextual settings (e.g., :kana). ``` -------------------------------- ### Romaji to Kana Conversion Source: https://context7.com/tshatrov/ichiran/llms.txt Functions for converting romaji to kana and providing word suggestions. ```APIDOC ## romaji-kana ### Description Converts romanized Japanese text to hiragana with pattern matching for ambiguous inputs. ### Method Lisp Function ### Parameters - **input** (string) - Required - The romaji string to convert. ### Response - **kana** (string) - The canonical kana form. - **pattern** (string) - Regex pattern for matching. ``` -------------------------------- ### Kana Conversion API Source: https://context7.com/tshatrov/ichiran/llms.txt Functions for converting between hiragana and katakana scripts. ```APIDOC ## as-hiragana / as-katakana ### Description Converts between hiragana and katakana scripts. ### Method Lisp Function ### Parameters - **text** (string) - Required - The input string to convert. ### Request Example (ichiran/characters:as-hiragana "トウキョウ") ### Response - **result** (string) - The converted string. ``` -------------------------------- ### Multiple Segmentation Interpretations Source: https://context7.com/tshatrov/ichiran/llms.txt Retrieves multiple possible segmentations of Japanese text, ranked by score. Useful for handling ambiguous word boundaries. ```lisp ;; Get top 5 possible segmentations (ichiran/dict:dict-segment "きょうはいいてんきですね" :limit 5) ;; Returns list of (word-info-list . score) pairs ;; Each interpretation has a score indicating likelihood ;; Example output structure: ;; (((# # ;; # # ;; # #) . 1250) ;; ((# ...) . 890) ;; ...) ``` -------------------------------- ### Normalize Half-Width Katakana Source: https://context7.com/tshatrov/ichiran/llms.txt The `normalize` function can convert half-width Katakana to full-width Katakana when the `:context` is set to `:kana`. ```lisp ;; Normalize half-width katakana (ichiran/characters:normalize "カタカナ" :context :kana) ;; => "カタカナ" ``` -------------------------------- ### Basic Romanization of Japanese Text Source: https://context7.com/tshatrov/ichiran/llms.txt Converts Japanese sentences to romaji using the default Hepburn basic method. For detailed word information, use the :with-info option. ```lisp ;; Basic romanization (ichiran:romanize "一覧は最高だぞ") ;; => "ichiran wa saikō da zo" ``` ```lisp ;; Romanization with dictionary info (ichiran:romanize "一覧は最高だぞ" :with-info t) ;; => "ichiran wa saikō da zo" ;; (("ichiran" . "一覧 【いちらん】 ;; 1. [n,vs] look; glance; sight; inspection ;; 2. [n] summary; list; table; catalog; catalogue") ;; ("wa" . "は ;; 1. [prt] indicates sentence topic ;; 2. [prt] indicates contrast with another option") ;; ("saikō" . "最高 【さいこう】 ;; 1. [adj-no,adj-na,n] best; supreme; wonderful; finest ;; 2. [n,adj-na,adj-no] highest; maximum; most") ;; ("da" . "だ ;; 1. [cop,cop-da] be; is") ;; ("zo" . "ぞ ;; 1. [prt] adds force or indicates command")) ``` -------------------------------- ### Remove PostgreSQL Data Source: https://github.com/tshatrov/ichiran/blob/master/README.md If there are errors during database import or if you need to import a new database, delete the existing PostgreSQL data directory. This ensures the initdb scripts are called on the next `docker compose up`. ```bash sudo rm -rf docker/pgdata ``` -------------------------------- ### Normalize Full-Width Characters Source: https://context7.com/tshatrov/ichiran/llms.txt Use `normalize` to convert full-width alphanumeric characters to their half-width equivalents. This is useful for standardizing input. ```lisp ;; Normalize text with full-width characters (ichiran/characters:normalize "123ABC") ;; => "123ABC" ``` -------------------------------- ### Text Segmentation API Source: https://context7.com/tshatrov/ichiran/llms.txt Functions for segmenting Japanese text into individual words with support for ambiguity handling. ```APIDOC ## simple-segment ### Description Segments Japanese text into individual words, returning a list of word-info objects representing the most likely interpretation. ### Parameters #### Request Body - **text** (string) - Required - The Japanese text to segment. ### Response - **result** (list) - A list of word-info objects. ## dict-segment ### Description Returns multiple possible segmentations ranked by score, useful for handling ambiguous text. ### Parameters #### Request Body - **text** (string) - Required - The Japanese text to segment. - **limit** (integer) - Optional - Maximum number of interpretations to return. ### Response - **result** (list) - A list of (word-info-list . score) pairs. ``` -------------------------------- ### Number Conversion API Source: https://context7.com/tshatrov/ichiran/llms.txt Functions for converting between Arabic numerals and Japanese kanji/kana representations. ```APIDOC ## number-to-kanji ### Description Converts Arabic numerals to Japanese kanji number representation. ### Method Lisp Function ### Parameters - **number** (integer) - Required - The number to convert. - **digits** (object) - Optional - Custom digit mapping (e.g., legal kanji). ``` -------------------------------- ### Convert Numbers to Legal Kanji Source: https://context7.com/tshatrov/ichiran/llms.txt The `number-to-kanji` function can also output numbers using formal or legal Kanji characters by passing the `ichiran/numbers:*digit-kanji-legal*` argument. ```lisp ;; Using legal/formal kanji (ichiran/numbers:number-to-kanji 123 :digits ichiran/numbers:*digit-kanji-legal*) ;; => "壱百弐拾参" ``` -------------------------------- ### Convert Romaji to Hiragana Source: https://context7.com/tshatrov/ichiran/llms.txt Use `romaji-kana` to convert Romaji input into Hiragana. It also returns a regex pattern for matching the converted text. ```lisp ;; Basic conversion (ichiran:romaji-kana "tokyo") ;; => "とうきょ" ;; "^とうきょう?$" ; regex pattern for matching (ichiran:romaji-kana "watashi") ;; => "わたし" ;; "^わたし$" ``` -------------------------------- ### Parse Kanji Numbers to Integers Source: https://context7.com/tshatrov/ichiran/llms.txt Use `parse-number` to convert Japanese Kanji number strings back into standard integer values. It handles various formats, including mixed Arabic and Kanji. ```lisp ;; Parse kanji numbers (ichiran/numbers:parse-number "四十二") ;; => 42 (ichiran/numbers:parse-number "千二百三十四") ;; => 1234 (ichiran/numbers:parse-number "一億") ;; => 100000000 ;; Mixed Arabic and kanji (ichiran/numbers:parse-number "12万3456") ;; => 123456 ``` -------------------------------- ### Analyze Kanji Readings in Words - Lisp Source: https://context7.com/tshatrov/ichiran/llms.txt Analyzes how kanji characters are read within a word, matching readings to individual characters. Can detect irregular readings in compounds. ```lisp ;; Analyze readings in a word (ichiran/kanji:match-readings-json "東京" "とうきょう") ;; => ((:OBJ ("kanji" . "東") ("reading" . "とう") ("type" . "ja_on") ;; ("link" . T) ("stats" . T) ("sample" . 234) ("total" . 567) ;; ("perc" . "41.27%") ("grade" . 2)) ;; (:OBJ ("kanji" . "京") ("reading" . "きょう") ("type" . "ja_on") ;; ("link" . T) ("stats" . T) ("sample" . 189) ("total" . 423) ;; ("perc" . "44.68%") ("grade" . 2))) ``` ```lisp ;; Detect irregular readings (ichiran/kanji:match-readings-json "今日" "きょう") ;; Returns reading analysis with type "irr" for irregular compounds ``` -------------------------------- ### Dictionary Lookup API Source: https://context7.com/tshatrov/ichiran/llms.txt Endpoints for retrieving word information, glosses, and formatted dictionary data. ```APIDOC ## word-info-from-text ### Description Creates a word-info object for a single word, useful for dictionary lookups. ### Method FUNCTION ### Parameters #### Request Body - **text** (string) - Required - The word to look up. ### Response #### Success Response (200) - **word-info** (object) - Returns a word-info object containing sequence, text, kana, and score. ``` ```APIDOC ## find-word-info ### Description Finds all matching dictionary entries for a word with full gloss information. ### Method FUNCTION ### Parameters #### Request Body - **text** (string) - Required - The word to search. - **reading** (string) - Optional - Filter by specific reading. - **root-only** (boolean) - Optional - If true, excludes conjugated variants. ### Response #### Success Response (200) - **list** (array) - List of word-info objects. ``` ```APIDOC ## find-word-info-json ### Description Returns word information in JSON format suitable for web APIs. ### Method FUNCTION ### Parameters #### Request Body - **text** (string) - Required - The word to search. ### Response #### Success Response (200) - **json** (object) - JSON object containing reading, text, kana, sequence, and gloss data. ``` -------------------------------- ### Convert Hiragana to Katakana Source: https://context7.com/tshatrov/ichiran/llms.txt Use `as-katakana` to convert Hiragana characters to their Katakana equivalents. This function processes text character by character. ```lisp ;; Convert hiragana to katakana (ichiran/characters:as-katakana "とうきょう") ;; => "トウキョウ" ``` -------------------------------- ### Convert Katakana to Hiragana Source: https://context7.com/tshatrov/ichiran/llms.txt Use `as-hiragana` to convert Katakana characters to their Hiragana equivalents. This function processes text character by character. ```lisp ;; Convert katakana to hiragana (ichiran/characters:as-hiragana "トウキョウ") ;; => "とうきょう" ``` -------------------------------- ### Convert Numbers to Kana Reading Source: https://context7.com/tshatrov/ichiran/llms.txt The `number-to-kana` function converts numbers into their phonetic readings in Kana. It correctly applies sound changes (sandhi) for pronunciation. ```lisp ;; Convert number to kana reading (ichiran/numbers:number-to-kana 100) ;; => "ひゃく" (ichiran/numbers:number-to-kana 300) ;; => "さんびゃく" ; sandhi: ひゃく -> びゃく (ichiran/numbers:number-to-kana 800) ;; => "はっぴゃく" ; sandhi: はち + ひゃく -> はっぴゃく (ichiran/numbers:number-to-kana 3000) ;; => "さんぜん" ; sandhi: せん -> ぜん ``` -------------------------------- ### Normalize Punctuation Source: https://context7.com/tshatrov/ichiran/llms.txt The `normalize` function also processes and standardizes Japanese punctuation marks. ```lisp ;; Normalize punctuation (ichiran/characters:normalize "「こんにちは」、世界!") ;; => "\"こんにちは\", 世界! " ``` -------------------------------- ### Kanji Analysis API Source: https://context7.com/tshatrov/ichiran/llms.txt Endpoints for analyzing kanji characters, their readings, and associated words. ```APIDOC ## kanji-info-json ### Description Returns comprehensive information about a kanji character including readings, meanings, stroke count, and usage statistics. ### Method FUNCTION ### Parameters #### Request Body - **text** (string) - Required - The kanji character. ### Response #### Success Response (200) - **json** (object) - Object containing strokes, grade, frequency, readings, and meanings. ``` ```APIDOC ## match-readings-json ### Description Analyzes how kanji characters are read within a word, matching readings to individual characters. ### Method FUNCTION ### Parameters #### Request Body - **kanji** (string) - Required - The kanji string. - **reading** (string) - Required - The reading to analyze. ### Response #### Success Response (200) - **json** (array) - Array of objects mapping kanji to readings and statistical data. ``` -------------------------------- ### Romanization API Source: https://context7.com/tshatrov/ichiran/llms.txt Functions for converting Japanese text and words into various romanization formats. ```APIDOC ## romanize ### Description Converts Japanese sentences to romanized form. Supports multiple romanization methods and optional dictionary information. ### Parameters #### Request Body - **text** (string) - Required - The Japanese text to romanize. - **with-info** (boolean) - Optional - If true, returns word-by-word dictionary information. - **method** (symbol) - Optional - The romanization method (e.g., ichiran:*hepburn-basic*). ### Response - **result** (string/list) - The romanized string or a list containing the string and dictionary metadata. ## romanize* ### Description Returns romanized text with detailed segmentation metadata including alternative interpretations and scores. ### Parameters #### Request Body - **text** (string) - Required - The Japanese text to process. - **limit** (integer) - Optional - Maximum number of alternative segmentations. - **wordprop-fn** (function) - Optional - A function to extract properties from word-info objects. ## romanize-word ### Description Converts a single Japanese word (kana) to romaji. ### Parameters #### Request Body - **word** (string) - Required - The Japanese word to convert. - **method** (symbol) - Optional - The romanization method. ``` -------------------------------- ### Add Errata to Database Source: https://context7.com/tshatrov/ichiran/llms.txt Use `add-errata` to apply corrections or errata to the existing Ichiran database, ensuring data accuracy. ```lisp ;; Add errata/corrections to existing database (ichiran/maintenance:add-errata) ``` -------------------------------- ### Single Word Romanization Source: https://context7.com/tshatrov/ichiran/llms.txt Converts a single Japanese word (kana) to romaji. The :method option allows specifying the romanization system. ```lisp ;; Basic word romanization (ichiran:romanize-word "ありがとう") ;; => "arigatō" ``` ```lisp ;; With specific method (ichiran:romanize-word "ありがとう" :method ichiran:*hepburn-simple*) ;; => "arigato" ``` -------------------------------- ### Find Words Containing Kanji - Lisp Source: https://context7.com/tshatrov/ichiran/llms.txt Retrieves common words that contain a specific kanji character. Returns a list of (seq kanji-text kana-text common-rating). ```lisp ;; Find words containing a kanji (ichiran/dict:get-kanji-words "食") ;; Returns list of (seq kanji-text kana-text common-rating): ;; ((1358280 "食べる" "たべる" 1) ;; (1394190 "食事" "しょくじ" 1) ;; (1358270 "食べ物" "たべもの" 2) ;; ...) ``` -------------------------------- ### Geographic Name Romanization Source: https://context7.com/tshatrov/ichiran/llms.txt Romanizes geographic names, automatically capitalizing the first letter of the result. ```lisp ;; Geographic names (capitalizes result) (ichiran:romanize-word-geo "おおさか") ;; => "Osaka" ``` ```lisp (ichiran:romanize-word-geo "とうきょう") ;; => "Tokyo" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.