Class RadicalMap


  • public class RadicalMap
    extends Object
    A way to determine the primary (or "semantic") radical of a Chinese character or get the set of characters with a given semantic radical. The information was extracted from the Unihan database with a script and then converted into the string format below.
    Author:
    Galen Andrew
    • Method Detail

      • getRadical

        public static char getRadical​(char ch)
        What is the primary radical of this char?
        Parameters:
        ch - a Chinese character
        Returns:
        the primary radical (also a char) or '.' if char has no radical
      • getChars

        public static Set getChars​(char ch)
        What are the Characters with this primary radical?
        Parameters:
        ch - a Chinese character, interpreted as a radical
        Returns:
        the Set of chars with this as primary radical
      • main

        public static void main​(String[] args)
                         throws IOException
        The main function reads a list of characters and outputs the list with corresponding radicals. If the input character is not Chinese or has no radical (like punctuation) the symbol '.' is output. The flag -infile specifies a file to read characters from. The -encoding flag can be used to specify the input encoding. Any other arguments on the command line will be interpreted as characters to translate.
        Throws:
        IOException