Contact State Segmentation Using Particle Filters for Programming by Human Demonstration in Compliant Motion Tasks