KeytermExtraction.java 35.3 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639
package nlp.whu.utils;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.BitSet;
import java.util.Collections;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import nlp.whu.model.Pair;


/**
 * @author shx 史华新关键词抽取
 * modified by hx
 * modified by lc
 */

public class KeytermExtraction {
	static final double seed = 15;
	static int minLength = 2;// 关键词的最小长度
	//关键词抽取,content的最大长度,2000000大致需要20s左右
	public static final int maxContentLength = 2000000;
	static String allChineseFile = "nlp/whu/conf/all_prw.txt";
	static String stopWordFile = "nlp/whu/conf/stopwords.txt";
	static int minFreqThreshold = LoadFocusPath.minKeytermThreshold;
	static int maxKeytermThreshold = LoadFocusPath.maxKeytermThreshold;
	static Hashtable<String, Double> refer_ht = new Hashtable<String, Double>();// 保存文本单元及对应频率

	static HashSet<String> stopWords = new HashSet<String>();
	/**
	 * 读取all_prw.txt文件获得单元及频率
	 */
	static {
		
		try {
			//BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(allChineseFile),"GBK")); 
			BufferedReader reader = new BufferedReader(new InputStreamReader(
							KeytermExtraction.class.getClassLoader().getResourceAsStream(allChineseFile),"gbk"));

			String line = null;
			while ((line = reader.readLine()) != null) {
				String[] a = line.split("\\s+");
				String word = a[0];
				String num = a[1];
				refer_ht.put(word, Double.valueOf(num));
				line = reader.readLine();
			}
			reader.close();
			
			reader = new BufferedReader(new InputStreamReader(
					KeytermExtraction.class.getClassLoader().getResourceAsStream(stopWordFile),"gbk"));
			while ((line = reader.readLine()) != null) {
				stopWords.add(line);
			}
			reader.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	@SuppressWarnings("rawtypes")
	public static class KeyTermPair extends Pair  implements Comparable{
		public KeyTermPair(Object fir, Object sec)
		{
			super(fir, sec);
		}
		@Override
		public int compareTo(Object arg0) {
			Pair o = (Pair)arg0;
			return (Integer)o.second - (Integer)second;
		}
	}
	
	public static void getEnglishWordFreq()
	{
		String a = "word_freq.txt";
		String b = "most_freq_words.txt";
		String c = "eng_words.txt";
		Hashtable<String, Long> a_table = new Hashtable<String, Long>();
		Hashtable<String, Long> b_table = new Hashtable<String, Long>();
		
		try{
			BufferedReader reader=new BufferedReader(new InputStreamReader(new FileInputStream(a),"utf8")); 
			String line = null;
			while ((line = reader.readLine()) != null) {
				line = line.trim();
				if(line.length() > 0){
					String[] items = line.split("\\t");
					if(items.length != 2){
						System.out.println("异常");
						break;
					}
					a_table.put(items[0], Long.parseLong(items[1]));
				}
			}
			reader.close();
			double totalCount = 0;
			reader=new BufferedReader(new InputStreamReader(new FileInputStream(b),"utf8")); 
			while ((line = reader.readLine()) != null) {
				line = line.trim();
				if(line.length() > 0){
					String[] items = line.split("\\s+");
					if(items.length == 2){
						Long freq = a_table.get(items[1]);
						if(freq == null){
							System.out.println("异常:"+line);
						}else{
							totalCount += freq;
							b_table.put(items[1], freq);
						}
					}else{
						System.out.println("异常:"+line);
					}
				}
			}
			reader.close();
			
			BufferedWriter writer=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(c),"GBK")); 
			for(String key : b_table.keySet())
			{
				Double prob = b_table.get(key).doubleValue() / totalCount;
				line = key+"\t"+ prob.toString();
				writer.write(line);
				writer.newLine();
			}
			writer.close();
		}catch(Exception ex){
			ex.printStackTrace();
		}
	}
	
	@SuppressWarnings("unchecked")
	public Hashtable<String, Integer> processForSubstr(Hashtable<String, Integer> result,String content, int threshold) 
	{
		LinkedList<WhuString> keys = new LinkedList<WhuString>();
		for(String key : result.keySet()){
			keys.add(new WhuString(key));
		}
		java.util.Collections.sort(keys);
		HashSet<Integer> removedItems = new HashSet<Integer>();
		for(int i=0;i<keys.size();i++) {
			if(removedItems.contains(i)) continue;
			String maxStr = keys.get(i).str;
			content = content.replaceAll(maxStr, "");

			for (int j=i+1;j<keys.size();j++) {
				String sub = keys.get(j).str;
				if(maxStr.contains(sub)){
					int substrCount= getCount(content,sub);
					if(substrCount<threshold)
					{
						removedItems.add(j);
						result.remove(sub);
					}
				}
			}
		}
		return result;
	}
	
