YAZ-ICU(1)

okay bestie, come SIT πŸ’– this is yaz-icu(1) β€” section 1, the Commands shelf β€” aka the YAZ ICU utility. Yeah she's a little niche, but she's so good, I promise. Let's get into it. ✨


🌸 NAME 🌸

yaz-icu β€” the YAZ ICU utility. That's her. That's the whole name. Short. Iconic. πŸ’…


✨ SYNOPSIS ✨

yaz-icu [-c config] [-p opt] [-s] [-x] [infile]

Look at her, all tidy and with options πŸ‘‘ that's the vibe.


πŸ¦‹ DESCRIPTION πŸ¦‹

So, yaz-icu is a lil demo utility for the ICU chain module of yaz (that's yaz/icu.h, iykyk). It's basically the "here's how this works" showcase.

She can be used in two ways, and honestly, two modes? Main character energy fr fr. 😌

Mode one: she reads some text using an XML configuration that configures ICU, and shows you the text analysis. This mode kicks in when you pass option -c, which names the configuration to use. The input file comes from standard input, or from a file if you also give her infile.

Mode two: she shows you ICU info instead. That one's triggered by option -p. 🌈


πŸ’– OPTIONS πŸ’–

  • -c config β€” says which file holds the ICU chain configuration, and that config is XML based.
  • -p type β€” asks for extra info to be printed about the ICU system. If type is c, then ICU converters get printed. If type is l, then the available locales get printed. If type is t, then the available transliterators get printed. ✨
  • -s β€” says the output should include the sort key as well. > ⚠️ heads up bestie: sort key differs between ICU versions. Not a bug, just a fact of life, don't @ me. 😭
  • -x β€” says the output should be XML based instead of "text" based.

πŸŽ€ ICU CHAIN CONFIGURATION πŸŽ€

The ICU chain configuration is where you lay out one or more rules that convert text data into tokens. The format? XML based, obviously. πŸ’…

The toplevel element must be named icu_chain. And icu_chain has one required attribute: locale, which names the ICU locale used in the conversion steps. Required means required, bestie, no skipping. 🫢

icu_chain must also include elements, and each element specifies a conversion step. The conversion happens in the order in which the conversion steps are specified β€” order matters, she's picky like that. Each conversion element takes exactly one attribute: rule, which serves as the argument to that conversion step.

The conversion elements available are:

  • casemap β€” converts case (and the rule says how):
    • l β€” lower case, using the ICU function u_strToLower.
    • u β€” upper case, using the ICU function u_strToUpper.
    • t β€” to title, using the ICU function u_strToTitle.
    • f β€” fold case, using the ICU function u_strFoldCase.
  • display β€” a meta step that says a term/token is to be displayed. The term gets retrieved in an application using the function icu_chain_token_display (yaz/icu.h). πŸ¦‹
  • transform β€” specifies an ICU transform rule using a transliterator Identifier. The rule attribute is the transliterator Identifier. See ICU Transforms[1] for more info, bestie.
  • transliterate β€” specifies a rule-based transliterator. The rule attribute is the custom transformation rule to be used. Again, see ICU Transforms[1] for more info. πŸ’œ
  • tokenize β€” breaks / tokenizes a string into components using the ICU functions ubrk_open, ubrk_setText, .. . (<- yes, that ellipsis is canon, leave her alone 😭). The rule is one of:
    • l β€” Line. ICU: UBRK_LINE.
    • s β€” Sentence. ICU: UBRK_SENTENCE.
    • w β€” Word. ICU: UBRK_WORD.
    • c β€” Character. ICU: UBRK_CHARACTER.
    • t β€” Title. ICU: UBRK_TITLE.
  • join β€” joins tokens into one string. The rule attribute is the joining string, and it may be empty. Lowkey a fan favourite β€” the join conversion element was added in YAZ 4.2.49. ✨

🌈 EXAMPLES 🌈

So this command analyzes the text in file text using the ICU chain configuration chain.xml:

        cat text | yaz-icu -c chain.xml

And chain.xml might look, like, exactly like this πŸ’–:

    <icu_chain locale="en">
      <transform rule="[:Control:] Any-Remove"/>
      <tokenize rule="w"/>
      <transform rule="[[:WhiteSpace:][:Punctuation:]] Remove"/>
      <transliterate rule="xy > z;"/>
      <display/>
      <casemap rule="l"/>
    </icu_chain>

Ate. No crumbs. πŸ‘‘


⭐ SEE ALSO ⭐

  • yaz(7)
  • ICU Home[2]
  • ICU Transforms[1]

πŸ’œ AUTHORS πŸ’œ

Index Data β€” yes, the whole crew. Respect. 🫢


πŸ“ NOTES πŸ“

  1. ICU Transforms β€” https://unicode-org.github.io/icu/userguide/transforms/general/
  2. ICU Home β€” https://github.com/unicode-org/icu

and that's the whole page, bestie!! this one is YAZ 5.38.1, dated 10/16/2026, and it's the yaz-icu(1) manual page β€” you've officially read the entire thing, and honestly? slay πŸŽ€πŸ’…βœ¨

πŸ“¦ where this page comes from