def populate_utterance(example, utterance, schema, tokenizer):
  """Sets the model input for a NLToSQLExample."""
  example.model_input.original_utterance = utterance

  schema_entities = get_schema_entities(schema)

  # Set the utterance wordpieces
  try:
    wordpieces, aligned_schema_entities = get_wordpieces(
        example.model_input.original_utterance, tokenizer, schema_entities)
    example.model_input.utterance_wordpieces.extend(wordpieces)

    # Set the table information
    example.model_input.tables.extend(
        process_tables(schema, tokenizer, aligned_schema_entities))
  except UnicodeDecodeError as e:
    print(unicode(e))
    return None
  return example
Sets the model input for a NLToSQLExample.
language/xsp/data_preprocessing/nl_to_sql_example.py