I programming puzzles, il code golf
Retina, 138 133 129 113 bytes

^.(s[^aeiou]|z|gn|pn|ps|x|i[aeiou])
B$&amp;
^.[aeiou]
V$&amp;
^\d.
A$&amp;
V[02]
l'
A0
il 
B0
lo 
A1
i 
.1
gli 
.2
la 
.3
le 


Test suite.
(prepended %(G&#96;\n to run all test-cases at once)

Input format: macchina f s becomes 2macchina instead.

0: Masculine Singular
1: Masculine Plural
2: Feminine Singular
3: Feminine Plural


Conversion table thanks to Kevin Lau.