PanGu分词器

https://top.chinaz.com/


https://sourceforge.net/projects/ktdictseg/
https://blog.csdn.net/lijun7788/article/details/7719439
http://www.cftea.com/c/2017/06/7991.asp
https://blog.csdn.net/wudiyong22/article/details/48289965
https://github.com/stanzhai/IKAnalyzer.NET
Lucene.net(4.8.0)+PanGu分词器
Install-Package jieba.NET -Version 0.42.2

https://github.com/anderscui/jieba.NET
var segmenter = new JiebaSegmenter();
var segments = segmenter.Cut("我来到北京清华大学", cutAll: true);
Console.WriteLine("【全模式】:{0}", string.Join("/ ", segments));

segments = segmenter.Cut("我来到北京清华大学");  // 默认为精确模式
Console.WriteLine("【精确模式】:{0}", string.Join("/ ", segments));

segments = segmenter.Cut("他来到了网易杭研大厦");  // 默认为精确模式,同时也使用HMM模型
Console.WriteLine("【新词识别】:{0}", string.Join("/ ", segments));

segments = segmenter.CutForSearch("小明硕士毕业于中国科学院计算所,后在日本京都大学深造"); // 搜索引擎模式
Console.WriteLine("【搜索引擎模式】:{0}", string.Join("/ ", segments));

segments = segmenter.Cut("结过婚的和尚未结过婚的");
Console.WriteLine("【歧义消除】:{0}", string.Join("/ ", segments));

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.IO;
using Lucene.Net.Index;
using Lucene.Net.Search;
using Lucene.Net.Store;
using Lucene.Net.Util;
using Lucene.Net.Documents;
using Lucene.Net.Analysis;
using Lucene.Net.Analysis.Standard;
using JiebaNet.Segmenter;

namespace WindowsFormsApp1
{
    //http://www.zhuzhusoft.com/article.php?id=151
    //Install-Package Lucene.Net -Pre
    //Install-Package Lucene.Net.Analysis.Common -Version 4.8.0-beta00014
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                this.textBox1.Text = this.folderBrowserDialog1.SelectedPath;

                // Ensures index backward compatibility
                const LuceneVersion AppLuceneVersion = LuceneVersion.LUCENE_48;

                // Construct a machine-independent path for the index
                var basePath = Environment.GetFolderPath(
                    Environment.SpecialFolder.CommonApplicationData);
                var indexPath = Path.Combine(basePath, "index");

                var dir = FSDirectory.Open(indexPath);

                // Create an analyzer to process the text
                var analyzer = new StandardAnalyzer(AppLuceneVersion);

                // Create an index writer
                var indexConfig = new IndexWriterConfig(AppLuceneVersion, analyzer);
                var writer = new IndexWriter(dir, indexConfig);


                PanGu.Segment.Init();
                PanGu.Segment segment = new PanGu.Segment();

                string[] files = System.IO.Directory.GetFiles(this.textBox1.Text.Trim(), "*.txt");
                foreach (string file in files)
                {
                    FileInfo f = new FileInfo(file);
                    ICollection words = segment.DoSegment(File.ReadAllText(file));
                    string FavoritePhraseStr = string.Empty;
                    foreach (var word in words)
                    {
                        FavoritePhraseStr += " " + word.Word;
                        Console.WriteLine(word.Word);
                    }

                    var segmenter = new JiebaSegmenter();
                    var segments = segmenter.Cut(File.ReadAllText(file), cutAll: true);
                    Console.WriteLine("【全模式】:{0}", string.Join(" ", segments));

                    var source = new
                    {
                        Name = file,
                        FavoritePhrase = FavoritePhraseStr
                    };
                    var doc = new Document
{
    // StringField indexes but doesn't tokenize
    new StringField("name",
        source.Name,
        Field.Store.YES),
    new TextField("favoritePhrase",
        source.FavoritePhrase,
        Field.Store.YES)
};

                    writer.AddDocument(doc);

                    writer.Flush(triggerMerge: false, applyAllDeletes: false);
                }

