⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 webthread.java

📁 这是一个matlab的java实现。里面有许多内容。请大家慢慢捉摸。
💻 JAVA
字号:
/* Copyright (C) 2003 Univ. of Massachusetts Amherst, Computer Science Dept.
   This file is part of "MALLET" (MAchine Learning for LanguagE Toolkit).
   http://www.cs.umass.edu/~mccallum/mallet
   This software is provided under the terms of the Common Public License,
   version 1.0, as published by http://www.opensource.org.  For further
   information, see the file `LICENSE' included with this distribution. */

/**  For multi-threaded web search.
 *   @author Ron Bekkerman <A HREF="mailto:ronb@cs.umass.edu">ronb@cs.umass.edu</A>
*/

package edu.umass.cs.mallet.projects.dex.web;

import edu.umass.cs.mallet.projects.dex.types.*;
import edu.umass.cs.mallet.base.util.*;

import java.util.*;

import java.util.logging.*;

public class WebThread extends Thread {

	private static Logger logger = MalletLogger.getLogger(WebThread.class.getName());
//The first parameter is vector of queries, the second one is the name of file
	//to which the result returned by Google will be written
	public WebThread(Vector queries, String outDirName, 
		     Person person, HashSet stopWords) {
		this.queries = queries;
		this.outDirName = outDirName;
		this.person = person;
		this.stopWords = stopWords;
	}
	
	public void run() {
		Google google = new Google(getName(), outDirName, person, stopWords);
		for(int j = 0; j < queries.size(); j++) {
	    String query = (String)queries.elementAt(j);
	    logger.fine (getName() + ") Processing query: " + query);
	    boolean response = 
				google.responseToQuery(query);
	    if(response) {
				//for(int i = 0; i <= j; i++) queries.remove(0);
				// break when one of the queries returns some result
				break;
	    }
		}
		logger.fine("Thread " + getName() + " is about to finish");
	}
	
	//Fields
	Vector queries;
	String outDirName;
	Person person;
	HashSet stopWords;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -