This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const str1 = 'This is an example to test cosine similarity between two strings'; | |
const str2 = 'This example is testing cosine similatiry for given two strings'; | |
// | |
// Preprocess strings and combine words to a unique collection | |
// | |
const str1Words = str1.trim().split(' ').map(omitPunctuations).map(toLowercase); | |
const str2Words = str2.trim().split(' ').map(omitPunctuations).map(toLowercase); | |
const allWordsUnique = Array.from(new Set(str1Words.concat(str2Words))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function increaseCounter() { | |
var account = web3.eth.accounts[0]; | |
var currentNumber = contract_instance.getMyNumber().toNumber(); | |
currentNumber++; | |
// User dialog goes here | |
web3.personal.unlockAccount(account, 'secretpasswrod'); | |
contract_instance.setMyNumber(currentNumber, {from: account, gas: 200000}, function(error, result) { | |
if (error) { |