| 22 | Â | (define m (mecab-new2 ""))Â |
| 23 | Â | (test* "mecab-sparse-tostr"Â |
| 24 |  | "�Ϻ ̾����,*,*,�Ϻ,ï¿½ï¿½ï¿½í¤¦,*\n\ |
| 25 |  | �������*,*,����*\n\ |
| 26 |  | ��Ϻ ̾����,*,*,��Ϻ,ï¿½ï¿½ï¿½í¤¦,*\n\ |
| 27 |  | �� ���ʽ�*,*,��,��,*\n\ |
| 28 |  | ��ư��,�Ҳ�ư�쥿���������Ʒ����ä��ɽɽ��:�� |
| 29 |  | �������������,���ư�����������\n\ |
| 30 |  | � ̾���̾��,*,�,�ۤ���:�� �ɽɽ��:�\n\ |
| 31 |  | ����ʽ�*,*,��,*\n\ |
| 32 |  | �ֻ�̾����,*,*,�ֻ��Ϥʤ�,*\n\ |
| 33 |  | �����ʽ�*,*,����*\n\ |
| 34 |  | ����� ư��,�Ҳ�ư�쥵���������,�錄����,�°ư����ʴ���ɽɽ��:���\n\ |
| 35 |  | �� ����,*,*,��,��,*\n\ |
| 36 | Â | EOS\n"Â |
| 37 |  | (mecab-sparse-tostr m "�Ϻ�ϼ�Ϻ���������Ҥ�Ϥ�����")) |
| 38 | Â | Â |
| 39 | Â | (mecab-destroy m)Â |
| Â | 35 | (test-section "reader-ctor")Â |
|  | 36 | (let1 m #,(mecab "") ;; with reader-ctor |
| Â | 37 | (test* "#,(mecab \"\") : mecab?" #t (mecab? m))Â |
| Â | 38 | (test* "#,(mecab \"\") : options" '() (mecab-options m))Â |
| Â | 39 | (mecab-destroy m))Â |
|  | 40 | (let1 m #,(mecab "-Ochasen") ;; with reader-ctor |
| Â | 41 | (test* "#,(mecab \"-Ochasen\") : mecab?" #t (mecab? m))Â |
| Â | 42 | (test* "#,(mecab \"-Ochasen\") : options" '((output-format-type chasen)) (mecab-options m))Â |
| Â | 43 | (mecab-destroy m))Â |
|  | 44 | (let1 m #,(mecab :O chasen :l 1) ;; with reader-ctor |
| Â | 45 | (test* "#,(mecab :O chasen :l 1) : mecab?" #t (mecab? m))Â |
| Â | 46 | (test* "#,(mecab :O chasen :l 1) : mecab-options" '((output-format-type chasen) (lattice-level 1)) (mecab-options m))Â |
| Â | 47 | (mecab-destroy m))Â |
| Â | 48 | Â |
| Â | 49 | ;;Â |
|  | 50 | ;; mecab?, mecab-node?, mecab-dictionary-info? |
| Â | 51 | ;;Â |
| Â | 52 | (let* ([m (mecab-new2 "")]Â |
| Â | 53 | [node (mecab-sparse-tonode m "")]Â |
| Â | 54 | [dinfo (mecab-dictionary-info m)])Â |
| Â | 55 | (test-section "mecab?, mecab-node?, mecab-dictionary-info?")Â |
| Â | 56 | Â |
| Â | 57 | (test* "is-a? m <mecab>" #t (is-a? m <mecab>))Â |
| Â | 58 | (test* "is-a? node <mecab>" #t (is-a? node <mecab-node>))Â |
| Â | 59 | (test* "is-a? dinfo <mecab>" #t (is-a? dinfo <mecab-dictionary-info>))Â |
| Â | 60 | Â |
| Â | 61 | (test* "mecab? m" #t (mecab? m))Â |
| Â | 62 | (test* "mecab? node" #f (mecab? node))Â |
| Â | 63 | (test* "mecab? dinfo" #f (mecab? dinfo))Â |
| Â | 64 | Â |
| Â | 65 | (test* "mecab-node? m" #f (mecab-node? m))Â |
| Â | 66 | (test* "mecab-node? node" #t (mecab-node? node))Â |
| Â | 67 | (test* "mecab-node? dinfo" #f (mecab-node? dinfo))Â |
| Â | 68 | Â |
| Â | 69 | (test* "mecab-dictionary-info? m" #f (mecab-dictionary-info? m))Â |
| Â | 70 | (test* "mecab-dictionary-info? node" #f (mecab-dictionary-info? node))Â |
| Â | 71 | (test* "mecab-dictionary-info? dinfo" #t (mecab-dictionary-info? dinfo))Â |
| Â | 72 | Â |
| Â | 73 | (mecab-destroy m))Â |
| Â | 74 | Â |
|  | 75 | ;; mecab, mecab-options |
| Â | 76 | (test-section "mecab-options")Â |
| Â | 77 | (let1 m (mecab-new '())Â |
| Â | 78 | (test* "(mecab-new '())" '() (mecab-options m))Â |
| Â | 79 | (mecab-destroy m))Â |
| Â | 80 | (let1 m (mecab-new '("-O" "chasen"))Â |
| Â | 81 | (test* "(mecab-new '(\"-O\" \"chasen\"))" '((output-format-type chasen)) (mecab-options m))Â |
| Â | 82 | (mecab-destroy m))Â |
| Â | 83 | (let1 m (mecab-new2 "")Â |
| Â | 84 | (test* "(mecab-new2 \"\"" '() (mecab-options m))Â |
| Â | 85 | (mecab-destroy m))Â |
| Â | 86 | (let1 m (mecab-new2 "-Ochasen")Â |
| Â | 87 | (test* "mecab?" #t (mecab? m))Â |
| Â | 88 | (test* "(mecab-new2 \"-Ochasen\") : options" '((output-format-type chasen)) (mecab-options m))Â |
| Â | 89 | (mecab-destroy m))Â |
| Â | 90 | (let1 m (mecab-new2 "-O chasen")Â |
| Â | 91 | (test* "mecab?" #t (mecab? m))Â |
| Â | 92 | (test* "(mecab-new2 \"-O chasen\") : options" '((output-format-type chasen)) (mecab-options m))Â |
| Â | 93 | (mecab-destroy m))Â |
| Â | 94 | (let1 m (mecab-new2 "--output-format-type chasen")Â |
| Â | 95 | (test* "mecab?" #t (mecab? m))Â |
| Â | 96 | (test* "(mecab-new2 \"--output-format-type chasen\") : options" '((output-format-type chasen)) (mecab-options m))Â |
| Â | 97 | (mecab-destroy m))Â |
| Â | 98 | (let1 m (mecab-new2 "--output-format-type=chasen")Â |
| Â | 99 | (test* "mecab?" #t (mecab? m))Â |
| Â | 100 | (test* "(mecab-new2 \"--output-format-type=chasen\") : options" '((output-format-type chasen)) (mecab-options m))Â |
| Â | 101 | (mecab-destroy m))Â |
| Â | 102 | (let1 m (mecab "")Â |
| Â | 103 | (test* "(mecab \"\") : mecab?" #t (mecab? m))Â |
| Â | 104 | (test* "(mecab \"\") : options" '() (mecab-options m))Â |
| Â | 105 | (mecab-destroy m))Â |
| Â | 106 | (let1 m (mecab "-Ochasen")Â |
| Â | 107 | (test* "(mecab \"-Ochasen\") : mecab?" #t (mecab? m))Â |
| Â | 108 | (test* "(mecab \"-Ochasen\") : options" '((output-format-type chasen)) (mecab-options m))Â |
| Â | 109 | (mecab-destroy m))Â |
| Â | 110 | (let1 m (mecab "-O chasen")Â |
| Â | 111 | (test* "(mecab \"-O chasen\") : mecab?" #t (mecab? m))Â |
| Â | 112 | (test* "(mecab \"-O chasen\") : options" '((output-format-type chasen)) (mecab-options m))Â |
| Â | 113 | (mecab-destroy m))Â |
| Â | 114 | (let1 m (mecab "-O" "chasen")Â |
| Â | 115 | (test* "(mecab \"-O\" \"chasen\") : mecab?" #t (mecab? m))Â |
| Â | 116 | (test* "(mecab \"-O\" \"chasen\") : options" '((output-format-type chasen)) (mecab-options m))Â |
| Â | 117 | (mecab-destroy m))Â |
| Â | 118 | (let1 m (mecab :O 'chasen :l 1)Â |
| Â | 119 | (test* "(mecab :O chasen :l 1) : mecab?" #t (mecab? m))Â |
| Â | 120 | (test* "(mecab :O chasen :l 1) : mecab-options" '((output-format-type chasen) (lattice-level 1)) (mecab-options m))Â |
| Â | 121 | (mecab-destroy m))Â |
| Â | 122 | Â |
| Â | 123 | ;;Â |
|  | 124 | ;; APIs |
| Â | 125 | ;;Â |
| Â | 126 | (test-section "mecab-new")Â |
| Â | 127 | (let1 m (mecab-new '())Â |
| Â | 128 | (test* "is-a? <mecab>" #t (is-a? m <mecab>))Â |
| Â | 129 | (test* "mecab?" #t (mecab? m))Â |
| Â | 130 | Â |
| Â | 131 | (test-section "mecab-destroy")Â |
| Â | 132 | (test* "not destroyed yet" #f (mecab-destroyed? m))Â |
| Â | 133 | (mecab-destroy m)Â |
| Â | 134 | (test* "destroyed" #t (mecab-destroyed? m))Â |
| Â | 135 | )Â |
| Â | 136 | Â |
| Â | 137 | (test-section "mecab-new2")Â |
| Â | 138 | (let1 m (mecab-new2 "")Â |
| Â | 139 | (test* "is-a? <mecab>" #t (is-a? m <mecab>))Â |
| Â | 140 | (test* "mecab?" #t (mecab? m))Â |
| Â | 141 | (test* "options" '() (mecab-options m))Â |
| Â | 142 | (mecab-destroy m))Â |
| Â | 143 | Â |
| Â | 144 | (test-section "mecab-version")Â |
| Â | 145 | (test* "mecab-version" 1Â |
|  | 146 | (rxmatch-num-matches |
| Â | 147 | (#/^[0-9]+\.[0-9]+[.0-9A-Za-z]*$/ (mecab-version))))Â |
| Â | 148 | Â |
| Â | 149 | (test-section "mecab-strerror")Â |
| Â | 150 | (mecab-new2 "")Â |
| Â | 151 | (test* "at mecab-new2 (ok)" "" (mecab-strerror #f))Â |
| Â | 152 | Â |
| Â | 153 | (mecab-new2 "-d //") ;; => "tagger.cpp(149) [load_dictionary_resource(param)] param.cpp(71) [ifs] no such file or directory: //dicrc"Â |
| Â | 154 | (test* "at mecab-new (err)" #f (string=? "" (mecab-strerror #f)))Â |
| Â | 155 | (test* "no such file or directory" #f (not (#/no such file or directory/ (mecab-strerror #f))))Â |
| Â | 156 | Â |
| Â | 157 | (let1 m (mecab-new2 "")Â |
|  | 158 | (mecab-sparse-tostr m "��Ĥ���") |
| Â | 159 | (test* "noerr" "" (mecab-strerror m))Â |
| Â | 160 | (mecab-destroy m))Â |
| Â | 161 | Â |
| Â | 162 | (let1 m (mecab-new2 "")Â |
| Â | 163 | (test-section "mecab-get-partial / mecab-set-partial")Â |
|  | 164 | (test* "default partial mode [0|1]" #t |
| Â | 165 | (and (memq (mecab-get-partial m) '(0 1)) #t))Â |
| Â | 166 | (mecab-set-partial m 1)Â |
| Â | 167 | (test* "set to 1" 1 (mecab-get-partial m))Â |
| Â | 168 | (mecab-set-partial m 0)Â |
| Â | 169 | (test* "set to 0" 0 (mecab-get-partial m))Â |
| Â | 170 | Â |
| Â | 171 | (test-section "mecab-get-theta / mecab-set-theta")Â |
| Â | 172 | (let1 theta (mecab-get-theta m)Â |
| Â | 173 | (test* "default partial mode [0..1]" #t (and (number? theta) (<= 0.0 theta 1.0))))Â |
| Â | 174 | (mecab-set-theta m 1.0)Â |
| Â | 175 | (test* "set to 1.0" 1.0 (mecab-get-theta m))Â |
| Â | 176 | (mecab-set-theta m 0.5)Â |
| Â | 177 | (test* "set to 0.5" 0.5 (mecab-get-theta m))Â |
| Â | 178 | Â |
| Â | 179 | (test-section "mecab-get-lattice-level / mecab-set-lattice-level")Â |
|  | 180 | (test* "default lattice-level [0|1|2]" #t |
| Â | 181 | (and (memq (mecab-get-lattice-level m) '(0 1 2)) #t))Â |
| Â | 182 | (mecab-set-lattice-level m 1)Â |
| Â | 183 | (test* "set to 1" 1 (mecab-get-lattice-level m))Â |
| Â | 184 | (mecab-set-lattice-level m 2)Â |
| Â | 185 | (test* "set to 2" 2 (mecab-get-lattice-level m))Â |
| Â | 186 | (mecab-set-lattice-level m 0)Â |
| Â | 187 | (test* "set to 0" 0 (mecab-get-lattice-level m))Â |
| Â | 188 | Â |
| Â | 189 | (test-section "mecab-get-all-morphs / mecab-set-all-morphs")Â |
|  | 190 | (test* "default all-morphs [0|1]" #t |
| Â | 191 | (and (memq (mecab-get-all-morphs m) '(0 1)) #t))Â |
| Â | 192 | (mecab-set-all-morphs m 1)Â |
| Â | 193 | (test* "set to 1" 1 (mecab-get-all-morphs m))Â |
| Â | 194 | (mecab-set-all-morphs m 0)Â |
| Â | 195 | (test* "set to 0" 0 (mecab-get-all-morphs m))Â |
| Â | 196 | )Â |