Skip to main content

Extract organization names from text using LLMs (OpenAI or Google Gemini).

Project description

FindOrg — Named Entity Recognition for Organizations using LLMs

FindOrg is a Python package that performs Named Entity Recognition (NER) targeting organizations within a given text. It leverages large language models from OpenAI or Google Gemini to extract organization names and return them as a tidy pandas DataFrame.

Installation

pip install FindOrg

To enable saving results as Excel files (.xlsx), install with the optional extra:

pip install FindOrg[excel]

Quick start

from findorg import org

text = (
    "In the heart of Silicon Valley, a collaboration has emerged between "
    "global tech giants such as Google, Apple, and Meta, aiming to "
    "revolutionize the digital landscape."
)

# OpenAI (default provider)
df = org(text, api_key="YOUR_OPENAI_API_KEY")
print(df)
  Organizations
0        Google
1         Apple
2          Meta

Using Google Gemini instead

df = org(text, provider="gemini", api_key="YOUR_GEMINI_API_KEY")

API keys via environment variables (recommended)

If api_key is omitted, FindOrg reads it from the environment: OPENAI_API_KEY for OpenAI or GEMINI_API_KEY for Gemini. This keeps keys out of your source code:

df = org(text)                      # uses OPENAI_API_KEY
df = org(text, provider="gemini")   # uses GEMINI_API_KEY

Analyzing multiple texts at once

Pass a list of strings. The result gains a Text_ID column (1-based index of the input text):

texts = [
    "Petrobras signed an agreement with the World Bank.",
    "The event took place in Brasília, with no companies involved.",
]

df = org(texts, verbose=True)
print(df)
   Text_ID Organizations
0        1     Petrobras
1        1    World Bank

Saving results

df = org(text, save_path="organizations.xlsx")   # Excel (requires openpyxl)
df = org(text, save_path="organizations.csv")    # CSV

Arguments

Argument Type Default Description
text str or list[str] required Text(s) to be analyzed.
api_key str None API key for the chosen provider. If omitted, read from OPENAI_API_KEY or GEMINI_API_KEY.
provider str "openai" "openai" or "gemini".
model str provider default Model name. Defaults to gpt-4o-mini (OpenAI) or gemini-3.5-flash (Gemini).
save_path str None If given, saves the result to this path (.xlsx or .csv).
unique bool False If True, removes duplicated organization names.
verbose bool False If True, prints progress messages.

Returns

pandas.DataFrame with one row per extracted organization:

  • Single text input → column Organizations.
  • List input → columns Text_ID and Organizations.

Extraction rules

  • Geographic locations (countries, states, cities) are not extracted — organization names only.
  • When an organization's name is followed by its acronym in brackets, only the full name is extracted.
  • Texts with no organizations return an empty DataFrame.

Migrating from version 0.x

Version 1.0.0 introduces breaking changes:

Version 0.x Version 1.0.0
from FindOrg import org from findorg import org (lowercase)
org(text, openai_key="...") org(text, api_key="...")
save=True (fixed filename) save_path="organizations.xlsx" (any path, .xlsx or .csv)
OpenAI only, gpt-3.5-turbo OpenAI or Gemini; default model is now gpt-4o-mini

The change of default model was required because OpenAI is shutting down gpt-3.5-turbo in October 2026.

How to cite

Neves, L. F. F. (2026). FindOrg: Named Entity Recognition for Organizations using LLMs (Version 1.0.0) [Python package]. https://pypi.org/project/FindOrg/

Contact

luiz.felipe@ufg.br

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

findorg-1.0.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

findorg-1.0.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file findorg-1.0.1.tar.gz.

File metadata

  • Download URL: findorg-1.0.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for findorg-1.0.1.tar.gz
Algorithm Hash digest
SHA256 14014ec7ab64ef7f60af68e6edbb3a050965117ad4f3450fabcf822525569561
MD5 de32cb5def4d114ee441fbca336725ed
BLAKE2b-256 b1c61f12f24a01c02ff6214cecdab23c07126e2e082b92bef73a7c63be7a3f21

See more details on using hashes here.

File details

Details for the file findorg-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: findorg-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for findorg-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e95e54d8d650c5ffea2d9c89b3c796225ea426daac4f4afef6bf7429b02017fd
MD5 1abe952500f5924da3e3a34bb837fe85
BLAKE2b-256 bc75955a985e51ba5f5d8e501d57b270e3727edf08387462d232164faeba3b4e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page