Skip to content

Wishlist: add lsa support for convert #414

@BobMuenchen

Description

@BobMuenchen

It took me a while to figure out the steps to take a dfm to a tdm that the lsa package would like, but once you know them, they're quite easy. See below.

class(quanteda_dfm)
[1] "dfmSparse"
attr(,"package")
[1] "quanteda"
lsa_tdm <- t(as.matrix(quanteda_dfm))
class(lsa_tdm) <- "textmatrix"
class(lsa_tdm)
[1] "textmatrix"
lsa_tdm[1:10, 1:5]
docs
features text1 text2 text3 text4 text5
handsome 1 0 0 0 0
good_looking 1 0 2 2 0
moroccan 1 0 0 0 0
soccer 1 0 0 0 0
player 1 0 0 0 0
student 1 0 0 0 0
moved 1 0 0 0 0
los 1 0 0 0 0
angeles 1 0 0 0 0
living 1 0 0 0 0
lsa_space <- lsa(lsa_tdm, dims = 3)
class(lsa_space)
[1] "LSAspace"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    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