Skip to content

Commit

Permalink
added testing files
Browse files Browse the repository at this point in the history
  • Loading branch information
Bikatr7 committed Jun 8, 2024
1 parent 65c9c7b commit e531f56
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 0 deletions.
140 changes: 140 additions & 0 deletions genders.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"Male": {
"Ijūin": ["伊集院"],
"Iki": ["井木"],
"Ishida": ["石田"],
"Keisei": ["啓誠"],
"Kijima": ["鬼島"],
"Kisarazu": ["木更津"],
"Kinugasa": ["衣笠"],
"Ohba": ["大場"],
"Onizuka": ["鬼塚"],
"Satonaka": ["里中"],
"Shiro": ["志朗"],
"Sonezaki": ["曽根崎"],
"Sōya": ["宗谷"],
"Sugio": ["杉尾"],
"Tatebayashi": ["舘林"],
"Tomose": ["トモセ"],
"Toyohashi": ["豊橋"],
"Asama Hisashi": ["浅間", ""],
"Ayanokōji Atsuomi": ["綾小路", "篤臣"],
"Ayanokōji Kiyotaka": ["綾小路", "清隆"],
"Hamaguchi Tetsuya": ["浜口", "哲也"],
"Hashimoto Masayoshi": ["橋本", "正義"],
"Hirata Yōsuke": ["平田", "洋介"],
"Hondō Ryōtarō": ["本堂", "遼太郎"],
"Hōsen Kazuomi": ["宝泉", "和臣"],
"Ike Kanji": ["", "寛治"],
"Ishigami Kyō": ["石上", ""],
"Ishizaki Daichi": ["石崎", "大地"],
"Isomaru Yōkō": ["磯丸", "容幸"],
"Kamogawa Toshizō": ["鴨川", "俊三"],
"Kanzaki Ryūji": ["神崎", "隆二"],
"Katsuragi Kōhei": ["葛城", "康平"],
"Kiriyama Ikuto": ["桐山", "生叶"],
"Kitō Hayato": ["鬼頭", ""],
"Komiya Kyōgo": ["小宮", "叶吾"],
"Kondō Reo": ["近藤", "玲音"],
"Kōenji Rokusuke": ["高円寺", "六助"],
"Kōji Machida": ["浩二", "町田"],
"Kusuda Yukitsu": ["楠田", "ゆきつ"],
"Mashima Tomonari": ["真嶋", "智也"],
"Miyake Akito": ["三宅", "明人"],
"Miyamoto Sōshi": ["宮本", "蒼士"],
"Nagumo Miyabi": ["南雲", ""],
"Naoe Jinnosuke": ["直江", "仁之助"],
"Norihito Watanabe": ["渡辺", "紀仁"],
"Okitani Kyōsuke": ["沖谷", "京介"],
"Ryūen Kakeru": ["龍園", ""],
"Sakagami Kazuma": ["坂上", "数馬"],
"Sakayanagi Narimori": ["坂柳", "成守"],
"Sanada Kousei": ["真田", "康生"],
"Shiba Katsunori": ["司馬", "克典"],
"Shibata Sō": ["柴田", ""],
"Sotomura Hideo": ["外村", "秀雄"],
"Sudō Ken": ["須藤", ""],
"Suzukake Tanji": ["鈴懸", "鍛治"],
"Tachibana Kento": ["立花", "賢人"],
"Takahashi Osamu": ["高橋", ""],
"Tokitō Hiroya": ["時任", "裕也"],
"Totsuka Yahiko": ["戸塚", "弥彦"],
"Tsukishiro Tokinari": ["月城", "常成"],
"Utomiya Riku": ["宇都宮", ""],
"Yagami Takuya": ["八神", "拓也"],
"Yamada Albert": ["山田", "アルベルト"],
"Yamauchi Haruki": ["山内", "春樹"],
"Yanagi Yasuhisa": ["", "安久"],
"Yukimura Teruhiko": ["幸村", "輝彦"]
},
"Female": {
"Akiyama": ["秋山"],
"Isoyama": ["磯山"],
"Mii": ["みー"],
"Mika": ["美香"],
"Minamikawa": ["南川"],
"Amasawa Ichika": ["天沢", "一夏"],
"Amikura Mako": ["網倉", "麻子"],
"Andō Sayo": ["安藤", "紗代"],
"Asahina Nazuna": ["朝比奈", "なずな"],
"Azuma Sana": ["", "咲菜"],
"Chabashira Sae": ["茶柱", "佐枝"],
"Enoshima Midoriko": ["榎嶋", "翠子"],
"Hasebe Haruka": ["長谷部", "波瑠加"],
"Himeno Yuki": ["姫野", "ユキ"],
"Horikita Suzune": ["堀北", "鈴音"],
"Hoshinomiya Chie": ["星之宮", "知恵"],
"Ibuki Mio": ["伊吹", ""],
"Ichinose Honami": ["一之瀬", "帆波"],
"Inogashira Kokoro": ["井の頭", ""],
"Kamuro Masumi": ["神室", "真澄"],
"Karuizawa Kei": ["軽井沢", ""],
"Kikyō Kushida": ["桔梗", "櫛田"],
"Kinoshita Minori": ["木下", "美野里"],
"Kiryūin Fūka": ["鬼龍院", "楓花"],
"Kobashi Yume": ["小橋", ""],
"Manabe Shiho": ["真鍋", "志保"],
"Matsushita Chiaki": ["松下", "千秋"],
"Mori Nene": ["", "寧々"],
"Morishita Ai": ["森下", ""],
"Nanase Tsubasa": ["七瀬", ""],
"Nishino Takeko": ["西野", "武子"],
"Onodera Kayano": ["小野寺", "かや乃"],
"Sakayanagi Arisu": ["坂柳", "有栖"],
"Sakura Airi": ["佐倉", "愛里"],
"Satō Maya": ["佐藤", "麻耶"],
"Shiina Hiyori": ["椎名", "ひより"],
"Shinohara Satsuki": ["篠原", "さつき"],
"Shiranami Chihiro": ["白波", "千尋"],
"Suchi Moeka": ["須知", "萌香"],
"Tachibana Akane": ["", ""],
"Tsubaki Sakurako": ["椿", "桜子"],
"Wan Mei-Yui": ["", "美雨"],
"Yabu Nanami": ["", "菜々美"],
"Yamamura Miki": ["山村", "美紀"],
"Yamanaka Ikuko": ["山中", "郁子"],
"Yamashita Saki": ["鈴代", "紗弓"]
},
"Unknown": {
"Anzai": ["安在"],
"Jima": [""],
"Kosumi": ["小角"],
"Midora": ["美空"],
"Namekawa": ["滑川"],
"Obokata": ["小保方"],
"Ryūko": ["竜子"],
"Yano": ["矢野"],
"king": ["Wan-sama"],
"Eikura Mami": ["榮倉", "まみ"],
"Fukuchi Hinano": ["福地陽", "菜乃"],
"Hagiwara Chihaya": ["萩原", "千颯"],
"Hatsukawa Maho": ["初川", "舞峰"],
"Iguchi Yuri": ["井口", "由里"],
"Nishimura Ryūko": ["西村", "龍子"],
"Sawada Yasumi": ["沢田", "恭美"],
"Shintoku Tarō": ["新徳", "太郎"],
"Tatewaki Aoi": ["帯刀", ""],
"Tōdō Rin": ["藤堂", ""],
"Yamashita Naohisa": ["山下", "直久"]
}
}
3 changes: 3 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from modules.common.gender_util import find_name_gender

print(find_name_gender("Sakayanagi Arisu"))
23 changes: 23 additions & 0 deletions modules/common/gender_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## custom modules
from modules.common.file_ensurer import FileEnsurer

import json

def load_genders(file_path):
with open(file_path, 'r', encoding='utf-8') as file:
return json.load(file)

def find_name_gender(name) -> list[str]:

result = []

genders = load_genders(FileEnsurer.external_translation_genders_path)

# Check each gender category
for gender, names in genders.items():
# Check each full name and partial names in the gender category
for full_name, parts in names.items():
if(name in full_name.split() or name in parts):
result.append(gender)

return result

0 comments on commit e531f56

Please sign in to comment.