# aardio 范例: 英汉词典



```aardio
import console; 
import string.words;

var pattern = "*er"

//通配符转换为 aardio 模式匹配
if(string.indexAny(pattern,"*?") && !string.match(pattern,"\p&[^*?\-\_]")){
	pattern = "^" + string.replace(pattern,"[*?]",{
		"*"=".*?",
		"?"="."
	})+"$"; 
}

//string.words 体积很小，搜索速度极快
for(word,meaning in string.words){
	
	/*
	使用速度极快的模式匹配进行搜索。
	模匹匹配快速入门: https://www.aardio.com/zh-cn/docs/guide/language/pattern-matching.html
	
	查找 er 结尾，与“人”有关的名词。
	*/
	if( string.find(word,pattern)
		&& string.find(meaning,"!\wn\..*人.*") 
	){
		console.log(word,meaning);
		console.more(20);
	}
}

/*
以函数调用方式查词则提共更多功能：
- 自动去除首尾空白字符。
- 先按以大小写敏感的方式查找，找不到则忽略大小写查找。
- 找不到单词时可自动还原词形变化，自动分析常用前缀后缀，自动拆分合成词，无分隔符时自动分词。
*/
print(string.words("howareyou"))

console.pause(true);
```

