Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
#include "../utils/defines.h"

size_t word = 0, character = 0;
for (size_t iter_char = 0; iter_char < strlen(example); iter_char++) {
size_t example_len = strlen(example);
for (size_t iter_char = 0; iter_char < example_len; iter_char++) {
example[iter_char] = tolower(example[iter_char]);
if (example[iter_char] == ' ') {
if (example[iter_char + 1] != ' ') {
Expand Down
5 changes: 3 additions & 2 deletions src/requests.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ if (only_spaces)
continue;

//Check for string length to be greater than 1. Since fgets gets the new line character, the length is 1 no matter if any input is given or not
if ((strlen(str) > 1) && (str[strlen(str) - 1] == '\n'))
str[strlen(str) - 1] = '\0';
len = strlen(str);
if ((len > 1) && (str[len - 1] == '\n'))
str[len - 1] = '\0';
else
continue;

Expand Down
2 changes: 1 addition & 1 deletion src/word_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void fillWordList() {
for (short phrase_iter = 0; phrase_iter < NUM_WORDS; phrase_iter++) {
for (short word_iter =0; word_iter < WORD_LEN; word_iter ++) {
if (classifier[class_iter][phrase_iter][word_iter] != NULL
&& strlen(classifier[class_iter][phrase_iter][word_iter])
&& classifier[class_iter][phrase_iter][word_iter][0] != '\0'
&& strcmp(classifier[class_iter][phrase_iter][word_iter]," ") != 0) {
strcpy(tmp[tmp_size].word, classifier[class_iter][phrase_iter][word_iter]);
tmp[tmp_size].category = 1 << class_iter;
Expand Down