Skip to content

LETS GOO 6/6 WAVES 8/8 TEST CASES WE DONE!!!#14

Open
RJRico17 wants to merge 16 commits intogrc-cohort-21:mainfrom
RJRico17:main
Open

LETS GOO 6/6 WAVES 8/8 TEST CASES WE DONE!!!#14
RJRico17 wants to merge 16 commits intogrc-cohort-21:mainfrom
RJRico17:main

Conversation

@RJRico17
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@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!

for (int i=0;i<word.length();i++) {
wordBreakdown[i] = word.charAt(i);
}
if (wordBreakdown[word.length()-1]=='.') {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This works well! As an alternative you could use endsWith

Comment on lines +19 to +25
@Test
public void testSentenceWillSplitIntoList() {
LowercaseSentenceTokenizer tokenizer = new LowercaseSentenceTokenizer();
Scanner scanner = new Scanner("RJ Fredrick Rico is a pool player who will be the best in Washington State.");
List<String> tokens = tokenizer.tokenize(scanner);
assertEquals(List.of("rj","fredrick", "rico","is","a","pool","player","who","will","be","the","best","in","washington","state","."), tokens);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This doesn't quite test what was being asked for. The instructions asked for a test that would have multiple spaces in a row, like hi hey hi

Comment on lines +55 to +65
for (int i=0; i < trainingWords.size()-1; i++) {
String currentWord = trainingWords.get(i);
List<String> emptyList = new ArrayList<>();
if (!neighborMap.containsKey(currentWord)) {
neighborMap.put(currentWord, emptyList);
emptyList.add(trainingWords.get(i+1));
}
else {
List<String> currentNeighbors = neighborMap.get(currentWord);
currentNeighbors.add(trainingWords.get(i+1));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice logic!

Comment on lines +114 to +118
Random rand = new Random();
String text = "";
List<String> nextWords = neighborMap.get(context.get(context.size()-1));
text = nextWords.get(rand.nextInt(nextWords.size()));
return text;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice! I think we don't need line 115 though, we can just declare and initialize the variable at the same time on 117.

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