Skip to content

Project: ramblebot #29

Open
EmilyMenken wants to merge 9 commits intogrc-cohort-21:mainfrom
EmilyMenken:main
Open

Project: ramblebot #29
EmilyMenken wants to merge 9 commits intogrc-cohort-21:mainfrom
EmilyMenken:main

Conversation

@EmilyMenken
Copy link

No description provided.

Copy link

@auberonedu auberonedu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

Comment on lines +1 to +4
attorney: what school did you present when a fight . attorney: what was your responses must be oral, ok? what school did you performed on dead people? witness: july 18th . attorney: doctor, how i dress when a fight . attorney: how old is your autopsies have you present when i just lie there . attorney: and what gear were you sexually active? witness: july 18th . attorney: and reeboks . attorney: what ways does it affect your iq . attorney: and what gear were you performed on dead people? witness: he's 20, much like your picture was it terminated?
//not sure why there is a little space before the period :C

//Output spread out for reading convenience:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spaces with the periods are RambleApp's fault, not your code. I might improve it in future versions

Comment on lines +40 to +44

if (length > 0 && rambleWord.charAt(length-1) == '.' && length > 1){
tokens.add(rambleWord.substring(0,length-1)); //adds word, removes end period
tokens.add("."); //readds period as a different token
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice logic! You can also use endsWith here

Comment on lines +19 to +28
@Test
void testTokenizeSentenceWithSpaces(){

LowercaseSentenceTokenizer tokenizer = new LowercaseSentenceTokenizer();
Scanner scanner = new Scanner("this is a lowercase sentence with many spaces");
List<String> tokens = tokenizer.tokenize(scanner);

assertEquals(List.of("this", "is", "a", "lowercase", "sentence", "with", "many", "spaces"), tokens);

}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test!

Comment on lines +56 to +66
neighborMap = new HashMap<>(); //makes a map for all the strings and lists
for(int i = 0; i < trainingWords.size() - 1; i++){
String currentWord = trainingWords.get(i);
String nextWord = trainingWords.get(i +1);

if (!neighborMap.containsKey(currentWord)){
neighborMap.put(currentWord, new ArrayList<>());
}//end if
neighborMap.get(currentWord).add(nextWord);
}//end for
}//end scanner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great logic!

Comment on lines +122 to +126
Random rand = new Random(); //didn't copy and paste anything, but I read up on how to use Random with this site: https://www.geeksforgeeks.org/generating-random-numbers-in-java/
int randomRamble = rand.nextInt(nextWord.size());

return nextWord.get(randomRamble);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for citing your source!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants