class Marisa::IntTrie
- Marisa::IntTrie
- Marisa::BytesTrie
- Marisa::Trie
- Reference
- Object
Defined in:
marisa/int_trie.crInstance Method Summary
-
#sum(prefix = "") : Int32
Adds initial and all the elements in the collection together.
Instance methods inherited from class Marisa::BytesTrie
[](value)
[],
[]=(key : String, value : String | Int32)
[]=,
add_many(hash : Hash(String, String | Int32), weight = nil)
add_many,
each_pairs(&block : Tuple(String, String | Int32) -> )
each_pairs,
get(key : String) : String | Nil | Int32
get,
get_all(key : String) : Array(String | Int32)
get_all,
include?(key : String) : Bool
include?,
set(key : String, value : String | Int32)
set
Constructor methods inherited from class Marisa::BytesTrie
new(hash = {} of String => String | Int32, separator : String = VALUE_SEPARATOR, binary : Bool = false, num_tries : Symbol | Int32 = :default, cache_size = :normal, order = :label)
new
Instance methods inherited from class Marisa::Trie
<<(value) : self
<<,
add(key : String, weight : Int32 | Nil = nil)
add,
add_many(keys : Array(String), weights : Array(Float32) = [] of Array(Float32))
add_many,
agent : Wrapper::Agent
agent,
build
build,
build_if_necessary
build_if_necessary,
built? : Bool
built?,
each(&block : String -> )
each,
get_id(key : String) : UInt64 | Nil
get_id,
get_key(id : UInt64) : String | Nil
get_key,
get_weight(key : String) : Float32 | Nil
get_weight,
has_keys? : Bool
has_keys?,
include?(key : String) : Bool
include?,
keys : Array(String)
keys,
load(path : String)
load,
save(path : String)
save,
search(prefix : String = "") : Search
search,
size : UInt64
size,
trie : Wrapper::Trie
trie
Constructor methods inherited from class Marisa::Trie
new(keys = [] of String, weights = [] of Float32, binary : Bool = false, num_tries : Symbol | Int32 = :default, cache_size : Symbol = :normal, order : Symbol = :label)
new
Instance methods inherited from module Marisa::BaseConfigFlags
binary_flag(bool : Bool) : Int32
binary_flag,
config_flags(binary = false, num_tries = :default, cache_size = :default, order = :default)
config_flags,
lookup_cache_size(cache_size : Symbol) : Int32
lookup_cache_size,
valid_node_order(order : Symbol) : Int32
valid_node_order,
valid_num_tries(num_tries : Int32 | Symbol) : Int32
valid_num_tries
Instance Method Detail
def sum(prefix = "") : Int32
#
Description copied from module Enumerable(String)
Adds initial and all the elements in the collection together. The type of initial will be the type of the sum, so use this if (for instance) you need to specify a large enough type to avoid overflow.
Expects all element types to respond to #+
method.
[1, 2, 3, 4, 5, 6].sum(7) # => 28
If the collection is empty, returns initial.
([] of Int32).sum(7) # => 7