Closed snotskie closed 7 months ago
turns out, it was actually already possible, but I had to fix this infinite recursion problem:
# Wrapper constructor, accepts any type for codes etc.
function constructENA(
::Type{M},
data::DataFrame,
codes::Array{<:Any,1},
conversations::Array{<:Any,1},
units::Array{<:Any,1},
rotation::AbstractENARotation;
kwargs...
) where {R<:AbstractENARotation, M<:AbstractENAModel{R}}
return constructENA(
M,
data,
Symbol.(codes),
Symbol.(conversations),
Symbol.(units),
rotation;
kwargs...
)
end
become
# Wrapper constructor, accepts any type for codes etc.
function constructENA(
::Type{M},
data::DataFrame,
codes::Array{<:Any,1},
conversations::Array{<:Any,1},
units::Array{<:Any,1},
rotation::AbstractENARotation;
kwargs...
) where {R<:AbstractENARotation, M<:AbstractENAModel{R}}
return constructENA(
M,
data,
convert(Array{Symbol}, Symbol.(codes)),
convert(Array{Symbol}, Symbol.(conversations)),
convert(Array{Symbol}, Symbol.(units)),
rotation;
kwargs...
)
end
This is the method that converts whatever type you give the config arrays to Symbols. However, Symbol.([])
has type Array{Any}
, so this method recurses infinitely. Also adding an explicit convert
fixed the problem, and the resulting behavior for conversations=[]
was exactly what we wanted
When
conversations
is an empty array[]
, the model should behind exactly as though we manually did[:All]
instead, to have a model with a single large conversationThis may actually be the case as-is, but it needs to be confirmed and tweaked if needed