N
N
Neuro2020-02-05 14:44:24
JavaScript
Neuro, 2020-02-05 14:44:24

Is it possible to encode a string to reduce its weight?

Good afternoon, I have a line of such a plan

`GO_TO_METER_BY_ADDRESS [москва, ул. Свердлова 43]`

which is essentially from "GO_TO_METER_BY_ADDRESS" and the array "[Moscow, Sverdlov st. 43]", this string weighs ~67 bytes, can I reduce its weight using some encoding to 50 bytes?

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Somewhere Intech, 2020-02-05
@Riveran

1. GO_TO_METER_BY_ADDRESS must be a number
2. The text part (if not in English) can be wrapped in koi8-r

A
Alexander, 2020-02-05
@Minifets

In Windows-1251, it just weighs 49 bytes.

1
15432, 2020-02-05
@15432

There are a lot of compression algorithms. Look up arithmetic coding and Huffman. Very long lines still won’t fit, of course, but it’s realistic to achieve 30 percent

M
M-ka, 2020-02-05
@M-ka

agree with the back and use their api for the city and streets ... because the length will be variable, and the address can also contain not only a street, but also an alley, an avenue, it can also not necessarily be written in abbreviation, and even if you add a body type prefix to the number ... Therefore, you should think about using a single api for requests for backing, in order to send not names, but their codes ...
Reducing to the fact that the user would not enter data, but choose from the list provided, this is how many taxis, deliveries do ...

I
imageman, 2020-02-07
@imageman

https://facebook.github.io/zstd/ - Zstandard is a real-time compression algorithm
There are implementations for different languages ​​(I see Javascript (emscripten) Yoshihito + node.js)
There is a special mode in this algorithm (with preliminary compilation of a dictionary) , which compresses short strings of the same type well.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question