data/parsetrigrams.cpp: ensure the output is deterministic
Noticed non-deterministic binary contents when built sonnet
on NixOS. There rebuild test found out that parsetrigrams
generates non-deterministic output of trigrams from run to
run.
This happens because parsetrigrams
uses QHash
traversal
order to store key/value pairs in resources section of
lib/libKF5SonnetCore.so.5.85.0
output binary.
The change uses QMap to serialize trigrams and keeps QHash to deserialize them (both QMap and QHash have compatible serialization format:
[ u32(elem_count) | <key><value> <key><value>... ]
Tested the change to produce deterministic output.