ericproffitt / TopicModelsVB.jl

A Julia package for variational Bayesian topic modeling.
Other
81 stars 8 forks source link

stop_corp!(corp): error : dataset_path not defined #27

Closed ValeriiBaidin closed 4 years ago

ValeriiBaidin commented 4 years ago

stop_corp!(corp): error : dataset_path not defined win 10, Julia ver 1.3

Would you suggest, how to define dataset_path?

Thank you in advance.

ericproffitt commented 4 years ago

Hi Valerii,

So I actually just came across this bug several days ago. If you download the latest version of the package, it should work.

Also, you're better off removing stop words using the fixcorp! function, i.e.

fixcorp!(corp, stop=true, trim=true)
ValeriiBaidin commented 4 years ago

Hi Valerii,

So I actually just came across this bug several days ago. If you download the latest version of the package, it should work.

Also, you're better off removing stop words using the fixcorp! function, i.e.

fixcorp!(corp, stop=true, trim=true)

I've tried fixcorp!(corp, stop_corp=true, trim_corp=true), but it gives the same error.

P.s. previous updated pages (and after try second times by reinstall the page).

Thank you for your help.

ValeriiBaidin commented 4 years ago

It seems you should change the line 540 Corpus.jl by this datasets_path = joinpath(split(@__DIR__, '/')[1][1:end-3], "datasets")

and additional line544: dataset_path to datasets_path

ericproffitt commented 4 years ago

I've tried fixcorp!(corp, stop_corp=true, trim_corp=true), but it gives the same error.

I've updated the argument names, it should be,

fixcorp!(corp, stop=true, trim=true)

It seems you should change the line 540 Corpus.jl by this datasets_path = joinpath(split(@DIR, '/')[1][1:end-3], "datasets")

and additional line544: dataset_path to datasets_path

The current version works for me, can you confirm that it still doesn't work for you with the latest version of the package?

ValeriiBaidin commented 4 years ago

I've tried fixcorp!(corp, stop_corp=true, trim_corp=true), but it gives the same error.

I've updated the argument names, it should be,

fixcorp!(corp, stop=true, trim=true)

It seems you should change the line 540 Corpus.jl by this datasets_path = joinpath(split(@DIR, '/')[1][1:end-3], "datasets") and additional line544: dataset_path to datasets_path

The current version works for me, can you confirm that it still doesn't work for you with the latest version of the package?

I remove old version by Pkg.rm() and add the new version, so It is supposed to give the latest version.

ericproffitt commented 4 years ago

You need to make sure that you're running the following,

pkg> add https://github.com/ericproffitt/TopicModelsVB.jl

The version currently in the official listing is outdated.

ValeriiBaidin commented 4 years ago

You need to make sure that you're running the following,

pkg> add https://github.com/ericproffitt/TopicModelsVB.jl

The version currently in the official listing is outdated.

I am sorry, but it doesn't work. You should replace 545 line by this code datasets_path = joinpath(split(@__DIR__, '/')[1][1:end-3], "datasets")

ericproffitt commented 4 years ago

The current version of the package works on my machine, so I'm wondering if generating this path needs to be customized differently for Windows/Mac.

Can you tell me what the path is for the TopicModelsVB package on your machine, as well as what datasets_path is currently defined as?

ValeriiBaidin commented 4 years ago

The current version of the package works on my machine, so I'm wondering if generating this path needs to be customized differently for Windows/Mac.

Can you tell me what the path is for the TopicModelsVB package on your machine, as well as what datasets_path is currently defined as?

C:\Users\vbaidin\.julia\packages\TopicModelsVB\6GW70\

ericproffitt commented 4 years ago

Ok so if that's where the TopicModelsVB package is located, then the datasets_path variable should be,

C:\Users\vbaidin\.julia\packages\TopicModelsVB\6GW70\datasets

are you able to confirm if this is its value?

You may have to temporarily patch the stop_corp! function inside Corpus.jl to print it.

ValeriiBaidin commented 4 years ago

Ok so if that's where the TopicModelsVB package is located, then the datasets_path variable should be,

C:\Users\vbaidin\.julia\packages\TopicModelsVB\6GW70\datasets

are you able to confirm if this is its value?

You may have to temporarily patch the stop_corp! function inside Corpus.jl to print it.

Yes, it's right I use the line of code, that send you here previously.

Thank you for your help

ericproffitt commented 4 years ago

Ok, now it all makes sense to me.

Because Windows uses backslashes for paths, while Linux and Mac use forward slashes, your workaround was basically not splitting on anything, so you just took the first element, and then removed \src from the path string.

Since the splitting is not necessary, here is a simpler solution which will work for both Windows and Mac/Linux,

datasets_path = joinpath((@__DIR__)[1:end-3], "datasets")

I'll push this change to master in a bit.

ValeriiBaidin commented 4 years ago
datasets_path = joinpath((@__DIR__)[1:end-3], "datasets")

yes, it works. thank you!!!

ValeriiBaidin commented 4 years ago

Ok, so I just realized that Windows uses backslashes for its paths, while Mac and Linux use forward slashes.

Could you try modifying line 545 in Corpus.jl, so that it is,

datasets_path = joinpath(join(split(@__DIR__, '\')[1:end-1], '\'), "datasets")

And see if that fixes the problem?

there should be double \

`datasets_path = joinpath(join(split(@__DIR__, '\\')[1:end-1], '\\'), "datasets")`
ericproffitt commented 4 years ago

Ok, changes have been pushed to master, so if you download the newest version it should work on all platforms.

I'll close this issue, but if for some reason it still doesn't work, please feel free to reopen.