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

as.Vcorpus Method to Coerce partition_bundle to VCorpus is not working. #55

Closed
chdhh opened this issue Nov 29, 2018 · 1 comment
Closed

Comments

@chdhh
Copy link

chdhh commented Nov 29, 2018

Tried to execute the provided example for the as.VCorpus method using GermaParlMini after failing on the GermaParl Corpus.

P <- partition("GERMAPARLMINI", date = "2009-11-10")
... get encoding: latin1
... get cpos and strucs
> PB <- partition_bundle(P, s_attribute = "speaker")
... getting values for s-attribute  speaker
... number of partitions to be generated:  37
> VC <- as.VCorpus(PB)
Error in UseMethod("as.VCorpus") : 
  no applicable method for 'as.VCorpus' applied to an object of class "c('partition_bundle', 'count_bundle', 'bundle')"
@PolMine
Copy link
Collaborator

PolMine commented Dec 5, 2018

Thanks for raising the issue. The error you report only occurrs, if the the tm-package has been loaded prior to executing the code. So if you execute the code without having loading tm, everything is fine.

This is obviously nasty. To have a solution that will always work, the new development version of polmineR includes a coerce-method that can be used by calling as(YOUROBJECT, "VCorpus"). The as.VCorpus()-method still exists, but it simply hands over the partition_bundle` to the coerce-method.

Just one note: If you use tm to generate a DocumentTermMatrix, it is really highly inefficient to reconstruct the full text using as.VCorpus first. Using the as.DocumentTermMatrix()-method, or as.TermDocumentMatrix() included in the polmineR package is the approach I recommend.

Andreas

@PolMine PolMine closed this as completed Dec 5, 2018
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

1 participant