Relationship between structural and optoelectronic properties in semiconducting polymers