We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analyse()
Chroma can classify text by its contents:
lexer := lexers.Analyse("package main\n\nfunc main()\n{\n}\n")
With this API though, it's not possible for me to know if even the best match is bad.
I would like to find that out, so that I can just not highlight if the text contents is uncertain.
One possible suggestion would be to change the API to this...
lexer, certainty := lexers.Analyse("package main\n\nfunc main()\n{\n}\n")
... where certainty is a number on a well defined and documented scale.
certainty
Then, if I feel this number is too low, I could choose not to highlight anything.
The text was updated successfully, but these errors were encountered:
Seems reasonable, how could we do this in a backwards compatible manner?
Sorry, something went wrong.
Maybe this?
lexer, certainty := lexers.AnalyseScore("package main\n\nfunc main()\n{\n}\n")
Possibly in combination with deprecating the existing function since it's sort of unpredictable.
In what way is it unpredictable?
Not sure if "unpredictable" is the right word, but let's say:
lexers.Analyse()
This means that even though C is the "best" guess, it's still a bad guess, and it might be better to not highlight at all.
That's why I'd like to have the confidence number as well to be able to make this judgement.
No branches or pull requests
Is there an existing issue for this?
What problem does this feature solve?
Chroma can classify text by its contents:
With this API though, it's not possible for me to know if even the best match is bad.
I would like to find that out, so that I can just not highlight if the text contents is uncertain.
What feature do you propose?
One possible suggestion would be to change the API to this...
... where
certainty
is a number on a well defined and documented scale.Then, if I feel this number is too low, I could choose not to highlight anything.
The text was updated successfully, but these errors were encountered: