minibikini / paasaa

🔤 Natural language detection for Elixir

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Detection not working without error

olavolav opened this issue · comments

Not sure what's going on here. I just istalled the dependency as usual:

* Getting paasaa (Hex package)
  Checking package (https://repo.hex.pm/tarballs/paasaa-0.2.0.tar)
  Fetched package
vagrant@vagrant-ubuntu-trusty-64:~/fm_gateway$ mix test test/services/language_service_test.exs
==> paasaa
Compiling 2 files (.ex)
warning: variable "generate_scripts" does not exist and is being expanded to "generate_scripts()", please use parentheses to remove the ambiguity or change the variable name
  lib/mix/tasks.ex:9

warning: variable "generate_languages" does not exist and is being expanded to "generate_languages()", please use parentheses to remove the ambiguity or change the variable name
  lib/mix/tasks.ex:10

warning: variable "und" does not exist and is being expanded to "und()", please use parentheses to remove the ambiguity or change the variable name
  lib/paasaa.ex:106

warning: variable "und" does not exist and is being expanded to "und()", please use parentheses to remove the ambiguity or change the variable name
  lib/paasaa.ex:107

warning: variable "und" does not exist and is being expanded to "und()", please use parentheses to remove the ambiguity or change the variable name
  lib/paasaa.ex:112

warning: variable "und" does not exist and is being expanded to "und()", please use parentheses to remove the ambiguity or change the variable name
  lib/paasaa.ex:125

warning: variable "und" does not exist and is being expanded to "und()", please use parentheses to remove the ambiguity or change the variable name
  lib/paasaa.ex:186

warning: function JSX.decode!/1 is undefined (module JSX is not available)
Found at 2 locations:
  lib/mix/tasks.ex:19
  lib/mix/tasks.ex:27

Generated paasaa app

Looked fine to me, it's just parenthesis warnings and missing JSX which does not seem to be needed except for the mix tasks, which in turn I don't seem to need. (Right?)

But then, every call to detect returns the "undefined" language, like so:

iex(1)> Paasaa.detect "Detect this!"
"und"

Strange that there is no error or anything. Any idea what's going on?

Hi @olavolav,

Sorry for the late response, ATM I'm in trip on vacation ✈️

I can't reproduce the problem. Which Elixir version and OS do you use?

Also, I've just released a new version with fixes for the warnings. Can you please try again?

HI @minibikini i'm getting the same problem on Elixir 1.4.5 and macOS Sierra with Paasaa 0.2.1 and 0.2.0:
image
Is there anything else apart from adding the package to mix.exs i should do to make it work?
Thanks in advance for response.

Hi @mpikula I'm sorry I'm currently on trip again.

Strange, I have the same elixir and os versions and it works for me.

Nope, nothing else to do, just add as dependency to mix.exs

I will look into this closer when get back home.

Please, let me know if you'll figure out the problem by your own.

hi @minibikini i think it can be something with dependencies. When i lowered the version to 0.1.1 it's working fine. When i change it to 2.0 or 2.0.1 with upgraded packages i'm getting 'und' as in the screenshot above.

@mpikula, can you please do ls -l deps/paasaa/priv/ in the project root and copy output here?
It should look about this:

-rw-r--r--  1 egor  staff  512482 Jul 26 00:55 languages.binary
-rw-r--r--  1 egor  staff   11508 Jul 26 00:55 scripts.binary

these binaries contains language data. Before 0.2.0 they were JSON files (see #1). I suspect something wrong with them.

@mpikula, no need to ls... I just updated Elixir to 1.5 and now I also get "und", hmm. Apparently those binaries are specific to Erlang/Elixir version.

I just recompiled the files and published new version 0.2.2, and it works for me with Elixir v1.5. Can you please try it with Elixir v1.4.5 and if possible with Elixir v1.5.

@mindreframer could you please give us a hint?

@minibikini well... It seems that the binary format changed between erlang OTP 18 and 20 (the recent one). Guess it would be necessary to version the compiled languages binaries based on the erlang version.

more here:
https://stackoverflow.com/questions/9560815/how-to-get-erlangs-release-version-number-from-a-shell

:erlang:system_info(version).

and/or

:erlang:system_info(otp_release).
iex(4)> :erlang.system_info(:version)
'9.0'
iex(5)> :erlang.system_info(:otp_release)
'20'

I guess: keep the current ones for OTP < 20, and create new ones for OTP 20...

Hi @minibikini sorry for not responding earlier. I've tried 0.2.2 and it works fine for me, thanks a lot!