This repository is a companion repository with examples for the IJRM article "How to Match Entities in Secondary Datasets in Marketing Strategy: Three Approaches."
It is a small comparison repository. The goal is to show how three common ways of matching entities work on the same types of secondary data researchers often combine:
- Exact matching with shared identifiers.
- Probabilistic or fuzzy matching with names.
- Machine-learning-assisted matching with embeddings and large language models.
The examples use reduced sample data so readers can inspect the code, rerun the local comparison steps, and compare the saved outputs.
Entity-Matching-Demo/
├── data/ # Sample inputs and validation labels
├── outputs/ # Saved outputs from the examples
│ └── benchmarking/ # GPT-4o and GPT-4o-mini comparison output
├── docs/ # Short guides for readers
├── tools/ # Extra comparison script
├── compustat_tvl_approach*.py # Case 1 scripts
├── compustat_mintel_approach*.py # Case 2 scripts
├── requirements.txt
└── README.md
Case 1: Compustat to TruValue Labs
This example compares all three approaches on the same firm-matching task: exact CUSIP matching, fuzzy name matching, and LLM-assisted name matching.
The saved outputs are in outputs/. To recreate the Case 1 comparison table
from those files, run:
python compustat_tvl_compare_matches_compustat_tvl.pyThe source scripts for exact, fuzzy, and LLM-assisted matching are included at
the repository root. The LLM step calls OpenAI and should only be rerun
intentionally with OPENAI_API_KEY set.
Case 2: Compustat to Mintel
This example shows a larger matching workflow when the datasets do not share a firm identifier. It first retrieves likely candidates with embeddings, then uses GPT-4o to classify each candidate pair.
The saved outputs are in outputs/. To compare the saved GPT-4o and GPT-4o-mini
results, run:
python tools/mintel_compustat_compare_gpt4o_vs_mini.pyThe embedding and GPT-4o classification scripts are included for readers who
want to regenerate the outputs. Those steps call OpenAI and require
OPENAI_API_KEY.
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtdocs/REPOSITORY_GUIDE.md: where to find the main files.docs/RUNNING_THE_CODE.md: how to run the examples.docs/DATA.md: what the sample files and outputs contain.docs/METHOD_NOTES.md: short notes on the matching approaches.
If you use this repository, please cite the associated paper and the repository version or commit used for your work.
Farinha, R. L., Colicev, A., & Bart, Y. (2026). How to match entities in secondary datasets in marketing strategy: Three approaches. International Journal of Research in Marketing. https://doi.org/10.1016/j.ijresmar.2026.06.003