Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Full text geoparsing as a Python library
| Date | Stars |
|---|---|
| 2026-07-24 | 767 |
| 2026-07-25 | 767 |
| 2026-07-28 | 767 |
| 2026-07-30 | 767 |
| 2026-08-06 | 767 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day

Full text geoparsing as a Python library. Extract the place names from a
piece of English-language text, resolve them to the correct place, and return
their coordinates and structured geographic information.
**Mordecai is ready for an upgrade!** Please take the user survey [here](https://z0l4ihmu0ud.typeform.com/to/b8FmCfMt)
to help shape what v3 will look like.
Example usage
-------------
```
>>> from mordecai import Geoparser
>>> geo = Geoparser()
>>> geo.geoparse("I traveled from Oxford to Ottawa.")
[{'country_conf': 0.96474487,
'country_predicted': 'GBR',
'geo': {'admin1': 'England',
'country_code3': 'GBR',
'feature_class': 'P',
'feature_code': 'PPLA2',
'geonameid': '2640729',
'lat': '51.75222',
'lon': '-1.25596',
'place_name': 'Oxford'},
'spans': [{'end': 22, 'start': 16}],
'word': 'Oxford'},
{'country_conf': 0.83302397,
'country_predicted': 'CAN',
'geo': {'admin1': 'Ontario',
'country_code3': 'CAN',
'feature_class': 'P',
'feature_code': 'PPLC',
'geonameid': '6094817',
'lat': '45.41117',
'lon': '-75.69812',
'place_name': 'Ottawa'},
'spans': [{'end': 32, 'start': 26}],
'word': 'Ottawa'}]
```
Mordecai requires a running Elasticsearch service with Geonames in it. See
"Installation" below for instructions.
Installation and Requirements
--------------------
1. Mordecai is on PyPI and can be installed for Python 3 with pip:
```
pip install mordecai
```
**Note**: It's *strongly* recommended that you run Mordecai in a virtual
environment. The libraries that Mordecai depends on are not always the most
recent versions and using a virtual environment prevents libraries from being
downgraded or running into other issues:
```
python -m venv mordecai-env
source mordecai-env/bin/activate
pip install mordecai
```
2. You should then download the required spaCy NLP model:
```
python -m spacy download en_core_web_lg
```
3. In order to work, Mordecai needs access to a Geonames gazetteer running in
Elasticsearch. The easiest way to set it up is by running the following
commands (you must have [Docker](https://docs.docker.com/engine/installation/)
installed first).
```
docker pull elasticsearch:5.5.2
wget https://andrewhalterman.com/files/geonames_index.tar.gz --output-file=wget_log.txt
tar -xzf geonames_index.tar.gz
docker run -d -p 127.0.0.1:9200:9200 -v $(pwd)/geonames_index/:/usr/share/elasticsearch/data elasticsearch:5.5.2
```
See the [es-geonames](https://github.com/openeventdata/es-geonames) for the code used
to produce this index.
To update the index, simply shut down the old container, re-download the index
from s3, and restart the container with the new index.
Citing
------
If you use this software in academic work, please cite as
```
@article{halterman2017mordecai,
title={Mordecai: Full Text Geoparsing and Event Geocoding},
author={Halterman, Andrew},
journal={The Journal of Open Source Software},
volume={2},
number={9},
year={2017},
doi={10.21105/joss.00091}
}
```
How does it work?
-----------------
Mordecai takes in unstructured text and returns structured geographic information extracted
from it.
- It uses [spaCy](https://github.com/explosion/spaCy/)'s named entity recognition to
extract placenames from the text.
- It uses the [geonames](http://www.geonames.org/)
gazetteer in an [Elasticsearch](https://www.elastic.co/products/elasticsearch) index
(with some custom logic) to find the potential coordinates of
extracted place names.
- It uses neural networks implemented in [Keras](https://keras.io/) and trained on new annotated
English-language data labeled with [Prodigy](https://prodi.gy/) to infer the correct country and correct gazetteer entries for each
placename.
The training data for the two models includes copyrighted text so cannot be
shared freely. Applying Mordecai to non-English language text would require labeling data
in the target language and retraining.
API and ConfiExcerpt of 7,420 characters
Read on GitHub143
43
43
Arfon Smith · United Kingdom
1
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:b0e74ee5bb151b9d, topic:nlp, topic:spacy, readme:named entity recognition