diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d358f0..de18a7d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/README.md b/README.md index 7ea226f..c0c870e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,22 @@ -# cpp-unity-template +# bayesian-spam-filter + +## Report + +Given SMSSpamCollection.txt was split in half for report + +First half was used for generation, second half for actual filter + +(Files included in test for convenience) + +Results: + + Spam precision: 0.935135 + Spam recall: 0.39229 + Ham precision: 0.780777 + Ham recall: 0.987584 + Spam F-Score: 0.552716 + Ham F-Score: 0.872088 + Accuracy: 0.689937 ## Compiling the project @@ -12,24 +30,11 @@ In order to compile the project, simply run these two commands: ## Running the Project -The program should now be compiled at build/bin/something +The program should now be compiled at build/bin/filter Simply run the program using: - build/bin/something + build/bin/filter -## 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 \ No newline at end of file +## Usage +Use the `--help` argument for usage help diff --git a/src/filter.cpp b/src/filter.cpp index 946f74d..835f8d0 100644 --- a/src/filter.cpp +++ b/src/filter.cpp @@ -147,6 +147,10 @@ void SMSMessageFilter::ReadArguments(int argc, char* argv[]) { is_input_defined = true; filter_file_path.assign(argv[i+1]); } + if (argument_string == "--help") { + PrintHelp(); + exit(0); + } } if (!is_input_defined) { std::cerr << "Usage error: Please specify file to filter" << std::endl; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 8a65233..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -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) diff --git a/test/test.cpp b/test/test.cpp deleted file mode 100644 index 6668b68..0000000 --- a/test/test.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include - -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(); -} -