  A large set of cross sections for semi-inclusive electroproduction of charged
pions ($\pi^\pm$) from both proton and deuteron targets was measured. The data
are in the deep-inelastic scattering region with invariant mass squared $W^2$ >
4 GeV$^2$ and range in four-momentum transfer squared $2 < Q^2 < 4$
(GeV/c)$^2$, and cover a range in the Bjorken scaling variable 0.2 < x < 0.6.
The fractional energy of the pions spans a range 0.3 < z < 1, with small
transverse momenta with respect to the virtual-photon direction, $P_t^2 < 0.2$
(GeV/c)$^2$. The invariant mass that goes undetected, $M_x$ or W', is in the
nucleon resonance region, W' < 2 GeV. The new data conclusively show the onset
of quark-hadron duality in this process, and the relation of this phenomenon to
the high-energy factorization ansatz of electron-quark scattering and
subsequent quark --> pion production mechanisms. The x, z and $P_t^2$
dependences of several ratios (the ratios of favored-unfavored fragmentation
functions, charged pion ratios, deuteron-hydrogen and aluminum-deuteron ratios
for $\pi^+$ and $\pi^-$) have been studied. The ratios are found to be in good
agreement with expectations based upon a high-energy quark-parton model
description. We find the azimuthal dependences to be small, as compared to
exclusive pion electroproduction, and consistent with theoretical expectations
based on tree-level factorization in terms of transverse-momentum-dependent
parton distribution and fragmentation functions. In the context of a simple
model, the initial transverse momenta of $d$ quarks are found to be slightly
smaller than for $u$ quarks, while the transverse momentum width of the favored
fragmentation function is about the same as for the unfavored one, and both
fragmentation widths are larger than the quark widths.
