Skip to content

Commit

Permalink
updates தமிழ்->romanized transliteration
Browse files Browse the repository at this point in the history
  • Loading branch information
echeran committed Feb 15, 2015
1 parent bdd21df commit eaf9797
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/cljx/clj_thamil/format/convert.cljx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@
"ங்க்" "ng"
"" "aa"
"" "ii"
"" "uu"})
"" "uu"
"ன்ப்" "nb"
"ண்ப்" "nb"})

(def ^{:doc "an inverse of romanized-தமிழ்-phoneme-map, but with a few manual mappings for certain தமிழ் letters that can be input in multiple ways (or whose transliteration into English should be different then how it is input via English)"}
தமி-romanized-phoneme-map
Expand Down
13 changes: 11 additions & 2 deletions test/cljx/clj_thamil/format/convert_test.cljx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@
(is (not= "neer" (தமிழ்->romanized "நீர்")))
(is (= "paambu" (தமிழ்->romanized "பாம்பு")))
(is (not= "paampu" (தமிழ்->romanized "பாம்பு")))
(is (= "anpu" (தமிழ்->romanized "அன்பு")))
(is (not= "anbu" (தமிழ்->romanized "அன்பு")))))
(is (not= "anpu" (தமிழ்->romanized "அன்பு")))
(is (= "anbu" (தமிழ்->romanized "அன்பு")))
(is (not= "panpu" (தமிழ்->romanized "பண்பு")))
(is (= "panbu" (தமிழ்->romanized "பண்பு")))))

(deftest double-check-test
(testing "from the test.check / double-check Readme"
Expand Down Expand Up @@ -62,13 +64,20 @@
no-ambig2 (every? false? (map ambig2 phoneme-doubles))
no-ambig3 (every? false? (map ambig3 phoneme-doubles))]
(and no-ambig1 no-ambig2 no-ambig3)))
;; old fonts can't distinguish certain character combinations,
;; so prevent test cases that could cause that
non-romanized-thamil-text-gen (gen/such-that old-font-no-ambig-combo lett-gen (* QCHK-SIZE A_LOT))
;; applying converters for old fonts followed by their
;; inverses should give back the original text
test-prop (fn [f inv] (prop/for-all [t non-romanized-thamil-text-gen]
(= t (-> t f inv))))
test-res (fn [f inv]
(->> (test-prop f inv)
(sc/quick-check QCHK-SIZE)
:result))
;; only after we've transliterated to romanized can we use
;; the rule about applying converter + inverse = input, since
;; the தமிழ்->romanized direction has certain overrides
romanized-test-prop (prop/for-all [t thamil-text-gen]
(let [converted-test-txt (-> t cvt/தமிழ்->romanized cvt/romanized->தமிழ்)]
(= converted-test-txt (-> converted-test-txt cvt/தமிழ்->romanized cvt/romanized->தமிழ்))))
Expand Down

0 comments on commit eaf9797

Please sign in to comment.