[英]Any known javascript/php dictionaries like 'word1', 'word2'?
Just recently I was looking up about Levenshtein algorithm and after searching for an hour I couldn't find a javascript file like: 就在最近,我正在查阅Levenshtein算法 ,在搜索了一个小时后,我找不到像以下那样的javascript文件:
var dictionary =
[
'coke',
'cokeman',
'cokeney'
]
Is there a faster way to do this? 有更快的方法吗? I haven't found any files like this and I've heard this function is kind of slow.
我没有找到这样的文件,我听说这个函数有点慢。 If I could how could I do this with php?
如果我能用魔法怎么做呢?
In order to get that javascript file you could run cat /usr/share/dict/words | sed "s/^.*$/\\'&\\'\\,/g"
为了获得该javascript文件,您可以运行
cat /usr/share/dict/words | sed "s/^.*$/\\'&\\'\\,/g"
cat /usr/share/dict/words | sed "s/^.*$/\\'&\\'\\,/g"
replacing /usr/share/dict/words
with a newline separated wordfile. 用换行符分隔wordfile替换
/usr/share/dict/words
。 Then all you have to do is add var dictionary = [
and ]
maybe throwing in a semicolon at the end if you feel like it. 然后你要做的就是添加
var dictionary = [
和]
如果你愿意的话,最后可以在分号中加一个分号。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.