138 datatype mash_engine = MaSh_Py | MaSh_SML_kNN | MaSh_SML_NB |
138 datatype mash_engine = MaSh_Py | MaSh_SML_kNN | MaSh_SML_NB |
139 |
139 |
140 fun mash_engine () = |
140 fun mash_engine () = |
141 let val flag1 = Options.default_string @{system_option MaSh} in |
141 let val flag1 = Options.default_string @{system_option MaSh} in |
142 (case if flag1 <> "none" (* default *) then flag1 else getenv "MASH" of |
142 (case if flag1 <> "none" (* default *) then flag1 else getenv "MASH" of |
143 "yes" => SOME MaSh_Py |
143 "yes" => SOME MaSh_SML_NB |
144 | "py" => SOME MaSh_Py |
144 | "py" => SOME MaSh_Py |
145 | "sml" => SOME MaSh_SML_NB |
145 | "sml" => SOME MaSh_SML_NB |
146 | "sml_knn" => SOME MaSh_SML_kNN |
146 | "sml_knn" => SOME MaSh_SML_kNN |
147 | "sml_nb" => SOME MaSh_SML_NB |
147 | "sml_nb" => SOME MaSh_SML_NB |
148 | _ => NONE) |
148 | _ => NONE) |
149 end |
149 end |
150 |
150 |
151 val is_mash_enabled = is_some o mash_engine |
151 val is_mash_enabled = is_some o mash_engine |
152 val the_mash_engine = the_default MaSh_Py o mash_engine |
152 val the_mash_engine = the_default MaSh_SML_NB o mash_engine |
153 |
153 |
154 |
154 |
155 (*** Low-level communication with Python version of MaSh ***) |
155 (*** Low-level communication with the Python version of MaSh ***) |
156 |
156 |
157 val save_models_arg = "--saveModels" |
157 val save_models_arg = "--saveModels" |
158 val shutdown_server_arg = "--shutdownServer" |
158 val shutdown_server_arg = "--shutdownServer" |
159 |
159 |
160 fun wipe_out_file file = (try (File.rm o Path.explode) file; ()) |
160 fun wipe_out_file file = (try (File.rm o Path.explode) file; ()) |
1632 val (save, effective_fact_filter) = |
1632 val (save, effective_fact_filter) = |
1633 (case fact_filter of |
1633 (case fact_filter of |
1634 SOME ff => (ff <> mepoN andalso maybe_learn (), ff) |
1634 SOME ff => (ff <> mepoN andalso maybe_learn (), ff) |
1635 | NONE => |
1635 | NONE => |
1636 if is_mash_enabled () then |
1636 if is_mash_enabled () then |
1637 (maybe_learn (), |
1637 (maybe_learn (), if mash_can_suggest_facts ctxt overlord then meshN else mepoN) |
1638 if mash_can_suggest_facts ctxt overlord then meshN else mepoN) |
|
1639 else |
1638 else |
1640 (false, mepoN)) |
1639 (false, mepoN)) |
1641 |
1640 |
1642 val unique_facts = drop_duplicate_facts facts |
1641 val unique_facts = drop_duplicate_facts facts |
1643 val add_ths = Attrib.eval_thms ctxt add |
1642 val add_ths = Attrib.eval_thms ctxt add |