Skip to content

Instantly share code, notes, and snippets.

Avatar
👷‍♂️
Looking for a job

Rinat Valiullov RinatValiullov

👷‍♂️
Looking for a job
View GitHub Profile
@RinatValiullov
RinatValiullov / sentiment-output.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View sentiment-output.js
0.42857142857142855 // указывает на относительно отрицательное утверждение
@RinatValiullov
RinatValiullov / sentiment-index.js
Last active Dec 3, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View sentiment-index.js
// index.js
var natural = require('natural');
var Analyzer = natural.SentimentAnalyzer;
var stemmer = natural.PorterStemmer;
var analyzer = new Analyzer("English", stemmer, "afinn");
// getSentiment ожидает массив строк
console.log(analyzer.getSentiment(["I", "don't", "want", "to", "play", "with", "you"]));
@RinatValiullov
RinatValiullov / classification-output.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
@RinatValiullov
RinatValiullov / classification-index.js
Last active Dec 2, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View classification-index.js
// index.js
var natural = require('natural');
var classifier = new natural.BayesClassifier();
classifier.addDocument('i am long qqqq', 'buy');
classifier.addDocument('buy the q\'s', 'buy');
classifier.addDocument('short gold', 'sell');
classifier.addDocument('sell gold', 'sell');
classifier.train();
@RinatValiullov
RinatValiullov / string_distance-output.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
@RinatValiullov
RinatValiullov / string_distance-index.js
Last active Dec 2, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View string_distance-index.js
// index.js
var natural = require('natural');
console.log(natural.HammingDistance("karolin", "kathrin", false));
console.log(natural.HammingDistance("karolin", "kerstin", false));
console.log(natural.HammingDistance("short string", "longer string", false));
@RinatValiullov
RinatValiullov / stemming-output.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View stemming-output.js
[ 'go', 'friend' ]
@RinatValiullov
RinatValiullov / stemming-index.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View stemming-index.js
// index.js
var natural = require('natural');
natural.PorterStemmer.attach();
console.log("I can see that we are going to be friends".tokenizeAndStem());
@RinatValiullov
RinatValiullov / tokenization-output.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View tokenization-output.js
[ 'The',
'quick',
'brown',
'fox',
'jumps',
'over',
'the',
'lazy',
'dog' ]
@RinatValiullov
RinatValiullov / tokenization-index.js
Created Nov 29, 2019
For translation of article "Natural language processing for Node.js" - https://bit.ly/2QZsts1
View tokenization-index.js
// index.js
var natural = require('natural');
var tokenizer = new natural.WordTokenizer();
console.log(tokenizer.tokenize("The quick brown fox jumps over the lazy dog"));