/**
 * https://github.com/huyingxi/Synonyms
 * */
var synonyms = require("node-synonyms");
var nodejieba = require("nodejieba");

//分词
synonyms.seg("足球比赛", true, true)
    .then(function(words){
        // do your magic
        console.log(words)
    });

//近义词及其相似度
synonyms.nearby("传奇")
    .then(function(results){
        // do your magic
        console.log(results);
    });

//两个词的相似度
synonyms.compare("移动互联网", "互联网")
    .then(function(similarity){
        console.log("相似度为: " + similarity);
    });



var sentence = "我是拖拉机学院手扶拖拉机专业的。不用多久，拖拉机，拖拉机，拖拉机，拖拉机，拖拉机，我就会升职加薪，当上CEO，走上人生巅峰。";

var result;

// 没有主动调用nodejieba.load载入词典的时候，
// 会在第一次调用cut或者其他需要词典的函数时，自动载入默认词典。
// 词典只会被加载一次。
result = nodejieba.cut(sentence);
console.log(result);

result = nodejieba.cut(sentence, true);
console.log(result);

result = nodejieba.cutHMM(sentence);
console.log(result);

result = nodejieba.cutAll(sentence);
console.log(result);

result = nodejieba.cutForSearch(sentence);
console.log(result);

result = nodejieba.tag(sentence);
console.log(result);

var topN = 5;
result = nodejieba.extract(sentence, topN);
console.log("关键词: ", result);

result = nodejieba.cut("男默女泪");
console.log(result);
nodejieba.insertWord("男默女泪");
result = nodejieba.cut("男默女泪");
console.log(result);

result = nodejieba.cutSmall("南京市长江大桥", 3);
console.log(result);

