亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mostwordsmodedictionariescompiler.java

?? 對Lcuene的良好的封裝,提供了中文分詞字典 功能強大
?? JAVA
字號:
package net.paoding.analysis.analyzer.impl;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.BitSet;
import java.util.Properties;

import net.paoding.analysis.Constants;
import net.paoding.analysis.dictionary.Dictionary;
import net.paoding.analysis.dictionary.Hit;
import net.paoding.analysis.dictionary.Word;
import net.paoding.analysis.knife.Beef;
import net.paoding.analysis.knife.Collector;
import net.paoding.analysis.knife.Dictionaries;
import net.paoding.analysis.knife.DictionariesCompiler;
import net.paoding.analysis.knife.Knife;

public class MostWordsModeDictionariesCompiler implements DictionariesCompiler {
	public static final String VERSION = "2";
	
	public boolean shouldCompile(Properties p) throws Exception {
		String lastModifieds = p.getProperty("paoding.analysis.properties.lastModifieds");
		String files = p.getProperty("paoding.analysis.properties.files");
		String dicHome = p.getProperty("paoding.dic.home.absolute.path");
		File dicHomeFile = new File(dicHome);
		File compliedMetadataFile = new File(dicHomeFile, ".compiled/most-words-mode/.metadata");
		if (compliedMetadataFile.exists() && compliedMetadataFile.isFile()) {
			Properties compiledProperties = new Properties();
			InputStream compiledPropertiesInput = new FileInputStream(compliedMetadataFile);
			compiledProperties.load(compiledPropertiesInput);
			compiledPropertiesInput.close();
			String compiledLastModifieds = compiledProperties.getProperty("paoding.analysis.properties.lastModifieds");
			String compiledFiles = compiledProperties.getProperty("paoding.analysis.properties.files");
			String clazz = compiledProperties.getProperty("paoding.analysis.compiler.class");
			String version = compiledProperties.getProperty("paoding.analysis.compiler.version");
			if (lastModifieds.equals(compiledLastModifieds) && files.equals(compiledFiles)
					&& this.getClass().getName().equalsIgnoreCase(clazz)
					&& VERSION.equalsIgnoreCase(version)) {
				return false;
			}
		}
		return true;
	}
	
	public void compile(Dictionaries dictionaries, Knife knife, Properties p) throws Exception {
		String dicHome = p.getProperty("paoding.dic.home.absolute.path");
		String noiseCharactor = getProperty(p, Constants.DIC_NOISE_CHARACTOR);
		String noiseWord = getProperty(p, Constants.DIC_NOISE_WORD);
		String unit = getProperty(p, Constants.DIC_UNIT);
		String confucianFamilyName = getProperty(p, Constants.DIC_CONFUCIAN_FAMILY_NAME);
		String combinatorics = getProperty(p, Constants.DIC_FOR_COMBINATORICS);
		String charsetName = getProperty(p, Constants.DIC_CHARSET);
		
		File dicHomeFile = new File(dicHome);
		File compiledDicHomeFile = new File(dicHomeFile, ".compiled/most-words-mode");
		compiledDicHomeFile.mkdirs();
		//
		Dictionary vocabularyDictionary = dictionaries.getVocabularyDictionary();
		File vocabularyFile = new File(compiledDicHomeFile, "vocabulary.dic.compiled");
		compileVocabulary(vocabularyDictionary, knife, vocabularyFile, charsetName);

		//
		Dictionary noiseCharactorsDictionary = dictionaries.getNoiseCharactorsDictionary();
		File noiseCharactorsDictionaryFile = new File(compiledDicHomeFile, noiseCharactor + ".dic.compiled");
		sortCompile(noiseCharactorsDictionary, noiseCharactorsDictionaryFile, charsetName);
		//
		Dictionary noiseWordsDictionary = dictionaries.getNoiseWordsDictionary();
		File noiseWordsDictionaryFile = new File(compiledDicHomeFile, noiseWord + ".dic.compiled");
		sortCompile(noiseWordsDictionary, noiseWordsDictionaryFile, charsetName);
		//
		Dictionary unitsDictionary = dictionaries.getUnitsDictionary();
		File unitsDictionaryFile = new File(compiledDicHomeFile, unit + ".dic.compiled");
		sortCompile(unitsDictionary, unitsDictionaryFile, charsetName);
		//
		Dictionary confucianFamilyDictionary = dictionaries.getConfucianFamilyNamesDictionary();
		File confucianFamilyDictionaryFile = new File(compiledDicHomeFile, confucianFamilyName + ".dic.compiled");
		sortCompile(confucianFamilyDictionary, confucianFamilyDictionaryFile, charsetName);
		//
		Dictionary combinatoricsDictionary = dictionaries.getCombinatoricsDictionary();
		File combinatoricsDictionaryFile = new File(compiledDicHomeFile, combinatorics + ".dic.compiled");
		sortCompile(combinatoricsDictionary, combinatoricsDictionaryFile, charsetName);
		
		//
		File compliedMetadataFile = new File(dicHomeFile, ".compiled/most-words-mode/.metadata");
		if (compliedMetadataFile.exists()) {
			compliedMetadataFile.setWritable(true);
			compliedMetadataFile.delete();
		}
		else {
			compliedMetadataFile.getParentFile().mkdirs();
		}
		OutputStream compiledPropertiesOutput = new FileOutputStream(compliedMetadataFile);
		Properties compiledProperties = new Properties();
		String lastModifiedsKey = "paoding.analysis.properties.lastModifieds";
		String filesKey = "paoding.analysis.properties.files";
		compiledProperties.setProperty(lastModifiedsKey, p.getProperty(lastModifiedsKey));
		compiledProperties.setProperty(filesKey, p.getProperty(filesKey));
		compiledProperties.setProperty("paoding.analysis.compiler.class", this.getClass().getName());
		compiledProperties.setProperty("paoding.analysis.compiler.version", VERSION);
		compiledProperties.store(compiledPropertiesOutput, "dont edit it! this file was auto generated by paoding.");
		compiledPropertiesOutput.close();
		compliedMetadataFile.setReadOnly();
	}


