1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA512 |
3 |
|
4 |
This is a great idea! |
5 |
|
6 |
|
7 |
On 04/04/16 07:03, Zac Medico wrote: |
8 |
> +.BR "\-\-search\-fuzzy [ y | n ]" |
9 |
> +Enable or disable fuzzy search for search actions. |
10 |
This is likely a good place to briefly explain what a "fuzzy search" |
11 |
is. |
12 |
|
13 |
Also, I'm not sold on "seach-fuzzy" as opposed to "fuzzy-search". Is |
14 |
there a particular reasoning for it? Since we don't seem to have a |
15 |
standardised "verbs mean this, nouns mean this" anyway, I would use |
16 |
the latter phrase. |
17 |
|
18 |
You also need to document your note on regexes. |
19 |
|
20 |
Lastly, you also need to document that a fuzzy search is slower than a |
21 |
regular search. |
22 |
|
23 |
> +.TP |
24 |
> +.BR "\-\-search\-fuzzy\-cutoff CUTOFF" |
25 |
> +Set similarity ratio cutoff (a floating-point number between 0 and 1). |
26 |
> +Results with similarity ratios lower than the cutoff are discarded. |
27 |
> +This option has no effect unless the \fB\-\-search\-fuzzy\fR option |
28 |
> +is enabled. |
29 |
This explanation is a bit heavy to read. And I think that using 0 to 1 |
30 |
isn't very nice. And calling the number "floating point" instead of |
31 |
decimal isn't very useful nor nice. How about making it a percentage, |
32 |
and describing it simply as a similarity percentage -- "package names |
33 |
must be at least N% similar to the search term to appear in search |
34 |
results". The option could then be called --seach-fuzzy-similarity, |
35 |
or (in keeping with the previous suggestion) |
36 |
- --fuzzy-search-similarity, or -- wait for it -- something similar. ;) |
37 |
Of course if you agree with this, you'll have to reverse the code to |
38 |
represent which results to show, rather than which ones to not show. |
39 |
|
40 |
You should also document here what happens if there's a mistake in the |
41 |
input. |
42 |
|
43 |
> + "--search-fuzzy-cutoff": { |
44 |
> + "help": "Set similarity ratio cutoff (a floating-point number between 0 and 1)", |
45 |
> + "action": "store" |
46 |
> + }, |
47 |
See comments above regarding how to explain what this actually does. |
48 |
|
49 |
> + if myoptions.search_fuzzy_cutoff: |
50 |
> + try: |
51 |
> + fuzzy_cutoff = float(myoptions.search_fuzzy_cutoff) |
52 |
> + except ValueError: |
53 |
> + fuzzy_cutoff = 0.0 |
54 |
Is this a reasonable fallback? I guess so... but you need to mention |
55 |
it in the manpage, as mentioned. |
56 |
|
57 |
> + |
58 |
> + if fuzzy_cutoff <= 0.0: |
59 |
> + fuzzy_cutoff = None |
60 |
> + if not silent: |
61 |
> + parser.error("Invalid --search-fuzzy-cutoff parameter: '%s'\n" % \ |
62 |
> + (myoptions.search_fuzzy_cutoff,)) |
63 |
> + |
64 |
> + myoptions.search_fuzzy_cutoff = fuzzy_cutoff |
65 |
> + |
66 |
I also don't understand why the first one is just 0.0, but this one |
67 |
is an error. Why aren't both either errors and revert to 0.8 cut-off |
68 |
(or 80% similarity) or 0.0/100? |
69 |
|
70 |
And this needs to go in the manpage too. |
71 |
|
72 |
> + self.fuzzy_cutoff = 0.8 if fuzzy_cutoff is None else fuzzy_cutoff |
73 |
See above. |
74 |
|
75 |
> + fuzzy = False |
76 |
Here's an interesting discussion: maybe this should be True? After |
77 |
all, it's True in any modern search engine. What do you think? |
78 |
|
79 |
> + # Fuzzy search does not support regular expressions, therefore |
80 |
> + # it is disabled for regular expression searches. |
81 |
Manpage. |
82 |
- -- |
83 |
Alexander |
84 |
bernalex@g.o |
85 |
https://secure.plaimi.net/~alexander |
86 |
-----BEGIN PGP SIGNATURE----- |
87 |
Version: GnuPG v2 |
88 |
|
89 |
iQIcBAEBCgAGBQJXAig0AAoJENQqWdRUGk8BOOEQAIEYXkn86ibMiYhN5BBDlsL1 |
90 |
2a6zBOCzygTkpxiBg+8vPsWJcHmzyTO7M6H1x3bUCY/JEfWq0354WdvNMtDM5qZk |
91 |
zpwIg0uPs/Q4Fo40hozHsc66f+jqZxgmy5rML2mO8cAFZANZdNtuvTkVQYF5zQXz |
92 |
4CI06tVDwXmYAmg7wIBEpWJ8O+is2F1abzPJcr42tLz5ELYm1IRn4Em8WO5m5klm |
93 |
mrYWWeesvNS1l2y8kbKCmtpQbSuzLYfFyVfFkSL/p6t16Tiu7edqGJ0HOrq5B5dx |
94 |
+cwuT+vwbTtA8d/Qo/cifbyuxnNtO8JthhEvemAdCYkDC4DQHDStsKFjA+Za1Sos |
95 |
r/eSQexXNOQ/oMgksm72aX9rIkfurtn73AhIthKEnzrzou3pVW+H5eHR25vF58EO |
96 |
qHUJO9/Z8ZkHec3HopxFtYng16i26VlW2pDehdkWGVoZSXomaOyH7x7XQXZoE7B+ |
97 |
4e4vDOMbeIvxyA/j1+H35WBZCu6f9FstOrEptD5FIE6/QM4oAW+CBllUQf5iQVEB |
98 |
4Rpodu2AvKWgqTTOMLcn9+HK8JgnbMlm6cYLT+YXP7j6OnJFB6yq5/L3dfS5rrEX |
99 |
sxwrvVTTx2dCbX/RImQoMpEIQFaTfimZgKQDw3rmtv+JfP3OnpdOrN+QJJfHbCgb |
100 |
4c9suzs/UTBLbtiFQhdO |
101 |
=XsDv |
102 |
-----END PGP SIGNATURE----- |