Ejemplo n.º 1
0
 public DocumentIndexWriter(TupleFlowParameters parameters)
     throws FileNotFoundException, IOException {
   Parameters p = new Parameters();
   p.add("isCompressed", "true");
   writer = new IndexWriter(parameters.getXML().get("filename"), p);
   documentsWritten = parameters.getCounter("Documents Written");
 }
 public StructuredRetrieval(StructuredIndex index, Parameters factoryParameters) {
   this.index = index;
   Parameters featureParameters = factoryParameters.clone();
   featureParameters.add("collectionLength", Long.toString(index.getCollectionLength()));
   featureParameters.add("documentCount", Long.toString(index.getDocumentCount()));
   featureFactory = new FeatureFactory(featureParameters);
 }
Ejemplo n.º 3
0
  public Node(String operator, String argument, ArrayList<Node> internalNodes, int position) {
    Parameters p = new Parameters();

    if (argument != null) {
      p.add("default", argument);
    }
    this.operator = operator;
    this.internalNodes = internalNodes;
    this.position = position;
    this.parameters = p;
  }
Ejemplo n.º 4
0
  @Override
  public String toString() {
    StringBuilder builder = new StringBuilder();

    builder.append('#');
    builder.append(operator);

    if (parameters.containsKey("default")) {
      String value = parameters.get("default");
      builder.append(':');
      builder.append(escapeAsNecessary(value));
    }

    Map<String, List<Value>> parameterMap = parameters.value().map();

    if (parameterMap != null) {
      for (String key : parameterMap.keySet()) {
        if (key.equals("default")) {
          continue;
        }
        String value = parameterMap.get(key).get(0).toString();

        builder.append(':');
        builder.append(escapeAsNecessary(key));
        builder.append('=');
        builder.append(escapeAsNecessary(value));
      }
    }

    if (internalNodes.size() == 0) {
      builder.append("()");
    } else {
      builder.append("( ");
      for (Node child : internalNodes) {
        builder.append(child.toString());
        builder.append(' ');
      }
      builder.append(")");
    }

    return builder.toString();
  }
Ejemplo n.º 5
0
 public String getDefaultParameter(String key) {
   return parameters.get(key, getDefaultParameter());
 }
Ejemplo n.º 6
0
 public String getDefaultParameter() {
   return parameters.get("default", (String) null);
 }
Ejemplo n.º 7
0
 public ScaleIterator(Parameters parameters, ScoreIterator iterator)
     throws IllegalArgumentException {
   this.iterator = iterator;
   weight = parameters.get("weight", 1.0);
 }