  Recent developments in time domain astronomy, like the Zwicky Transient
Facility, have made possible a daily scan of the entire visible sky, leading to
the discovery of hundreds of new transients every night. Among them, 10 to 15
are supernovae (SNe), which have to be classified prior to cosmological use.
The Spectral Energy Distribution machine (SEDm), a low resolution Integral
Field Spectrograph, has been designed, built, and operated to spectroscopically
classify targets detected by the ZTF main camera. The current Pysedm pipeline
is limited by contamination when the transient is too close to its host galaxy
core; this can lead to an incorrect typing and ultimately bias the cosmological
analyses, and affect the SN sample homogeneity in terms of local environment
properties. We present a new scene modeler to extract the transient spectrum
from its structured background, aiming at improving the typing efficiency of
the SEDm. HyperGal is a fully chromatic scene modeler, which uses pre-transient
photometric images to generate a hyperspectral model of the host galaxy; it is
based on the CIGALE SED fitter used as a physically-motivated spectral
interpolator. The galaxy model, complemented by a point source and a diffuse
background component, is projected onto the SEDm spectro-spatial observation
space and adjusted to observations. The full procedure is validated on 5000
simulated cubes. We introduce the contrast as the transient-to-total flux ratio
at SN location. From estimated contrast distribution of real SEDm observations,
we show that HyperGal correctly classifies ~95% of SNe Ia. Compared to the
standard extraction method, HyperGal correctly classifies 10% more SNe Ia. The
false positive rate is less than 2%, half as much as the standard extraction
method. Assuming a similar contrast distribution for core-collapse SNe,
HyperGal classifies 14% (11%) additional SNe II (Ibc).
