The electronic structure of emeraldine base form of polyaniline is investigated by means of semi-empirical quantum chemical methods. A phenyl-capped octaaniline has been adopted as the molecular model for the polymer. Neutral and protonated states of this molecule were investigated. In particular, the energetics of polaron and bipolaron formation and their relative stability were obtained. The results are consistent with a polaron being energetically more stable than a bipolaron. The implications of the present results regarding the current models for the insulator-to-metal transition in emeraldine upon acidic doping are discussed.