	public boolean vd(String str) 
	{
		String w = "[A-Za-z]";
		
		Pattern p = Pattern.compile(w);
		
		Matcher m = p.matcher(str);
		
		return m.find();
	}
	
	/**
	 * 
	 * @param 列表中每个单位都是一个待抽取关键词的文本
	 * @return 列表中每个哈希表对应每个文本的关键词
	 * @throws Exception 
	 * 
	 */
	public Hashtable<String, Integer> execute(String content, boolean overlap) {
		String regex = "\\d{10,}";
		Hashtable<String, Integer> ht_result = new Hashtable<String, Integer>();
		content = content.replaceAll(regex, "");
		
		
		int threshold = (int)(0.003f*content.length());
		if(threshold < minFreqThreshold){
			threshold = minFreqThreshold;
		} 
		if(threshold > maxKeytermThreshold){
			threshold = maxKeytermThreshold;
		}
		ht_result = docManage(content, overlap, threshold);

		return ht_result;
	}
	
	@SuppressWarnings("unchecked")
	public List<KeyTermPair> getTopN(int n, Hashtable<String, Integer> all)
	{
		List<KeyTermPair> pairs = new LinkedList<KeyTermPair>();
		for(Map.Entry<String, Integer> en : all.entrySet())
		{
			KeyTermPair pair = new KeyTermPair(en.getKey(), en.getValue());
			pairs.add(pair);
		}
		Collections.sort(pairs);
		if(n > 0){
			while(pairs.size() > n){
				pairs.remove(n);
			}
		}
		return pairs;
	}

	/**
	 * 
	 * @param 待处理文本
	 * @return 文本中的所有关键词
	 */
	public void validSeeds(Hashtable<String, Integer> ht_result, HashSet<String> ht_seed)
	{
		Object[] results = ht_result.keySet().toArray();
		for(Object k : results)
		{
			String key = (String)k;
			if(!IsChinese(key)){
				if(!ht_seed.contains(key)) {
					ht_result.remove(key);
				}
			}else{
				int i = 0;
				for(i=0;i<key.length();i++)
				{
					String c = key.substring(i,i+1);
					if(ht_seed.contains(c)) break;
				}
				if(i == key.length()){
					ht_result.remove(key);
				}
			}
		}
	}
	public Hashtable<String, Integer> docManage(String content, boolean overlap, int threshold) {
		Integer size = 0;
		Hashtable<String, Integer> ht_result = new Hashtable<String, Integer>();
		Hashtable<String, HashSet<Integer>>  ht_index = new Hashtable<String, HashSet<Integer>>();
		
		size= readDoc(content, ht_index );   //对content中的汉字进行统计
//		传出ht_index->{词/字:(句中位置的set)}
		HashSet<String> ht_seed = getSeeds(size, ht_index);  //获取超过一定词频的汉字或者符号组合
		ht_result = getAllSubs(content, overlap, threshold, ht_index);  //获取所有可能的连续中文以及符号组合
		validSeeds(ht_result, ht_seed);  //移除非中文字符以及和ht_seed中相同的只有最后一个是汉字的字符组合

		return ht_result;
	}

	/**
	 * 得到一篇文章的所有种子
	 * 
	 * @param ht待处理文本中每个单元出现的概率
	 * @return 返回待处理文本中的种子
	 */
	public HashSet<String> getSeeds(int size,
			Hashtable<String, HashSet<Integer>> htInput) {
		HashSet<String> htOutput = new HashSet<String>();

		for (String chr : htInput.keySet()) {
			HashSet<Integer> sets = htInput.get(chr);
			double d1 = (double)sets.size() / size;
//			sets.size()出现次数/size 词语总数
			if(refer_ht.containsKey(chr)){
//				refer是all_prw的字:词频
				double d = refer_ht.get(chr);
				double s = d1 / d;
				if(s > seed){
					htOutput.add(chr);
				}
			}else if(!IsNumber(chr)){
				htOutput.add(chr);
			}
		}
		return htOutput;
	}
	
