damirazo / petrovich Goto Github PK
View Code? Open in Web Editor NEWБиблиотека для склонения русских ФИО к нужному падежу
License: MIT License
Библиотека для склонения русских ФИО к нужному падежу
License: MIT License
Добрый день, Дамир.
Спасибо за портирование петровича (думал сам начать, а оказалось уже сделано добрым человеком).
Но обнаружилось, что в пакете на pypi (https://pypi.python.org/pypi/Petrovich/0.1), нет файлика с правилами для петровича (rules.json). Из-за чего зависимость получается не совсем рабочая.
На Python 3.6.9 и Ubuntu 18.04 lastname и middlename не работают, выдают исходное слово. На Python 3.8.3 и Windows 10 64bit тоже не работают.
Было бы полезно иметь функцию для определения падежа фамилии.
Спасибо.
А возможно ли после применения методов получить информацию об извлечённом поле? Или, может, стоит отдельный метод сделать для определения пола? Это было бы очень полезно.
Проблема заключается в кодировке файла rules.json, которую нужно указывать явным образом при открытии файла в Python 3.x.
main.py:36
with open(rules_path, 'r') as fp:
self.data = json.load(fp)
Можно реализовать, например, так:
try:
with open(rules_path, 'r', encoding='utf8') as fp:
self.data = json.load(fp)
except:
with open(rules_path, 'r') as fp:
self.data = json.load(fp)
В результате получаем полностью совместимую с Python3.x библиотеку.
Спасибо!
Например, "Андрюша" в любом падеже так и остаётся "Андрюша".
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.