{"id":209826,"date":"2014-01-21T13:12:02","date_gmt":"2014-01-21T09:12:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=209826"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=209826","title":{"rendered":"<span class=\"post_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u043d\u0430 Node.JS. \u041f\u043e\u0438\u0441\u043a \u043d\u0435\u0447\u0435\u0442\u043a\u0438\u0445 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u0432 \u0434\u043b\u044f \u0430\u043d\u0433\u043b\u0438\u0439\u0441\u043a\u0438\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u2014 <a href=\"http:\/\/habrahabr.ru\/post\/65944\/\">\u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0434\u043b\u044f \u0432\u0435\u0431-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432\u00bb<\/a>. <\/p>\n<p>  \u0427\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 Node.JS, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u043c. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043d\u0430 javascript \u0438\u043b\u0438 npm-\u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u2014 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u0412\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e \u043a\u043e\u0434\u0443 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 \u0441\u0442\u0430\u0442\u044c\u0435 \u0432\u044b\u0448\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0441\u0435 \u043f\u0443\u043d\u043a\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0437 \u043d\u0435\u0435, \u043d\u043e \u0441 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u0430\u043c\u0438. <\/p>\n<p>  \u0414\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0445\u043e\u0436\u0435\u0441\u0442\u0438 2-\u0445 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:  <\/p>\n<ol>\n<li> \u043a\u0430\u043d\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430; <\/li>\n<li> \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u0448\u0438\u043d\u0433\u043b\u044b; <\/li>\n<li> \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0445\u0435\u0448\u0435\u0439 \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e 84\u0445 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439; <\/li>\n<li> \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 84 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u0441\u0443\u043c\u043c; <\/li>\n<li> \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. <\/li>\n<\/ol>\n<p>  \u041f\u0443\u043d\u043a\u0442\u044b 3,4 \u0434\u043b\u044f \u043c\u0435\u043d\u044f \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u044b\u043c\u0438. 1-\u0435 \u2014 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0439\u0442\u0438 84 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0430 2-\u0435 \u2013 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 84-\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c\u043d\u044b\u0445 \u0441\u0443\u043c\u043c. \u0415\u0441\u043b\u0438 \u0434\u043b\u044f 1\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u2013 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430\u0439\u0442\u0438 \u043c\u043e\u0436\u043d\u043e, \u0442\u043e \u0432\u0442\u043e\u0440\u043e\u0435 \u043c\u043d\u0435 \u043d\u0435 \u044f\u0441\u043d\u043e. \u0415\u0441\u043b\u0438 \u043c\u0430\u0441\u0441\u0438\u0432 \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0434\u043b\u044f \u0442\u0435\u043a\u0441\u0442\u0430 \u043c\u044b \u0445\u0435\u0448\u0438\u0440\u0443\u0435\u043c 84-\u043c\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u043c\u0438 \u0442\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0447\u0442\u043e \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f 2-\u0445 \u043c\u0435\u0440\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c\u044e 84xN(\u043a\u043e\u043b-\u0432\u043e \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0435). \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u043e\u0442 84-\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043d\u044b\u0439 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0445\u0435\u0448\u0438 \u0448\u0438\u043d\u0433\u043b\u043e\u0432. \u041c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0434\u0430\u0442\u044c \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0431\u0440\u0430\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u0445\u0435\u0448\u0438 \u043f\u043e \u0434\u043b\u0438\u043d\u043d\u0435, \u0442\u043e \u0434\u043b\u044f md5 \u0432\u0441\u0435 \u0445\u0435\u0448\u0438 \u0440\u0430\u0432\u043d\u044b \u043f\u043e \u0434\u043b\u0438\u043d\u0435, \u0430 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u043b\u0438\u043d\u0443 \u043f\u043e \u043a\u043e\u0434\u0430\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u2013 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0443\u043d\u043a\u0442\u044b 3 \u0438 4 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e crc32 \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435. <br \/>  \u041a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c:  <\/p>\n<ol>\n<li> \u043a\u0430\u043d\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430; <\/li>\n<li> \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u0448\u0438\u043d\u0433\u043b\u044b; <\/li>\n<li> \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0445\u0435\u0448\u0435\u0439 \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e crc32; <\/li>\n<li> \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. <\/li>\n<\/ol>\n<p>  <\/p>\n<h5>1. \u041a\u0430\u043d\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0442\u0435\u043a\u0441\u0442\u0430<\/h5>\n<p>  \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u043d\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437:  <\/p>\n<ol>\n<li>\u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043e\u0442 html \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439; <\/li>\n<li>\u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0445 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u0432 \u043f\u043e \u0431\u043e\u043a\u0430\u043c(trim); <\/li>\n<li>\u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043e\u0442 \u0442\u0430\u043a\u0438\u0445 \u0441\u043f\u0435\u0446 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 &#8216;\u201d&#8217;, &#8216;\u201c&#8217;, &quot;\\n&quot;, &#8216;\\r&#8217;, &#8216;,&#8217;, &#8216;.&#8217;, &#8216;:&#8217;, &#8216;$&#8217;, &#8216;#&#8217;, &#8216;&quot;&#8217;, &#8216;(&#8216;, &#8216;)&#8217;; <\/li>\n<li>\u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u043e\u0442 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 \u0440\u0435\u0447\u0438 \u0432 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u0438<\/li>\n<\/ol>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0442\u0435\u043a\u0441\u0442\u0430.  <\/p>\n<pre><code class=\"javascript\">var strWordRemove = function(entry) {     var regex = new RegExp('(^|\\\\s)'  + entry + '(?=\\\\s|$)', 'g');     text = text.replace(regex, '');   };    var strCharacterRemove = function(entry) {     var escapeRegExp = function (str) {       return str.replace(\/[\\-\\[\\]\\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]\/g, &quot;\\\\$&&quot;);     };      var regex = new RegExp(escapeRegExp(entry), 'g');     text = text.replace(regex, '');   }; <\/code><\/pre>\n<p>  \u041f\u0435\u0440\u0432\u044b\u0439 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u043e \u0441\u043b\u043e\u0432 \u0432 \u0442\u0435\u043a\u0441\u0442\u0435, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0434\u043b\u044f \u0437\u0430\u043c\u0435\u043d\u044b \u0441\u043f\u0435\u0446. \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432. \u0414\u0430\u043b\u0435\u0435 \u0438\u0434\u0435\u0442 \u0441\u0430\u043c\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430:<\/p>\n<pre><code class=\"javascript\">  var withoutTagsRegex = \/(&lt;([^&gt;]+)&gt;)\/ig;    text = text.replace(withoutTagsRegex, &quot;&quot;);    text = text.trim();    ['\u201d', '\u201c', &quot;\\n&quot;, '\\r'].forEach(strCharacterRemove); <\/code><\/pre>\n<p>  \u0414\u043b\u044f Node.JS \u0435\u0441\u0442\u044c npm-\u043f\u0430\u043a\u0435\u0442 \u201cpos\u201d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0432 \u0442\u0435\u043a\u0441\u0442\u0435 \u0447\u0430\u0441\u0442\u0438 \u0440\u0435\u0447\u0438. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e.   <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0447\u0430\u0441\u0442\u0435\u0439 \u0440\u0435\u0447\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e pos<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">var words = new pos.Lexer().lex(text);   var taggedWords = new pos.Tagger().tag(words);    var removeWords = [];   var nounWords = [];    for (var i in taggedWords) {     var taggedWord = taggedWords[i];     var word = taggedWord[0];     var tag = taggedWord[1];      \/\/Adjective      \/*      JJ Adjective                big      JJR Adj., comparative       bigger      JJS Adj., superlative       biggest      CC Coord Conjuncn           and,but,or      IN Preposition              of,in,by      TO \u00d2to\u00d3                     to      UH Interjection             oh, oops      DT Determiner               the,some      *\/      \/\/console.log(word + &quot; \/&quot; + tag);     if(tag === 'NNS') {       nounWords.push(word);     }      if(['JJ', 'JJR', 'JJS', 'CC', 'IN', 'TO', 'UH', 'DT'].indexOf(tag) !== -1) {       removeWords.push(word);     }   }    removeWords.forEach(strWordRemove); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043f\u0435\u0446. \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u044f \u0440\u0435\u0448\u0438\u043b \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0447\u0430\u0441\u0442\u0435\u0439 \u0440\u0435\u0447\u0438.  <\/p>\n<pre><code class=\"javascript\">[',', '.', ':', '$', '#', '&quot;', '(', ')'].forEach(strCharacterRemove); <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443 \u0438 \u0431\u043b\u043e\u043a \u043a\u0430\u043d\u043e\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0433\u043e\u0442\u043e\u0432\u044b\u043c. \u0421\u0442\u043e\u0438\u0442\u044c \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e pos \u0437\u0430\u043d\u043e\u0441\u0438\u0442 \u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0442\u0430\u043a\u0438\u0435 \u0441\u043b\u043e\u0432\u0430 \u043a\u0430\u043a Command&#8217;s. \u0418\u0445 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">C\u0443\u0449\u0435\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043a \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">\/\/ replace all plural nouns to single ones   nounWords.forEach(function(entry) {     \/\/parent\u2019s || Apple\u2019s || Smurf\u2019s     if(entry.length &gt; 2 && entry.slice(-2) === &quot;\u2019s&quot;) {       \/\/ now skip it. in future we can test to remove it       return ;     }      var newOne = '';      if(entry.length &gt; 3 && entry.slice(-3) === &quot;ies&quot;) {       newOne = entry.slice(0, -3) + 'y';     } else if(entry.length &gt; 2 && entry.slice(-1) === &quot;s&quot;) {       newOne = entry.slice(0,-1);     } else {       return ;     }      var rexp = new RegExp('(^|\\\\s)' + entry + '(?=\\\\s|$)','g')     text = text.replace(rexp, &quot;$1&quot; + newOne );   }); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0423\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0435 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c.  <\/p>\n<pre><code class=\"javascript\">text = text.replace(\/ +(?= )\/g,''); callback(text); <\/code><\/pre>\n<p>  <\/p>\n<h5>2. \u0420\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u0448\u0438\u043d\u0433\u043b\u044b<\/h5>\n<p>  \u0421 \u044d\u0442\u0438\u043c \u043f\u0443\u043d\u043a\u0442\u043e\u043c \u0432\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u0414\u0435\u043b\u0438\u043c \u0442\u0435\u043a\u0441\u0442 \u043f\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u0430\u043c \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u044b.  <\/p>\n<pre><code class=\"javascript\">var makeShingles = function(text, callback) {   var words = text.split(' ');   var shingles = [];   var wordsLength = words.length;   while(shingles.length !== (wordsLength - shingleLength + 1)) {    shingles.push(words.slice(0, shingleLength).join(' '));    words = words.slice(1);   }    callback(shingles) }; <\/code><\/pre>\n<p>  <\/p>\n<h5>3. \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0445\u0435\u0448\u0435\u0439 \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e crc32<\/h5>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0443\u043d\u043a\u0442\u0435 \u043c\u044b \u043e\u0431\u0445\u043e\u0434\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0438 \u0445\u0435\u0448\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438. \u041f\u0435\u0440\u0432\u044b\u0439 \u0446\u0438\u043a\u043b \u043e\u0442 0 \u0434\u043e 1 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043e\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0438 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e 84-\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0420\u0435\u0448\u0438\u043b \u043d\u0435 \u0443\u0431\u0438\u0440\u0430\u0442\u044c(\u0432\u0434\u0440\u0443\u0433 \u0432\u0435\u0440\u043d\u0443\u0441\u044c \u043a \u044d\u0442\u043e\u0439 \u0438\u0434\u0435\u0435).   <\/p>\n<pre><code class=\"javascript\">var hashingShingles = function(shingles, callback) {   var hashes = [];   for(var i = 0, n = 1; i &lt; n; i++) {     var hashedArr = [];     for(var j = 0, k = shingles.length; j &lt; k; j++) {         hashedArr.push(crc.crc32(shingles[j]));     }     hashes.push(hashedArr);   }    callback(hashes); }; <\/code><\/pre>\n<p>  <\/p>\n<h5>4. \u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 <\/h5>\n<p>  \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u044f \u0432\u0437\u044f\u043b 2 \u043d\u043e\u0432\u043e\u0441\u0442\u0438 \u0438\u0437 google news \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u043e\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043a\u0430\u043a \u043f\u043e\u0445\u043e\u0436\u0438\u0435. \u0421\u043e\u0445\u0440\u0430\u043d\u0438\u043b \u0438\u0445 \u0432 json \u0444\u0430\u0439\u043b\u0435 \u0438 \u0434\u0430\u043b\u0435\u0435, \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Async utilities. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043d\u0430\u0448\u0435\u043b \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0432\u043f\u0430\u0432\u0448\u0438\u0445 \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0438 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043b \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0434\u043b\u044f 2-\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"javascript\">var fileJSON = require('.\/article1.json'); var content1 = fileJSON.content;  var fileJSON2 = require('.\/article2.json'); var content2 = fileJSON2.content;  var async = require('async');  async.parallel([   function(callback){     textCanonization(content1, function(text) {       makeShingles(text, function(shingles) {         hashingShingles(shingles, function(hashes) {           callback(null, hashes);         });       })     });   },   function(callback){     textCanonization(content2, function(text) {       makeShingles(text, function(shingles) {         hashingShingles(shingles, function(hashes) {           callback(null, hashes);         });       })     });   } ], function(err, results){     var firstHashes = results[0];     var secondHashes = results[1];       var compareShingles = function(arr1, arr2) {       var count = 0;        arr1[0].forEach(function(item) {         if(arr2[0].indexOf(item) !== -1) {           count++;         }       });        return count*2\/(arr1[0].length + arr2[0].length)*100;     };      var c = compareShingles(firstHashes, secondHashes);      console.log(c);   }); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0424\u043e\u0440\u043c\u0443\u043b\u0430 <code>count*2\/(arr1[0].length + arr2[0].length)*100<\/code> \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0446\u0435\u043d\u0442\u043d\u043e\u0435 \u0441\u043e\u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f 2\u0445 \u0442\u0435\u043a\u0441\u0442\u043e\u0432. <\/p>\n<p>  \u0422\u0435\u043a\u0441\u0442\u044b \u0434\u043b\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f: <a href=\"http:\/\/www.washingtonpost.com\/business\/technology\/ftc-says-apple-will-pay-at-least-325-million-over-in-app-purchases\/2014\/01\/15\/7c2ebc54-7e13-11e3-95c6-0a7aa80874bc_story.html\">FTC says Apple will pay at least $32.5 million over in-app purchases<\/a> \u0438 <a href=\"http:\/\/www.bostonglobe.com\/business\/2014\/01\/16\/apple-will-refund-least-million-app-case\/EZlzgfWQWoCXsxcQKqReWP\/story.html\">Apple will pay $32.5m to settle app complaints<\/a>. \u041f\u0440\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u043b\u043e\u0432 \u0432 \u0448\u0438\u043d\u0433\u043b\u0435, \u0440\u0430\u0432\u043d\u043e\u043c 10 \u2014 \u0442\u0435\u043a\u0441\u0442\u044b \u0431\u044b\u043b\u0438 \u043f\u043e\u0445\u043e\u0436\u0438 \u043d\u0430 2.16% \u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u043e.<br \/>  \u0418\u0437 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0435 \u044f\u0441\u043d\u043e, \u0447\u0435\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f 84\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043b\u0443\u0447\u0448\u0435. \u0410 \u0442\u0430\u043a\u0436\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u043b\u044f \u0432\u044b\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u043b\u043e\u0432 \u0432 \u0448\u0438\u043d\u0433\u043b\u0435(\u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u043d\u043e 10). <br \/>  \u0412\u0435\u0441\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 <a href=\"https:\/\/github.com\/aslikeyou\/node-w-shingling\">github.com<\/a> \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/209826\/\"> http:\/\/habrahabr.ru\/post\/209826\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u041f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0435\u0439 \u0447\u0430\u0441\u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0430 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u041e\u0434\u043d\u043e\u0439 \u0438\u0437 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0442\u0430\u043a\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u2014 <a href=\"http:\/\/habrahabr.ru\/post\/65944\/\">\u00ab\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0448\u0438\u043d\u0433\u043b\u043e\u0432 \u0434\u043b\u044f \u0432\u0435\u0431-\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043e\u0432\u00bb<\/a>. <\/p>\n<p>  \u0427\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u043e \u043f\u0430\u0440\u0441\u0438\u043d\u0433\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043d\u0430 Node.JS, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0435\u043c. \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u043d\u0430 javascript \u0438\u043b\u0438 npm-\u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u2014 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u044e.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-209826","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=209826"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209826\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}