Package org.carrot2.util.attribute

Examples of org.carrot2.util.attribute.AttributeValueSets.serialize()


        final StringWriter json = new StringWriter();
        result.serializeJson(json);
        assertThat(json.toString()).doesNotContain("\"luceneDocument\"");

        final ByteArrayOutputStream xml = new ByteArrayOutputStream();
        result.serialize(xml);
        assertThat(xml.toString("UTF-8")).doesNotContain(
            "org.apache.lucene.document.Document");
    }
}
View Full Code Here


        final ProcessingResult result = controller.process(attributes,
            LingoClusteringAlgorithm.class);

        // Now, we can serialize the entire result to XML like this
        result.serialize(System.out);
        System.out.println();

        // Optionally, we can choose whether we want to serialize documents and clusters
        result.serialize(System.out,
            false /* don't save documents */,
 
View Full Code Here

        // Now, we can serialize the entire result to XML like this
        result.serialize(System.out);
        System.out.println();

        // Optionally, we can choose whether we want to serialize documents and clusters
        result.serialize(System.out,
            false /* don't save documents */,
            true /* save clusters */);
    }
}
View Full Code Here

                    result.serializeJson(w, null, outputDocuments, true, outputAttributes);
                    w.flush();
                }
                else
                {
                    result.serialize(stream, outputDocuments, true, outputAttributes);
                }
            }
            finally
            {
                CloseableUtils.close(stream);
View Full Code Here

        // We'll need to wrap the exported attribute values in a AttributeValueSets,
        // even if we want to export just one set.
        final AttributeValueSets attributeValueSets = new AttributeValueSets();
        attributeValueSets.addAttributeValueSet("example-id", attributeValueSet);

        attributeValueSets.serialize(System.out);
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.