Named Entity Recognition (NER) is a key technique in natural language processing that involves identifying and classifying specific entities in a text, such as people, organisations, locations or dates. The following prompt offers a structured and nuanced approach to testing NER capabilities using a rich biographical narrative.
The prompt instructs the model to extract all named entities from a continuous text focusing on Barack and Michelle Obama, assigning each instance to a predefined category drawn from an explicit taxonomy—including Person, Organisation, Geo-Political Entity, Law, among others. The prompt instructs the model to extract all named entities from a continuous text focusing on Barack and Michelle Obama, assigning each instance to a predefined category drawn from an explicit taxonomy—including Person, Organisation, Geo-Political Entity, Law, among others. It explicitly requires the model to list entities in the order of their appearance and to include each occurrence, even if repeated. This approach emphasizes contextual sensitivity as well as consistency in classification. The expected output is clearly defined: a numbered list, with each item containing the identified entity and its corresponding category.
Prompt
Identify all named entities in the following input text. For each entity, indicate its category from the following list:
- Organisation: Companies, agencies, institutions, and other formally named groups (e.g. Google, United Nations).
- Product: Physical objects such as devices, vehicles, foods, and other tangible items, excluding services (e.g. iPhone, Toyota Corolla).
- Law: Named legal documents or pieces of legislation (e.g. Civil Rights Act, GDPR).
- Work of Art: Titles of creative works, including books, films, songs, paintings, and similar artistic outputs (e.g. Hamlet, The Starry Night).
- Person: Named individuals, both real and fictional (e.g. Barack Obama, Sherlock Holmes).
- Location: Geographical places that do not have political or administrative status, such as mountain ranges, oceans, or landmarks (e.g. Sahara Desert, Pacific Ocean).
- Geo-Political Entity: Locations with political or administrative boundaries and governance, such as countries, cities, and states (e.g. France, New York, California).
- Ordinal Number: Words indicating position or rank in a sequence (e.g. first, second, 3rd).
- Event: Named historical, social, political, or sporting events (e.g. World War II, Olympic Games).
- Cardinal Number: Numerals expressing quantity that do not fall under other categories (e.g. 100, five million, two).
- Nationality, Religious or Political Group: Named groups based on nationality, religion, or political affiliation (e.g. Hungarian, Buddhist, Democrats).
- Date: Specific or relative calendar references, including full dates, months, years, or time periods (e.g. 4 July 1998, last year).
Go through the text in order, and create a numbered list of all named entities as they appear. Each entity should be listed every time it occurs, even if it has appeared earlier in the text. Please only include entities that belong to one of the categories listed above. Do not include any entity that does not fall into one of the categories listed above.
Present your output as a numbered list, with each item containing: Entity – Category
"""[Barack Obama, the 44th President of the United States, served two terms in office from 2009 to 2017. Born on August 4, 1961, in Honolulu, Hawaii, Obama was the first African American to hold the highest office in the country. His presidency was marked by significant achievements in both domestic and foreign policy. Barack Obama’s wife, Michelle Obama, was an influential First Lady who championed numerous initiatives related to health, education, and veterans' affairs. Michelle Obama, originally Michelle LaVaughn Robinson, was born on January 17, 1964, in Chicago, Illinois. She met Barack Obama while working at a law firm in Chicago, and the two married in 1992. Together, Barack and Michelle Obama have two daughters, Malia Obama and Sasha Obama. Malia Ann Obama was born on July 4, 1998, while Natasha Marian Obama, known as Sasha, was born on June 10, 2001. The Obama family resided in the White House for eight years, making their mark as a close-knit and public-minded first family. During his presidency, Barack Obama’s administration focused on major issues such as healthcare reform, the economic recovery from the Great Recession, and the killing of Osama bin Laden. One of his landmark achievements was the Affordable Care Act, often referred to as "Obamacare," which aimed to provide affordable healthcare to millions of uninsured Americans. Key figures in Obama’s cabinet included Hillary Clinton, who served as Secretary of State from 2009 to 2013, and Joe Biden, the Vice President of the United States during both terms. In foreign affairs, Barack Obama's administration sought to improve relations with other nations and promote diplomacy. For instance, Secretary of State Hillary Clinton played a pivotal role in initiating the U.S. pivot to Asia, focusing on enhancing diplomatic ties and economic engagement with countries in the Asia-Pacific region. Another notable member of Obama's administration was John Kerry, who succeeded Hillary Clinton as Secretary of State in 2013. Under Kerry’s leadership, the Obama administration was instrumental in negotiating the Iran nuclear deal, officially known as the Joint Comprehensive Plan of Action (JCPOA), aimed at preventing Iran from developing nuclear weapons. In addition to his political achievements, Barack Obama was also known for his inspirational speeches, such as his address on race relations in America, often referred to as the "A More Perfect Union" speech, delivered in 2008. He frequently spoke about themes of hope, change, and unity, which resonated with many Americans. Barack Obama’s legacy also includes his administration’s efforts to combat climate change. His administration actively participated in the Paris Agreement, a landmark international treaty adopted in 2015, which brought together nations to tackle global warming and reduce greenhouse gas emissions. Barack Obama's Environmental Protection Agency (EPA) worked on implementing regulations to limit carbon emissions from power plants, which were significant steps in the fight against climate change. Michelle Obama also played a crucial role in promoting healthy lifestyles and educational opportunities for children and young adults. Her "Let’s Move!" initiative aimed to combat childhood obesity by encouraging healthier food choices and increased physical activity. Michelle also launched the "Reach Higher" initiative, which inspired students to pursue higher education and training beyond high school. After leaving office, Barack Obama and Michelle Obama continued their public service through the Obama Foundation, established to inspire and empower the next generation of leaders. The couple also signed a deal with Netflix to produce content, including documentaries and series that align with their values and vision for the future. In summary, Barack Obama, along with his wife Michelle Obama, left a lasting impact on American society through their leadership, advocacy, and commitment to service. Their legacy is characterized by efforts to improve healthcare, address climate change, promote education, and inspire hope and unity among the American people.]"""
This prompt offers a clear and replicable framework for testing Named Entity Recognition across a range of entity types. It is particularly well suited for evaluating how models handle classification consistency and contextual sensitivity in longer, narrative-style texts. The input text provided can easily be replaced with other domain-specific content, allowing for flexible adaptation to various research or instructional purposes.
Output
The prompt was tested using the GPT-4.5 model, which identified 89 named entities in the input text.
Named Entities – Annotated List
- Barack Obama – Person
- 44th – Ordinal Number
- President – Person
- United States – Geo-Political Entity
- two – Cardinal Number
- 2009 – Date
- 2017 – Date
- August 4, 1961 – Date
- Honolulu – Geo-Political Entity
- Hawaii – Geo-Political Entity
- Obama – Person
- first – Ordinal Number
- African American – Nationality, Religious or Political Group
- Barack Obama – Person
- Michelle Obama – Person
- First Lady – Person
- Michelle Obama – Person
- Michelle LaVaughn Robinson – Person
- January 17, 1964 – Date
- Chicago – Geo-Political Entity
- Illinois – Geo-Political Entity
- Barack Obama – Person
- Chicago – Geo-Political Entity
- 1992 – Date
- Barack – Person
- Michelle Obama – Person
- two – Cardinal Number
- Malia Obama – Person
- Sasha Obama – Person
- Malia Ann Obama – Person
- July 4, 1998 – Date
- Natasha Marian Obama – Person
- Sasha – Person
- June 10, 2001 – Date
- Obama – Person
- White House – Geo-Political Entity
- eight – Cardinal Number
- Barack Obama – Person
- Great Recession – Event
- Osama bin Laden – Person
- Affordable Care Act – Law
- Obamacare – Law
- Americans – Nationality, Religious or Political Group
- Obama – Person
- Hillary Clinton – Person
- Secretary of State – Person
- 2009 – Date
- 2013 – Date
- Joe Biden – Person
- Vice President – Person
- United States – Geo-Political Entity
- Barack Obama – Person
- Hillary Clinton – Person
- U.S. – Geo-Political Entity
- Asia – Geo-Political Entity
- Asia-Pacific – Geo-Political Entity
- Obama – Person
- John Kerry – Person
- Hillary Clinton – Person
- Secretary of State – Person
- 2013 – Date
- Kerry – Person
- Obama – Person
- Iran nuclear deal – Event
- Joint Comprehensive Plan of Action – Law
- JCPOA – Law
- Iran – Geo-Political Entity
- Barack Obama – Person
- America – Geo-Political Entity
- A More Perfect Union – Work of Art
- 2008 – Date
- Americans – Nationality, Religious or Political Group
- Barack Obama – Person
- Paris Agreement – Law
- 2015 – Date
- Barack Obama – Person
- Environmental Protection Agency – Organisation
- EPA – Organisation
- Michelle Obama – Person
- Let’s Move! – Work of Art
- Michelle – Person
- Reach Higher – Work of Art
- Barack Obama – Person
- Michelle Obama – Person
- Obama Foundation – Organisation
- Netflix – Organisation
- Barack Obama – Person
- Michelle Obama – Person
- American – Nationality, Religious or Political Group
The output reflects the model’s strong ability to follow detailed instructions, including strict adherence to the specified taxonomy and the requirement to list entities in order of appearance, including repetitions. The consistent categorisation and contextual awareness evident in the results indicate that GPT-4.5 performs reliably in complex NER tasks.
The authors used GPT-4.5 [OpenAI (2025), GPT-4.5 (accessed on 22 March 2025), Large language model (LLMs), available at: https://openai.com] to generate the output.