js文章的查重率展示


视频加载中...

function getpost() {

let url = 'http://127.0.0.1:8000/get_request';

let ajx = new XMLHttpRequest();

ajx.open('GET', url, true);

ajx.onreadystatechange = function () {

if (ajx.readyState == 4) {

if (ajx.status == 200) {

tabledata(JSON.parse(ajx.responseText)['data']);

}

}

}

ajx.send();

}

getpost();

function postget() {

let content = Array.prototype.shift.apply(arguments);

let url = 'http://127.0.0.1:8000/post_request';

let ajx = new XMLHttpRequest();

ajx.open('POST', url, true);

ajx.onreadystatechange = function () {

if (ajx.readyState == 4) {

if (ajx.status == 200) {

console.log(123);

}

}

}

ajx.send(JSON.stringify(content));

}

function tabledata() {

let arr = ['序号', '名称', '操作'];

let content = Array.prototype.shift.apply(arguments);

let p = document.createElement('p');

document.body.appendChild(p);

let table = document.createElement('table');

p.appendChild(table);

let tr = document.createElement('tr');

table.appendChild(tr);

table.border = 2;

table.id = 'table1';

for (let i = 0; i < arr.length; i++) {

let th = document.createElement('th');

tr.appendChild(th)

th.innerHTML = arr[i];

}

for (let i = 0; i < content.length; i++) {

let tr1 = document.createElement('tr');

table.appendChild(tr1);

let td = document.createElement('td');

let td1 = document.createElement('td');

let td2 = document.createElement('td');

tr1.appendChild(td);

tr1.appendChild(td1);

tr1.appendChild(td2);

td.innerHTML = i + 1;

td1.innerHTML = content[i]['textarea'].substring(0, 4) + '...';

td2.innerHTML = '详情';

td2.id = content[i]['id'];

}

document.getElementById('table1').addEventListener('click', function (e) {

query(e.target.id);


})

}

function query() {

let content = Array.prototype.shift.apply(arguments);

let url = 'http://127.0.0.1:8000/query_get'

let ajx = new XMLHttpRequest();

ajx.open('POST', url, true);

ajx.onreadystatechange = function () {

if (ajx.readyState == 4) {

if (ajx.status == 200) {

compare(JSON.parse(ajx.responseText)['data']);

}

}

}

ajx.send(JSON.stringify(content));

}


function compare() {

let count = 0;

let arr = [];

let arr1 = [];

let arr2 = [];

let arr3 = [];

let arr4 = [];

let arr5 = [];

let arr6 = []

let number3;

let content = Array.prototype.shift.apply(arguments);

let url = 'http://127.0.0.1:8000/get_request';

let ajx = new XMLHttpRequest();

ajx.open('GET', url, true);

ajx.onreadystatechange = function () {

if (ajx.readyState == 4) {

if (ajx.status == 200) {

JSON.parse(ajx.responseText)['data']

for (let i = 0; i < JSON.parse(ajx.responseText)['data'].length; i++) {

if (JSON.parse(ajx.responseText)['data'][i]['textarea'] != content[0]['textarea']) {

arr.push(JSON.parse(ajx.responseText)['data'][i])

}

}

for (let i = 0; i < arr.length; i++) {

if ((content[0]['textarea'].substring(0, 13)).length == (arr[i]['textarea'].substring(0, 13)).length) {

arr2.push(arr[i]);

arr4.push(arr[i]);

}

}

for(let i = 0;i

for(let j = 0;j

if(content[0]['textarea'][j] == arr2[i]['textarea'][j]){

arr1.push(arr2[i]['textarea'][j]);

}

}

arr1.push('&*')

}

for(let i = 0;i

if(arr1[i] == '&*'){

count+=1;

}

}

number3 = arr1.toString();

let str1 = number3.split('&*');

let res = str1;

for(let i = 0;i

let reg = new RegExp(',',"g");

let regs = res[i].replace(reg,'');

arr3.push(regs.length);

}

for(let i = 0;i

console.log(arr3[i])

arr4.push(arr3[i]/arr2[i]['textarea'].length);

}

arr6.push(content[0]['textarea'])

arr5.push(arr6,arr4,arr3);

drawdesigns(arr5);

}

}

}

ajx.send();

}

function drawdesigns() {

let arr = [];

let content = Array.prototype.shift.apply(arguments);

alert(content[0]);

if(document.getElementById('p1')){

document.getElementById('p1').remove();

}

if(document.getElementById('p2')){

document.getElementById('p2').remove();

}

if(content[0].length == 0 || content[1].length == 0 ||content[2].length == 0){

let p = document.createElement('p');

p.setAttribute('id','p1');

let p = document.createElement('p');

let p1 = document.createElement('p');

let p2 = document.createElement('p');

document.body.appendChild(p);

p.appendChild(p);

p.appendChild(p1);

p.appendChild(p2);

p.innerHTML = '发现匹配内容的文章字数为:'+0+'个';

p1.innerHTML = '相同匹配文字的个数为:'+0+'个';

p2.innerHTML = '匹配度为:'+ 0+'%';

if(document.getElementById('p3')){

document.getElementById('p3').remove();

}

}else{

let p = document.createElement('p');

p.setAttribute('id','p2');

let p = document.createElement('p');

document.body.appendChild(p);

p.appendChild(p);

for(let i = 0;i

let p1 = document.createElement('p');

p.appendChild(p1);

p1.innerHTML = '相同匹配第'+(i+1)+'篇文章的相同字数为:'+content[2][i]+'个';

}

for(let i = 0;i

if(typeof content[1][i] != 'object'){

let p2 = document.createElement('p');

p.appendChild(p2);

p2.innerHTML = '匹配度为:'+ ((content[1][i]).toFixed(2)*100).toFixed(2)+'%';

arr.push((content[1][i]).toFixed(2)*100)

}

}

p.innerHTML = '发现匹配内容的文章有:'+content[2].length+'个';

echartsfunction(arr);

}

}


function echartsfunction(){

let content = Array.prototype.shift.apply(arguments);

console.log(content)

let data = [];

if(document.getElementById('p3')){

document.getElementById('p3').remove();

}

let p = document.createElement('p');

document.body.appendChild(p);

p.setAttribute('id','p3');

p.style.width = '500px';

p.style.height = '300px';

let myChart = echarts.init(document.getElementById('p3'));

for(let i = 0;i

data.push({value: content[i], name: '第'+(i+1)+'篇文章,雷同占比'+content[i].toFixed(2)+'%'})

}

let option = {

title: {

text: '比例饼状图',

subtext: '对比度',

left: 'center'

},

tooltip: {

trigger: 'item'

},

legend: {

orient: 'vertical',

left: 'left'

},

series: [

{

name: 'Access From',

type: 'pie',

radius: '50%',

data,

emphasis: {

itemStyle: {

shadowBlur: 10,

shadowOffsetX: 0,

shadowColor: 'rgba(0, 0, 0, 0.5)'

}

}

}

]

};

myChart.setOption(option);

}


document.getElementById('input1').addEventListener('click', function () {

postget(document.getElementById('textarea1').value);

location.reload();

})

展开阅读全文

页面更新:2024-05-17

标签:文章   篇文章   对比度   序号   字数   比例   名称   详情   发现   内容

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top