presage  0.9.2~beta
contextChangeDetector.h
Go to the documentation of this file.
1 
2 /******************************************************
3  * Presage, an extensible predictive text entry system
4  * ---------------------------------------------------
5  *
6  * Copyright (C) 2008 Matteo Vescovi <matteo.vescovi@yahoo.co.uk>
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
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.
17 
18  You should have received a copy of the GNU General Public License along
19  with this program; if not, write to the Free Software Foundation, Inc.,
20  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  *
22  **********(*)*/
23 
24 
25 #ifndef PRESAGE_CONTEXTCHANGEDETECTOR
26 #define PRESAGE_CONTEXTCHANGEDETECTOR
27 
28 #ifdef HAVE_CONFIG_H
29 #include "config.h"
30 #endif
31 
32 #include <string>
33 
34 #include "../configuration.h"
35 
37 public:
38  ContextChangeDetector(const std::string,
39  const std::string,
40  const std::string,
41  const std::string,
42  bool);
44 
45  bool context_change(const std::string& past_stream) const;
46  std::string change(const std::string& past_stream) const;
47 
48  std::string get_sliding_window() const;
49 
50  void set_sliding_window_size(const std::string& str);
51  void update_sliding_window(const std::string& str);
52 
53 private:
54  bool context_change_helper(const std::string& str1, const std::string& str2) const;
55 
56  static const std::string::size_type DEFAULT_SLIDING_WINDOW_SIZE;
57  std::string::size_type SLIDING_WINDOW_SIZE;
58  std::string sliding_window;
59 
60  const std::string wordChars;
61  const std::string separatorChars;
62  const std::string blankspaceChars;
63  const std::string controlChars;
65 
66 };
67 
68 #endif // PRESAGE_CONTEXTCHANGEDETECTOR
std::string change(const std::string &past_stream) const
const std::string wordChars
const std::string blankspaceChars
bool context_change(const std::string &past_stream) const
std::string get_sliding_window() const
std::string::size_type SLIDING_WINDOW_SIZE
const std::string controlChars
void set_sliding_window_size(const std::string &str)
const std::string separatorChars
ContextChangeDetector(const std::string, const std::string, const std::string, const std::string, bool)
static const std::string::size_type DEFAULT_SLIDING_WINDOW_SIZE
void update_sliding_window(const std::string &str)
bool context_change_helper(const std::string &str1, const std::string &str2) const