<p>A very simple approach can be:</p>
<ul>
<li>Calculate tf-idf vector for sentence 1 and 2.</li>
<li>Calculate vector similarity (Cosine similarity) of these 2 vectors.</li>
</ul>
<p>This is a general approach and works for any representational vector.</p>
<p>For a more complex one, check <a href="https://keras.io/examples/nlp/semantic_similarity_with_bert/" rel="nofollow noreferrer">semantic similarity with BERT</a> post from Keras blog.</p>

CC BY-SA 4.0
2021-07-12T22:25:53.670Z
2021-07-12T22:25:53.670Z
meliksahturker
<p><strong>Context:</strong> I want to determine if someone's written review contains content that is relevant to a paragraph that they are reviewing.</p>
<p>To do so, I am trying to determine if one paragraph is relevant to another paragraph. I initially tried to use TF-IDF to calculate the relevancy, but I think TF-IDF works well for determining if one paragraph is relevant to a whole set of paragraphs. I only want to determine if two paragraphs are relevant with each other.</p>
<p>What would be a good approach for this problem?</p>

<natural-language-processing><resource-request>
Language Processing: Determine if one paragraph is relevant to another paragraph
Bill Cui
# Language Processing: Determine if one paragraph is relevant to another paragraph

(Asked by: username_0 on 2021-07-12)

**Context:** I want to determine if someone's written review contains content that is relevant to a paragraph that they are reviewing.

To do so, I am trying to determine if one paragraph is relevant to another paragraph. I initially tried to use TF-IDF to calculate the relevancy, but I think TF-IDF works well for determining if one paragraph is relevant to a whole set of paragraphs. I only want to determine if two paragraphs are relevant with each other.

What would be a good approach for this problem?

**Tags:** natural-language-processing, resource-request


---

## 1 answers

### Answer by username_1 on 2021-07-12. Score: 0 | Accepted answer

A very simple approach can be:

* Calculate tf-idf vector for sentence 1 and 2.
* Calculate vector similarity (Cosine similarity) of these 2 vectors.

This is a general approach and works for any representational vector.

For a more complex one, check [semantic similarity with BERT](https://keras.io/examples/nlp/semantic_similarity_with_bert/) post from Keras blog.


---

