Commit 8f201521 authored by ElaFHNW's avatar ElaFHNW
Browse files

added sentiWordNet, Szymborska, Shakespeare files

parent c942b7c5
This diff is collapsed.
So much world all at once – how it rustles and bustles!
Moraines and morays and morasses and mussels,
The flame, the flamingo, the flounder, the feather –
How to line them all up, how to put them together?
All the tickets and crickets and creepers and creeks!
The beeches and leeches alone could take weeks.
Chinchillas, gorillas, and sarsaparillas –
Thanks do much, but all this excess of kindness could kill us.
Where’s the jar for this burgeoning burdock, brooks’ babble,
Rooks’ squabble, snakes’ quiggle, abundance, and trouble?
How to plug up the gold mines and pin down the fox,
How to cope with the linx, bobolinks, streptococs!
Tale dioxide: a lightweight, but mighty in deeds:
What about octopodes, what about centipedes?
I could look into prices, but don’t have the nerve:
These are products I just can’t afford, don’t deserve.
Isn’t sunset a little too much for two eyes
That, who knows, may not open to see the sun rise?
I am just passing through, it’s a five-minute stop.
I won’t catch what is distant: what’s too close, I’ll mix up.
While trying to plumb what the void's inner sense is,
I'm bound to pass by all these poppies and pansies.
What a loss when you think how much effort was spent
perfecting this petal, this pistil, this scent
for the one-time appearance, which is all they're allowed,
so aloofly precise and so fragilely proud.
\ No newline at end of file
package Collections;
import java.io.File;
import java.util.Scanner;
public class Shakespeare {
public static void main(String[] args) {
int noOfWords = 0;
File file = new File("src/shakespeare.txt");
String [] text = new String[1000000];
int index = 0;
try {
Scanner scan = new Scanner(file);
// System.out.println(scan);
while (scan.hasNext() && index < 1000000) {
String line = scan.nextLine();
line = line.trim();
if (line.length()>0) { // added to skip empty lines
String [] words = line.split("\\s+");
for (int i=0; i<words.length; i++) {
words[i] = words[i].replace(".", "");
words[i] = words[i].replace(",", "");
text[index] = words[i];
noOfWords++;
index++;
if (index==1000000) {
break;
}
}
}
}
}
catch (Exception e) {
System.out.println(e.getMessage());
}
System.out.println("no of words is " + noOfWords);
for (int i= 0; i< noOfWords-1; i++) {
if (text[i].equals("votarist")) {
System.out.println("ok: "+ text[i]);
}
}
}
}
package Collections;
import java.io.File;
import java.util.ArrayList;
import java.util.Scanner;
public class ShakespeareArrayList {
public static void main(String[] args) {
int noOfWords = 0;
File file = new File("src/shakespeare.txt");
ArrayList <String> text = new ArrayList<String> ();
try {
Scanner scan = new Scanner(file);
while (scan.hasNext() ) {
String line = scan.nextLine();
line = line.trim();
if (line.length()>0) { // added to skip empty lines
String [] words = line.split("\\s+");
for (int i=0; i<words.length; i++) {
words[i] = words[i].replace(".", "");
words[i] = words[i].replace(",", "");
text.add(words[i]);
noOfWords++;
}
}
}
}
catch (Exception e) {
System.out.println("exception " + e.getMessage());
}
System.out.println(noOfWords);
if (text.contains("votarist")) {
System.out.println("ok");
}
}
}
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment