<commit_before>/* @(#)hanyupinying.c
 */

#include <stdio.h>
#include <string.h>
#include "hanyupinying.h"

/*
  according to http://oclccjk.lib.uci.edu/pycywg.htm
 */
#define HANYU_INITIALS 23
PinYingZuinMap hanyuInitialsMap[HANYU_INITIALS] = {
    {"b" , "1"}, {"p" , "q"}, {"m" , "a"}, {"f" ,"z"},
    {"d" , "2"}, {"t" , "w"}, {"n" , "s"}, {"l" ,"x"},
    {"g" , "e"}, {"k" , "d"}, {"h" , "c"},
    {"j" , "r"}, {"g" , "f"}, {"x" , "v"},
    {"zh", "5"}, {"ch", "t"}, {"sh", "g"}, {"r" ,"b"},
    {"z" , "y"}, {"c" , "h"}, {"s" , "n"},
    {"er", "-"}
};

#define HANYU_FINALS 40
PinYingZuinMap hanyuFinalsMap[HANYU_FINALS] = {
    {"iang","u;"},
    {"iong","m/"},
    {"uang","j;"},
    {"uang","j;"},
    {"yuan","m0"},

    {"ang",";"},
    {"eng","/"},
    {"ian","u0"},
    {"iao","ul"},
    {"ing","u/"},
    {"ong","j/"},
    {"uai","j9"},
    {"uan","j0"},
    {"uei","jo"},
    {"yue","m,"},
    {"yun","mp"},

    {"ai","9" },
    {"an","0" },
    {"ao","l" },
    {"ei","o" },
    {"en","p" },
    {"ia","u8"},
    {"ie","u,"},
    {"in","up"},
    {"iu","u."},
    {"ou","l" },
    {"ou","l" },
    {"un","jp"},
    {"wa","j8"},
    {"wo","ji"},
    {"ya","m8"},
    {"yu","m"},

    {"a","8"},
    {"e",","},
    {"e","k"},
    {"o","i"},
    {"w","j"},
    {"y","u"},
    {"r","-"}
};

/*
  0: Success
  Non-Zero: Fail to fully convert
  1: Failed fo lookup initals
  2: Failed fo lookup finals
  Map pinyin key-sequence to Zuin key-sequence.
  Caller should allocate char zuin[4].
 */

int<commit_msg> r10906@ib:  gugod | 2005-02-19 11:33:50 +0800  So, "umlaut u" is deonted as "v".<commit_after>/* @(#)hanyupinying.c
 */

#include <stdio.h>
#include <string.h>
#include "hanyupinying.h"

/*
  according to http://oclccjk.lib.uci.edu/pycywg.htm
 */
#define HANYU_INITIALS 23
PinYingZuinMap hanyuInitialsMap[HANYU_INITIALS] = {
    {"b" , "1"}, {"p" , "q"}, {"m" , "a"}, {"f" ,"z"},
    {"d" , "2"}, {"t" , "w"}, {"n" , "s"}, {"l" ,"x"},
    {"g" , "e"}, {"k" , "d"}, {"h" , "c"},
    {"j" , "r"}, {"g" , "f"}, {"x" , "v"},
    {"zh", "5"}, {"ch", "t"}, {"sh", "g"}, {"r" ,"b"},
    {"z" , "y"}, {"c" , "h"}, {"s" , "n"},
    {"er", "-"}
};

#define HANYU_FINALS 40
PinYingZuinMap hanyuFinalsMap[HANYU_FINALS] = {
    {"iang","u;"},
    {"iong","m/"},
    {"uang","j;"},
    {"uang","j;"},

    {"ang",";"},
    {"eng","/"},
    {"ian","u0"},
    {"iao","ul"},
    {"ing","u/"},
    {"ong","j/"},
    {"uai","j9"},
    {"uan","j0"},
    {"uei","jo"},
    {"van","m0"},
    {"ve","m,"},
    {"vn","mp"},

    {"ai","9" },
    {"an","0" },
    {"ao","l" },
    {"ei","o" },
    {"en","p" },
    {"ia","u8"},
    {"ie","u,"},
    {"in","up"},
    {"iu","u."},
    {"ou","l" },
    {"ou","l" },
    {"un","jp"},
    {"va","m8"},
    {"wa","j8"},
    {"wo","ji"},

    {"a","8"},
    {"e",","},
    {"e","k"},
    {"o","i"},
    {"r","-"},
    {"v","m"},
    {"w","j"},
    {"y","u"}
};

/*
  0: Success
  Non-Zero: Fail to fully convert
  1: Failed fo lookup initals
  2: Failed fo lookup finals
  Map pinyin key-sequence to Zuin key-sequence.
  Caller should allocate char zuin[4].
 */

int
{'fraction_non_alphanumeric': 0.3683193818415969, 'fraction_numerical': 0.02092723760463619, 'mean_word_length': 2.766060606060606, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7442968', 'n_tokens_mistral': 1467, 'n_tokens_neox': 1403, 'n_words': 275}