	/**
	 * 获取包含种子i的所有字串,i为一个种子,txt为待处理的doc所合并成的字符串, 所得结果存在一个字符串数组中
	 * 
	 * @param 待处理文本中的一个种子i
	 * @param 待处理文本txt
	 * @return 待处理文本中包含此输入种子的所有候选关键词串
	 */
	public static void KeyIncrement(Hashtable<String, Integer> ht, String key, int cnt)
	{
		Integer count = ht.get(key);
		if(count == null){
			count = 0;
		}
		count += cnt;
		ht.put(key, count);
	}
	@SuppressWarnings("rawtypes")
	public class WhuString implements Comparable{
		public String str;
		public WhuString()
		{
			str = "";
		}
		public WhuString(String s)
		{
			str = s;
		}
		@Override
		public int compareTo(Object arg0) {
			WhuString o = (WhuString)arg0;
			return o.str.length() - str.length();
		}
		
	}
	
	private void AddPos(Hashtable<String, LinkedList<Pair>> subtermPos,
			String word, Pair pair)      //将同一个词的位置用链表连接起来
	{
		LinkedList<Pair> pairs = subtermPos.get(word);
		if(pairs == null) {
			pairs = new LinkedList<Pair>();
			subtermPos.put(word, pairs);
		}
		pairs.add(pair);
	}
	@SuppressWarnings("unchecked")
	public Hashtable<String, Integer> getAllSubs(String txt, boolean overlap, int threshold,
			Hashtable<String, HashSet<Integer>> ht_index)
	{
		Hashtable<String, Integer> ht_all_subterms = 
				new Hashtable<String, Integer>();
		
		Hashtable<String, LinkedList<Pair>> subtermPos = 
				new Hashtable<String, LinkedList<Pair>>();
		
		BitSet bits = new BitSet(txt.length());
		bits.clear();
		for(String key : ht_index.keySet())
		{
			HashSet<Integer> indexes = ht_index.get(key);
			if(indexes.size() >= threshold){
				for(Integer index : indexes){
					for(int i=0;i<key.length();i++){
						bits.set(index+i);
					}
				}
			}
		}
//		bits for 文本的向量,1为关键词位置
		int start =0;
		while(start < bits.length())
		{
			int end = start + 1;
			if(start <  bits.length() &&  bits.get(start) ){
				while(end < bits.length() &&  bits.get(end)) end++;
				if(end - start > 1){
					String temp = txt.substring(start, end);
					if(IsEnglish(temp)){
						Pair pair = new Pair(start, end);
						AddPos(subtermPos, temp, pair);
					}else{
						for(int i=0; i<temp.length(); i++)
						{
							for(int j=i+2;j<temp.length()+1;j++){
								String key = temp.substring(i, j);
								Pair pair = new Pair(start+i, start+j);
								AddPos(subtermPos, key, pair);
							}
						}
					}
				}
			}
			start = end;
		}
//		subterm主要是列出中文组合
		LinkedList<WhuString> words = new LinkedList<WhuString>();
		for(String word : subtermPos.keySet())
		{
			words.add(new WhuString(word));
		}
		Collections.sort(words);
		
		for(WhuString str : words)
		{
			String word = str.str;
			LinkedList<Pair> pos = subtermPos.get(word);
			int count = 0;
			for(Pair pair : pos)
			{
				if( bits.get((Integer)pair.first) ) 
					count ++;
			}
			if(count >= threshold) {
				ht_all_subterms.put(word, overlap? count : pos.size());
				for(Pair pair : pos)
				{
					bits.clear( (Integer)pair.first, (Integer)pair.second );
				}
			}
		}
		
		return ht_all_subterms;
	}
	/**
	 * 判断字符串b是否是字符串a的子串
	 * 
	 * @param 字符串a
	 *            ,字符串b
	 * @return 
	 */
	public boolean isSubStr(String a, String b) {

		if (a.equals(b))
			return false;

		if (a.contains(b))
			return true;
		return false;
	}

