From 103a859247bd88b4cb99b712c3e0e6fe0564dfe3 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 21 Oct 2022 11:36:09 +0300 Subject: [PATCH] FIXED: don't include irrelevant candidates in apropos results * sweep.pl (sweep_predicate_apropos/2): filter candidates by minimum match quality. --- sweep.pl | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/sweep.pl b/sweep.pl index 7b4a8d0..cf29c39 100644 --- a/sweep.pl +++ b/sweep.pl @@ -81,6 +81,11 @@ :- use_module(library(http/html_write)). :- use_module(library(prolog_pack)). +:- if(exists_source(library(help))). +:- use_module(library(help)). +:- endif. + + :- meta_predicate with_buffer_stream(-, +, 0). :- dynamic sweep_current_color/3, @@ -523,14 +528,14 @@ sweep_predicate_location(FN, [Path|Line]) :- sweep_predicate_apropos(Query0, Matches) :- atom_string(Query, Query0), findall([S,Path|Line], - (prolog_help:apropos(Query, M:F/N, _, _), - format(string(S), '~w:~W/~w', [M, F, [quoted(true), character_escapes(true)], N]), + (prolog_help:apropos(Query, M:F/N, _, P), P >= 0.3, + format(string(S), '~W', [M:F/N, [quoted(true), character_escapes(true)]]), pi_head(F/N, Head), sweep_predicate_location_(M, Head, Path, Line)), Matches, Tail), findall([S,Path], - (prolog_help:apropos(Query, F/N, _, _), - format(string(S), '~W/~w', [F, [quoted(true), character_escapes(true)], N]), + (prolog_help:apropos(Query, F/N, _, P), P >= 0.3, + format(string(S), '~W', [F/N, [quoted(true), character_escapes(true)]]), pi_head(F/N, Head), sweep_predicate_location_(Head, Path, Line)), Tail). -- 2.39.2