Merge pull request 'Final Changes' (#13) from dev into master

Reviewed-on: #13
This commit is contained in:
Trianta 2023-12-08 23:47:38 -06:00
commit 49b2806f4d
6 changed files with 1088 additions and 55 deletions

View File

@ -10,7 +10,3 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
add_subdirectory(src)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
add_subdirectory(test)
endif()

View File

@ -1,5 +1,35 @@
# markov-generator
## Results
This program was tested using aces-up.txt and stalemate.txt
stalemate replaced aces-up for more interesting generation
A k=8 input resulted in the best output since it stopped words from being cut off
### Favorites
*All k's were generated from stalemate.txt with n=32*
>k=0: thinopreareBunofothinothinealoupa
>k=1: wit. thimp worg thanc thelescrope
>k=2: thate anyh out. IRS. God. some IN
>k=3: that. There. high fough that' fin
>k=4: protec you?" its infrin that?" Un
>k=5: United ankles can't having younge
>k=6: thing, God. You'll forgotte shave
>k=7: three into wounded? online away.
>k=8: both. several whatsoever thing, s
## Compiling the project
Prerequisites
@ -18,18 +48,3 @@ Simply run the program using:
build/bin/markov
## Testing the Project
Prerequisites
- [Unity (Throw the Switch)](https://github.com/ThrowTheSwitch/Unity) | [AUR](https://aur.archlinux.org/packages/unity-test)
In order to compile the tests for the project, simply run these two commands:
cmake -DCMAKE_BUILD_TYPE=Debug -B build -S .
cmake --build build
The program should now be compiled at build/bin/tests
Simply run the tests using:
build/bin/tests

View File

@ -116,14 +116,7 @@ void Generator::Train(void) {
std::cout << "[Setup - Info] Begin training" << std::endl;
for (const auto& word : words) {
if (word.size() < setup.prefixLength) {
trie.Insert(word);
continue;
} else {
for (int i = 0; i < word.size() - setup.prefixLength; ++i) {
trie.Insert(word.substr(i, setup.prefixLength));
}
}
trie.Insert(word);
}
std::cout << "[Setup - Info] Finished training" << std::endl;
}

View File

@ -1,7 +0,0 @@
find_package(unity REQUIRED)
include_directories(${CMAKE_SOURCE_DIR}/src)
add_executable(testing
test.cpp
)
set_target_properties(testing PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(testing unity)

1057
test/stalemate.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
#include <unity/unity.h>
#include <unity/unity_internals.h>
void setUp() { ; }
void tearDown() { ; }
int Math(void) {
return 2+2;
}
void test_Math(void) {
TEST_ASSERT_EQUAL_INT(4, Math());
}
int main(void) {
UNITY_BEGIN();
RUN_TEST(test_Math);
return UNITY_END();
}