1
$\begingroup$

I now have $N$ documents, which share common content and they have special unique content.

Say I have $3$ legal documents related to the same person. Document $A$ is about land law, document $B$ is about company law and document $C$ is about marriage law. How can I extract the land, company and marriage content from each document respectively and skip the common personal information?

It sounds like text-summarization but with a very different nature. Any idea is welcome.

Edit: In my situation, $N$ varies and the nature of the unique content is unknown.

$\endgroup$

2 Answers 2

0
$\begingroup$

It might be worthwhile to try TF-IDF and see if that works for you.

Score each term in each document proportional to how often it occurs in that document, but inversely proportional to how often it occurs across multiple documents. Then look at the the terms that have the highest scores for each document. You can use scikit-learn's TF-IDF Vectorizer to help you with this, if you are using Python.

Presumably, words that are highly specific and relevant to each of your three documents will stand out, and words that relate to personal information (as well as generic legal terms and non-specific English words) will be common to multiple documents and get filtered out.

Note: This will get you the specific words that are particular to each document. If the type of "content" you are seeking to extract goes beyond the word level, then you might have to take a different approach. Perhaps one way is to use the words obtained from TF-IDF to highlight the places in each document where the desired content might be found.

$\endgroup$
1
  • $\begingroup$ This may be a good base to obtain an extraction-based summarization. Thanks. $\endgroup$
    – fuyutsuki
    Oct 10, 2021 at 4:01
0
$\begingroup$

I think the best task for your purpose is name entity recognition (NER) rather than text summarization.

The logic is the following: if the three classes of documents are truly specific, there would be specific entities for each of them, but since the documents are linked by information about a single individual, all entities related to that individual and not to the specific domain would be shared.

So the most obvious shared entity in all documents, the name of the individual, could be identified and then pruned in all document, same holds for every other shared entity (can't came up with more clever examples right now).

If you work with python, SpaCy offer pretrained models that do a great job already also for NER, and in several languages as well. But you might consider to train your own model as well, maybe retrain on top of spacy models, cause for these type of tasks, the most information you can provide about which entities belongs to which class, the best the performances, and unfortunately, generic use models can account for many entities, but they can't associate them directly to specific domains of interest.

$\endgroup$
2
  • $\begingroup$ In my situation, N varies and the nature of the unique content is unknown. How can we make NER work in this case? $\endgroup$
    – fuyutsuki
    Oct 10, 2021 at 3:50
  • $\begingroup$ The models in spacy are pretrained on billions of documents, so you don't need to know before hand every name or entity. And you said that one document is law related, the second is about marriage and the third about company stuff, so to me sound like the content domains are known? $\endgroup$ Oct 10, 2021 at 13:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .