parsing strings into lists of terms