	/**
	 * 得出长度最大的字符串
	 * 
	 * @param 待处理字符串数组
	 * @return 字符串数组中最长字符串
	 */
	public String getMaxlength(String[] s) {
		int i = 0, max = 0, maxLength = 0;

		while ((i < s.length) && (s[i] != null)) {
			int len = s[i].length();
			if (len > maxLength) {
				maxLength = len;
				max = i;
			}
			i++;
		}
		return s[max];
	}
	/**
	 * 得出长度最小的字符串
	 * 
	 * @param 待处理字符串数组
	 * @return 字符串数组中最小字符串
	 */
	public String getMinlength(String[] s) {
		int i = 0, min = 0, minLength = s[0].length();

		while ((i < s.length) && (s[i] != null)) {
			int len = s[i].length();
			if (len < minLength) {
				minLength = len;
				min = i;
			}
			i++;
		}
		return s[min];
	}
	/*
	 * 返回字符类型
	 * 0	标点符号或其他隔断符(包括空格等)
	 * 1	汉字
	 * 2	英文
	 * 3	数字
	 */
	public int CharType(char c)
	{
		if(c >= 0x4e00 && c <= 0x9fa5){
			return 1;
		}else if((c >= 'A' && c <= 'Z')
				|| (c >= 'a' && c <= 'z')){
			return 2;
		}else if(c >= '0' && c <= '9'){
			return 3;
		}else{
			return 0;
		}
	}
	public static Pattern engPattern = Pattern.compile("^[a-zA-Z]\\w*");
	public static Pattern chiPattern = Pattern.compile("[\u4e00-\u9fa5]+");
	public static Pattern numPattern = Pattern.compile("^\\d+$");
	public boolean IsChinese(String str)
	{
		Matcher mh = chiPattern.matcher(str);
		return mh.find();
	}
	public boolean IsEnglish(String str)
	{
		Matcher mh = engPattern.matcher(str);
		return mh.find();
	}
	public boolean IsNumber(String str)
	{
		Matcher mh = numPattern.matcher(str);
		return mh.find();
	}
	/**
	 * 计算每个汉字在文本中的概率
	 * 
	 * @param 待处理文本
	 * @return 文本中每个单元以及出现的次数
	 */
	public static void PutString(String key, int index, 
			Hashtable<String, HashSet<Integer>> result)
	{
		HashSet<Integer> sets = result.get(key);
		if(sets == null){
			sets = new HashSet<Integer>();
			result.put(key, sets);
		}
		sets.add(index);
	}
	public int readDoc(String text, Hashtable<String, HashSet<Integer>> result) {
		int size = 0;
		char c = 0;
		
		StringBuilder str = new StringBuilder();
		for(int index =0; index < text.length(); index ++)
		{
			c = text.charAt(index);
			int type = CharType(c);
			String key = null;
			switch(type)
			{
			case 0:
				if(str.length() > 0){
					key = str.toString();
					if( !stopWords.contains(key) ){
						PutString(key, index - key.length(), result);
					}
					str.delete(0, str.length());
					size ++;
				}
				break;
			case 1:
				if(str.length() > 0){
					key = str.toString();
					if(!stopWords.contains(key) ){
						PutString(key, index - key.length(), result);
					}
					str.delete(0, str.length());
					size ++;
				}
				key = String.valueOf(c);
				if(!stopWords.contains(key)){
					PutString(key, index, result);
				}
				size ++;
				break;
			case 2:
				str.append(c);
				break;
			case 3:
				str.append(c);
				break;
				default:break;
			}
		}

		return size;
	}

	/**
	 * 计算子串在给定字符串出现的次数
	 * 
	 * @param 待处理字母串
	 * @param 待计数的子串
	 * @return 待计数的子串在母串中出现的次数
	 */
	public int getCount(String str, String sign) {
		// 查找某一字符串中str,特定子串sign的出现次数
		if (str == null)
			return 0;
		int count = 0;
		int startIndex = 0;
		while(startIndex < str.length() &&
				(startIndex = str.indexOf(sign, startIndex)) >= 0)
		{
			count ++;
			startIndex += sign.length();
		}
		return count;
	}
	
