Tidy tables of a text hypergraph
Arguments
- x
A
text_hypergraph()object.- what
Which table:
"weights"(default) – for the bag construction one row per document-word pair (doc,word,count,weight); for the window construction one row per window-content/word membership (edge,word,weight= window count); for the sentence construction one row per sentence/word membership (edge,word,weight= in-sentence count); for the knn construction one row per hyperedge membership (doc,edge,weight= cosine similarity)."sentences"(sentence construction only) gives one row per sentence hyperedge (edge,doc,sentence,n_tokens)."documents"gives one row per document (withn_tokens/n_typesfor token-based constructions, plus any metadata columns carried from the input)."vocabulary"gives one row per word (word,count,doc_freq, andidfunder tf-idf weighting; empty for the knn construction, which has no token layer).- ...
Unused.
Examples
hg <- text_hypergraph(c(a = "salt and soup", b = "soup and stars"))
hg_get(hg)
#> doc word count weight
#> 1 a and 1 1
#> 2 a salt 1 1
#> 3 a soup 1 1
#> 4 b and 1 1
#> 5 b soup 1 1
#> 6 b stars 1 1
hg_get(hg, what = "documents")
#> doc n_tokens n_types
#> 1 a 3 3
#> 2 b 3 3