MEHDIE Arabic Name Parser
This is an AI-backed name parser that parses names into their constituent parts. The parser employs an Open-AI GPT Chat
model that is prompted with explanations on how to parse names of the specific chosen language, script and sometimes
historical period. The GPT model is also given a langauge and script specific example.
The response is parsed into a structured response by the phi.agent framework and some post-processing rules are applied
to handle some of the common mistakes the agent makes.
The parser was developed as part of the MEHDIE project- https://mehdie.org/. )
MEHDIE is funded by the Israel Ministry of Science and Technology MOST. )
Usage
The parser can be used to parse a single name or a given tab-seperated file containing names.
Set up
- Choose which language and script to parse from. Supported language-script combinations can be shown by running:
print(parse.get_supported_languages()) - Choose an AI model to use. The model string needs to be one of the valid models specified in the OpenAI API or the Anthropic API.
- Set an environment variable for your chosen AI provider's API key (e.g.
export OPENAI_API_KEY=your-api-keyorexport ANTHROPIC_API_KEY=your-api-key).
Parsing a single name
from parse_me.parse import parse_name
result = parse_name(name="Abū Ayyūb Sulaymān b. Yaḥyā b. Ǧabīrūl al-Qurṭubī", language="arL",
background_info="A fighter and a poet", model_name="gpt-o1-mini")
Use the background_info parameter to provide additional context that can help the parser understand the name better.
Use the model_name parameter to specify the AI model to use, e.g. gpt-4o or claude-3-5-sonnet-latest.
This model should match the API key you have set up.
Parsing a file with names
from parse_me.parse import parse_tsv
result_file = parse_tsv(tsv_file='/data/names.tsv', column_name='person_name', language='he', background_column_name='description',
model_name='gpt-4o')
Contributing
We invite users to contribute new prompts and examples for existing and new languages, scripts and historical periods. Just edit the parsing_prompts and open a pull request or open an issue with suggested additional post-processing rules or encountered mistakes the parser made.
Metadata
Release files for parse-me 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| parse_me-0.2.0.tar.gz | 12.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| parse_me-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.4 kB
Release files / parse_me-0.2.0.tar.gz
| Download URL | parse_me-0.2.0.tar.gz |
|---|---|
| Size | 12.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39723d016ea7f32e568a71c5640d55c0d2ced28a168ce511e558a1e1e4ed07e3
|
|
BLAKE2b-256 checksum How to use checksums |
d3e57f3de7e11bd4b6e43354515baedaee2b8ee6dea8cb3a3115466c0e387848
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / parse_me-0.2.0-py3-none-any.whl
| Download URL | parse_me-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f24feb9d6edee481999ede83cbe8c96302f3c6d56412bebf4d00191bef59c67b
|
|
BLAKE2b-256 checksum How to use checksums |
b2ca9a6d541d3484b3307760374adb34614e5b389e66da405df771b707107ba1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|