95bbfb8232
commit a1f8cef250bcc033d120d87aaeafd0794e0c7252 Author: Jordan Sherer <jordan@widefido.com> Date: Sun Dec 30 20:16:47 2018 -0500 Added word replacement from suggestions menu commit 51af18c06d3268b34dd5b472f8a94787e47af04c Author: Jordan Sherer <jordan@widefido.com> Date: Sun Dec 30 11:21:24 2018 -0500 Simplified word checker to use text stats signal for computation commit aa831492784fec30c8a6d804a4ae7ca718f865fe Author: Jordan Sherer <jordan@widefido.com> Date: Sat Dec 29 22:50:24 2018 -0500 Initial working implmementation of spell check highlighting
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
#ifndef JSC_H
|
|
#define JSC_H
|
|
|
|
/**
|
|
* (C) 2018 Jordan Sherer <kn4crd@gmail.com> - All Rights Reserved
|
|
**/
|
|
|
|
#include <QTextStream>
|
|
#include <QList>
|
|
#include <QStringList>
|
|
#include <QMap>
|
|
#include <QPair>
|
|
#include <QVector>
|
|
|
|
typedef QPair<QVector<bool>, quint32> CodewordPair; // Tuple(Codeword, N) where N = number of characters
|
|
typedef QVector<bool> Codeword; // Codeword bit vector
|
|
|
|
typedef struct Tuple{
|
|
char const * str;
|
|
int size;
|
|
int index;
|
|
} Tuple;
|
|
|
|
class JSC
|
|
{
|
|
public:
|
|
#if 0
|
|
static CompressionTable loadCompressionTable();
|
|
static CompressionTable loadCompressionTable(QTextStream &stream);
|
|
#endif
|
|
static Codeword codeword(quint32 index, bool separate, quint32 bytesize, quint32 s, quint32 c);
|
|
static QList<CodewordPair> compress(QString text);
|
|
static QString decompress(Codeword const& bits);
|
|
|
|
static bool exists(QString w, quint32 *pIndex);
|
|
static quint32 lookup(QString w, bool *ok);
|
|
static quint32 lookup(char const* b, bool *ok);
|
|
|
|
static const quint32 size = 262144;
|
|
static const Tuple map[262144];
|
|
static const Tuple list[262144];
|
|
|
|
static const quint32 prefixSize = 69;
|
|
static const Tuple prefix[69];
|
|
};
|
|
|
|
#endif // JSC_H
|