解析许多文档后,我有很多包含乌克兰语文本的行/列,应该为 Postgres 中的全文搜索建立索引。
我发现 Postgres 14 默认支持29 种语言,但不幸的是不支持乌克兰语。
经过后续挖掘,我发现它允许添加外部字典:
CREATE TEXT SEARCH DICTIONARY my_lang_ispell (
TEMPLATE = ispell,
DictFile = path_to_my_lang_dict_file,
AffFile = path_to_my_lang_affixes_file,
StopWords = path_to_my_lang_astop_words_file
);
Run Code Online (Sandbox Code Playgroud)
但如何找到最相关的DictFile、AffFile、 和StopWords文件呢?例如,snowball源不包含此语言。
那么,有人可以帮助我找到获取ispell、aspell、snowball或其他乌克兰语词典的最佳方法吗?
谢谢!
将 ES6 JavaScript 添加到我的 Rails 项目后:
class SpinnerWindow {
static show() {
//...
}
static autoHideShow(timeout=1500) {
//...
}
static hide() {
//...
}
}
Run Code Online (Sandbox Code Playgroud)
部署到 Heroku 时它仍然包含已编译的 ES6(不是 ES5!)
...</div> </div></div>';class SpinnerWindow{static show(){...
Run Code Online (Sandbox Code Playgroud)
我已将所有需要的配置添加到.babelrc
{
"presets": [
["env", {
"modules": false,
"targets": {
"browsers": "> 1%",
"uglify": true
},
"useBuiltIns": true
}]
],
"plugins": [
"syntax-dynamic-import",
"transform-object-rest-spread",
"transform-es2015-arrow-functions",
"transform-es2015-block-scoped-functions",
"transform-es2015-block-scoping",
"transform-es2015-classes",
"transform-es2015-computed-properties",
"transform-es2015-destructuring",
"transform-es2015-for-of",
"transform-es2015-function-name",
"transform-es2015-literals",
"transform-es2015-modules-commonjs",
"transform-es2015-object-super",
"transform-es2015-parameters",
"transform-es2015-shorthand-properties",
"transform-es2015-spread",
"transform-es2015-sticky-regex",
"transform-es2015-template-literals",
"transform-es2015-typeof-symbol",
"transform-es2015-unicode-regex",
"transform-regenerator",
"transform-async-to-generator",
["transform-class-properties", …Run Code Online (Sandbox Code Playgroud) 我在使用AngularJS集成Rails路由时遇到了麻烦.
当我在浏览器输入中转到"localhost:3000"时,它会将我重定向到"localhost:3000 /#/ auth/sign_in"
但'sign_in'模板无法渲染.
然后,如果我转到"localhost:3000 /#/",它会将我重定向到"localhost:3000 /#/ auth/sign_in"并向右渲染"sign_in"模板.
如何修复它,当我去"localhost:3000"然后渲染'sign_in'?
路由器代码在这里:http://pastie.org/8917505
谢谢!
请帮助我解决有关Elixir与Ruby性能的基准问题.
我尝试在两种语言中实现相同的阶乘,而Ruby显示出比Elixir更好的结果:
# ruby_factorial_with_iterator.rb
def factorial_with_iterator(n)
res = 1
(1..n).each{|time| res *= time}
res
end
p "factorial_with_iterator(200000)"
p factorial_with_iterator(200000)
Run Code Online (Sandbox Code Playgroud)
运行后:
$ time ruby ruby_factorial_with_iterator.rb
real 0m18.378s
user 0m17.348s
sys 0m0.844s
Run Code Online (Sandbox Code Playgroud)
和两个Elixir例子:
# elixir_factorial_with_iterator.exs
defmodule FactorialWithIterator do
def of(n) do
Enum.reduce(1..n, 1, &*/2)
end
end
IO.puts "Factorial of 200000: "
IO.puts FactorialWithIterator.of(200000)
Run Code Online (Sandbox Code Playgroud)
运行后:
$ time elixir elixir_factorial_with_iterator.exs
real 1m1.735s
user 1m1.556s
sys 0m0.104s
Run Code Online (Sandbox Code Playgroud)
另一个例子:
# elixir_factorial_with_recursion.exs
defmodule FactorialWithRecursion do
def of(0), do: 1
def of(n) when n > 0 do
n …Run Code Online (Sandbox Code Playgroud) angularjs ×1
babeljs ×1
benchmarking ×1
compare ×1
dictionary ×1
ecmascript-5 ×1
ecmascript-6 ×1
elixir ×1
ispell ×1
performance ×1
postgresql ×1
routing ×1
ruby ×1
snowball ×1
webpack ×1