-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathWordCollection.h
More file actions
72 lines (55 loc) · 2.47 KB
/
Copy pathWordCollection.h
File metadata and controls
72 lines (55 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef CWORDCOLLECTION_H
#define CWORDCOLLECTION_H
#include <QList>
#include <iterator>
#include "generaldefinitions.h"
#include <QMapIterator>
#include "Lexicon.h"
class CWord;
class CWordCollection
{
protected:
QMap<QString, CWord*> m_WordMap;
QList<CWord*> m_word_list;
int m_CorpusCount;
QString m_MemberName;
QStringList m_sorted_list;
QStringList m_end_sorted_list;
CLexicon * m_Lexicon;
bool m_SortValidFlag;
enum eSortStyle m_SortStyle;
public:
// construction/destruction.
CWordCollection(CLexicon*);
~CWordCollection();
private:
CWordCollection& operator=(const CWordCollection& x);
void sort_word_lists();
const QStringList* get_sorted_list() {return & m_sorted_list;}
const QStringList* get_end_sorted_list() {return & m_end_sorted_list;}
public:
// Many functions below used to take the type `QString` as arguments.
// Changed them to `const QString&` for possibly greater efficiency.
// Changed made by Hanson 7.30
friend class CLexicon;
CWord* operator<< (const QString&);
CWord* operator^= (const QString&);
CWord* add_word (const QString&, int count= 1);
bool contains(const QString& string) {return m_WordMap.contains(string);}
CWord* find_or_add (const QString&);
CWord* find_or_fail(const QString& word_t);
int get_count() const { return m_WordMap.size(); }
int get_token_count();
QString get_string_from_sorted_list(int n) {return m_sorted_list[n];}
QString get_string_from_end_sorted_list(int n){return m_end_sorted_list[n];}
QList<CWord*> * get_word_list() {return & m_word_list;}
CWord* get_word(int n);
CWord* get_at(int n) {return get_word(n);}
int get_word_count();
const QMap<QString, CWord*> get_map() {return m_WordMap;}
void input_words(QMap<QString, int> word_counts);
void clear_all_words_parse_triple_maps();
void assign_json_id();
void write_json(QJsonObject& ref_json, eJsonType json_type = INDEXED);
};
#endif // CWORDCOLLECTION_H