	public Dictionaries readCompliedDictionaries(Properties p) {
		String dicHomeAbsolutePath = p.getProperty("paoding.dic.home.absolute.path");
		String noiseCharactor = getProperty(p, Constants.DIC_NOISE_CHARACTOR);
		String noiseWord = getProperty(p, Constants.DIC_NOISE_WORD);
		String unit = getProperty(p, Constants.DIC_UNIT);
		String confucianFamilyName = getProperty(p, Constants.DIC_CONFUCIAN_FAMILY_NAME);
		String combinatorics = getProperty(p, Constants.DIC_FOR_COMBINATORICS);
		String charsetName = getProperty(p, Constants.DIC_CHARSET);
		return new CompiledFileDictionaries(
				dicHomeAbsolutePath + "/.compiled/most-words-mode",
				noiseCharactor, noiseWord, unit,
				confucianFamilyName, combinatorics, charsetName);
	}
	
	private static String getProperty(Properties p, String name) {
		return Constants.getProperty(p, name);
	}
	

	private void sortCompile(final Dictionary dictionary, 
			File dicFile, String charsetName) throws FileNotFoundException,
			IOException, UnsupportedEncodingException {
		int wordsSize = dictionary.size();
		if (dicFile.exists()) {
			dicFile.setWritable(true);
			dicFile.delete();
		}
		BufferedOutputStream out = new BufferedOutputStream(
				new FileOutputStream(dicFile), 1024 * 16);
		
		for (int i = 0; i < wordsSize; i++) {
			Word word = dictionary.get(i);
			out.write(word.getText().getBytes(charsetName));
			if (word.getModifiers() != Word.DEFAUL) {
				out.write("[m=".getBytes());
				out.write(String.valueOf(word.getModifiers()).getBytes());
				out.write(']');
			}
			out.write('\r');
			out.write('\n');
		}
		out.flush();
		out.close();
		dicFile.setReadOnly();
	}
	
