3 * Used to define the class Dict which can handle dictionary.
5 * Copyright (C) 2008 Kermit Mei <kermit.mei@gmail.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 3 as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
22 * Written by Kermit Mei <kermit.mei@gmail.com>
24 * Many of the ideas implemented here are from the author's experiment.
25 * But the dictionary's format coincide with the other word recite software
26 * to help the users get more available data. And the review times designed
27 * by means of the theory named Forgetting Curve which dicoveried by the
28 * German psychologist named Hermann Ebbinghaus(1850–1909).
40 namespace freeRecite
{
43 extern Dict dictionary
;
50 //Initialize the dictionary
53 //Fine the word 'word' in dictionaries
54 bool lookUp(const std::string
&word
);
59 //Modify the local dictionary.
60 bool modify(const std::string
&item
);
62 //Merge the local and global dictionaries.
63 bool merge(const char *newDicName
);
65 //Save the local dictionary when you modified
68 //Get the current word
69 const std::string
&word() const;
71 //Get the current phonetics
72 const std::string
&phonetics() const;
74 //Get the current raw phonetics();
75 const std::string
&rawPhonetics() const;
78 const std::string
&translation() const;
81 const std::string
&example()const;
83 //Get the plain text of translation
84 const std::string
&plainTranslation() const;
87 bool findInGlobl(const std::string
&swatch
);
88 void setPlainTranslation();
91 std::string plainTran
;
92 std::ifstream
*ifsgdic
;
93 std::map
<std::string
,std::string
> dict
;
98 : validFlag(false),ifsgdic(0)
102 const std::string
&Dict::word() const {
103 return dictItem
.getW();
107 const std::string
&Dict::rawPhonetics() const {
108 return dictItem
.getT();
112 const std::string
&Dict::translation()const {
113 return dictItem
.getM();
117 const std::string
&Dict::example()const {
118 return dictItem
.getE();
123 const std::string
&Dict::plainTranslation() const{
129 } // namespace freeRecite end