docs: def f1_with_flattening(estimator, X, y):
      """
      Calculate F1 score by flattening the predictions of the
      estimator across all sequences. For example, given the following
      address sequences as input
          ['1 My str', '2 Your blvd'],
      the predictions of the model will be flattened like so:
          ['AddressNumber', 'StreetName', 'StreetNamePostType', 'AddressNumber', 'StreetName', 'StreetNamePostType']
      and compared to a similarly flattened gold standard labels. This calculates the overall
      quality of the model across all sequences as opposed to how well it does
      at any particular sequence.
      :param X: list of sequences to tag
      :param y: list of gold standard tuples
      """
      predicted = estimator.predict(X)
      flat_pred, flat_gold = [], []
      for a, b in zip(predicted, y):
          if len(a) == len(b):
              flat_pred.extend(a)
              flat_gold.extend(b)
      return f1_score(flat_gold, flat_pred)