Skip to content

A solution to find the best order of random sentences in a paragraph Using Bert algorithm and PyTorch.

Notifications You must be signed in to change notification settings

MahsaSeifikar/sentence-reordering

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sentence Reordering

This project aims to create a paragraph from 6 random sentences.

We have half a million dictionaries in train data, including a list of sentences and a list of the index that shows the correct order.

Due to lack of memory and GPU, a sampled data is created from the original dataset. We map the ordering sentences problem to a classifier with two possible classes. Either two sentences are continuous or not. For each paragraph, we consider the combination of 2 from 6 sentences which 5 of them have the label True, and the rest are False. Then, we finetune a BertForSequenceClassification from huggingface library.

To order sentences in the test step, we consider all possible combinations of 6 sentences and, for all of them, calculate the sum of the probability of pair sentences, then choose the combination that leverages the max score.

How to run?

To get the result, just run the following command.

chmod +x run.py
./run.py

About

A solution to find the best order of random sentences in a paragraph Using Bert algorithm and PyTorch.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published