in src/rime/util/score_array.py [0:0]
def auto_cast_lazy_score(other):
if other is None:
return None # prior_score=None -> None
elif isinstance(other, LazyScoreBase):
return other
elif isinstance(other, numbers.Number):
return _LazyScoreScalar(other)
elif sps.issparse(other):
return LazyScoreSparseMatrix(other)
elif isinstance(other, pd.DataFrame):
return LazyScoreDenseMatrix(other.values)
elif np.ndim(other) == 2:
return LazyScoreDenseMatrix(other)
else:
raise NotImplementedError(f"type {type(other)} is not supported")