code: def build_pattern(body, features):
      '''Converts body into a pattern i.e. a point in the features space.
  
      Applies features to the body lines and sums up the results.
      Elements of the pattern indicate how many times a certain feature occurred
      in the last lines of the body.
      '''
      line_patterns = apply_features(body, features)
      return reduce(lambda x, y: [i + j for i, j in zip(x, y)], line_patternsf build_pattern(body, features):
      '''Converts body into a pattern i.e. a point in the features space.
  
      Applies features to the body lines and sums up the results.
      Elements of the pattern indicate how many times a certain feature occurred
      in the last lines of the body.
      '''
      line_patterns = apply_features(body, features)
      return reduce(lambda x, y: [i + j for i, j in zip(x, y)], line_patterns)
docs: Converts body into a pattern i.e. a point in the features space.
  
      Applies features to the body lines and sums up the results.
      Elements of the pattern indicate how many times a certain feature occurred
      in the last lines of the body.