update
This commit is contained in:
+35
-65
@@ -150,11 +150,8 @@ end
|
||||
|
||||
# ---------------------------------------------- 100 --------------------------------------------- #
|
||||
|
||||
""" read_textfile_by_index(folder_path::String, read_file_number::Integer=1)
|
||||
|
||||
# What it does
|
||||
- Reads the x-th text file from a folder, where files are listed by the OS
|
||||
without explicit sorting. Returns the file number, filename, and content.
|
||||
""" Reads the x-th text file from a folder, where files are listed by the OS
|
||||
without explicit sorting. Returns the file number, filename, and content.
|
||||
|
||||
# Arguments
|
||||
- `folder_path::String`
|
||||
@@ -207,14 +204,12 @@ end
|
||||
|
||||
|
||||
""" Recursively convert dictionary-like variable (e.g. JSON.Object) into a dictionary.
|
||||
|
||||
# What it does
|
||||
- Walks any nested structure composed of `AbstractDict` (e.g., `JSON.Object`,
|
||||
`Dict`, `OrderedDict`) and `AbstractArray` and produces a new tree where
|
||||
every dictionary-like node is a plain `Dict` and every array-like node is a
|
||||
`Vector{Any}`. Scalar values (numbers, strings, booleans, `nothing`, etc.)
|
||||
are returned unchanged.
|
||||
- Does **not** mutate the input; it always allocates new containers.
|
||||
The function walks any nested structure composed of `AbstractDict` (e.g., `JSON.Object`,
|
||||
`Dict`, `OrderedDict`) and `AbstractArray` and produces a new tree where
|
||||
every dictionary-like node is a plain `Dict` and every array-like node is a
|
||||
`Vector{Any}`. Scalar values (numbers, strings, booleans, `nothing`, etc.)
|
||||
are returned unchanged.
|
||||
Does **not** mutate the input; it always allocates new containers.
|
||||
|
||||
# Arguments
|
||||
- `x`
|
||||
@@ -299,14 +294,12 @@ end
|
||||
# ---------------------------------------------- 100 --------------------------------------------- #
|
||||
|
||||
""" Recursively convert dictionary-like variable (e.g. JSON.Object) into a dictionary.
|
||||
|
||||
# What it does
|
||||
- Walks any nested structure composed of AbstractDict (e.g., JSON.Object,
|
||||
Dict, OrderedDict) and AbstractArray and produces a new tree where
|
||||
every dictionary-like node is an OrderedDict{Any,Any} and every array-like
|
||||
node is a Vector{Any}. Scalar values (numbers, strings, booleans,
|
||||
nothing, etc.) are returned unchanged.
|
||||
- Does **not** mutate the input; it always allocates new containers.
|
||||
The function walks any nested structure composed of AbstractDict (e.g., JSON.Object,
|
||||
Dict, OrderedDict) and AbstractArray and produces a new tree where
|
||||
every dictionary-like node is an OrderedDict{Any,Any} and every array-like
|
||||
node is a Vector{Any}. Scalar values (numbers, strings, booleans,
|
||||
nothing, etc.) are returned unchanged.
|
||||
Does **not** mutate the input; it always allocates new containers.
|
||||
|
||||
# Arguments
|
||||
- `x`
|
||||
@@ -474,10 +467,8 @@ function randomChoiceOnTarget(target::AbstractVector, choiceList::AbstractVector
|
||||
end
|
||||
|
||||
""" Compute the linearly weighted average of an array.
|
||||
|
||||
# What it does
|
||||
- Assigns weights proportional to position indices (1, 2, 3, ...) to array
|
||||
elements and returns the weighted average.
|
||||
The function assigns weights proportional to position indices (1, 2, 3, ...) to array
|
||||
elements and returns the weighted average.
|
||||
|
||||
# Arguments
|
||||
- `a::Array`
|
||||
@@ -512,10 +503,8 @@ end
|
||||
|
||||
|
||||
""" Convert a variable's value (String) into a Symbol.
|
||||
|
||||
# What it does
|
||||
- Takes a variable containing a String value and converts it to a Symbol
|
||||
using Julia's expression interpolation mechanism.
|
||||
The function takes a variable containing a String value and converts it to a Symbol
|
||||
using Julia's expression interpolation mechanism.
|
||||
|
||||
# Arguments
|
||||
- `variable`
|
||||
@@ -585,11 +574,9 @@ end
|
||||
|
||||
|
||||
""" Draw unique elements from a list without replacement.
|
||||
|
||||
# What it does
|
||||
- Randomly selects a specified number of distinct elements from a collection,
|
||||
optionally excluding certain elements from consideration. Uses in-place
|
||||
shuffling for efficiency.
|
||||
The function randomly selects a specified number of distinct elements from a collection,
|
||||
optionally excluding certain elements from consideration. Uses in-place
|
||||
shuffling for efficiency.
|
||||
|
||||
# Arguments
|
||||
- `drawOptions::Array`
|
||||
@@ -789,10 +776,7 @@ function selectRange(d::Dict{Symbol, <:AbstractVector}, range)
|
||||
return newDict
|
||||
end
|
||||
|
||||
""" assignDict!(dict::Dict, accessArray::Array{Symbol}, valueToAssign)
|
||||
|
||||
# What it does
|
||||
- Recursively traverses a nested dictionary structure using a vector of keys
|
||||
""" Recursively traverses a nested dictionary structure using a vector of keys
|
||||
and assigns a value to the final key. Creates intermediate dictionaries
|
||||
if they don't exist.
|
||||
|
||||
@@ -852,11 +836,8 @@ function assignDict!(dict::Dict, accessArray::Array{Symbol}, valueToAssign)
|
||||
end
|
||||
end
|
||||
|
||||
""" iTime(h::Integer, m::Integer)
|
||||
|
||||
# What it does
|
||||
- Converts hour (0-23) and minute (0-59) into a Julia `Time` object using
|
||||
12-hour format with AM/PM indicator.
|
||||
""" Converts hour (0-23) and minute (0-59) into a Julia `Time` object using
|
||||
12-hour format with AM/PM indicator.
|
||||
|
||||
# Arguments
|
||||
- `h::Integer`
|
||||
@@ -931,12 +912,9 @@ function limitvalue(v::Number, lowerbound::Pair, upperbound::Pair)
|
||||
end
|
||||
|
||||
|
||||
""" cartesianAssign!(a, b)
|
||||
|
||||
# What it does
|
||||
- Assigns elements from matrix `b` to matrix `a` using the Cartesian indices
|
||||
of `b`. Elements are copied in the order they appear when iterating over `b`,
|
||||
and placed into `a` at the corresponding Cartesian positions of `b`.
|
||||
""" Assigns elements from matrix `b` to matrix `a` using the Cartesian indices
|
||||
of `b`. Elements are copied in the order they appear when iterating over `b`,
|
||||
and placed into `a` at the corresponding Cartesian positions of `b`.
|
||||
|
||||
# Arguments
|
||||
- `a`
|
||||
@@ -1350,11 +1328,8 @@ function getStringBetweenCharacters(text::T, startChar::Char, endChar::Char;
|
||||
end
|
||||
|
||||
|
||||
""" mkDictPath!(dict::Union{Dict{Symbol, Any}, Dict{String, Any}}, addkeys::Union{Vector{String}, Vector{Symbol}}, value)
|
||||
|
||||
# What it does
|
||||
- Recursively creates nested dictionary paths if they do not exist and assigns
|
||||
a value to the final key. Similar to `mkpath()` but for dictionaries.
|
||||
""" Recursively creates nested dictionary paths if they do not exist and assigns
|
||||
a value to the final key. Similar to `mkpath()` but for dictionaries.
|
||||
|
||||
# Arguments
|
||||
- `dict::Union{Dict{Symbol, Any}, Dict{String, Any}}`
|
||||
@@ -1410,11 +1385,8 @@ function mkDictPath!(dict::Union{Dict{Symbol, Any}, Dict{String, Any}},
|
||||
end
|
||||
|
||||
|
||||
""" getDictPath(dict::Dict, keys::Vector)
|
||||
|
||||
# What it does
|
||||
- Retrieves a value from a nested dictionary by traversing a vector of keys.
|
||||
Creates intermediate dictionaries if they don't exist.
|
||||
""" Retrieves a value from a nested dictionary by traversing a vector of keys.
|
||||
Creates intermediate dictionaries if they don't exist.
|
||||
|
||||
# Arguments
|
||||
- `dict::Dict`
|
||||
@@ -1652,12 +1624,10 @@ function textToDict(text::String, detectKeywords::Vector{String};
|
||||
end
|
||||
|
||||
""" Recursively convert dictionary into an HTML string representation.
|
||||
|
||||
# What it does
|
||||
- Walks a nested `AbstractDict` structure and produces a well-formed HTML string
|
||||
where each dictionary key becomes an HTML tag. Nested dictionaries become
|
||||
nested tags, and scalar values (numbers, strings, etc.) become the text
|
||||
content of leaf tags.
|
||||
The function walks a nested `AbstractDict` structure and produces a well-formed HTML string
|
||||
where each dictionary key becomes an HTML tag. Nested dictionaries become
|
||||
nested tags, and scalar values (numbers, strings, etc.) become the text
|
||||
content of leaf tags.
|
||||
|
||||
# Arguments
|
||||
- `d::AbstractDict`
|
||||
|
||||
Reference in New Issue
Block a user