With dissimilar weapons like spears vs. swords, it's all about getting to where you can use your weapon but the other can't use theirs, and staying there. The sword-wielders need to be closer than the spear-fighters, and the spears can't afford to let that happen. Overall the spear is more of a defensive weapon in this situation, purely because of the need to preserve the extra reach.
De-heading the spear is a good way to get started, but a wise spear-user won't let that happen - and even then, you're left with a thin staff, which is devastating in experienced hands. With even numbers if the spears are in a narrow space, like an alley, it's going to suit them down to the ground (three or four incompetent spears can hold off ten times their number of competent swords in a narrow alley, I've seen it done), while in open terrain the swords will be able to spread more and gain the advantage. More swords will be able to spread even further, while more spears will be able to defend more territory.
Experienced spearmen usually carry something small as a last-resort backup. In that case, the swordsman closes in to optimum range for a sword, then gets a horrible surprise courtesy of a spearman stepping right up close - inside the sword's reach - with a knife or shortsword.