I Have a WordPress website. I want to create an Paraphrasing tool on this website with fully frontend and Backend. Currently I Have a frontend on my website written in HTML, CSS and JavaScript with these features.
Here are the features:
1: There is Two boxes on the Page in the first page user enter its paragraph or line which he want to paraphrase and in the second box the paraphrased graph or line is show up.
2: There is A button with name of "Paraphrase" which user click to paraphrase the content which he has summited in the first box.
3: The both Boxes are Along side with each other and the button is under the First Box.
4: The UI and UX are advance use in it and the interface is good.
Now you need to develop the backend for this tool which use NLP Algorithms, Machine Learning and paraphrasing algorithm. In the Backend I want these features:
1: the User enter the paragraph or line in the first box of front end and then front end give this paragraph or line to the backend and backend performs paraphrasing on it. After doing all this the Backend give paraphrased content or line to the frontend to display on the second box which show to the user.
2: The user can easily copy the paraphrased content from the second box
I am Giving you the code which I used to develop the frontend. I will provide you Codes in this sequence. I firstly provide you HTML, Then CSS and at last JavaScript.
here Is the HTML Code:
Paraphrasing Tool
Paraphrasing Tool
Original Text
Paraphrased Text
Paraphrase
Here is the CSS use:
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: sans-serif;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 50px;
}
.row {
display: flex;
flex-wrap: wrap;
margin: 20px 0;
}
.col {
flex: 1;
margin-right: 20px;
}
textarea {
width: 100%;
height: 200px;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 5px;
resize: vertical;
}
button {
background-color: #007bff;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px 20px;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #0069d9;
}
Here is the JavaScript:
const paraphraseBtn = document.getElementById("paraphrase-btn");
const originalText = document.getElementById("original-text");
const paraphrasedText = document.getElementById("paraphrased-text");
paraphraseBtn.addEventListener("click", () => {
const apiUrl = "/paraphrase.php";
const data = new FormData();
data.append('text', originalText.value);
fetch(apiUrl, {
method: 'POST',
body: data
})
.then(response => response.json())
.then(data => {
paraphrasedText.value = data.paraphrasedText;
})
.catch(error => {
console.error(error);
});
});
// Load the T5 model
const model = await tf.loadGraphModel('path/to/t5/model.json');