	private void compileVocabulary(final Dictionary vocabularyDictionary, Knife knife,
			File vocabularyFile, String charsetName) throws FileNotFoundException,
			IOException, UnsupportedEncodingException {
		int vocabularySize = vocabularyDictionary.size();
		Word[] vocabularyWords = new Word[vocabularySize];
		char[] chs = new char[128];
		for (int i = 0; i < vocabularySize; i ++) {
			final Word curWord = vocabularyDictionary.get(i);
			curWord.getText().getChars(0, curWord.length(), chs, 0);
			chs[curWord.length()] = (char) -1;
			Beef beef = new Beef(chs, 0, curWord.length() + 1);
			final BitSet bs = new BitSet(curWord.length());
			knife.dissect(new Collector(){
				public void collect(String word, int offset, int end) {
					Hit hit = vocabularyDictionary.search(word, 0, word.length());
					if (hit.isHit() && hit.getWord().length() != curWord.length()) {
						for (int j = offset; j < end; j++) {
							bs.set(j, true);
						}
					}
				}
				
			}, beef, 0);
			
			for (int j = 0; j < curWord.length();j++) {
				if (!bs.get(j)) {
					vocabularyWords[i] = curWord;
					break;
				}
			}
		}
		if (vocabularyFile.exists()) {
			vocabularyFile.setWritable(true);
			vocabularyFile.delete();
		}
		BufferedOutputStream out = new BufferedOutputStream(
				new FileOutputStream(vocabularyFile), 1024 * 16);
		
		for (int i = 0; i < vocabularySize; i++) {
			if (vocabularyWords[i] != null) {
				out.write(vocabularyWords[i].getText().getBytes(charsetName));
				if (vocabularyWords[i].getModifiers() != Word.DEFAUL) {
					out.write("[m=".getBytes());
					out.write(String.valueOf(vocabularyWords[i].getModifiers()).getBytes());
					out.write(']');
				}
				out.write('\r');
				out.write('\n');
			}
		}
		out.flush();
		out.close();
		vocabularyFile.setReadOnly();
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
不卡一区二区中文字幕| 狠狠色丁香久久婷婷综| 亚洲国产激情av| 欧美激情一区不卡| 中文字幕精品综合| 国产精品麻豆欧美日韩ww| 国产精品美女久久久久aⅴ| 国产精品麻豆欧美日韩ww| 亚洲免费色视频| 亚洲影视在线观看| 亚洲h在线观看| 美脚の诱脚舐め脚责91 | 精品国产乱码久久久久久免费| 欧美另类z0zxhd电影| 欧美精品久久99| 日韩欧美123| 国产精品视频你懂的| 亚洲男同1069视频| 亚洲成人动漫一区| 国产一区二区导航在线播放| 粉嫩高潮美女一区二区三区| 在线观看av一区| 欧美sm美女调教| 国产精品久久毛片a| 欧美日韩免费视频| 91传媒视频在线播放| 欧美一区二区精品| 国产蜜臀97一区二区三区| **性色生活片久久毛片| 日本午夜一本久久久综合| 国模一区二区三区白浆| 色综合天天综合网国产成人综合天 | 亚洲美女少妇撒尿| 天堂久久一区二区三区| 国产精品羞羞答答xxdd| 欧美日韩成人在线| 亚洲国产精品激情在线观看| 午夜视频一区二区三区| 国产福利一区二区三区视频在线| 91国产丝袜在线播放| 久久久久久久久久久久久女国产乱| 亚洲欧洲综合另类在线| 久久99精品久久只有精品| 91在线一区二区三区| 精品久久五月天| 亚洲国产精品一区二区www| 国产激情一区二区三区四区| 欧洲一区在线电影| 国产日韩欧美a| 免费成人你懂的| 欧美丝袜丝交足nylons| 国产精品入口麻豆原神| 精品一区二区免费看| 欧美少妇bbb| 综合久久久久综合| 丁香婷婷综合五月| 久久久久久久久久久久久女国产乱| 日韩精品亚洲一区二区三区免费| 97久久久精品综合88久久| 久久网站最新地址| 国产中文字幕一区| 日韩欧美激情四射| 日本欧美一区二区三区乱码| 欧美日韩一区二区三区不卡| 亚洲免费av在线| av资源网一区| 国产精品乱码人人做人人爱| 国产真实乱偷精品视频免| 欧美一级黄色大片| 亚洲成人一二三| 欧美久久久久久蜜桃| 亚洲高清免费视频| 欧美日韩国产高清一区二区三区| 一区二区三区在线观看欧美| 99国产精品视频免费观看| 国产精品人妖ts系列视频| 粉嫩av亚洲一区二区图片| 国产精品女人毛片| 99re视频精品| 一区二区三区精品视频在线| 欧美三级在线视频| 日韩电影免费一区| 亚洲精品一区二区三区在线观看| 国产麻豆精品theporn| 久久网站最新地址| www.亚洲人| 亚洲免费观看高清完整版在线观看 | 精品一区二区三区视频在线观看| 日韩一二三四区| 国产一区二区三区电影在线观看| 久久综合色综合88| 成人性生交大片免费看中文| 亚洲日穴在线视频| 欧美图片一区二区三区| 久久精品国产99| 欧美国产1区2区| 欧美最新大片在线看| 婷婷丁香激情综合| 26uuu成人网一区二区三区| 不卡一区二区中文字幕| 亚洲国产精品自拍| 欧美精品一区二| 色婷婷综合久久久中文一区二区| 亚洲一级不卡视频| 久久综合久久综合久久| 99久久精品免费看国产免费软件| 日韩专区在线视频| 久久久久久久久久美女| 欧美午夜精品一区| 国产剧情在线观看一区二区| 樱桃视频在线观看一区| 久久综合色一综合色88| 欧洲一区二区三区免费视频| 激情综合色播五月| 樱花影视一区二区| 久久青草欧美一区二区三区| 在线观看视频91| 国产成人啪免费观看软件| 婷婷综合在线观看| 国产精品国产三级国产aⅴ入口 | 91麻豆精品国产自产在线| 丁香一区二区三区| 久久精品国产亚洲aⅴ | 免费在线成人网| 亚洲欧洲性图库| 欧美成人一区二区三区在线观看| 99九九99九九九视频精品| 国产永久精品大片wwwapp| 亚洲va国产va欧美va观看| 综合欧美亚洲日本| 国产清纯美女被跳蛋高潮一区二区久久w | 成人精品免费网站| 久久狠狠亚洲综合| 视频一区中文字幕| 亚洲男人天堂av网| 综合精品久久久| 中文字幕电影一区| 欧美国产精品v| 精品国产三级a在线观看| 在线电影一区二区三区| 欧美日韩性生活| 欧美日韩一二三区| 欧美日韩亚洲丝袜制服| 欧美专区日韩专区| 色婷婷久久一区二区三区麻豆| 成人激情小说网站| 国产成人精品影视| 国产iv一区二区三区| 国产一区二区三区观看| 国产成人精品一区二区三区四区 | 成人av资源下载| 国产91富婆露脸刺激对白| 国产电影精品久久禁18| 国产精品一二三区在线| 激情六月婷婷久久| 国产成人av电影在线观看| 成人做爰69片免费看网站| 国产高清不卡二三区| 成人美女视频在线观看| av一本久道久久综合久久鬼色| 丁香婷婷深情五月亚洲| 色综合天天狠狠| 欧美在线视频你懂得| 欧美色成人综合| 日韩欧美卡一卡二| 亚洲国产精品av| 亚洲自拍另类综合| 日韩激情视频网站| 国产一区视频在线看| 成人高清视频在线| 欧美日韩一区二区在线观看视频| 欧美一二三四在线| 国产精品视频九色porn| 亚洲小说欧美激情另类| 热久久国产精品| 成人污视频在线观看| 欧美午夜片在线观看| 精品剧情v国产在线观看在线| 中文字幕av不卡| 首页国产欧美日韩丝袜| 丁香天五香天堂综合| 欧美午夜精品久久久| 精品成人一区二区三区| 亚洲人成电影网站色mp4| 日日夜夜精品视频免费| 国产成人99久久亚洲综合精品| 欧美性生活影院| 国产亚洲精品资源在线26u| 一区二区三区精品久久久| 国产一区二区剧情av在线| 91蜜桃在线观看| 26uuu精品一区二区| 一片黄亚洲嫩模| 风间由美中文字幕在线看视频国产欧美 | 成人免费三级在线| 欧美精品亚洲一区二区在线播放| 国产精品丝袜在线| 久久99久久久久| 91福利区一区二区三区| 精品国产乱子伦一区|