Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

warning thrown #2

Open
kshahkshah opened this issue Mar 17, 2017 · 4 comments
Open

warning thrown #2

kshahkshah opened this issue Mar 17, 2017 · 4 comments

Comments

@kshahkshah
Copy link

Hi I'm testing out this handy gem, hope you're still considering active development?

Anyway, I'm getting a warning with Ruby 2.3.1:

In file included from /home/deploy/.rbenv/versions/2.3.1/include/ruby-2.3.0/ruby.h:33:0,
                 from /home/deploy/.ruby_inline/ruby-2.3.0/Inline_FuzzyTools__WeightedDocumentTokens_a329c30e0075fa4cebaee897338b8713.c:1:
/home/deploy/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fuzzy_tools-1.0.0/lib/fuzzy_tools/weighted_document_tokens.rb: In function ‘cosine_similarity_fast’:
/home/deploy/.rbenv/versions/2.3.1/include/ruby-2.3.0/ruby/ruby.h:1254:22: warning: passing argument 1 of ‘rb_array_len’ makes integer from pointer without a cast [-Wint-conversion]
 #define RARRAY(obj)  (R_CAST(RArray)(obj))
                      ^
/home/deploy/.rbenv/versions/2.3.1/include/ruby-2.3.0/ruby/ruby.h:1044:36: note: in definition of macro ‘RARRAY_LEN’
 #define RARRAY_LEN(a) rb_array_len(a)
                                    ^
/home/deploy/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/fuzzy_tools-1.0.0/lib/fuzzy_tools/weighted_document_tokens.rb:49:39: note: in expansion of macro ‘RARRAY’
             for(i = 0; i < RARRAY_LEN(RARRAY(my_tokens)); i++) {
                                       ^
In file included from /home/deploy/.rbenv/versions/2.3.1/include/ruby-2.3.0/ruby.h:33:0,
                 from /home/deploy/.ruby_inline/ruby-2.3.0/Inline_FuzzyTools__WeightedDocumentTokens_a329c30e0075fa4cebaee897338b8713.c:1:
/home/deploy/.rbenv/versions/2.3.1/include/ruby-2.3.0/ruby/ruby.h:2010:1: note: expected ‘VALUE {aka long unsigned int}’ but argument is of type ‘struct RArray *’
 rb_array_len(VALUE a)
 ^

note that the gem installs fine w/in my Gemfile, this is upon require

@brianhempel
Copy link
Owner

Does is still work? i.e. does it not crash?

@kshahkshah
Copy link
Author

@brianhempel still works! just tested it :) awesome

Only issue is creating the index, in a pry console e.g., spits back out the whole object which just floods the terminal with never-ending text, but that of course wouldn't be a problem in prod

@kshahkshah
Copy link
Author

kshahkshah commented Mar 17, 2017

totally side note (sorry to cloud your GH issues) very fast still too! Hopefully I can come up with some way to Marshall and persist the model so I can retrieve and use it in background jobs processed by Sidekiq

@brianhempel
Copy link
Owner

There's a weight_function lambda that prevents Marshal from dumping the index. It looks like it is only used once and can just become a regular instance method of either WeightedDocumentTokens or TfIdfIndex. I abstracted too early.

Feel free to make that change and then it should Marshall fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants