src/main/java/pt/it/av/tnav/ml/tm/dp/DPWC.java
public static void store(DPWC dpwc, Writer out) throws IOException {
    JSONObject json = new JSONObject();
    JSONArray categories = new JSONArray();

    for (Category c : dpwc.categories) {
      JSONObject category = new JSONObject();
      JSONArray dimentions = new JSONArray();
      for (DPW.DpDimension d : c.dpDimensions) {
        JSONObject dimention = new JSONObject();
        dimention.put("stemm", d.stemm.toString());
        dimention.put("term", d.term.toString());
        dimention.put("value", d.value);
        dimentions.add(dimention);
      }
      category.put("affinity", c.affinity);
      category.put("dimentions", dimentions);
      categories.add(category);
    }

    json.put("categories", categories);
    json.put("term", dpwc.term.toString());

    json.write(out);
  }
/**
   * Stores a {@link DPWC} in JSON format inside a compressed file.
   *
   * @param dpwc
   * @param out
   */
Stores a  DPWC in JSON format inside a compressed file.
@param dpwc
@param out
Stores a DPWC in JSON format inside a compressed file . @param dpwc @param out
public static void store(DPWC dpwc, Writer out) throws IOException {
    JSONObject json = new JSONObject();
    JSONArray categories = new JSONArray();
    for (Category c : dpwc.categories) {
      JSONObject category = new JSONObject();
      JSONArray dimentions = new JSONArray();
      for (DPW.DpDimension d : c.dpDimensions) {
        JSONObject dimention = new JSONObject();
        dimention.put("stemm", d.stemm.toString());
        dimention.put("term", d.term.toString());
        dimention.put("value", d.value);
        dimentions.add(dimention);
      }
      category.put("affinity", c.affinity);
      category.put("dimentions", dimentions);
      categories.add(category);
    }
    json.put("categories", categories);
    json.put("term", dpwc.term.toString());
    json.write(out);
  }
public static void store ( DPWC dpwc , Writer out ) throws IOException { JSONObject json = new JSONObject ( ) ; JSONArray categories = new JSONArray ( ) ; for ( Category c : dpwc . categories ) { JSONObject category = new JSONObject ( ) ; JSONArray dimentions = new JSONArray ( ) ; for ( DPW . DpDimension d : c . dpDimensions ) { JSONObject dimention = new JSONObject ( ) ; dimention . put ( "stemm" , d . stemm . toString ( ) ) ; dimention . put ( "term" , d . term . toString ( ) ) ; dimention . put ( "value" , d . value ) ; dimentions . add ( dimention ) ; } category . put ( "affinity" , c . affinity ) ; category . put ( "dimentions" , dimentions ) ; categories . add ( category ) ; } json . put ( "categories" , categories ) ; json . put ( "term" , dpwc . term . toString ( ) ) ; json . write ( out ) ; }
Stores a {@link DPWC} in JSON format inside a compressed file.
Stores a { @link DPWC } in JSON format inside a compressed file .