Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dedublicate #3

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Dedublicate #3

wants to merge 3 commits into from

Conversation

imevro
Copy link
Contributor

@imevro imevro commented Jan 12, 2018

No description provided.

@@ -0,0 +1,201 @@
'use strict';
/*
* From: https://github.com/sjhorn/node-minhash
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
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
Copy link
Contributor Author

imevro commented Jan 12, 2018

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

@Fl0pZz
Copy link
Contributor

Fl0pZz commented Jan 12, 2018

ок

@@ -0,0 +1,201 @@
'use strict';
/*
* From: https://github.com/sjhorn/node-minhash
Copy link
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",

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

class SelfCleaningMsgMap extends Map {
Copy link
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
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)
}

@@ -9,10 +9,11 @@ const deleteCommandMessage = require("../utils/command_traces_cleaner").default;

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

@sergeysova sergeysova Jan 12, 2018

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 вверху файла

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
Member

Choose a reason for hiding this comment

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

template literals?

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

async function check(msg) {
console.log("dedublicator");
Copy link
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