chubin / cheat.sh

the only cheat sheet you need
https://cheat.sh/
MIT License
38.2k stars 1.78k forks source link

Replace polyglot with langdetect #259

Open abitrolly opened 3 years ago

abitrolly commented 3 years ago

https://github.com/aboSamoor/polyglot depends on pycld2, which depends on PyICU, which needs C compiler and tons of stuff to build, because it doesn't ship wheels.

The only polyglot feature what is used it language detection - https://polyglot.readthedocs.io/en/latest/Detection.html

This can be done with less sophisticated dependencies, such as https://github.com/Mimino666/langdetect

chubin commented 3 years ago

It is a good idea. We should test it and see if it detects language reliably enough. I believe, I considered it first, before switching to polyglot, and it detected languages way worse than the latter one

abitrolly commented 3 years ago

I am not even sure why language is needed as all https://cheat.sh output seems to be only English.

chubin commented 3 years ago

It is for input, not for output.

$ curl cht.sh/python/прочитать+json
#  python - Parsing values from a JSON file?
#
#  I think what Ignacio is saying is that your JSON file is incorrect.
#  You have [] when you should have {}. [] are for lists, {} are for
#  dictionaries.
#
#  Here's how your JSON file should look, your JSON file wouldn't even
#  load for me:

{
    "maps": [
        {
            "id": "blabla",
            "iscategorical": "0"
        },
        {
            "id": "blabla",
            "iscategorical": "0"
        }
    ],
    "masks": {
        "id": "valore"
    },
    "om_points": "value",
    "parameters": {
        "id": "valore"
    }
}
...

This feature is broken at the moment though, but we will fix it

abitrolly commented 3 years ago

@chubin is that supposed to search only for Russian results?

chubin commented 3 years ago

No, for any language; the feature is currently broken though