public static void demoForWebPage() {
String[] vs = {
"Radiation from this solar flare will hit Earth's magnetic field on Wednesday, with impact on air traffic.",
"Our magnetic field will be affected, next Wednesday, by this solar flare.",
"Tim Cook and Philip Schiller unveil the company's newest iPad."
};
System.out.println("\n\n[ARRAY OF SENTENCES]\n");
Sentence[] vst= new Sentence[vs.length];
for (int i = 0; i < vst.length; i++) {
vst[i]= new Sentence(vs[i]);
System.out.printf("S%d --> %s\n", i+1, vst[i].toString());
}
System.out.println("\n\n[SENTENCE SIMILARITY - METHOD: Sumo]\n");
System.out.println(" S1 S2 S3\n");
for (int i = 0; i < vst.length; i++) {
System.out.printf(" S%d", i+1);
for (int j = 0; j < vst.length; j++) {
double dx= vst[i].dsumo(vst[j]);
System.out.printf(" %.7f", dx);
}
System.out.println("\n");
}
System.out.println("\n\n[SENTENCE DISSIMILARITY - METHOD: Edit Distance]\n");
System.out.println(" S1 S2 S3\n");
for (int i = 0; i < vst.length; i++) {
System.out.printf(" S%d", i+1);
for (int j = 0; j < vst.length; j++) {
double dx= vst[i].dsLevenshtein(vst[j]);
System.out.printf(" %4d", (int)dx);
}
System.out.println("\n");
}
}