It's pretty easy for an intelligent item to cast spells, provided it has a way to know them in the first place. The limitation is in the variety of spells available, not the basic ability to cast 'em.
Like a character, an intelligent item speaks Common plus one additional language per point of Intelligence bonus. (source)
Verbal components are go! You can just speak them like normal because that's how intelligent items roll.
Also, not all spells require all components. Look for options that only need verbal components. This is limiting, but can lead to interesting group tactics. Spells like command can be a lot of fun. I once ran a fight between a PC and a lich who was stuck in her phylactery and limited to speech-only spells. So basically it was a fight between a druid and a screaming rock.
There are cases where it'd be easy to convince a GM that you're your own focus: if you're a staff casting cleric spells, perhaps you count as a crosier and thus are a divine focus. If you're casting bard spells, maybe you can be considered a digerdoo or really really big flute.
And for a complete get-out-of-components-free card, use spell-like abilities:
A spell-like ability has no verbal, somatic, or material component, nor does it require a focus or have an XP cost. The user activates it mentally. (source)
There are a lot of creative ways to acquire spell-like abilities, far outside the scope of this question. (Warning: warlock invocations don't work for this out of the box. They're considered special spell-like abilities that all have somatic components.)