Package: lenu
lenu - Legal Entity Name Understandingin collaboration withlenuis a python library that helps to understand and work with Legal Entity Names
in the context of theLegal Entity Identifier(LEI) Standard (ISO 17441)
as well as theEntity Legal Form (ELF) Code ListStandard (ISO 20275).The library utilizes Machine Learning with Transformers and scikit-learn. It provides and utilizes pre-trained ELF Detection models published athttps://huggingface.co/Sociovestix. This code as well as the LEI data and models are distributed under Creative Commons Zero 1.0 Universal license.The project was started in November 2021 as a collaboration of theGlobal Legal Entity Identifier Foundation(GLEIF) andSociovestix Labswith the goal to explore how Machine Learning can support in detecting the legal form (ELF Code) from a legal name.It provides:an interface to downloadLEIandELF Codedata from GLEIF's public websitean interface to train and make use of Machine Learning models to classify ELF Codes from given Legal Namesan interface to use pre-trained ELF Detection models published onhttps://huggingface.co/SociovestixDependencieslenurequirespython (>=3.8, <3.10)scikit-learn- Provides Machine Learning functionality for token based modellingtransformers- Download and applying Neural Network Modelspytorch- Machine Learning Framework to train Neural Network Modelspandas- For reading and handling dataTyper- Adds the command line interfacerequestsandpydantic- For downloading LEI data from GLEIF's websiteInstallationvia PyPI:pipinstalllenuFrom github:pipinstallhttps://github.com/Sociovestix/lenuEditable install from locally cloned repositorygitclonehttps://github.com/Sociovestix/lenu
pipinstall-elenuUsageCreate folders for LEI and ELF Code data and to store your modelsmkdirdata
mkdirmodelsDownload LEI data and ELF Code data into yourdatafolderlenudownloadTrain a (default) ELF Code Classification model. An ELF Classification model is always Jurisdiction specific and
will be trained from Legal Names from this Jurisdiction.Examples:lenutrainDE# GermanylenutrainUS-DE# United States - DelawarelenutrainIT# Italy# enable logging to see more information like the number of samples and accuracylenu--enable-loggingtrainCHIdentify ELF Code by using a model. The tool will return the best scoring ELF Codes.lenuelfDE"Hans Müller KG"#   ELF Code                  Entity Legal Form name Local name     Score# 0     8Z6G                              Kommanditgesellschaft  0.979568# 1     V2YH                       Stiftung des privaten Rechts  0.001141# 2     OL20  Einzelunternehmen, eingetragener Kaufmann, ein...  0.000714You can also use pre-trained models, which is recommended in most cases:# Model available at https://huggingface.co/Sociovestix/lenu_DElenuelfSociovestix/lenu_DE"Hans Müller KG"#  ELF Code      Entity Legal Form name Local name     Score#0     8Z6G                  Kommanditgesellschaft  0.999445#1     2HBR  Gesellschaft mit beschränkter Haftung  0.000247#2     FR3V       Gesellschaft bürgerlichen Rechts  0.000071Support and ContributingFeel free to reach out to eitherSociovestix LabsorGLEIFif you need support in using this library, in utilizing LEI data in general, or in case you would like to contribute to this library in any form.