小编Sas*_* B.的帖子

在哪里可以找到乌克兰语 'ispell'、'aspell'、'snowball' 字典以将其添加到 Postgres 的全文搜索中?

解析许多文档后,我有很多包含乌克兰语文本的行/列,应该为 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)

但如何找到最相关的DictFileAffFile、 和StopWords文件呢?例如,snowball源不包含此语言。

那么,有人可以帮助我找到获取ispellaspellsnowball或其他乌克兰语词典的最佳方法吗?

谢谢!

postgresql dictionary full-text-search snowball ispell

7
推荐指数
1
解决办法
555
查看次数

为什么 Rails 不使用 webpacker 将 ES6 转译为 ES5?

将 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)

ruby-on-rails ecmascript-5 ecmascript-6 webpack babeljs

5
推荐指数
0
解决办法
684
查看次数

如何在AngularJS的Rails 4中修正设置根路由?

我在使用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

谢谢!

routing ruby-on-rails angularjs

4
推荐指数
1
解决办法
8550
查看次数

Elixir比Ruby慢吗?

请帮助我解决有关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)

ruby performance benchmarking compare elixir

1
推荐指数
1
解决办法
2240
查看次数