必威体育Betway必威体育官网
当前位置:首页 > IT技术

单词语音音标正则式查询分析JavaScript应用

时间:2019-10-03 04:12:07来源:IT技术作者:seo实验室小编阅读:54次「手机版」
 

音标查询

可以使用正则表达式查询音标

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,Minimum-scale=1.0,maximum-scale=1.0, user-scalable=no"/>
<title>phonetics</title>
<style type="text/css">
body{
	background-color:#CCCCCC;
	padding:50px;
	font-family:IPAPANNEW;
}
button{
	margin:5px;
}
</style>
<script type="text/javascript" src="pronunciation.js"></script>
<script type="text/JavaScript">
function $(id){
	return document.getelementbyid(id);
}
function search(){
	var regString=$("regString").value;
	var reg=new RegExp(regString,"ig");
	var resultArray=new Array();
	for(var word in phonetics){
		var pronunciation=phonetics[word];
		var pass=reg.test(pronunciation);
		if(pass){
			resultArray.push(word+" : "+pronunciation);
		}
	}
	
	var resultCount=resultArray.length;
	$("resultDiv").innerHTML="找到匹配单词"+resultCount+"个"+"<hr>"+resultArray.join("<br/>").replace(/\$/g,"");
	
	


}
</script>
</head>

<body>
<input id="regString" type="text" placeholder="在此输入音标正则表达式查询对应单词" οnkeypress="if(event.keyCode==13){search()}" value="" />
<button οnclick="search()">search</button>
<button οnclick="$('regString').value=''">clear</button>

<br/><br/>

<button οnclick="$('regString').value+=this.innerHTML">iː</button>
<button οnclick="$('regString').value+=this.innerHTML">i</button>
<button οnclick="$('regString').value+=this.innerHTML">ɪ</button>
<button οnclick="$('regString').value+=this.innerHTML">e</button>
<button οnclick="$('regString').value+=this.innerHTML">æ</button>
<button οnclick="$('regString').value+=this.innerHTML">ɑː</button>
<button οnclick="$('regString').value+=this.innerHTML">ɒ</button>
<button οnclick="$('regString').value+=this.innerHTML">ɔː</button>
<button οnclick="$('regString').value+=this.innerHTML">ʊ</button>
<button οnclick="$('regString').value+=this.innerHTML">u</button>
<button οnclick="$('regString').value+=this.innerHTML">uː</button>
<button οnclick="$('regString').value+=this.innerHTML">ʌ</button>
<button οnclick="$('regString').value+=this.innerHTML">ɜː</button>
<button οnclick="$('regString').value+=this.innerHTML">ə</button>
<button οnclick="$('regString').value+=this.innerHTML">əː</button>

<br/>

<button οnclick="$('regString').value+=this.innerHTML">eɪ</button>
<button οnclick="$('regString').value+=this.innerHTML">əʊ</button>
<button οnclick="$('regString').value+=this.innerHTML">oʊ</button>
<button οnclick="$('regString').value+=this.innerHTML">aɪ</button>
<button οnclick="$('regString').value+=this.innerHTML">ɔɪ</button>
<button οnclick="$('regString').value+=this.innerHTML">aʊ</button>
<button οnclick="$('regString').value+=this.innerHTML">ɪə</button>
<button οnclick="$('regString').value+=this.innerHTML">eə</button>
<button οnclick="$('regString').value+=this.innerHTML">ʊə</button>

<button οnclick="$('regString').value+=this.innerHTML">[</button>
<button οnclick="$('regString').value+=this.innerHTML">^</button>
<button οnclick="$('regString').value+=this.innerHTML">]</button>
<button οnclick="$('regString').value+=this.innerHTML">ː</button>


<br/><br/>

<button οnclick="$('regString').value+=this.innerHTML">p</button>
<button οnclick="$('regString').value+=this.innerHTML">b</button>
<button οnclick="$('regString').value+=this.innerHTML">t</button>
<button οnclick="$('regString').value+=this.innerHTML">d</button>
<button οnclick="$('regString').value+=this.innerHTML">k</button>
<button οnclick="$('regString').value+=this.innerHTML">g</button>
<button οnclick="$('regString').value+=this.innerHTML">tʃ</button>
<button οnclick="$('regString').value+=this.innerHTML">dʒ</button>
<button οnclick="$('regString').value+=this.innerHTML">f</button>
<button οnclick="$('regString').value+=this.innerHTML">v</button>
<button οnclick="$('regString').value+=this.innerHTML">θ</button>
<button οnclick="$('regString').value+=this.innerHTML">ð</button>

<br/>

<button οnclick="$('regString').value+=this.innerHTML">s</button>
<button οnclick="$('regString').value+=this.innerHTML">z</button>
<button οnclick="$('regString').value+=this.innerHTML">ʃ</button>
<button οnclick="$('regString').value+=this.innerHTML">ʒ</button>
<button οnclick="$('regString').value+=this.innerHTML">h</button>
<button οnclick="$('regString').value+=this.innerHTML">m</button>
<button οnclick="$('regString').value+=this.innerHTML">n</button>
<button οnclick="$('regString').value+=this.innerHTML">ŋ</button>
<button οnclick="$('regString').value+=this.innerHTML">l</button>
<button οnclick="$('regString').value+=this.innerHTML">r</button>
<button οnclick="$('regString').value+=this.innerHTML">j</button>
<button οnclick="$('regString').value+=this.innerHTML">w</button>

<br/><br/>

<p id="resultDiv"></p>

</body>
</html>

相关阅读

英语单词整理

置顶是为了方便更新 English 音标 中文 itinerari [aɪˈtɪnər

新东方大塘小鱼(新东方绘本馆)英语启蒙,让孩子3个月吃透1

导读:新东方大塘小鱼(新东方绘本馆),新东方旗下0-12岁少儿在线学习平台。专注于幼儿、少儿中英文绘本教育,每天更新免费的音频故事、

最全面计算机英语单词列表(一)

作为一名开发者,不管是自己写代码还是阅读英文文档,英语水平对于开发进度有很大的影响。业余时间简单整理了计算机开发中常见的英语

星期一到星期日的英文及缩写 和 一月到十二月的英

星期一:Monday(Mon.) 星期二:Tuesday(Tues.) 星期三:Wednesday(Wed.) 星期四:Thursday(Thur./Thurs.) 星期五:Friday(Fri.) 星期六:Saturday(Sat.)

OpenJudge 1.7 21:单词替换

21:单词替换 描述 输入一个字符串,以回车结束(字符串长度<=100)。该字符串由若干个单词组成,单词之间用一个空格隔开,所有单词区分大

分享到:

栏目导航

推荐阅读

热门阅读