	public static void main(String args[]) throws IOException {
		//getEnglishWordFreq();
		
		KeytermExtraction keytermExtract = new KeytermExtraction();
//		String content = "ITTERY, Maine (AP) — The Navy said farewell Friday to the USS Miami, the nuclear-powered submarine whose service was cut short when a shipyard employee trying to get out of work set it on fire, causing $700 million in damage.The somber deactivation ceremony at Portsmouth Naval Shipyard marked the beginning of an inglorious end: Next year, the submarine will be towed to the West Coast to be cut up for scrap metal.Rear Adm. Ken Perry, commander of the submarine Group Two in Groton, Conn., where the sub was based, acknowledged the disappointment over its premature retirement but told the crowd they were there to celebrate Miami and its crew members for nearly 24 years of service.\"This is a tribute,\" he said. \"This is a celebration of the ship's performance and the superb contributions to the nation's defense and this is how we're going to treat it. So I expect to see some smiles out there.\"Perry praised the ship's performance over more than a dozen deployments that included clandestine undersea warfare missions and back-to-back deployments in which it fired cruise missiles in Iraq and in Serbia, earning the nickname \"Big Gun.\"The audience included crew members and their families and seven former Miami commanding officers, including retired Capt. Tom Mader, the sub's first skipper.View galleryRear Admiral Ken Perry arrives at the decommissioning&nbsp;&hellip;Rear Admiral Ken Perry arrives at the decommissioning ceremony for the fire-damaged USS Miami nuclea …At the end of the ceremony, the crew filed out of the auditorium after its top enlisted sailor, Chief Tyrus Rock, led them in a cheer, shouting out the first part of the ship's motto, \"No free rides!\" The crew finished by responding, \"Everybody rows!\"Cmdr. Rolf Spelker, the Miami crew's current leader, said he came to Portsmouth thinking his assignment was to return the ship for service.\"They are no doubt disappointed and saddened that they can't take the ship out to sea,\" he said of his crew. \"They have gone through the tidal wave of emotion.\"After the fire, the Navy originally intended to return the ship to the fleet next year after extensive repairs. But it decided to scrap the submarine when estimated repair costs grew substantially above a $450 million estimate.Instead, shipyard workers will remove nuclear fuel and ship it to a federal repository in Idaho. They will make enough repairs so that the submarine can be towed to Puget Sound Naval Shipyard in Washington state, where it will be cut up for scrap. The estimated cost of the sub's inactivation is $54 million.View gallerySubmarine sailors are dismissed during the decommissioning&nbsp;&hellip;Submarine sailors are dismissed during the decommissioning ceremony for the fire-damaged USS Miami n …The Los Angeles-class submarine was damaged at the hands of a shipyard worker who set a fire in May 2012 while the submarine was undergoing a 20-month overhaul.Seeking an excuse to leave work early, Casey James Fury set fire to a box of rags on a bunk, and the blaze quickly spread throughout the forward compartments. Fury pleaded guilty and is serving a 17-year sentence in federal prison.It took 12 hours and the efforts of more than 100 firefighters to save the vessel. The fire severely damaged living quarters, the command and control center and a torpedo room, but it did not reach the nuclear propulsion components at the sub's rear. Seven people were hurt dousing the flames.The Navy launched a series of investigations after the fire that led to recommendations, including installation of temporary automatic fire detection systems while submarines and other vessels are being repaired or overhauled.";
		StringBuilder sb = new StringBuilder();
		String content1 = "湖北省各院校2014年本科新增专业名单_新闻_新民网|||||||街镇报||||||||||||||||关闭新民网移动客户端您现在的位置: > > 正文湖北省各院校2014年本科新增专业名单2014-03-29 13:51来源: | 字号:  本信息来自教育部公布的《教育部关于公布2013年度普通高等学校本科专业设置备案或审批结果的通知》。  武汉轻工大学070202应用物理学四年理学武汉轻工大学080905物联网工程四年工学武汉轻工大学082705酿酒工程四年工学武汉科技大学080703通信工程四年工学武汉科技大学082802城乡规划五年工学长江大学080905物联网工程四年工学长江大学090105种子科学与工程四年农学长江大学090402动物药学四年农学武汉工程大学080905物联网工程四年工学武汉纺织大学080403材料化学四年工学武汉纺织大学130301表演四年艺术学武汉纺织大学130506公共艺术四年艺术学050262商务英语四年文学湖北中医药大学040206T运动康复四年理学湖北大学050305编辑出版学四年文学湖北大学082503环境科学四年理学湖北大学120802T电子商务及法律四年管理学湖北师范学院130309播音与主持艺术四年艺术学黄冈师范学院020307T经济与金融四年经济学黄冈师范学院080705光电信息科学与工程四年工学黄冈师范学院120902酒店管理四年管理学湖北民族学院130402绘画四年艺术学湖北文理学院080703通信工程四年工学湖北文理学院120105工程造价四年工学武汉体育学院130502视觉传达设计四年艺术学湖北美术学院120210文化产业管理四年管理学湖北美术学院130101艺术史论四年艺术学湖北美术学院130307戏剧影视美术设计四年艺术学湖北汽车工业学院120503信息资源管理四年管理学湖北工程学院040106学前教育四年教育学湖北工程学院080401材料科学与工程四年工学湖北理工学院080207车辆工程四年工学湖北理工学院080905物联网工程四年工学湖北理工学院120601物流管理四年管理学湖北科技学院081201测绘工程四年工学湖北科技学院130305广播电视编导四年艺术学湖北医药学院100805T中药制药四年理学江汉大学050261翻译四年文学江汉大学101003医学影像技术四年理学江汉大学120210文化产业管理四年管理学三峡大学080204机械电子工程四年工学三峡大学080905物联网工程四年工学荆楚理工学院050262商务英语四年文学荆楚理工学院080905物联网工程四年工学荆楚理工学院080906数字媒体技术四年工学武汉音乐学院130206舞蹈编导四年艺术学湖北经济学院040207T休闲体育四年教育学湖北经济学院080905物联网工程四年工学湖北经济学院130501艺术设计学四年艺术学武汉商学院050262商务英语四年文学武汉商学院081002建筑环境与能源应用工程四年工学武汉商学院130310动画四年艺术学武汉东湖学院050261翻译四年文学武汉东湖学院083002T生物制药四年工学武汉东湖学院120204财务管理四年管理学汉口学院020304投资学四年经济学汉口学院080905物联网工程四年工学汉口学院120103工程管理四年管理学华中科技大学武昌分校080905物联网工程四年工学华中科技大学武昌分校120105工程造价四年工学武昌理工学院080905物联网工程四年工学武昌理工学院080907T智能科学与技术四年工学武昌理工学院130507工艺美术四年艺术学武汉生物工程学院050262商务英语四年文学武汉生物工程学院080204机械电子工程四年工学武汉生物工程学院101001医学检验技术四年理学武汉大学珞珈学院050262商务英语四年文学武汉大学珞珈学院080604T电气工程与智能控制四年工学武汉大学珞珈学院080905物联网工程四年工学050204法语四年文学082702食品质量与安全四年工学武汉科技大学城市学院080902软件工程四年工学三峡大学科技学院101101护理学四年理学三峡大学科技学院120105工程造价四年管理学江汉大学文理学院050261翻译四年文学江汉大学文理学院050304传播学四年文学工程技术学院082803风景园林四年工学武昌工学院050103汉语国际教育四年文学武昌工学院120205国际商务四年管理学武汉长江工商学院120204财务管理四年管理学武汉长江工商学院120205国际商务四年管理学武汉长江工商学院120602物流工程四年管理学长江大学工程技术学院050262商务英语四年文学长江大学工程技术学院080905物联网工程四年工学082802城乡规划四年工学130305广播电视编导四年艺术学商贸学院020102经济统计学四年经济学商贸学院130404摄影四年艺术学湖北汽车工业学院科技学院080703通信工程四年工学湖北民族学院科技学院080204机械电子工程四年工学湖北经济学院法商学院050262商务英语四年文学湖北经济学院法商学院120205国际商务四年管理学湖北经济学院法商学院120602物流工程四年管理学武汉体育学院体育科技学院120210文化产业管理四年管理学武汉体育学院体育科技学院130309播音与主持艺术四年艺术学湖北师范学院文理学院050207日语四年文学湖北师范学院文理学院120601物流管理四年管理学湖北师范学院文理学院120904T旅游管理与服务教育四年管理学湖北文理学院理工学院020304投资学四年经济学湖北文理学院理工学院050261翻译四年文学湖北工程学院新技术学院080703通信工程四年工学华中科技大学文华学院120204财务管理四年管理学中南财经政法大学武汉学院050262商务英语四年文学中南财经政法大学武汉学院080903网络工程四年工学中南财经政法大学武汉学院120206人力资源管理四年管理学中国地质大学江城学院050262商务英语四年文学中国地质大学江城学院130508数字媒体艺术四年艺术学武汉理工大学华夏学院020307T经济与金融四年经济学华中农业大学楚天学院050262商务英语四年文学华中农业大学楚天学院130507工艺美术四年艺术学湖北第二师范学院080905物联网工程四年工学湖北第二师范学院081001土木工程四年工学湖北第二师范学院130310动画四年艺术学华中师范大学武汉传媒学院050262商务英语四年文学华中师范大学武汉传媒学院080902软件工程四年工学华中师范大学武汉传媒学院120903会展经济与管理四年管理学  注:专业代码加有“T”者表示特设专业;专业代码加有“K”者表示国家控制布点专业;专业代码加有“H”者表示中外合作办学专业;学校名称加有“※”者为经教育部批准和确认的独立学院。  分享到新民网事由新民网出品微信号:xinminwangshi突发事、新鲜事、有趣事感人事、烦心事等你来爆料!扫一扫,关注有礼!侬好上海由新民网出品微信号:helloshanghai2013吃喝玩乐、上海故事、同城活动每天热爱上海多一点加入小侬家族就对啦!今日热点更多关于的新闻版权声明:? 在本网站刊登的所有内容,包括但不限于文字、图片、音频视频、美术设计、程序及多媒体等信息,未经著作权人合法书面授权,不得进行一切形式的下载、转载或建立镜像。获得著作权人合法书面授权的,必须在授权范围内使用,使用时保留本网注明的“稿件来源”,并自负法律责任。凡注明为其他媒体来源,均为转载自其他媒体,转载并不代表本网赞同其观点,也不代表本网对其真实性负责。如果擅自篡改为“稿件来源:新民网”,本网将依法追究责任。? 您若对稿件处理有任何疑问或质疑,请即与新民网联系,本网将迅速给您回应并做处理。电话:021-52921234转641111 021-52921234转 新民网 传真:021-62677454邮箱:稿件处理 处理时间:9:00—18:00数据加载中……新产品微互动清明踏青出行攻略金山爱苗看护点 3天2娃发病身亡马航一吉隆坡飞北京航班失联俄攀高狂人爬上海中心随手拍身边固定污染源发送你与爱车的合影,并为爱车定制一句绿色标语,将有机会获得“钛马星”车联网绿驾车顶盒1个,赶快来参加吧!新生活新民报系成员新民全媒体产品微信号新民网战略合作伙伴| |广播电视节目制作经营许可证:(沪)字第536号 | 新民晚报官方网站 xinmin.cn ?2013 All rights reserved.您还未登录用户名:密 码:下次自动登录没有账号?新民网友:评论成功评论成功,谢谢参与!点“看微博”查看您的评论成功评论成功,谢谢参与!";
		String content2 = "我的脚下沾有多少泥土,我的心中就沉淀多少真情6月23日,端午节。清晨5时,机械与动力工程学院青年志愿者服务队的队员们在风雨中启程,赶赴400多公里外的安徽省定远县蒋集镇卜店乡大庙小学进行为期两天的社会实践。在短暂的行程中,队员们紧紧围绕“走近乡村儿童,点燃梦想火炬”这一主题,通过为孩子们组织游戏、开展“梦想宣讲会”、举办家长座谈会、捐赠礼品等多种形式的活动,为交通不便、信息闭塞的蒋集镇的孩子和家长们点燃梦想火炬,勉励他们用知识改变命运。本次社会实践得到了当地村支书、大庙小学校长,以及众多村民的大力支持,他们身上所表现出的对美好生活的渴望和逆境中的坚强意志让队员们尤为动容。安徽省定远县蒋集镇卜店乡地处腹地,交通不便,信息闭塞。村中的大庙小学建于1951年,全盛时有超过1000名在校生。然而,随着越来越多的青壮年携家眷外出打工,目前,这所学校仅剩30多个学生和4位老师。从清晨5时开始,青志队员们从上海出发7个小时后终于到达定远县城。又摇摇晃晃了近两个小时到达镇上,之后的道路,客车已经无法行使。于是队员们分为两组:一组步行,另一组乘坐村长亲自驾驶的手扶拖拉机。一番跋涉后,队员们终于到达目的地。在校门下,站满了迎接队员的孩子和家长。到达之后,队员们按照计划,将家长和孩子们安排在两个教室进行活动。此时正值酷暑,由于设备简陋,教师没有电风扇,但这丝毫挡不住孩子们以及家长们的热情。在孩子们期待的目光中,队员们开始了以“传递梦想”为主题的宣讲会。看着孩子们规规矩矩地坐在座位上,但是却又显得拘谨,于是队员们按计划在游戏中与他们拉近距离。击鼓传花游戏中,孩子们并不懂得如何表演,然而在游戏组织者的带领下,“床前明月光,疑是地上霜”“日照香炉生紫烟,遥望瀑布挂前川”“锄禾日当午,汗滴禾下土”······虽然普通话发音并不标准,但稚嫩的童声中透出的认真仍然让人动容。尤其是每一位孩子在自我介绍时,能勇敢地走上讲台,一笔一划地写上自己的名字。“韩国杨”、“季群”···一串串名字,歪歪扭扭地散布在黑板上,可爱又温暖。一连串游戏下来,笑容与期待渐渐在一个个小脸上浮现。活动终于正式开始。对农村的孩子而言,什么是最大的梦想 ?显然,他们最期盼的是外面的世界。外面的世界很精彩,但是交通的闭塞以及信息的不流通让他们并不懂得何为城市,何为城市的精彩。作为宣讲的开篇,队员们就首先用一连串的照片及视频为他们刻画出对上海的第一印象------时尚、古典、科技文化。东方明珠、外滩、南京路步行街、石库门、老洋房······每一处美景都如梦如幻,引来孩子们的声声赞叹,好奇、向往为他们初步展开梦想的羽翼。接着队员们大致介绍了一下交大的情况。最后,作为整个宣讲会的主要环节,队员们以闲聊的方式与孩子们一起聊聊各自的梦想。一个调皮小男孩想做警察,一个羞怯坐在一角的女孩子想做医生,胖胖的小姑娘想做画家······每个人都有梦想,梦想是渴望,更是一种动力,没有去追求、努力的梦想也只能是空想。众所周知,从农村走出的孩子在诧然面对五光十色的外部世界时,他人的歧视、不屑总会打退他们融入这个城市的勇气。他们用了18年才坐在这里与城里的同龄人一起喝咖啡,但他们努力了18年又不是为了与别人一起喝咖啡。他们为的是为农村耕地的爷爷奶奶,为的是在外乡辛苦拼搏的父母,为的是同样渴望着城市的弟弟妹妹,他们为的是生活重担所塑造的梦想。所以不用害怕,不用彷徨,既然已经决定了前行,那么就应当风雨兼程。或许他们还不理解这些大道理,但是当他们在台下不由自主地点头认同,他们已经开始学会了担当。梦想的翅膀隐藏在每个人的身后,只是有人选择起飞,有人选择留在原地,青志队员们千里迢迢,惟愿能为他们初生的羽翼送上一道清风,吹奏出追逐梦想的动人旋律。与此同时,在另一个教室里,青志队员们正在举办一场家长交流会。首先,青志队员们逐个进行自我介绍,将自己的成长历程介绍给家长们。其中,来自安徽的施傲同学从自己和家长走出安徽农村到上海打拼的经历入手,介绍了自己对知识改变命运这一格言的理解。他熟悉的口音,相似的成长背景让家长们感同身受,听得津津有味。来自上海的李嘉磊同学从自己的成长历程入手,向家长们强调了抓紧孩子学习、加强竞争意识的重要性。他生动诙谐的语言在家长中引起了一阵阵笑声。在城市中长大的刘博扬同学虽没有农村生活的经历,但他另辟蹊径,以炼金作比喻,强调了学习知识对拓展视野、提高生活质量的重大意义。随后,村支书代表家长,向队员们介绍了村里和大庙小学的历史和目前面临的突出问题。他说道:由于村里自然条件较为恶劣,很多人携家带口迁往他地。剩下没有能力迁移的家庭则纷纷派出劳动力外出打工,使许多孩子成为“留守儿童”。缺少父母管教的孩子们大多比较贪玩,学业成绩不良。支书的话道出了到场家长们的心声,大家纷纷与队员交流想法,整场交流会渐入佳境。青志队队员们还是尚未走入社会的大学生,更不知晓为人父母的";
		sb.append(content1);
		sb.append(content2);
		Hashtable<String, Integer> result = new Hashtable<String, Integer>();
		Hashtable<String, HashSet<Integer>> ht = new Hashtable<String, HashSet<Integer>>();
		long time = System.currentTimeMillis();
		result = keytermExtract.execute(sb.toString(), true);
		time = System.currentTimeMillis() -time;
		
		System.out.println("time-consuming: " + time + " ms, str length: " + sb.length());
		int size = keytermExtract.readDoc(sb.toString(), ht);
		HashSet<String> h = keytermExtract.getSeeds(size, ht);
		Hashtable<String, Integer> h_t = new Hashtable<String, Integer>();
		h_t = keytermExtract.getAllSubs(sb.toString(), true, (int)(0.003f * sb.toString().length()), ht);
//		System.out.println(size);
		for(String k : ht.keySet()){
			System.out.println(k + ":" + ht.get(k));
		}
		for(String k : h){
			System.out.println(k);
		}
		for(String k : h_t.keySet()){
			System.out.println(k + ":" + h_t.get(k));
		}
//		List<KeyTermPair> pairs = keytermExtract.getTopN(0, result);
//		for(Pair pair : pairs){
//			System.out.println(pair.first+"\t"+pair.second);
//		}
	}
}