kbenoit / wordshoal

quanteda implementation of the Lauderdale and Herzog (2016) "Wordshoal" model
13 stars 2 forks source link

make the package compatible with current version of quanteda #6

Closed amatsuo closed 6 years ago

amatsuo commented 6 years ago

Because of the change of the class of textmodel_fitted_* in quanteda, package wordshoal is not compatible with the current version of quanteda. This PR provides a quick fix to this issue.

In particular,

  1. Make textmodel_fitted_wordshoal-class independent from textmodel_fitted.
  2. Check the class of wordfish-output (S4 or not) and change the method of access.
kbenoit commented 6 years ago

Thanks @amatsuo!

I'm seeing:

* checking whether the namespace can be unloaded cleanly ... WARNING
---- unloading
Error in .mergeMethodsTable(generic, mtable, tt, attach) : 
  trying to get slot "defined" from an object of a basic class ("environment") with no slots
Calls: unloadNamespace ... <Anonymous> -> .updateMethodsInTable -> .mergeMethodsTable
Execution halted

Note that in 1.0.0 we made some extensive changes to the textmodel_*() infrastructure - they're all S3 now. (formerly a mixture of S3 and S4)

amatsuo commented 6 years ago

@kbenoit,

It seems the issue had already been there before I touched the package. I am thinking to convert the output from S4 to S3 for this package as quanteda did as:

  1. this could resolve the build failure
  2. make the function closer to quanteda

What do you think?

kbenoit commented 6 years ago

Yes very good idea. This model has multiple layers of parameters so it will require a bit of creative thinking on the post-estimation methods, but it is probably closest to textmodel_wordscores(). Please try to follow the naming conventions used in the textmodel_*() functions for S3 object classes and object formats, where applicable.

And add your name to the author list. We can get this passing all checks and turn it over to @lauderdale.