--- license: mit base_model: dbmdz/bert-base-turkish-cased pipeline_tag: token-classification library_name: transformers tags: - ner - token-classification - pytorch - turkish - tr - dbmdz - bert - bert-base-cased - bert-base-turkish-cased widget: - text: "Bağlarbaşı Mahallesi, Zübeyde Hanım Caddesi No: 10 / 3 34710 Üsküdar/İstanbul" --- # address-extraction ![Next Geography](https://nextgeography.com/wp-content/uploads/2022/02/next-geo-logo-1.png) This is a simple library to extract addresses from text. The train.py file contains the code to train but is just included for reference, not to be run. The model is trained on our own dataset of addresses, which is not included in this repo. There is also predict.py which is a simple script to run the model on a single address. The model is based on [dbmdz/bert-base-turkish-cased](https://huggingface.co/dbmdz/bert-base-turkish-cased) from [Hugging Face](https://huggingface.co/). ## Example Results ``` (g:\projects\address-extraction\venv) G:\projects\address-extraction>python predict.py Osmangazi Mahallesi, Hoca Ahmet Yesevi Cd. No:34, 16050 Osmangazi/Bursa Osmangazi Mahalle 98.65% Hoca Ahmet Yesevi Cadde 97.63% 34 Bina Numarası 98.92% 16050 Posta Kodu 97.83% Osmangazi İlçe 98.97% Bursa İl 99.21% Average Score: 0.9902257982053255 Labels Found: 6 ---------------------------------------------------------------------- Karşıyaka Mahallesi, Mavişehir Caddesi No: 91, Daire 4, 35540 Karşıyaka/İzmir Karşıyaka Mahalle 99.11% Mavişehir Cadde 97.16% 91 Bina Numarası 98.73% 4 Kat 29.06% 35540 Posta Kodu 98.65% Karşıyaka İlçe 99.17% İzmir İl 99.16% Average Score: 0.9237866433043229 Labels Found: 7 ---------------------------------------------------------------------- Selçuklu Mahallesi, Atatürk Bulvarı No: 55, 42050 Selçuklu/Konya Selçuklu Mahalle 98.67% Atatürk Cadde 57.06% 55 Bina Numarası 98.94% 42050 Posta Kodu 98.81% Selçuklu İlçe 99.06% Konya İl 99.22% Average Score: 0.9659512996673584 Labels Found: 6 ---------------------------------------------------------------------- Alsancak Mahallesi, 1475. Sk. No:3, 35220 Konak/İzmir Alsancak Mahalle 99.38% 1475 Sokak 96.04% 3 Bina Numarası 98.06% 35220 Posta Kodu 98.75% Konak İlçe 99.23% İzmir İl 99.16% Average Score: 0.9909308176291617 Labels Found: 6 ---------------------------------------------------------------------- Kocatepe Mahallesi, Yaşam Caddesi 3. Sokak No:4, 06420 Bayrampaşa/İstanbul Kocatepe Mahalle 99.46% Yaşam Cadde 94.07% 3 Sokak 84.07% 4 Bina Numarası 98.42% 06420 Posta Kodu 98.54% Bayrampaşa İlçe 98.97% İstanbul İl 98.98% Average Score: 0.9832726591511777 Labels Found: 7 ---------------------------------------------------------------------- ``` ## Installation & Usage The environment.yml file contains the conda environment used to run the model. Environment is configured to use cuda enabled gpus but should work with no gpus too. To run the model, you can use the following commands: ```bash conda env create -f environment.yml -p ./condaenv conda activate ./condaenv python predict.py ``` ## License This project is licensed under the terms of the MIT license.