Coder Social home page Coder Social logo

Comments (5)

gucci-on-fleek avatar gucci-on-fleek commented on September 28, 2024 1

I'm starting to think that this (and #94) is maybe more of an issue with the scoring than with how the results are displayed.

Example:

$ texdoc -lM qwert # unstable results here
qwert	7.0	/usr/local/texlive/2022/texmf-dist/doc/fonts/bera/bera.pdf		Font samples
qwert	1.8	/usr/local/texlive/2022/texmf-dist/doc/fonts/bera/README		Readme
qwert	1.6	/usr/local/texlive/2022/texmf-dist/doc/fonts/bera/bera.txt		

$ texdoc -lM texbytopi
texdoc warning: No good result found, showing all results.
texbytopi	-8.5	/usr/local/texlive/2022/texmf-dist/doc/plain/texbytopic/TeXbyTopic.pdf		The book itself
texbytopi	-9.8	/usr/local/texlive/2022/texmf-dist/doc/plain/texbytopic/README		Readme

$ texdoc -lM zezbytopiz
zezbytopiz	7.0	/usr/local/texlive/2022/texmf-dist/doc/plain/texbytopic/TeXbyTopic.pdf		The book itself
zezbytopiz	1.8	/usr/local/texlive/2022/texmf-dist/doc/plain/texbytopic/README		Readme

With the first case, no one will really care what message we show since there aren't really any sensible results for the search. What would be bad here would be to just open a random document with no notice, but that is what is happening here.

For the second case, texdoc "should" be able to open the correct document automatically. Showing any message here would be fairly annoying, but that is what is happening here.

The third case shows texdoc being helpful and correcting my terrible spelling. I think that it's a tossup here for if an "ideal" texdoc should ask first or just open up the first matching document. Also interesting is how the scores here compare to the scores in the second case.

(Also, this is not a dig at texdoc's scoring. I find that texdoc works really well in practice; these are just some surprising edge cases)

I'm thinking that if fuzzy/Levenshtein searching is penalized more and the fuzzy search algorithm also considers adding letters (maybe it does already but it's just penalized too much?), we might not need to add any config options.

(#96 seems like a good idea to me regardless)

from texdoc.

wtsnjp avatar wtsnjp commented on September 28, 2024

Another value view to show the top ones anyway, even if there are only negative matches. This is the identical behavior as in v3.x.

from texdoc.

wtsnjp avatar wtsnjp commented on September 28, 2024

When the value is other than ask, it would be better to display a warning as in the case of going to showall in the current list mode.

$ texdoc -l topic
texdoc warning: No good result found, showing all results.
 1 /usr/local/texlive/2023/texmf-dist/doc/latex/bibtopic/bibtopic.pdf
   = Package documentation
...

from texdoc.

kberry avatar kberry commented on September 28, 2024

from texdoc.

wtsnjp avatar wtsnjp commented on September 28, 2024

I think the second case (texdoc -lM texbytopi) is the one that really needs improvement. Could you please create a separate issue?

The fuzzy search I introduced in Texdoc v3.0 is incomplete. The fuzzy search is only executed when Texdoc fails to find anything in the standard search; in the second case, the fuzzy search is not working because something was found even though only negative matches were found. This is why the results are worse than in the third case (texdoc -lM zezbytopiz).

The fuzzy search should be triggered even when only bad results are found. More to the point, you could always use fuzzy search in any case and, as you say, give an appropriate penalty based on edit distance. However, the latter would require more drastic changes than the former.

In any case, I don't think it will eliminate the cases where only negative matches are found, no matter how hard you try to calculate the score. In such cases, I think adding this config item is worthwhile, as there are those who do not want to see any online search options and those who want to do online searches. Improving score calculation and improving the way negative matches are displayed should both be done independently.

from texdoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.