Tree @lintian-fixes/main (Download .tar.gz)
- ..
- calculator
- __init__.py
- BUILD
- calculator_rewriter.cc
- calculator_rewriter.h
- calculator_rewriter_test.cc
- collocation_rewriter.cc
- collocation_rewriter.h
- collocation_rewriter_test.cc
- collocation_util.cc
- collocation_util.h
- collocation_util_test.cc
- command_rewriter.cc
- command_rewriter.h
- command_rewriter_test.cc
- correction_rewriter.cc
- correction_rewriter.h
- correction_rewriter_test.cc
- date_rewriter.cc
- date_rewriter.h
- date_rewriter_test.cc
- dice_rewriter.cc
- dice_rewriter.h
- dice_rewriter_test.cc
- dictionary_generator.cc
- dictionary_generator.h
- dictionary_generator_test.cc
- emoji_rewriter.cc
- emoji_rewriter.h
- emoji_rewriter_test.cc
- emoticon_rewriter.cc
- emoticon_rewriter.h
- emoticon_rewriter_test.cc
- english_variants_rewriter.cc
- english_variants_rewriter.h
- english_variants_rewriter_test.cc
- focus_candidate_rewriter.cc
- focus_candidate_rewriter.h
- focus_candidate_rewriter_test.cc
- fortune_rewriter.cc
- fortune_rewriter.h
- fortune_rewriter_test.cc
- gen_collocation_data_main.cc
- gen_collocation_suppression_data_main.cc
- gen_counter_suffix_array.py
- gen_emoji_rewriter_data.py
- gen_emoticon_rewriter_data.cc
- gen_existence_data.cc
- gen_existence_data.h
- gen_reading_correction_data.py
- gen_single_kanji_noun_prefix_data.cc
- gen_single_kanji_rewriter_data.py
- gen_symbol_rewriter_dictionary_main.cc
- gen_usage_rewriter_dictionary_main.cc
- katakana_promotion_rewriter.cc
- katakana_promotion_rewriter.h
- katakana_promotion_rewriter_test.cc
- language_aware_rewriter.cc
- language_aware_rewriter.h
- language_aware_rewriter_test.cc
- merger_rewriter.h
- merger_rewriter_test.cc
- normalization_rewriter.cc
- normalization_rewriter.h
- normalization_rewriter_test.cc
- number_compound_util.cc
- number_compound_util.h
- number_compound_util_test.cc
- number_rewriter.cc
- number_rewriter.h
- number_rewriter_test.cc
- remove_redundant_candidate_rewriter.cc
- remove_redundant_candidate_rewriter.h
- remove_redundant_candidate_rewriter_test.cc
- rewriter.cc
- rewriter.gyp
- rewriter.h
- rewriter_base.gyp
- rewriter_interface.h
- rewriter_test.cc
- rewriter_test.gyp
- single_kanji_rewriter.cc
- single_kanji_rewriter.h
- single_kanji_rewriter_test.cc
- symbol_rewriter.cc
- symbol_rewriter.h
- symbol_rewriter_test.cc
- transliteration_rewriter.cc
- transliteration_rewriter.h
- transliteration_rewriter_test.cc
- unicode_rewriter.cc
- unicode_rewriter.h
- unicode_rewriter_test.cc
- usage_rewriter.cc
- usage_rewriter.h
- usage_rewriter_test.cc
- user_boundary_history_rewriter.cc
- user_boundary_history_rewriter.h
- user_boundary_history_rewriter_test.cc
- user_dictionary_rewriter.cc
- user_dictionary_rewriter.h
- user_dictionary_rewriter_test.cc
- user_segment_history_rewriter.cc
- user_segment_history_rewriter.h
- user_segment_history_rewriter_test.cc
- variants_rewriter.cc
- variants_rewriter.h
- variants_rewriter_test.cc
- version_rewriter.cc
- version_rewriter.h
- version_rewriter_test.cc
- zipcode_rewriter.cc
- zipcode_rewriter.h
- zipcode_rewriter_test.cc
gen_single_kanji_noun_prefix_data.cc @lintian-fixes/main — raw · history · blame
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | // Copyright 2010-2020, Google Inc. // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <map> #include <string> #include "base/flags.h" #include "base/init_mozc.h" #include "base/port.h" #include "data_manager/serialized_dictionary.h" DEFINE_string(output_token_array, "", "Output token array of noun prefix dictionary"); DEFINE_string(output_string_array, "", "Output string array of noun prefix dictionary"); namespace { struct NounPrefix { const char *key; const char *value; int16 rank; } kNounPrefixList[] = { {"お", "お", 1}, {"ご", "ご", 1}, // {"ご", "誤"}, // don't register it as 誤 isn't in the ipadic. // {"み", "み"}, // seems to be rare. {"もと", "もと", 1}, {"だい", "代", 1}, {"てい", "低", 0}, {"もと", "元", 1}, {"ぜん", "全", 0}, {"さい", "再", 0}, {"しょ", "初", 1}, {"はつ", "初", 0}, {"ぜん", "前", 1}, {"かく", "各", 1}, {"どう", "同", 1}, {"だい", "大", 1}, {"おお", "大", 1}, {"とう", "当", 1}, {"ご", "御", 1}, {"お", "御", 1}, {"しん", "新", 1}, {"さい", "最", 1}, {"み", "未", 0}, {"ほん", "本", 1}, {"む", "無", 0}, {"だい", "第", 1}, {"とう", "等", 1}, {"やく", "約", 1}, {"ひ", "被", 1}, {"ちょう", "超", 1}, {"ちょう", "長", 1}, {"なが", "長", 1}, {"ひ", "非", 1}, {"こう", "高", 1}, }; } // namespace int main(int argc, char **argv) { mozc::InitMozc(argv[0], &argc, &argv); std::map<std::string, mozc::SerializedDictionary::TokenList> tokens; for (const NounPrefix &entry : kNounPrefixList) { std::unique_ptr<mozc::SerializedDictionary::CompilerToken> token( new mozc::SerializedDictionary::CompilerToken); token->value = entry.value; token->lid = 0; token->rid = 0; token->cost = entry.rank; tokens[entry.key].emplace_back(std::move(token)); } mozc::SerializedDictionary::CompileToFiles(tokens, FLAGS_output_token_array, FLAGS_output_string_array); return 0; } |