# Relationship extraction

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frelationship-extraction%2F42168%3E%5C
**Category:** Beginners\
**Created:** [June 5, 2023, 8:48pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frelationship-extraction%2F42168 "2023-06-05T20:48:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmcclure](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@rmcclure](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Frmcclure)%5C
**Post date:** [June 5, 2023, 8:48pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frelationship-extraction%2F42168%2F1 "2023-06-05T20:48:34Z")

</div>

What would be the best approach for extracting entities and relationships among those entities, so that I can achieve something like the following?

**Input**

```auto
"I want to buy a book on Amazon, and then I'll walk my dog."

```

**Output**

```auto
Action 1
---
Subject: Book
Action: Buy
Quantity: 1
Location: Amazon

Action 2
---
Subject: Dog
Action: Walk

```

This is a very loose example, but the idea is that I need to extract the entities and be able to determine the relationships between them. I see that NER is a major focus of many of the models available, so I don’t think I’ll have trouble with that. But I don’t see nearly as much focus on relationship extraction, so that’s primarily where my question lies - what is the best way to approach RE with hugging face? Or is hf not well suited for RE?
