Learning techniques are able to extract structural knowledge specific to a selected set of proteins. We describe two algorithms that optimize scores expressing the propensity of a polypeptide sequence to adopt a local fold. The first algorithm generates secondary structure prediction rules based on a dictionary of geometrical patterns frequently found in the learning database. The second algorithm leads to scores that indicate the fit between an amino acid and a given local structural environment. Dynamic programming is then used to align structural information profiles by modifying the local mutation cost with the above learned functions. The main features of the system are exemplified on the structural prediction of the N-terminal domain of the CD4 antigen. Then the usefulness of additional 3-D information in the alignment is benchmarked on eight pairs of weakly homologous proteins.