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

get.terms function in movie database example #93

Open
hannofalkenberg opened this issue Sep 21, 2018 · 0 comments
Open

get.terms function in movie database example #93

hannofalkenberg opened this issue Sep 21, 2018 · 0 comments

Comments

@hannofalkenberg
Copy link

Hello,

I noticed that in the movie database example, the documents are created by

get.terms <- function(x) {
index <- match(x, vocab)
index <- index[!is.na(index)]
rbind(as.integer(index - 1), as.integer(rep(1, length(index))))
}.

however, the resultant matrix will have a second row of only 1s. Shouldn't it be the frequency of that token in the document?

Hence something as

get_terms <- function(x) {
index <- match(x, vocab)
index <- table(index)
rbind(as.integer(as.integer(names(index)) - 1), as.integer(index))
}

Thanks!

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