The word 公猪 is formed by combining the character 公, meaning "male", with the character 猪, meaning "pig", creating a compound where 公 modifies 猪 to specify a male pig.