src/edu/stanford/nlp/sempre/interactive/VegaRandomizer.java
public Example generateModification(int amount) {
    LogInfo.begin_track("VegaRandomizer.generateModification");
    List<Derivation> derivations = new ArrayList<>();
    List<List<String>> paths = VegaResources.allPathsMatcher.match(null);
    while (derivations.size() < amount) {
      // Pick a path and value
      List<String> path = randomChoice(paths);
      List<JsonValue> possibleValues = VegaResources.getValues(path, null, true);
      for (JsonSchema schema : VegaResources.vegaSchema.schemas(path)) {
        String type = schema.types().get(0);
        if ("number".equals(type))
          possibleValues.addAll(smallNumbers);
      }
      JsonValue value = randomChoice(possibleValues);
      if (value == null) continue;
      // Build the derivation
      Derivation deriv = createModificationDeriv(path, value);
      derivations.add(deriv);
      LogInfo.logs("%s", deriv);
    }
    LogInfo.end_track();
    ex.predDerivations = derivations;
    return ex;
  }
/**
   * Generate derivations for the example.
   */
Generate derivations for the example.
Generate derivations for the example .
public Example generateModification(int amount) {
    LogInfo.begin_track("VegaRandomizer.generateModification");
    List<Derivation> derivations = new ArrayList<>();
    List<List<String>> paths = VegaResources.allPathsMatcher.match(null);
    while (derivations.size() < amount) {
      List<String> path = randomChoice(paths);
      List<JsonValue> possibleValues = VegaResources.getValues(path, null, true);
      for (JsonSchema schema : VegaResources.vegaSchema.schemas(path)) {
        String type = schema.types().get(0);
        if ("number".equals(type))
          possibleValues.addAll(smallNumbers);
      }
      JsonValue value = randomChoice(possibleValues);
      if (value == null) continue;
      Derivation deriv = createModificationDeriv(path, value);
      derivations.add(deriv);
      LogInfo.logs("%s", deriv);
    }
    LogInfo.end_track();
    ex.predDerivations = derivations;
    return ex;
  }
public Example generateModification ( int amount ) { LogInfo . begin_track ( "VegaRandomizer.generateModification" ) ; List < Derivation > derivations = new ArrayList < > ( ) ; List < List < String > > paths = VegaResources . allPathsMatcher . match ( null ) ; while ( derivations . size ( ) < amount ) { List < String > path = randomChoice ( paths ) ; List < JsonValue > possibleValues = VegaResources . getValues ( path , null , true ) ; for ( JsonSchema schema : VegaResources . vegaSchema . schemas ( path ) ) { String type = schema . types ( ) . get ( 0 ) ; if ( "number" . equals ( type ) ) possibleValues . addAll ( smallNumbers ) ; } JsonValue value = randomChoice ( possibleValues ) ; if ( value == null ) continue ; Derivation deriv = createModificationDeriv ( path , value ) ; derivations . add ( deriv ) ; LogInfo . logs ( "%s" , deriv ) ; } LogInfo . end_track ( ) ; ex . predDerivations = derivations ; return ex ; }
Generate derivations for the example.
Generate derivations for the example .
// Pick a path and value // Build the derivation