                writer.Dispose();
            }
        }


        private void button2_Click(object sender, EventArgs e)
        {


            Ensures index backward compatibility
            //const LuceneVersion AppLuceneVersion = LuceneVersion.LUCENE_48;

            Construct a machine-independent path for the index
            //var basePath = Environment.GetFolderPath(
            //    Environment.SpecialFolder.CommonApplicationData);
            //var indexPath = Path.Combine(basePath, "index");

            //var dir = FSDirectory.Open(indexPath);

            Create an analyzer to process the text
            //var analyzer = new StandardAnalyzer(AppLuceneVersion);

            Create an index writer
            //var indexConfig = new IndexWriterConfig(AppLuceneVersion, analyzer);
            //var writer = new IndexWriter(dir, indexConfig);


            // Search with a phrase
            var phrase = new MultiPhraseQuery
{
    new Term("favoritePhrase", this.textBox2.Text.Trim()),
    //new Term("favoritePhrase", "fox")
};
            Re-use the writer to get real-time updates
            //var reader = writer.GetReader(applyAllDeletes: true);
            //var searcher = new IndexSearcher(reader);


            var basePath = Environment.GetFolderPath(
                Environment.SpecialFolder.CommonApplicationData);
            var indexPath = Path.Combine(basePath, "index");
            var dir = FSDirectory.Open(indexPath);
            var searcher = new IndexSearcher(DirectoryReader.Open(dir));
            var hits = searcher.Search(phrase, 20 /* top 20 */).ScoreDocs;

            DataTable dataTable = new DataTable();
            dataTable.Columns.Add("name");
            dataTable.Columns.Add("favoritePhrase");
            // Display the output in a table
            Console.WriteLine($"{"Score",10}" +
                $" {"Name",-15}" +
                $" {"Favorite Phrase",-40}");
            foreach (var hit in hits)
            {
                var foundDoc = searcher.Doc(hit.Doc);
                DataRow dr = dataTable.NewRow();
                dr["name"] = foundDoc.Get("name");
                dr["favoritePhrase"] = foundDoc.Get("favoritePhrase");
                dataTable.Rows.Add(dr);
                Console.WriteLine($"{hit.Score:f8}" +
                    $" {foundDoc.Get("name"),-15}" +
                    $" {foundDoc.Get("favoritePhrase"),-40}");
            }
            this.dataGridView1.DataSource = dataTable;
        }
    }
}

it自媒体

1、做长远计划 ;2、精准人群定位 ;3、差异化竞争 ;4、有营销点;5、吸粉更容易 ;6、打造知名度 ;7、时间定位运营 ;8、低成本高收益 ;9、增加客户粘性 ;10、内容服务为王。

https://www.svgrepo.com/
https://kalendar.altinselimi.com/
https://www.yuque.com/explore/headlines
Mybatis.net
https://xiaoluoboding.github.io/monthly/2021/2021-03.html#%E5%B7%A5%E5%85%B7
https://xiaoluoboding.github.io/monthly/2019/#%F0%9F%8D%AD-%E8%AE%BE%E8%AE%A1%E5%88%9B%E6%84%8F
http://www.chinavalue.net/Wiki/%E8%87%AA%E5%AA%92%E4%BD%93.aspx
https://www.163.com/dy/article/G3MQE1MQ0511GV8V.html
https://www.infoq.cn/
https://www.infoq.cn/article/W4leI4XZ32eSTqFJ8qPl
https://xiaoluoboding.github.io/monthly/2019/2019-01.html#%E6%95%99%E7%A8%8B
http://yixiaoer.coozf.com/
SpringBoot+SpringMVC+Mybatis+Redis+ELK+Quartz+Websocket+vue.js
https://activity.feishu.cn/


https://www.yuque.com/woniu666/tech_doc/pueka0

网站的排行榜
https://top.chinaz.com/

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
NodeJieba "结巴"分词的Node.js版本Introduction NodeJieba只是CppJieba简单包装而成的node扩展,用来进行中文分词。 详见NodeJiebaBlogInstallnpm install nodejieba 因为npm速度很慢而且经常因为墙的原因出现莫名其妙的问题,在此强烈建议使用cnpm,命令如下:npm --registry=http://r.cnpmjs.org install nodejieba默认分词算法初始化var segment = require("nodejieba"); segment.loadDict("./node_modules/nodejieba/dict/jieba.dict.utf8", "./node_modules/nodejieba/dict/hmm_model.utf8");阻塞式调用var wordList = segment.cutSync("阻塞模式分词"); if (wordList.constructor == Array) // just for tutorial, this is always be true  {     wordList.forEach(function(word) { console.log(word);          }); }非阻塞式调用segment.cut("非阻塞模式分词", function(wordList) {     wordList.forEach(function(word) { console.log(word);          }); });初始化var segment = require("nodejieba"); segment.queryLoadDict("./node_modules/nodejieba/dict/jieba.dict.utf8", "./node_modules/nodejieba/dict/hmm_model.utf8");阻塞式调用var wordList = segment.queryCutSync("阻塞模式分词"); if (wordList.constructor == Array) // just for tutorial, this is always be true  {     wordList.forEach(function(word) { console.log(word);          }); }非阻塞式调用segment.queryCut("非阻塞模式分词", function(wordList) {     wordList.forEach(function(word) { console.log(word);          }); }); 具体用法可以参考 test/segment.js test/query_segment.jsTesting 在node v0.10.2下测试通过http://cppjieba-webdemo.herokuapp.com/ (chrome is suggested)ThanksJieba中文分词 标签:nodejieba

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值