Skip to content

Dedublicate - #3

Open
imevro wants to merge 3 commits into
masterfrom
dedublicate
Open

Dedublicate#3
imevro wants to merge 3 commits into
masterfrom
dedublicate

Conversation

@imevro

@imevro imevro commented Jan 12, 2018

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread deduplicator/minhash.js
@@ -0,0 +1,201 @@
'use strict';
/*
* From: https://github.com/sjhorn/node-minhash

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

используй это, а не тяни свой недофорк

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну или вынести в реальный форк
"minhash": "github:name/forkname",

@imevro

imevro commented Jan 12, 2018

Copy link
Copy Markdown
Contributor Author

И сделай гит пулл из мастера (только не проеби мои изменения)

@Fl0pZz

Fl0pZz commented Jan 12, 2018

Copy link
Copy Markdown
Contributor

ок

Comment thread deduplicator/minhash.js
@@ -0,0 +1,201 @@
'use strict';
/*
* From: https://github.com/sjhorn/node-minhash

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ну или вынести в реальный форк
"minhash": "github:name/forkname",

Comment thread storage/index.js
const { shingles, minhash } = require('../deduplicator/minhash');
const expirationTime = 20 * 60 * 60 * 1000; // 20h

class SelfCleaningMsgMap extends Map {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Composition vs. Inheritance

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предлагаю не наследовать, а заюзать инстанс Map

constructor(iterable) {
  this.map = new Map()
  // ...
}

has(msg) {
  return this.map.has(msg.message_id)
}

Comment thread commands/publishVacancy.js Outdated

const keywords = new Set(["в канал"]);
const replyText = "Вакансия опубликована в " + process.env.APP_TELEGRAM_CHANNEL;
const storage = require('../storage').storage;

@sergeysova sergeysova Jan 12, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe

const { storage } = require('../storage')

и может отсортировать строчки?
что-то вроде: все require/import вверху файла

Comment thread deduplicator/index.js
const minhashval = smlrty(minhash, minhashMsg);
const jaccard = jaccardIndex(shingles, shinglesMsg);
console.log( "Minhash similarity is "+minhashval+" (%d%% similar)", Math.round(minhashval * 100) );
console.log( "Jaccard index is "+jaccard+" (%d%% similar)", Math.round(jaccard * 100) );

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

template literals?

Comment thread commands/dedublicator.js
const replyText = "Кажется, еще не прошло 24 часов с момомента последней публикации этой вакансии";

async function check(msg) {
console.log("dedublicator");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мб заюзать debug ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants