equal
deleted
inserted
replaced
510 fun knn () = |
510 fun knn () = |
511 k_nearest_neighbors dffreq num_facts num_feats depss featss max_suggs fact_idxs int_goal_feats |
511 k_nearest_neighbors dffreq num_facts num_feats depss featss max_suggs fact_idxs int_goal_feats |
512 |> map fst |
512 |> map fst |
513 in |
513 in |
514 (trace_msg ctxt (fn () => "MaSh query internal " ^ commas (map fst goal_feats) ^ " from {" ^ |
514 (trace_msg ctxt (fn () => "MaSh query internal " ^ commas (map fst goal_feats) ^ " from {" ^ |
515 elide_string 1000 (space_implode " " (Vector.foldr (op ::) [] fact_names)) ^ "}"); |
515 elide_string 1000 (implode_space (Vector.foldr (op ::) [] fact_names)) ^ "}"); |
516 (case algorithm of |
516 (case algorithm of |
517 MaSh_NB => nb () |
517 MaSh_NB => nb () |
518 | MaSh_kNN => knn () |
518 | MaSh_kNN => knn () |
519 | MaSh_NB_kNN => |
519 | MaSh_NB_kNN => |
520 mesh_facts I (op =) max_suggs |
520 mesh_facts I (op =) max_suggs |
543 | NONE => "" (* error *)) |
543 | NONE => "" (* error *)) |
544 | unmeta_chars _ (#"%" :: _) = "" (* error *) |
544 | unmeta_chars _ (#"%" :: _) = "" (* error *) |
545 | unmeta_chars accum (c :: cs) = unmeta_chars (c :: accum) cs |
545 | unmeta_chars accum (c :: cs) = unmeta_chars (c :: accum) cs |
546 |
546 |
547 val encode_str = String.translate meta_char |
547 val encode_str = String.translate meta_char |
548 val encode_strs = map encode_str #> space_implode " " |
548 val encode_strs = map encode_str #> implode_space |
549 |
549 |
550 fun decode_str s = |
550 fun decode_str s = |
551 if String.isSubstring "%" s then unmeta_chars [] (String.explode s) else s; |
551 if String.isSubstring "%" s then unmeta_chars [] (String.explode s) else s; |
552 |
552 |
553 fun decode_strs s = |
553 fun decode_strs s = |