24-11 ?然語???????

ڭ̥iHϥ WSH ӹ Google idߡAöǦ^GAҦp

lɡ]googleQuery.js^G]ǦϰUYi^
query = "tx";
url = "http://www.google.com.tw/search?hl=zh-TW&q="+query+"&meta=";
objHttp = new ActiveXObject("Microsoft.XMLHTTP");
objHttp.open("GET", url, false, "");
objHttp.send();
content = objHttp.responseText;
//WScript.Echo(content);
re = new RegExp("<b>(.*?)</b>ŦX", "");
found = content.match(re);
count=RegExp.$1;
WScript.Echo(count);

bWzdҤAڭ̥iHdߡutxvyX{ơC

~Aڭ̤]iHҥ Google FightAXC@ӤWG

lɡ]googleFight.js^G]ǦϰUYi^
// Example usage: cscript googleFight.js Tp @aG k` `yNF
// Roger Jang, 20081215, tested under Vista

function googleQuery(term){
//	WScript.Echo("Querying Google about " + term + "...");
	var url = "http://www.google.com.tw/search?hl=zh-TW&q="+term+"&meta=";
	var objHttp = new ActiveXObject("Microsoft.XMLHTTP");
	objHttp.open("GET", url, false, "");
	objHttp.send();
	content = objHttp.responseText;
	var re = new RegExp("<b>(.*?)</b>ŦX", "");
	var found = content.match(re);
	var count=RegExp.$1;
	return(count);
}

args=WScript.Arguments;
if (args.Count()==0){
	WScript.Echo("Usage: " + WScript.ScriptName + " term1 term2 term3 ...");
	WScript.Quit();
}

for (i=0; i<args.length; i++)
	WScript.Echo(args(i) + " ===> " + googleQuery(args(i)));

դWzdҡAiHb DOS UFROpUG

cscript googleFight.js Tp @aG k` `yNF
~Aڭ̤]iHɥΤ| web service Ӷi椤媺_PʤRG

lɡ]sinica.js^G]ǦϰUYi^
function seg(sentence)
{
	// get sn
	url = "http://mt.iis.sinica.edu.tw/cgi-bin/text.cgi?query="+sentence;
	var http = WScript.CreateObject("Microsoft.XMLHTTP");
	http.open("GET", url, false);
	http.send();
	var html = http.responseText;
	var re = /pool\/(\d+)\.html/;
	var sn = re.exec(html)[1];
	// use this page http://mt.iis.sinica.edu.tw/uwextract/pool/{sn}.tag.txt
	// convert encoding by php
	url = "http://exa.zibox.cc/~zi/mt/sinica/en.php?sn="+sn;
	http.open("GET", url, false);
	http.send();
	html = http.responseText;
	// parse tokens
	var rew = /@([^(]+)\((\w+)\)/g;
	var ws = html.match(rew);
	var res = new Array();
	for(var i=0; i<ws.length; ++i)
	{
		var w = new Object();
		w.cword = ws[i].replace(rew, "$1");
		w.cpos = ws[i].replace(rew, "$2");
		res.push(w);
	}
	return res;
}
s = seg("ڮadWUߡAuOӦhFrC");
for(var i in s)
	WScript.Echo(s[i].cword+s[i].cpos);


JScript {]pPΡGΩ WSH