class Cadmium::Glove::Corpus
- Cadmium::Glove::Corpus
- Reference
- Object
Included Modules
- JSON::Serializable
Defined in:
glove/corpus.crConstructors
- .new(pull : JSON::PullParser)
-
.new(text, window = nil, min_count = nil, **parser_options)
Create a new
Glove::Corpus
Class Method Summary
-
.build(text, window = nil, min_count = nil, **parser_options)
Convenience method for creating an instance and building the token count and pairs.
Instance Method Summary
-
#build_tokens
Builds the token count, token index, and token pairs
-
#count
Hash that stores the occurence count of unique tokens.
-
#index
A hash whose values hold a sequential index of a word as it appears in the
#count
hash. - #min_count : Int32
- #min_count=(min_count : Int32)
-
#pairs
Iterates over the tokens and constructs
Glove::TokenPair
s where neighbors hold the adjacent (context) words. -
#token_neighbors(word, index)
Construct an array of neighbors to the given word and its index in the
#tokens
array. - #tokens : Array(String)
- #tokens=(tokens : Array(String))
- #window : Int32
- #window=(window : Int32)
Constructor Detail
Create a new Glove::Corpus
Class Method Detail
Convenience method for creating an instance and building the token count and pairs.
Instance Method Detail
Iterates over the tokens and constructs Glove::TokenPair
s where
neighbors hold the adjacent (context) words. The number of neighbors
is controlled by #window
(on each side).