Skip to content

all waves complete#8

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

all waves complete#8
mlarsen-source wants to merge 16 commits intogrc-cohort-21:mainfrom
mlarsen-source:main

Conversation

@mlarsen-source
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.

Awesome job!


Enter the filename: dylanTraining.txt
Enter the number of words to generate: 250
once upon a siamese cat ain't got it feel? to it feel, ah you don't seem so loud now you ain't no secrets to fall' you better pawn it ain't got nothing, you say 'beware doll, you're gonna have to be on your own, with no direction home like a home like a chrome horse with no secrets to get your own, with no direction home like a complete unknown, like a chrome horse with no secrets to be on the jugglers and say you dressed so proud about everybody that it feel, how does it feel, ah how does it feel? to get juiced in your own, with your diamond ring, you know you better take your kicks for you say 'beware doll, you're invisible now, you've got nothing to get juiced in rags and the clowns when you say do you you realize he's not selling any alibis as you how does it feel, how does it ain't no direction home like a deal? how does it babe you want to him he really wasn't where it's at napoleon in rags and the frowns on your diamond ring, you everything he really wasn't where it's at napoleon in your kicks for you say do you used to conceal how does it feel? to be without a rolling stone ahh you've gone to fall' you everything he used to him he could steal how to him he could steal how does it babe you stare into the pretty people No newline at end of file

Choose a reason for hiding this comment

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

Deep

Comment on lines +117 to +124
public boolean checkIfPunctuation(char character)
{
if(character == '.' || character == '!' || character == '?' || character == ',' || character == ';' || character == ':' || character == '\"')
{
return true;
}

return false;

Choose a reason for hiding this comment

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

Very cool! Can you think how you could write this as a single line with no if/else?

Comment on lines +51 to +62
if(token.startsWith("\""))
{
tokenList.add("\"");
token = token.substring(1,token.length());
}

if(token.endsWith("..."))
{
token = token.substring(0,token.length()-3);
tokenList.add(token);
tokenList.add("...");
}

Choose a reason for hiding this comment

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

Cool you're adding all this functionality!

Comment on lines +60 to +76
@Test
void testTokenizeEndsWithElipsisi() {
LowercaseSentenceTokenizer tokenizer = new LowercaseSentenceTokenizer();
Scanner scanner = new Scanner("Hello world... This is Dr.Smith's example...");
List<String> tokens = tokenizer.tokenize(scanner);

assertEquals(List.of("hello", "world", "...", "this", "is", "dr.smith's", "example", "..."), tokens);
}

@Test
void testTokenizeSentenceInQuotes() {
LowercaseSentenceTokenizer tokenizer = new LowercaseSentenceTokenizer();
Scanner scanner = new Scanner("\"Hello world. This is Dr.Smith's example.\"");
List<String> tokens = tokenizer.tokenize(scanner);

assertEquals(List.of("\"", "hello","world", ".", "this", "is", "dr.smith's", "example", ".","\""), tokens);
}

Choose a reason for hiding this comment

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

Great tests!

Comment on lines +60 to +78
for (int i = 0; i < trainingWords.size() - 1; i++)
{
String word = trainingWords.get(i);
String nextWord = trainingWords.get(i + 1);

if (neighborMap.containsKey(word))
{
List<String>temp = neighborMap.get(word);
temp.add(nextWord);
neighborMap.put(word, temp);
}

else
{
List<String>temp = new ArrayList<>();
temp.add(nextWord);
neighborMap.put(word, temp);
}
}

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 +139 to +149
String lastWordInContext = context.get(context.size()-1);
Random random = new Random();
String nextWord = "";

if (neighborMap.containsKey(lastWordInContext))
{
List<String> temp = neighborMap.get(lastWordInContext);
int index = random.nextInt(temp.size());
nextWord = temp.get(index);
return nextWord;
}

Choose a reason for hiding this comment

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

Great!

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