diff --git a/src/cipher_analytical_machine/cipher_analyzers.clj b/src/cipher_analytical_machine/analyzers/analyzers.clj similarity index 96% rename from src/cipher_analytical_machine/cipher_analyzers.clj rename to src/cipher_analytical_machine/analyzers/analyzers.clj index b0fb3e5..74ea2df 100644 --- a/src/cipher_analytical_machine/cipher_analyzers.clj +++ b/src/cipher_analytical_machine/analyzers/analyzers.clj @@ -1,4 +1,4 @@ -(ns cipher-analytical-machine.cipher-analyzers +(ns cipher-analytical-machine.analyzers.analyzers (:require [clojure.string :as cs]) (:gen-class)) diff --git a/src/cipher_analytical_machine/caesar_analyzers.clj b/src/cipher_analytical_machine/analyzers/caesar.clj similarity index 88% rename from src/cipher_analytical_machine/caesar_analyzers.clj rename to src/cipher_analytical_machine/analyzers/caesar.clj index 8030d5a..aa16145 100644 --- a/src/cipher_analytical_machine/caesar_analyzers.clj +++ b/src/cipher_analytical_machine/analyzers/caesar.clj @@ -1,9 +1,9 @@ -(ns cipher-analytical-machine.caesar-analyzers - (:require [cipher-analytical-machine.caesar :as caesar] +(ns cipher-analytical-machine.analyzers.caesar + (:require [cipher-analytical-machine.ciphers.caesar :as caesar] [clojure.string :as cs] - [cipher-analytical-machine.cipher-analyzers :as ca]) + [cipher-analytical-machine.analyzers.analyzers :as ca]) (:import [cipher_analytical_machine.ciphers.caesar Decrypted] - [cipher_analytical_machine.analizers.caesar FrequencyAnalyzer]) + [cipher_analytical_machine.analyzers.caesar FrequencyAnalyzer]) (:gen-class)) (defn get-all-texts diff --git a/src/cipher_analytical_machine/language_analyzer.clj b/src/cipher_analytical_machine/analyzers/language.clj similarity index 90% rename from src/cipher_analytical_machine/language_analyzer.clj rename to src/cipher_analytical_machine/analyzers/language.clj index 867c17f..ddfc7ab 100644 --- a/src/cipher_analytical_machine/language_analyzer.clj +++ b/src/cipher_analytical_machine/analyzers/language.clj @@ -1,4 +1,4 @@ -(ns cipher-analytical-machine.language-analyzer +(ns cipher-analytical-machine.analyzers.language (:import [org.apache.tika.language LanguageIdentifier]) (:gen-class)) diff --git a/src/cipher_analytical_machine/caesar.clj b/src/cipher_analytical_machine/ciphers/caesar.clj similarity index 96% rename from src/cipher_analytical_machine/caesar.clj rename to src/cipher_analytical_machine/ciphers/caesar.clj index cdaba11..6b8b897 100644 --- a/src/cipher_analytical_machine/caesar.clj +++ b/src/cipher_analytical_machine/ciphers/caesar.clj @@ -1,4 +1,4 @@ -(ns cipher-analytical-machine.caesar +(ns cipher-analytical-machine.ciphers.caesar (:require [clojure.string :as cs]) (:gen-class)) diff --git a/src/cipher_analytical_machine/cli.clj b/src/cipher_analytical_machine/cli/cli.clj similarity index 94% rename from src/cipher_analytical_machine/cli.clj rename to src/cipher_analytical_machine/cli/cli.clj index 2b198c7..3568516 100644 --- a/src/cipher_analytical_machine/cli.clj +++ b/src/cipher_analytical_machine/cli/cli.clj @@ -1,10 +1,10 @@ -(ns cipher-analytical-machine.cli +(ns cipher-analytical-machine.cli.cli (:require - [cipher-analytical-machine.file :as file] - [cipher-analytical-machine.caesar :as caesar] - [cipher-analytical-machine.caesar-analyzers :as caesar-analyzers] - [cipher-analytical-machine.symbol-factories :as sf] - [cipher-analytical-machine.symbol-frequences :as symbol-frequences] + [cipher-analytical-machine.cli.file :as file] + [cipher-analytical-machine.ciphers.caesar :as caesar] + [cipher-analytical-machine.analyzers.caesar :as caesar-analyzers] + [cipher-analytical-machine.symbols.factories :as sf] + [cipher-analytical-machine.symbols.frequences :as symbol-frequences] [clojure.string :as cs] [clojure.tools.cli :refer [parse-opts]]) (:gen-class)) diff --git a/src/cipher_analytical_machine/file.clj b/src/cipher_analytical_machine/cli/file.clj similarity index 91% rename from src/cipher_analytical_machine/file.clj rename to src/cipher_analytical_machine/cli/file.clj index bc58876..7de67e9 100644 --- a/src/cipher_analytical_machine/file.clj +++ b/src/cipher_analytical_machine/cli/file.clj @@ -1,4 +1,4 @@ -(ns cipher-analytical-machine.file +(ns cipher-analytical-machine.cli.file (:require [clojure.java.io :as io]) (:gen-class)) diff --git a/src/cipher_analytical_machine/core.clj b/src/cipher_analytical_machine/core.clj index 5e7e992..e5106b4 100644 --- a/src/cipher_analytical_machine/core.clj +++ b/src/cipher_analytical_machine/core.clj @@ -1,6 +1,6 @@ (ns cipher-analytical-machine.core (:require - [cipher-analytical-machine.cli :as cli]) + [cipher-analytical-machine.cli.cli :as cli]) (:gen-class)) (defn -main diff --git a/src/cipher_analytical_machine/symbol_factories.clj b/src/cipher_analytical_machine/symbols/factories.clj similarity index 95% rename from src/cipher_analytical_machine/symbol_factories.clj rename to src/cipher_analytical_machine/symbols/factories.clj index 65ac2f5..7cbd8a3 100644 --- a/src/cipher_analytical_machine/symbol_factories.clj +++ b/src/cipher_analytical_machine/symbols/factories.clj @@ -1,4 +1,4 @@ -(ns cipher-analytical-machine.symbol-factories +(ns cipher-analytical-machine.symbols.factories (:require [clojure.string :as cs]) (:gen-class)) diff --git a/src/cipher_analytical_machine/symbol_frequences.clj b/src/cipher_analytical_machine/symbols/frequences.clj similarity index 94% rename from src/cipher_analytical_machine/symbol_frequences.clj rename to src/cipher_analytical_machine/symbols/frequences.clj index 3878e31..491c475 100644 --- a/src/cipher_analytical_machine/symbol_frequences.clj +++ b/src/cipher_analytical_machine/symbols/frequences.clj @@ -1,4 +1,4 @@ -(ns cipher-analytical-machine.symbol-frequences +(ns cipher-analytical-machine.symbols.frequences (:gen-class)) (def english-letter-frequences { diff --git a/src/main/java/cipher_analytical_machine/analizers/caesar/FrequencyAnalyzer.java b/src/main/java/cipher_analytical_machine/analyzers/caesar/FrequencyAnalyzer.java similarity index 91% rename from src/main/java/cipher_analytical_machine/analizers/caesar/FrequencyAnalyzer.java rename to src/main/java/cipher_analytical_machine/analyzers/caesar/FrequencyAnalyzer.java index 26c2cc5..08c4e3b 100644 --- a/src/main/java/cipher_analytical_machine/analizers/caesar/FrequencyAnalyzer.java +++ b/src/main/java/cipher_analytical_machine/analyzers/caesar/FrequencyAnalyzer.java @@ -1,4 +1,4 @@ -package cipher_analytical_machine.analizers.caesar; +package cipher_analytical_machine.analyzers.caesar; import cipher_analytical_machine.ciphers.caesar.Decrypted; import java.util.Map; diff --git a/test/cipher_analytical_machine/caesar_analyzers_test.clj b/test/cipher_analytical_machine/analyzers/caesar_test.clj similarity index 94% rename from test/cipher_analytical_machine/caesar_analyzers_test.clj rename to test/cipher_analytical_machine/analyzers/caesar_test.clj index 1d26e0c..894755a 100644 --- a/test/cipher_analytical_machine/caesar_analyzers_test.clj +++ b/test/cipher_analytical_machine/analyzers/caesar_test.clj @@ -1,9 +1,9 @@ -(ns cipher-analytical-machine.caesar-analyzers-test +(ns cipher-analytical-machine.analyzers.caesar-test (:require [clojure.test :refer :all] - [cipher-analytical-machine.caesar-analyzers :refer :all] - [cipher-analytical-machine.symbol-frequences :as sf] - [cipher-analytical-machine.cipher-analyzers :as ca] + [cipher-analytical-machine.analyzers.caesar :refer :all] + [cipher-analytical-machine.symbols.frequences :as sf] + [cipher-analytical-machine.analyzers.analyzers :as ca] [clojure.string :as cs])) (deftest get-all-texts-test diff --git a/test/cipher_analytical_machine/language_analyzer_test.clj b/test/cipher_analytical_machine/analyzers/language_test.clj similarity index 93% rename from test/cipher_analytical_machine/language_analyzer_test.clj rename to test/cipher_analytical_machine/analyzers/language_test.clj index c380455..63317f6 100644 --- a/test/cipher_analytical_machine/language_analyzer_test.clj +++ b/test/cipher_analytical_machine/analyzers/language_test.clj @@ -1,7 +1,7 @@ -(ns cipher-analytical-machine.language-analyzer-test +(ns cipher-analytical-machine.analyzers.language-test (:require [clojure.test :refer :all] - [cipher-analytical-machine.language-analyzer :refer :all] + [cipher-analytical-machine.analyzers.language :refer :all] )) (deftest detect-language-test diff --git a/test/cipher_analytical_machine/cipher_analyzers_test.clj b/test/cipher_analytical_machine/cipher_analyzers_test.clj deleted file mode 100644 index 16991f2..0000000 --- a/test/cipher_analytical_machine/cipher_analyzers_test.clj +++ /dev/null @@ -1,25 +0,0 @@ -(ns cipher-analytical-machine.cipher-analyzers-test - (:require - [clojure.test :refer :all] - [cipher-analytical-machine.cipher-analyzers :refer :all])) - -(deftest count-characters-test - (testing "Count two dublicates and one uniq character from a string." - (is (= {\a 2 \b 1} - (count-characters "aba"))))) - -(deftest chi-squared-letter-statistic-test - (testing "If the frequence of A is 0.1, the text length is 100 and contains 20 times, then the chi-squared is 10." - (is (= 10.0 - (chi-squared-letter-statistic 20 0.1 100)))) - - (testing "If the frequence of A is 0.1, the text length is 10 and contains 5 times, then the chi-squared is 16.0." - (is (= 16.0 - (chi-squared-letter-statistic 5 0.1 10))))) - -(deftest chi-squared-statistic-test - (let [text "aaaaabbbbb"] - (testing "If the frequences of a and b is 0.1, the text length is 10 and contains them 5 times, then score is 32." - (is (= 32.0 - (chi-squared-statistic text {\a 0.1 \b 0.1})))))) - diff --git a/test/cipher_analytical_machine/caesar_test.clj b/test/cipher_analytical_machine/ciphers/caesar_test.clj similarity index 95% rename from test/cipher_analytical_machine/caesar_test.clj rename to test/cipher_analytical_machine/ciphers/caesar_test.clj index e1b773e..3611c86 100644 --- a/test/cipher_analytical_machine/caesar_test.clj +++ b/test/cipher_analytical_machine/ciphers/caesar_test.clj @@ -1,7 +1,7 @@ -(ns cipher-analytical-machine.caesar-test +(ns cipher-analytical-machine.ciphers.caesar-test (:require [clojure.test :refer :all] - [cipher-analytical-machine.caesar :refer :all] + [cipher-analytical-machine.ciphers.caesar :refer :all] )) (deftest calculate-char-index-test diff --git a/test/cipher_analytical_machine/symbol_factories_test.clj b/test/cipher_analytical_machine/symbols/factories_test.clj similarity index 94% rename from test/cipher_analytical_machine/symbol_factories_test.clj rename to test/cipher_analytical_machine/symbols/factories_test.clj index b00d054..0a85f02 100644 --- a/test/cipher_analytical_machine/symbol_factories_test.clj +++ b/test/cipher_analytical_machine/symbols/factories_test.clj @@ -1,7 +1,7 @@ -(ns cipher-analytical-machine.symbol-factories-test +(ns cipher-analytical-machine.symbols.factories-test (:require [clojure.test :refer :all] - [cipher-analytical-machine.symbol-factories :refer :all] + [cipher-analytical-machine.symbols.factories :refer :all] )) (deftest english-alphabet-factory-test