syntax = "proto2";

import "dragnn/protos/data.proto";


package syntaxnet.dragnn;

// Describes single embedding "group", e.g., 'words', 'tags'. Each group shares
// an embedding space.
message FixedFeatureChannelTrace {
  // string-valued name of the group, e.g., 'words'.
  optional string name = 1;

  // The feature functions active in this embedding group.
  repeated FixedFeatures value_trace = 2;
}

// Trace for an entire linked feature channel.
message LinkedFeatureChannelTrace {
  // Name of the embedding space.
  optional string name = 1;

  // The component that this feature links to.
  optional string source_component = 2;

  // The string-valued name of the translator function that maps a feature value
  // to a step index.
  optional string source_translator = 3;

  // The name of the layer that we are extracting from the identified step.
  optional string source_layer = 4;

  // Individual features within this group.
  repeated LinkFeatures value_trace = 5;
}

// The trace for a single step of a single Component.
message ComponentStepTrace {
  // A caption/description to describe this step. This should fit in a graphical
  // node rendered to the screen.
  optional string caption = 1;

  repeated FixedFeatureChannelTrace fixed_feature_trace = 2;
  repeated LinkedFeatureChannelTrace linked_feature_trace = 3;

  // An *HTML-language* representation of the current state.
  optional string html_representation = 4;

  // The scores for each potential decision. (The mapping from index to name is
  // managed by the component.)
  repeated double outcome_score = 5;

  // Set to true once the step is finished. (This allows us to open a step after
  // each transition, without having to know if it will be used.)
  optional bool step_finished = 6 [default = false];
}

// The traces for all steps for a single Component.
message ComponentTrace {
  // Name of the component; should match the ComponentSpec.
  optional string name = 1;

  // The steps that have been taken by this Component.
  repeated ComponentStepTrace step_trace = 2;
}

// The traces for all Components.
message MasterTrace {
  repeated ComponentTrace component_trace = 1;
}

// Main proto being used to trace parsing.
message DragnnTrace {

  // For each sentence, there is a sequence of state sets storing tracing
  // information.
  repeated MasterTrace master_trace = 1;
}
