Giter Site home page Giter Site logo

treesplitword's Introduction

TreeSplitWord 一个tire树结构的分词

一个trie树数据结构的分词 没有什么新意.使用方便

词典结构支持read流.字符.文件各种格式调用简单.支持不定参数

这是个例子欢迎大家使用.我用了好久了应该没有bug的


		/**
		 * 词典的构造.一行一个词后面是参数.可以从文件读取.可以是read流.
		 */
		String dic = "**\t1\tzg\n人名\t2\n**人民\t4\n人民\t3\n孙健\t5\nCSDN\t6\njava\t7\njava学习\t10\n";
		Forest forest = Library.makeForest(new BufferedReader(new StringReader(dic)));

		/**
		 * 删除一个单词
		 */
		Library.removeWord(forest, "**");
		/**
		 * 增加一个新词
		 */
		Library.insertWord(forest, "**人");
		String content = "**人名识别是**人民的一个骄傲.孙健人民在CSDN中学到了很多最早iteye是java学习笔记叫javaeye但是java123只是一部分";
		GetWord udg = forest.getWord(content);

		String temp = null;
		while ((temp = udg.getFrontWords()) != null)
			System.out.println(temp + "\t\t" + udg.getParam(1) + "\t\t" + udg.getParam(2));

treesplitword's People

Contributors

ansjsun avatar

Stargazers

 avatar  avatar  avatar  avatar Jason Hao avatar  avatar  avatar tom.wen avatar Weirong Yang avatar Nil avatar

Watchers

Willis avatar James Cloos avatar LshGo avatar Jason Hao avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.