rskmoi / namedivider-python Goto Github PK
View Code? Open in Web Editor NEWA tool for dividing the Japanese full name into a family name and a given name.
License: MIT License
A tool for dividing the Japanese full name into a family name and a given name.
License: MIT License
GBDTNameDivider occurs FileNotFoundError in environment that user cache directory (/Users/"user_name"/.cache) is not exist.
I paste traceback message when I do sample code and occurs error.
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
/var/folders/cl/wm2yh_cj509fjnj8d5nw0vtw0000gn/T/ipykernel_12025/2559231275.py in <module>
8 basic_divider = BasicNameDivider() # BasicNameDivider is fast but accuracy is 99.2%
9
---> 10 gbdt_divider = GBDTNameDivider() # GBDTNameDivider is slow but accuracy is 99.9%
11 divided_name = gbdt_divider.divide_name("菅義偉")
12 print(divided_name)
~/.pyenv/versions/anaconda3-2021.11/envs/ai_study/lib/python3.9/site-packages/namedivider/divider/gbdt_name_divider.py in __init__(self, config)
21 config = GBDTNameDividerConfig()
22 super().__init__(config=config)
---> 23 download_family_name_pickle_if_needed(config.path_family_names)
24 download_gbdt_model_v1_if_needed(config.path_model)
25 kanji_statistics_repository = KanjiStatisticsRepository(path_csv=config.path_csv)
~/.pyenv/versions/anaconda3-2021.11/envs/ai_study/lib/python3.9/site-packages/namedivider/util.py in download_family_name_pickle_if_needed(path)
39 if path.exists():
40 return None
---> 41 DEFAULT_CACHE_DIR.mkdir(exist_ok=True)
42 print("Download FamilyNameRepository from GitHub...")
43 content = requests.get(FAMILY_NAME_REPOSITORY_URL).content
~/.pyenv/versions/anaconda3-2021.11/envs/ai_study/lib/python3.9/pathlib.py in mkdir(self, mode, parents, exist_ok)
1321 """
1322 try:
-> 1323 self._accessor.mkdir(self, mode)
1324 except FileNotFoundError:
1325 if not parents or self.parent == self:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/"user_name"/.cache/namedivider-python'
I tried to fix.
namedivider/util.py L.41 changes "DEFAULT_CACHE_DIR.mkdir(exist_ok=True)" -> "DEFAULT_CACHE_DIR.mkdir(exist_ok=True, parents=True)".
But, error cannot fix...
I make /Users/"user_name"/.cache directory by mkdir command. This error don't occurs.
I fixed this problem by myself, but, other user may gets same error and this issue has possibility of useful for you. So, I will report this error in issue.
Was get_family_name_txt_default_path
replaced with something?
I don't think it can be divided perfectly in all cases, but I think it will be helpful for improvement.
input | expected | result |
---|---|---|
中臣鎌足 | 中臣 鎌足 | 中 臣鎌足 |
豊臣秀吉 | 豊臣 秀吉 | 豊 臣秀吉 |
聖徳太子 | 聖徳 太子 | 聖 徳太子 |
First of all, thank you so much @rskmoi for making this package! I tried the demo on https://rskmoi-namedivider-python-examplesdemoexample-streamlit-x2ba84.streamlit.app/ and the results are amazing!
I intend to try it out in our business card management application to increase the accuracy of name dividing.
I have a request: Is it possible to get Kanji names Furigana too, especially all the possible candidates? OSS packages like Sudachi give only one candidate for the Furigana but I would like all possible suggestions for the Furigana.
For example, for the family name "大谷" Sudachi gives "オオヤ" as the output (please see attachment) but probably "オオタニ" is a more common Furigana of the name.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.