Skip to content

std::bad_alloc when dfm() is applied to a large number of documents #1395

Description

@geethapriyakrish

Hi,
I applied quanteda::dfm on a list of tokens of size 50000 and it works.

> grams[[1]] = quanteda::dfm(tokens[1:50000], ngrams = 1) --> works
> grams[[1]] = quanteda::dfm(tokens[50000:100000], ngrams = 1) --> works

When I apply it on larger list of tokens, it fails.
> grams[[1]] = quanteda::dfm(tokens[1:100000], ngrams = 1) --> throws following error

Error in qatd_cpp_tokens_ngrams(x, types(x), concatenator, n, skip + 1) : 
  std::bad_alloc

Please suggest me a solution. I would like to apply it on a list of size 500k

R version: 3.5.1
quanteda version: 1.3.3
OS version: Ubuntu 16.04.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions